Yukihiro "Matz" Matsumoto
47cc5d66e3
Singleton classes do not have outer class set; fix #3505
2017-03-16 22:13:58 +09:00
Yukihiro "Matz" Matsumoto
b64f08784c
Protect stack region before calling mrb_convert_type(); fix #3504
2017-03-16 21:40:22 +09:00
Yukihiro "Matz" Matsumoto
877f43bca5
OP_BLKPUSH is invalid outside of methods; fix #3501
2017-03-13 22:03:31 +09:00
Yukihiro "Matz" Matsumoto
92f5becabe
Update VM to support new OP_RESCUE behavior; ref #3487
2017-03-12 00:58:00 +09:00
Yukihiro "Matz" Matsumoto
26169f9e25
Enhance OP_RESCUE to take B operand fas matching exception; ref #3487
2017-03-12 00:50:38 +09:00
Yukihiro "Matz" Matsumoto
4ab70294ea
Revert 642ab8e; ref #3422
...
Also fix #3499 . The issue was solved by #3462 .
2017-03-11 16:03:04 +09:00
Yukihiro "Matz" Matsumoto
ff262f2133
Update ci->mid according to surrounding scope; fix #3490
2017-03-10 12:37:19 +09:00
Yukihiro "Matz" Matsumoto
2f299cf4dc
Simplify expression; ref #3490
2017-03-10 12:36:58 +09:00
Yukihiro "Matz" Matsumoto
e8f09f9393
Raise special Exception when exception class is redefined; fix #3493
2017-03-10 11:43:25 +09:00
Yukihiro "Matz" Matsumoto
8a15abdac2
Avoid trampoline code if mrb_f_send is called from funcall; fix #3383
2017-03-06 07:35:41 +09:00
Yukihiro "Matz" Matsumoto
d050694580
Merge pull request #3483 from ksss/string-index
...
String#index shouldn't return nil when "".index ""
2017-03-05 20:27:28 +09:00
ksss
76e10351fa
String#index shouldn't return nil when "".index ""
2017-03-05 14:15:18 +09:00
Yukihiro "Matz" Matsumoto
4f43db862a
Unshare popped TT_ENV objects.
2017-03-04 22:45:44 +09:00
Yukihiro "Matz" Matsumoto
3b40a2f6b5
Limit ecall() recursion levels; fix #3466
2017-03-04 18:56:20 +09:00
Yukihiro "Matz" Matsumoto
ecee8c51b0
Avoid tracing shared TT_ENV object.
2017-03-04 18:53:36 +09:00
Yukihiro "Matz" Matsumoto
c789acbc36
Save/restore arena index in the loop.
2017-03-04 18:52:51 +09:00
Yukihiro "Matz" Matsumoto
ffdf7be723
Define jmpbuf_id outside of extern "C"; ref #3470
2017-03-02 20:42:06 +09:00
Yukihiro "Matz" Matsumoto
3390020fd0
The method_missing removal condition in a76dc04a was wrong.
2017-03-02 17:59:27 +09:00
Yukihiro "Matz" Matsumoto
27ec2437fd
Fix possible stack overflow for method_missing; fix #3478
...
Instead of shifting mruby VM stack, we always use CALL_MAXARGS.
2017-03-02 17:55:15 +09:00
Yukihiro "Matz" Matsumoto
0bcf9e28fc
Reorganize C++ exceptions; ref #3470
...
There are 3 levels of C++ exception handling:
* default - no C++ exception (use setjmp/longjmp)
* enable_cxx_exception (use C++ exceptions with C ABI)
* enable_cxx_abi (use C++ ABI including exceptions)
2017-03-02 10:58:26 +09:00
Yukihiro "Matz" Matsumoto
fdd92750fe
Create NoMethodError instance using mrb_obj_new().
2017-03-02 10:56:23 +09:00
Yukihiro "Matz" Matsumoto
eca35df4ff
ci may be moved during mrb_convert_type(); ref #3474
2017-03-01 12:06:18 +09:00
Yukihiro "Matz" Matsumoto
7db0786abd
Fix integer overflow; fix #3473
...
The fix is suggested by https://hackerone.com/lucnguyen
2017-02-28 09:54:56 +09:00
Yukihiro "Matz" Matsumoto
405f5a2d2a
Add type check by mrb_get_args(); ref #3476
2017-02-28 09:30:06 +09:00
Yukihiro "Matz" Matsumoto
74dbee8e52
Add check before calling str_substr(); ref #3476
2017-02-28 09:21:24 +09:00
Yukihiro "Matz" Matsumoto
bdac7dfae8
Check if the value is fixnum before mrb_funcall(); fix #3476
...
The issue is reported by https://hackerone.com/aerodudrizzt
2017-02-28 09:14:42 +09:00
Yukihiro "Matz" Matsumoto
a76dc04aa8
Remove default Kernel#method_missing.
...
Internal method_missing works without problems.
2017-02-27 23:11:39 +09:00
Yukihiro "Matz" Matsumoto
b563bcb7ff
Check if OP_RETURN cross C function boundary; fix #3462
2017-02-27 20:13:01 +09:00
Yukihiro "Matz" Matsumoto
50bbdbb11b
Fixed ecall() invoked too early; fix #3464
2017-02-27 18:40:35 +09:00
Yukihiro "Matz" Matsumoto
3fc9bf3d5f
Update local variable only after the value is checked.
2017-02-27 18:39:42 +09:00
Yukihiro "Matz" Matsumoto
d219e63a74
Clear block arg when method_missing takes *args.
2017-02-27 18:38:56 +09:00
Yukihiro "Matz" Matsumoto
9e93d5dbf0
Stack may be reallocated in mrb_run(); fix #3465
2017-02-27 16:17:57 +09:00
Yukihiro "Matz" Matsumoto
736be0e98b
Always keep block argument space in stack; fix #3469
2017-02-27 13:05:26 +09:00
Yukihiro "Matz" Matsumoto
517e9313bf
Move #__id__ to BasicObject; ref #3417
2017-02-15 13:19:21 +09:00
Yukihiro "Matz" Matsumoto
612d636b77
Move #instance_eval to BasicObject; ref #3417
2017-02-15 13:15:58 +09:00
Yukihiro "Matz" Matsumoto
3dbda91788
Move #__send__ to BasicObject; ref #3417
2017-02-15 13:12:05 +09:00
Yukihiro "Matz" Matsumoto
8b4bd3158b
Move #== and #!= to BasicObject; ref #3417
2017-02-15 13:07:53 +09:00
Yukihiro "Matz" Matsumoto
3f9450e7b0
Move BasicObject#method_missing to Kernel#method_missing; ref #3417
...
More compatibility to CRuby.
Updated tests that assume old mruby behavior.
2017-02-15 12:56:27 +09:00
Yukihiro "Matz" Matsumoto
1e5b5b14d7
Prohibit too deep mrb_funcall() recursion; ref #3421
...
`mrb_funcall()` recursion can cause stack overflow easily,
so recursion depth is now limited to MRB_FUNCALL_DEPTH_MAX,
which default value is 512.
2017-02-15 12:06:32 +09:00
Yukihiro "Matz" Matsumoto
1e57fefbcf
Do not funcall() Exception#set_backtrace from runtime.
...
This change reduce flexibility but makes mruby simpler and faster.
2017-02-15 12:01:52 +09:00
Yukihiro "Matz" Matsumoto
8efa7b00df
Preallocate SystemStackError; ref #3421
2017-02-15 11:59:47 +09:00
Yukihiro "Matz" Matsumoto
dd24f9f5cc
Avoid calling hook methods if they are not overridden.
2017-02-15 09:25:09 +09:00
Yukihiro "Matz" Matsumoto
04296925ac
Use mrb_funcall_argv() instead of mrb_funcall()
2017-02-15 09:24:35 +09:00
Yukihiro "Matz" Matsumoto
30aa521854
Do not use mrb_funcall() if Hash#default is not overridden; ref #3421
...
This change reduces the recursion level, but does not solve the stack
overflow issue entirely.
2017-02-14 00:22:12 +09:00
Yukihiro "Matz" Matsumoto
719f700adf
Extend mruby stack when keep is bigger than room; fix #3421
...
But #3421 still cause stack overflow error due to infinite recursion.
To prevent overflow, we need to add different stack depth check.
2017-02-14 00:15:58 +09:00
Yukihiro "Matz" Matsumoto
c2ddcd4517
Should handle break from funcall(); fix #3434
...
This issue was reported by https://hackerone.com/d4nny
2017-02-13 18:45:20 +09:00
Yukihiro "Matz" Matsumoto
f198530444
Fixed too much value_copy() when block is not given; fix #3440
...
The issue was reported by https://hackerone.com/titanous
2017-02-13 18:18:09 +09:00
Yukihiro "Matz" Matsumoto
60664823ba
Merge pull request #3451 from dabroz/revert-string-mul
...
Revert "Optimization for String#* for 1-byte strings"
2017-02-11 22:49:20 +09:00
Yukihiro "Matz" Matsumoto
1f2d786e32
Avoid direct return from ecall(); fix #3441
...
There's incompatibility left for mruby.
When you return from `ensure` clause, mruby simply ignores the return
value. CRuby returns from the method squashing the exception raised.
```
def f
no_such_method() # NoMethodError
ensure
return 22
end
p f() # CRuby prints `22`
```
2017-02-11 21:58:47 +09:00
Tomasz Dabrowski
90f262f642
Revert "Optimization for String#* for 1-byte strings"
...
This reverts commit d1bc7caeca .
2017-02-11 13:02:48 +01:00