Yukihiro "Matz" Matsumoto
9b5910bd0f
Revert "Remove top-level constant lookup; CRuby2.5"; fix #4070
...
This reverts commit c96def7c96 .
This change was from my misunderstanding.
2018-09-04 21:19:07 +09:00
Yukihiro "Matz" Matsumoto
7592dfcf7d
Need more precise constant name check.
...
This change was inspired by [ruby-bugs#7573]
2018-09-04 20:50:54 +09:00
Yukihiro "Matz" Matsumoto
c2634e18b6
Add type casts to silence MSVC warnings.
2018-09-04 16:22:50 +09:00
Yukihiro "Matz" Matsumoto
28c50b3e90
Merge pull request #4101 from take-cheeze/fix_4085
...
Avoid root fiber initialization for CRuby.
2018-09-04 16:22:40 +09:00
take-cheeze
901dccb2df
Avoid root fiber initialization for CRuby workaround.
...
closes #4085 .
2018-09-04 16:18:01 +09:00
take-cheeze
e6357f3baa
Fix indent.
2018-09-04 16:18:01 +09:00
Yukihiro "Matz" Matsumoto
02adae167f
Merge pull request #4098 from dearblue/reverse-gems-final
...
Reversing gems final
2018-09-04 07:26:25 +09:00
dearblue
cbf2738861
Reverse gems final
2018-09-02 14:13:09 +09:00
Yukihiro "Matz" Matsumoto
a657117e4e
Avoid warning in MSVC compilation.
2018-09-01 17:36:35 +09:00
Yukihiro "Matz" Matsumoto
20c0c6330f
Too much peephole optimization in gen_call; fix #4091
...
It causes trouble for safe navigation operator.
2018-09-01 17:14:54 +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
593c12a5cd
Avoid NoMethodError exception from mrb_func_basic_p.
2018-09-01 11:18:12 +09:00
Yukihiro "Matz" Matsumoto
05f377dee4
Use __send__ instead of send.
2018-09-01 11:02:59 +09:00
Yukihiro "Matz" Matsumoto
0c6353aa2c
Remove MRB_API from mrb_f_send which is not API.
2018-09-01 11:01:50 +09:00
Yukihiro "Matz" Matsumoto
2be42aef0f
Fix ISO/JIS section numbers.
2018-09-01 09:35:46 +09:00
Yukihiro "Matz" Matsumoto
1bc1fed534
Update RITE_BINARY_FORMAT_VER and RITE_VM_VER.
...
The bytecode format was updated so the header version constants must be
updated as well.
2018-08-30 22:48:05 +09:00
Yukihiro "Matz" Matsumoto
50b840c9de
Use mrb_ensure_hash_type() to check if an operand is a Hash; fix #4097
2018-08-30 22:30:36 +09:00
Yukihiro "Matz" Matsumoto
f6564dd83e
Add new function mrb_ensure_hash_type(); ref #4097
...
Unlike `mrb_check_hash_type()` that returns `nil` if the argument is
not a `Hash`, `mrb_ensure_hash_type()` raises a `TypeError` exception.
2018-08-30 22:30:36 +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
75a01af710
Remove consequent OP_RETURN by peephole optimization.
2018-08-30 01:23:17 +09:00
Yukihiro "Matz" Matsumoto
5addd5db4a
Need to clear mrb->c->cibase->ridx (toplevel ridx) at L_STOP; fix #4092
...
This problem only appears when `mrb` executed multiple times (i.e. `mirb`)
2018-08-30 01:20:59 +09:00
Yukihiro "Matz" Matsumoto
500bd38dfe
uint16_t is too small for reference count; fix #4093
...
Use `uint32_t` instead. Theoretically `uint32_t` can overflow as well,
but I think it is sufficient size for embeddable Ruby VM.
2018-08-30 00:29:35 +09:00
Yukihiro "Matz" Matsumoto
2c93e4a0a8
The operand of OP_ARYDUP may not be an array; fix #4094
...
This commit also fix #4096 .
2018-08-30 00:29:35 +09:00
Yukihiro "Matz" Matsumoto
f76cc483d5
Fix off-by-one error in OP_EPUSH and OP_ONERR; fix #4095
2018-08-29 23:59:20 +09:00
Yukihiro "Matz" Matsumoto
e91b6a0378
Merge pull request #4080 from 'ukrainskiysergey-node_negate_fix'
2018-08-29 13:34:02 +09:00
Yukihiro "Matz" Matsumoto
441ff45a51
Merge branch 'node_negate_fix' of https://github.com/ukrainskiysergey/mruby into ukrainskiysergey-node_negate_fix
2018-08-29 13:29:54 +09:00
Yukihiro "Matz" Matsumoto
98c759e86a
Check the size of rescue&ensure stacks; ref #4088
...
Those small stack indexes can cause integer overflow.
2018-08-29 13:17:18 +09:00
Yukihiro "Matz" Matsumoto
2a88a546b2
Fix type of eidx and ridx from uint8_t to uint16_t; fix #4088
...
A byte was too small to hold ensure&rescue stacks indexes.
2018-08-29 13:15:24 +09:00
Yukihiro "Matz" Matsumoto
6aa091e5aa
Simplified #ifdef nesting in codedump.c; fix #4089
...
`printf()` and related functions should not be called when
`MRB_DISABLE_STDIO` is defined.
2018-08-29 12:37:07 +09:00
Yukihiro "Matz" Matsumoto
bc88fc6ed1
Check iseq buffer size before code emission; fix #4090
...
The type of `s->pc` is now `uint16_t` that can be overflowed easily.
Need more checks.
2018-08-29 12:31:48 +09:00
Yukihiro "Matz" Matsumoto
814b7b5ef8
Move back mrb_define_alias to mruby.h to avoid breakage.
2018-08-29 07:00:13 +09:00
Yukihiro "Matz" Matsumoto
93bab387a7
Merge branch 'mruby2-draft'
2018-08-28 22:13:52 +09:00
Yukihiro "Matz" Matsumoto
471288f37d
Reduce integer casting warnings.
2018-08-25 16:58:01 +09:00
Yukihiro "Matz" Matsumoto
d79dbd92f9
fixup! New bytecode implementation of mruby VM.
2018-08-25 09:49:20 +09:00
Yukihiro "Matz" Matsumoto
49d1b16822
Hash splat ** should not be ignored.
...
Implemented by adding `OP_HASHCAT` that merges hashes.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
306732e02d
Fixed a bug in OP_HASHADD.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
a3fb80904d
Remove unused Hash#__update method.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
3554fc54de
Add a new function mrb_hash_merge().
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
b06dad43fa
Remove unused NODE_* constants from node.h.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
e5eb7ef046
Add NODE_KW_HASH support in mrb_parser_dump().
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
162243d95c
Remove arg_value from parse.y.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
b7e56e9d20
Add bytecode support for MRB_WORD_BOXING.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
eeb6d5658d
New bytecode implementation of mruby VM.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
a16885efe5
Try to fix a fragile File#mtime test.
2018-08-25 09:19:17 +09:00
Yukihiro "Matz" Matsumoto
31827189ab
Remove potential path to avoid uninitialized variable access.
2018-08-25 09:19:17 +09:00
Yukihiro "Matz" Matsumoto
fbfe519be7
Simplify mruby-inline-struct tests.
...
`gcc -O3` raises error on truncation using `snprintf`.
2018-08-25 09:19:17 +09:00
Yukihiro "Matz" Matsumoto
b3a1d37926
Make Array.new to accept both integers and floats.
...
This time we used `Integral` module which is mruby specific.
2018-08-25 09:19:17 +09:00
Kazuhiro Sera
2b2ff844a1
Fix misspelling words in comments
2018-08-25 09:19:17 +09:00
Yukihiro "Matz" Matsumoto
b083c1351f
Fixed the corner case bug in String#{gsub!,sub!}.
...
`"a".sub!("a", "a")` should not return `nil`.
2018-08-25 09:17:46 +09:00
pyama86
821135e2df
irep is released when Fiber is terminated
2018-08-25 09:17:46 +09:00