Yukihiro "Matz" Matsumoto
10ed730e4b
Cancel df3507660 that does not do any good.
2017-12-07 15:18:41 +09:00
Yukihiro "Matz" Matsumoto
cdf173d32c
Avoid updating to reallocated stack in OP_RETURN; fix #3870
...
The code was introduced to address #3175 but it's no longer needed.
2017-12-07 15:05:14 +09:00
Yukihiro "Matz" Matsumoto
0e46b14b9e
The ci should not be equal to cibase with OP_R_BREAK; #3871
2017-12-06 17:28:20 +09:00
Yukihiro "Matz" Matsumoto
6975258efd
The proc with top-level env must be 'proc-closure'; fix #3871
2017-12-06 17:28:20 +09:00
Yukihiro "Matz" Matsumoto
ae44e80668
Limit ecall() depth to 32 (default).
2017-12-06 17:28:20 +09:00
Yukihiro "Matz" Matsumoto
b00d45b095
mrb_method_search_vm() should gives the defined class.
...
Otherwise `super` may call a wrong method.
2017-12-06 17:28:20 +09:00
Yukihiro "Matz" Matsumoto
4a99f4949e
Need to set ci->proc when we have RProc structure.
...
Mentioned in https://qiita.com/bamchoh/items/eabebbbb330cb0e0470a
2017-12-05 11:43:12 +09:00
Yukihiro "Matz" Matsumoto
0b5d97ec42
Need to unshare env stack on break; fix #3866
2017-12-04 10:15:12 +09:00
Yukihiro "Matz" Matsumoto
6f4d4bbcc7
Remove temporary objects from GC arena in `mrb_vformat()'; #3863
2017-12-04 08:56:11 +09:00
Yukihiro "Matz" Matsumoto
5d04e3316b
Check if ci->proc is not NULL and MRB_PROC_CFUNC_P(); fix #3867
2017-12-04 08:56:11 +09:00
Yukihiro "Matz" Matsumoto
cd9f53d42e
Pop exception objects from the bottom of GC arena; fix #3863
2017-12-04 08:56:11 +09:00
Yukihiro "Matz" Matsumoto
c35a402676
The stack shift width should be determined by p->upper; fix #3864
...
And check required register number from `ci->proc` as well.
The fixes for #3859 and #3862 were incomplete.
2017-12-01 10:01:46 +09:00
Yukihiro "Matz" Matsumoto
86ef9a2806
Avoid calling mrb_env_unshare() when env is NULL.
...
Small performance improvement by reducing function invocations.
2017-11-30 08:19:38 +09:00
Yukihiro "Matz" Matsumoto
2b9f762ba1
Avoid double free() of env stack; fix #3860
...
Should turn on `MRB_ENV_STACK_UNSHARED` flag only after env stack
reallocation. `malloc()` may fail.
2017-11-30 08:17:14 +09:00
Yukihiro "Matz" Matsumoto
d3e273ba4e
Wrong stack adjustment in ecall() ( f35f975 #3859 ); fix #3862
2017-11-30 08:04:27 +09:00
Yukihiro "Matz" Matsumoto
f3279b41e6
Stop infinite recursion in Class#to_s; fix #3861
2017-11-30 07:58:11 +09:00
Yukihiro "Matz" Matsumoto
5f7cdecdc9
Clear c->prev on fiber termination.
2017-11-29 20:25:55 +09:00
Yukihiro "Matz" Matsumoto
b746a0f0d2
Need to free contexts when freeing fibers.
...
Memory leak fixed; ref #3711
2017-11-29 20:24:03 +09:00
Yukihiro "Matz" Matsumoto
9c78a9bfa2
Set MRB_FIBER_TERMINATED flag on exception termination of a fiber.
2017-11-29 20:17:33 +09:00
Yukihiro "Matz" Matsumoto
b7c3a876f1
Add most recent call last message to the backtrace.
2017-11-29 16:56:10 +09:00
Yukihiro "Matz" Matsumoto
3e67a116d1
Call all ensure clauses pushed at OP_STOP.
2017-11-29 12:16:16 +09:00
Yukihiro "Matz" Matsumoto
afa53809e2
No need to use ecall_adjust().
2017-11-29 12:15:24 +09:00
Yukihiro "Matz" Matsumoto
f35f975d26
Fixed stack address adjustment in ecall(); fix #3859
2017-11-29 12:14:05 +09:00
Yukihiro "Matz" Matsumoto
d4fc980527
Need to evaluate ensure clauses at fiber termination.
2017-11-29 11:57:33 +09:00
Yukihiro "Matz" Matsumoto
6bb5ad786c
Remove unnecessary code; ref #3711
2017-11-29 11:44:07 +09:00
Yukihiro "Matz" Matsumoto
284a1d12ee
Provide shortcut comparison methods for numbers for performance.
2017-11-22 15:43:48 +09:00
Yukihiro "Matz" Matsumoto
0ab21a9a5e
Stack adjustment should be based on p->upper; fix #3857
...
It used to be based on `ci->proc` but the callinfo position may be
wrong when `ecall()` is called during stack rewinding from `OP_RETURN`.
2017-11-22 14:05:11 +09:00
Yukihiro "Matz" Matsumoto
fbafa78098
Clear ensure stack after calling in OP_EPOP; #3855 3856
2017-11-22 12:22:45 +09:00
Yukihiro "Matz" Matsumoto
4665b07f7b
No need to pop ensure stack if eidx is smaller than epos; #3855 #3856
2017-11-22 12:21:24 +09:00
Yukihiro "Matz" Matsumoto
fe3ac50845
fixup! Remove fixed argument of ecall(); ref #3855 #3856
2017-11-22 12:20:56 +09:00
Yukihiro "Matz" Matsumoto
cb4b042777
Remove fixed argument of ecall(); ref #3855 #3856
2017-11-22 12:19:40 +09:00
Yukihiro "Matz" Matsumoto
393133e741
Should have marked all ensure stack entries; fix #3855 fix #3856
2017-11-22 12:18:20 +09:00
Yukihiro "Matz" Matsumoto
8b7a8978e2
Reduce the size of struct RBreak to reduce memory usage.
...
The old size of `struct RBreak` was 56 bytes (`MRB_NO_BOXING`)
and it's bigger than other object structures. That increase the
size of `RVALUE` thus increase the total amount of memory consumption.
2017-11-20 18:33:41 +09:00
Yukihiro "Matz" Matsumoto
8f2c62407c
Add MRB_METHOD_TABLE_INLINE option.
...
Now the method tables (in classes/modules and caches) keeps C function
pointers without wrapping in `struct RProc` objects. For the sake of
portability, `mrb_method_t` is represented by the struct and union, but
if the most significant bit of the pointer is not used by the platform,
`mrb_method_t` should be packed in `uintptr_t` to reduce memory usage.
`MRB_METHOD_TABLE_INLINE` is turned on by default for linux.
2017-11-20 18:33:41 +09:00
Yukihiro "Matz" Matsumoto
6a9efd6849
Invoke mrb_full_gc() before ObjectSpace.count_objects.
2017-11-19 12:19:46 +09:00
Yukihiro "Matz" Matsumoto
9b2454c94d
Leave hash->ht to be NULL if initial capacity is zero.
2017-11-19 03:46:58 +09:00
Yukihiro "Matz" Matsumoto
825e93eba4
Assign operands to local variables.
2017-11-18 00:03:59 +09:00
Ukrainskiy Sergey
a2d0ee59c6
Removed useless condition
2017-11-17 22:30:22 +09:00
Ukrainskiy Sergey
ddd32d74e1
Changed the assignment of a variable in variable.c
2017-11-17 19:43:57 +09:00
Ukrainskiy Sergey
74714c8fee
Changed numbers to TRUE and FALSE for mrb_bool in variable.c
2017-11-17 19:16:29 +09:00
Yukihiro "Matz" Matsumoto
c8da602752
Need to save stack space by number of registers from the current proc,
...
Not from the execution ensure proc; fix #3849
2017-11-17 01:08:46 +09:00
Yukihiro "Matz" Matsumoto
03a3bd9178
The number of argument should be retrieved by mrb_get_argc; fix #3848
...
You should not access `mrb->c->ci->argc` directly.
2017-11-13 16:16:38 +09:00
Yukihiro "Matz" Matsumoto
c210a8adf9
Fixed wrong stack extend size; fix #3847
2017-11-11 17:55:32 +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
41c8c419cf
Use proper target_class to define class/module; fix #3843
...
The outer class of the class/module definition should be taken from
`MRB_TARGET_CLASS(mrb->c->ci->proc)` not `mrb->c->ci->target_class`
which is the target of constant lookups.
2017-11-09 00:14:21 +09:00
Yukihiro "Matz" Matsumoto
f723832ebc
Should allocate memory region before updating len; fix #3842
...
Otherwise half-baked string object will be allocated.
2017-11-08 08:46:55 +09:00
Yukihiro "Matz" Matsumoto
fef4b394a7
Avoid compiling fmt_fp.c if MRB_WITHOUT_FLOAT is set; #3827
2017-11-04 12:12:52 +09:00
Yukihiro "Matz" Matsumoto
de2363a9f0
Merge branch 'mrb_without_float' of https://github.com/pandax381/mruby into pandax381-mrb_without_float
2017-11-04 11:49:25 +09:00
Yukihiro "Matz" Matsumoto
388d26d770
Reimplement block_given?; ref #3841
...
Make `block_given?` to search for the top of the scope first.
The top of the scope means either:
* the top method body
* the enclosing class body
* the top-level
The special case is the method defined by `define_method` with a
block as in #3841 . In cases like this, the method body (given by
a block) is not considered as the top of the scope. You need to use
`&block` in the block parameter if you want to know if a block is
given to the method.
This commit also changes the behavior of `MRB_PROC_SCOPE` flag.
Now it is only set if the `proc` is either a class body or a method
body defined in Ruby. It is no longer set for a block that given to
`define_method`.
2017-11-04 11:20:04 +09:00
Yukihiro "Matz" Matsumoto
ab27abe083
The bidx saved in env may be useless; fix #3841
...
When `block_given?` is called from a block given to `define_method`
as a method body, the `bidx` may not be within `env` saved closure.
In this case, it causes heap buffer overflow.
2017-11-04 03:01:37 +09:00