Yukihiro "Matz" Matsumoto
b3a181aaa1
Fixed a bug in processing OP_EXT? instructions.
...
fix haconiwa/haconiwa#171
2018-10-23 21:10:03 +09:00
Yukihiro "Matz" Matsumoto
8392578216
Fixed SEGV from eval called form top-level mrb_funcall(); fix #4028
2018-10-02 17:26:43 +09:00
Yukihiro "Matz" Matsumoto
b80e0ef742
Move Kernel#send to mruby-metaprog gem.
...
But `BasicObject#__send__` is still available from the core.
2018-09-01 11:20:30 +09:00
Yukihiro "Matz" Matsumoto
e471d37ca5
Separate meta-programming features to mruby-metaprog gem.
...
We assume meta-programming is less used in embedded environments.
We have moved following methods:
* Kernel module
global_variables, local_variables, singleton_class,
instance_variables, instance_variables_defined?, instance_variable_get,
instance_variable_set, methods, private_methods, public_methods,
protected_methods, singleton_methods, define_singleton_methods
* Module class
class_variables, class_variables_defined?, class_variable_get,
class_variable_set, remove_class_variable, included_modules,
instance_methods, remove_method, method_removed, constants
* Module class methods
constants, nesting
Note:
Following meta-programming methods are kept in the core:
* Module class
alias_method, undef_method, ancestors, const_defined?, const_get,
const_set, remove_const, method_defined?, define_method
* Toplevel object
define_method
`mruby-metaprog` gem is linked by default (specified in default.gembox).
When it is removed, it will save 40KB (stripped:8KB) on x86-64
environment last time I measured.
2018-08-30 22:30:36 +09:00
Yukihiro "Matz" Matsumoto
471288f37d
Reduce integer casting warnings.
2018-08-25 16:58:01 +09:00
Yukihiro "Matz" Matsumoto
8a18d1539b
Should update ci->env to share the environment; fix #4073
2018-08-25 09:13:09 +09:00
Yukihiro "Matz" Matsumoto
891839b976
New bytecode implementation of mruby VM.
2018-07-30 22:57:54 +09:00
Yukihiro "Matz" Matsumoto
b09d2eb900
Kernel#instance_eval should define singleton methods; fix #4069
2018-07-23 18:26:24 +09:00
Ichito Nagata
1dbeda5c9c
add test for eval
2018-06-06 15:35:41 +09:00
Yukihiro "Matz" Matsumoto
181f980b6c
Need to clear stack region for local variables in eval; fix #3844
2017-11-10 21:53:12 +09:00
Yukihiro "Matz" Matsumoto
c7c9543bed
Fixed UPVAR gotchas; fix #3835
...
Both `uvenv` function and `env` generation in `create_proc_from_string`
function have bugs to handling enclosed environment objects.
2017-10-28 23:08:31 +09:00
Yukihiro "Matz" Matsumoto
93f5f22577
Heavily refactored how lexical scope links are implemented; fix #3821
...
Instead of `irep` links, we added a `upper` link to `struct RProc`.
To make a space for the `upper` link, we moved `target_class` reference.
If a `Proc` does not have `env`, `target_class` is saved in an `union`
shared with `env` (if a `Proc` has env, you can tell it by `MRB_PROC_ENV_P()).
Otherwise `target_class` is referenced from `env->c`. We removed links
in `env` as well.
This change removes 2 members from `mrb_irep` struct, thus saving 2
words per method/proc/block. This also fixes potential memory leaks
due to the circular references caused by a link from `mrb_irep`.
2017-10-28 00:29:30 +09:00
Tomasz Dąbrowski
f632baddb1
fix: mrbgems\mruby-eval\src\eval.c(301): warning C4244: 'function': conversion from 'mrb_int' to 'int', possible loss of data
2017-09-27 14:42:27 +02:00
Tomasz Dąbrowski
49db1db81f
fix: mrbgems\mruby-eval\src\eval.c(214): warning C4244: '=': conversion from 'mrb_int' to 'short', possible loss of data
2017-09-27 14:42:27 +02:00
Yukihiro "Matz" Matsumoto
8bf492f127
Reduce integer type mismatch warnings in VC.
2017-08-12 09:35:35 +09:00
Yukihiro "Matz" Matsumoto
25a0a6b038
Need to patch OP_GETUPVAR and OP_SETUPVAR; fix #3732
2017-07-20 22:47:20 +09:00
Yukihiro "Matz" Matsumoto
a18904a4c2
Use "$!" specifier of mrb_get_args.
2017-07-12 14:49:55 +09:00
Yukihiro "Matz" Matsumoto
0de7eec628
Fixed disclosure of local variables by eval; ref #3710
...
This patch fixes the latter part of #3710 . We need to change
`struct REnv` to fix the former part of the issue.
2017-06-19 22:00:16 +09:00
Yukihiro "Matz" Matsumoto
d7e09ffa5f
Print the file name along with line number on syntax errors; fix #3698
2017-06-15 15:46:03 +09:00
Yukihiro "Matz" Matsumoto
88cd807379
Avoid use of snprintf() when DISABLE_STDIO is set; fix #3632
...
ref #3492 #3515 #3517
2017-04-25 10:41:50 +09:00
Yukihiro "Matz" Matsumoto
5513fcee22
Keep reference to mrb_context from env; fix #3619
2017-04-22 14:35:36 +09:00
Yukihiro "Matz" Matsumoto
fca17b41c7
Avoid trampoline when #eval is called from mrb_funcall(); fix #3522
2017-03-17 15:55:18 +09:00
Yukihiro "Matz" Matsumoto
f8b31a0db6
instance_eval method does not introduce C function boundary; fix #3508
2017-03-15 09:00:03 +09:00
Yukihiro "Matz" Matsumoto
73e5a19c39
Configure callinfo target_class as CRuby; ref #3429
2017-02-16 23:43:02 +09:00
Yukihiro "Matz" Matsumoto
097da2399a
Avoid executing OP_STOP in eval(); fix #3429
2017-02-16 22:40:31 +09:00
Yukihiro "Matz" Matsumoto
5e3c329c98
Adjust callinfo env and target_class; ref #3429
2017-02-16 22:38:47 +09:00
Yukihiro "Matz" Matsumoto
48e0bbbfee
Make eval to use trampoline technique; fix #3415
...
Now `eval()` can call Fiber.yield etc.
2017-02-04 16:19:31 +09:00
ksss
e66b35c6ee
Fix SEGV when unshared env
2016-09-06 17:11:18 +09:00
ksss
ada264a513
instance_eval env should remake Fix #3191
2016-08-08 12:41:19 +09:00
Yukihiro "Matz" Matsumoto
8c67e915b4
mruby-eval: instance_eval should keep target_class; close #3141
2016-04-11 14:28:44 +09:00
Kouhei Sutou
e5cce388ff
Suppress a warning
...
mrbgems/mruby-eval/src/eval.c: In function ‘create_proc_from_string’:
mrbgems/mruby-eval/src/eval.c:152:10: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
file = "(eval)";
^
2016-03-06 10:05:14 +09:00
Yusuke Endoh
668cc1b435
Fix segfault when eval("__FILE__") is executed
2016-02-15 23:57:18 +09:00
Yukihiro "Matz" Matsumoto
fb2e0b721f
fixed a problem with upvar access from instance_eval; ref #3072
2016-01-08 09:07:58 +09:00
Yukihiro "Matz" Matsumoto
258cb2093c
mruby-eval: fixed receiver value in eval context; close #3072
2016-01-07 22:37:58 +09:00
Yukihiro "Matz" Matsumoto
7c82bfa7fe
mruby-sprintf to use mrb_int formatting macros; ref #3076
2016-01-07 12:23:17 +09:00
Yukihiro "Matz" Matsumoto
5c405dea3d
include changed from by quotes ("") to by brackets (<>); close #3032
2015-11-27 17:48:23 +09:00
INOUE Yasuyuki
49bfaca6c7
Add regression test for #2933
2015-10-04 18:22:34 +09:00
Yukihiro "Matz" Matsumoto
e8f88daa9c
instance_eval should set target_class; close #2936
...
target_class should be singleton class of the receiver
2015-09-14 15:56:54 +09:00
take_cheeze
6460ef77bc
Compile mruby compiler as mrbgem.
...
Compiler codes is moved to "mruby-compiler".
Executable `mrbc` is moved to "mruby-bin-mrbc".
2015-06-01 21:53:55 +09:00
sdottaka
79f703ecba
mruby-eval: fix typo
2014-12-23 22:17:07 +09:00
Yukihiro "Matz" Matsumoto
10e9a1a167
now retrieves number of arguments of blocks from OP_ENTER op code; close #2671
2014-12-19 19:45:20 +09:00
Yukihiro "Matz" Matsumoto
5b203ead1e
mruby-eval: proc from env may be NULL; close #2676
2014-12-17 12:35:19 +09:00
Yukihiro "Matz" Matsumoto
ed56d56dab
avoid out-of-bounds access of irep->lv; ref #2671 , fix #2675
...
allocation size of irep->iv is irep->nlocals-1.
2014-12-17 11:14:14 +09:00
Yukihiro "Matz" Matsumoto
ab72410456
eval() should preserve stack in env properly; fix #2671
2014-12-17 01:10:19 +09:00
Yukihiro "Matz" Matsumoto
3f06307317
need addtional type check to avoid SEGV; ref #2609
2014-10-18 11:26:30 +09:00
Yukihiro "Matz" Matsumoto
3ff5081650
context proc may be cfunc; fix #2609
2014-10-17 15:48:58 +09:00
Yukihiro "Matz" Matsumoto
3e3048ddd1
Merge pull request #2599 from SatoshiOdawara/fix_target_class_in_instance_eval
...
target_class should not be TT_ICLASS in instance_eval(string); ref #1152
2014-09-30 10:14:25 +09:00
Satoshi Odawara
a10d36e0a2
target_class should not be TT_ICLASS in instance_eval(string); ref #1152
2014-09-29 17:53:08 +09:00
Satoshi Odawara
2551d14ff1
fixed. closures scope in eval(string)
2014-09-29 16:41:51 +09:00
Tatsuhiko Kubo
2b283393c6
Remove empty lines.
2014-08-20 12:07:36 +09:00