Yukihiro "Matz" Matsumoto
33f97bccba
array.c (mrb_ary_unshift): use mrb_get_argc() and mrb_get_argv().
2022-10-21 13:31:32 +09:00
Yukihiro "Matz" Matsumoto
da8ef29fba
array.c (mrb_ary_push_m): fixed a stupid bug.
2022-10-19 17:14:49 +09:00
Yukihiro "Matz" Matsumoto
bdb51d1af4
array.c (mrb_ary_push_m): adjust function order.
...
ary_modify() and ary_expand_capa() may cause garbage collection and may
make argv invalid (in the future).
2022-10-18 17:11:07 +09:00
Yukihiro "Matz" Matsumoto
3f286f1bfd
array.c: make ary_modify_check() an alias to mrb_check_frozen().
2022-10-17 21:59:22 +09:00
Yukihiro "Matz" Matsumoto
4cefb2cccd
class.c (mt_get): fix a bug regarding inline method cache.
2022-10-10 22:23:10 +09:00
Yukihiro "Matz" Matsumoto
5d13733352
vm.c (OP_ENTER): address fast path.
...
For method of fixed arguments only (no rest arguments, no keyword
arguments). Makes Fibonacci benchmark and ao_bench 4-5% faster.
2022-10-07 12:01:13 +09:00
dearblue
dbc78cd861
Added documentation for mrb_singleton_class()
2022-10-06 21:56:07 +09:00
Yukihiro "Matz" Matsumoto
268f6dcab3
numeric.c (mrb_float_to_integer): isinf/isnan takes any float values.
...
So don't need to cast to `float`, just use `mrb_float`.
2022-10-04 11:05:15 +09:00
Yukihiro "Matz" Matsumoto
62e0e3eebe
class.c (mrb_get_args_a): adjust spacing [ci skip]
2022-10-04 11:05:15 +09:00
Yukihiro "Matz" Matsumoto
b73802d437
vm.c (cipop): wrong callinfo shifts fixed; ref #5791
2022-09-28 16:57:11 +09:00
Yukihiro "Matz" Matsumoto
0c475708de
vm.c (cipop): use mrb_object_dead_p() to detect reclaimed block; #5791
2022-09-26 07:50:41 +09:00
Yukihiro "Matz" Matsumoto
993c8c1053
gc.c (final_marking_phase): move exception clearing after marking; #5789
2022-09-24 23:08:28 +09:00
Yukihiro "Matz" Matsumoto
d9061bd969
numeric.c: update documents [ci skip].
2022-09-23 22:13:28 +09:00
Yukihiro "Matz" Matsumoto
81f98a3925
vm.c (cipop): check type of the callinfo::blk; fix #5791
...
Since `callinfo::blk` is not marked in the GC, it may be reclaimed in
the sweep phase. When it reclaimed, it will become either (a) a non Proc
object, or (b) a Proc object that happen to have the same address.
For case (a), adding `b->tt == MRB_TT_PROC` check works. We should avoid
the following `MRB_PROC_STRICT_P()` and `MRB_PROC_ENV()` operations for
non Proc objects.
For case (b), `MRB_PROC_ENV(b) == CI_ENV(&c->ci[-1])` check should work.
Unrelated Proc objects should be filtered by the check.
We don't need to clear `callinfo::blk` by `NULL` because the callinfo
struct will be discarded afterward in the `cipop()` function.
2022-09-19 08:35:36 +09:00
Yukihiro "Matz" Matsumoto
5b62fbc0fc
array.c (mrb_ary_concat_m): Array#concat to take multiple arguments.
2022-09-19 08:25:00 +09:00
Yukihiro "Matz" Matsumoto
bd1310c9f9
gc.c (incremental_gc_finish): rename the function.
...
incremental_gc_until() are always called with MRB_GC_STATE_ROOT.
So no need to supply it from outside.
2022-09-17 16:43:06 +09:00
Yukihiro "Matz" Matsumoto
97a419f540
gc.c (clear_error_object): need to mark class of error objects; ref #5789
2022-09-13 22:20:34 +09:00
Yukihiro "Matz" Matsumoto
b5677bff1f
gc.c (final_marking_phase): clear error objects before sweep; close #5789
...
Some error objects are referenced from `mrb_state`, and previously they
are simply marked as root objects. But when they are not referenced from
other part of the program, they are no longer used at the current incarnation.
That means we can safely reclaim their child objects (their messages and
backtrace information).
2022-09-13 07:16:38 +09:00
Yukihiro "Matz" Matsumoto
966d90e182
src/readfloat.c: renamed from readflt.c
2022-09-05 07:30:13 +09:00
Yukihiro "Matz" Matsumoto
4669d43f50
error.h: move rbreak_tag definitions to src/vm.c.
2022-09-05 07:30:12 +09:00
Yukihiro "Matz" Matsumoto
eecb6cc080
vm.c (cipush): push block information in the callinfoa; fix #5786
2022-09-01 18:57:19 +09:00
Yukihiro "Matz" Matsumoto
0645c4536b
readflt.c: small style modifications.
2022-08-29 15:14:46 +09:00
Yukihiro "Matz" Matsumoto
818ca413af
symbol.c (find_symbol): use mrb_byte_hash() instead of symhash().
2022-08-25 18:50:17 +09:00
Yukihiro "Matz" Matsumoto
d4e649f8bf
class.c: refactoring mrb_get_args(); ref #5596
2022-08-24 16:49:10 +09:00
Yukihiro "Matz" Matsumoto
eaa89fbe2a
Merge branch 'get-args-array' of https://github.com/sasq64/mruby into sasq64-get-args-array
2022-08-24 16:46:00 +09:00
Yukihiro "Matz" Matsumoto
9b4bbed047
vm.c (OP_SEND): remove scoping braces; ref #5775
2022-08-20 21:24:30 +09:00
Yukihiro "Matz" Matsumoto
43c5cd2dea
Merge pull request #5775 from dearblue/integrate-super
...
Integrate the second half of `OP_SUPER` with `OP_SENDB`
2022-08-20 21:23:16 +09:00
Yukihiro "Matz" Matsumoto
c7d2eaa3e8
Revert "vm.c (mrb_funcall_with_block): avoid use of MRB_METHOD_CFUNC_P()."
...
This reverts commit c28ac75a87 .
This change caused SEGV in the case like the following:
```
class C
class << self
attr_accessor :a
alias :const_missing :a=
end
end
p C::CONST
```
2022-08-20 12:58:17 +09:00
dearblue
9c3e0145eb
Directly write ARGUMENT_NORMALIZE()
...
The common parts of `OP_SEND` and `OP_SUPER` have been merged so they no longer need to be independent.
This effectively means revert commit d0e8637e30 .
2022-08-20 10:46:46 +09:00
dearblue
a7bfddecdb
Integrate the second half of OP_SUPER with OP_SENDB
...
Not exactly the same, but I think there were some things that should have been fixed in the original `OP_SUPER`.
2022-08-20 10:46:46 +09:00
Yukihiro "Matz" Matsumoto
28d1e794db
vm.c (mrb_funcall_with_block): need to initialize arginfo.
2022-08-19 23:17:23 +09:00
Yukihiro "Matz" Matsumoto
82b98bb8a4
vm.c (funcall_args_capture): move argument set-up in the function; #5777
2022-08-18 13:00:08 +09:00
Yukihiro "Matz" Matsumoto
c28ac75a87
vm.c (mrb_funcall_with_block): avoid use of MRB_METHOD_CFUNC_P().
2022-08-18 12:58:30 +09:00
Yukihiro "Matz" Matsumoto
772fe11d83
vm.c (stack_copy): use early return.
2022-08-18 12:57:51 +09:00
Yukihiro "Matz" Matsumoto
d577221c2d
vm.c (stack_copy) check if src is NULL before memcpy(); ref #5777
...
Because 2nd argument of memcpy() is declared to never be null.
2022-08-18 08:17:44 +09:00
Yukihiro "Matz" Matsumoto
8c08324d2f
Merge pull request #5777 from dearblue/gc-on-cipush
...
Protect prepared arguments when GC occurs in `cipush()`
2022-08-18 08:09:05 +09:00
Yukihiro "Matz" Matsumoto
4107cc95a2
internal.c: move some functions to <mruby/internal.h>.
...
Ref #5776
2022-08-15 18:13:59 +09:00
Yukihiro "Matz" Matsumoto
37dc1be74b
internal.c: move mrb_method_missing prototype to <mruby/internal.h>.
...
Ref #5776
2022-08-15 17:25:08 +09:00
Yukihiro "Matz" Matsumoto
db20cbce53
src/class.c: move method_missing from Kernel to BasicObject; fix #5776
...
In ISO30170, method_missing is defined under Kernel, but BasicObject is
introduced after ISO and we should move (and have moved) some Kernel
methods to BasicObject, e.g. instance_eval, equal?, etc.
We have missed method_missing (mostly because built-in method_missing
in VM handles most of the case).
2022-08-15 16:41:19 +09:00
Yukihiro "Matz" Matsumoto
b891c63ae1
numeric.c: calculate correct rounding for bigger numbers.
2022-08-12 12:31:38 +09:00
Yukihiro "Matz" Matsumoto
1a95da4ac2
numeric.c (mrb_cmp): inline big-integer comparison.
2022-08-12 12:24:04 +09:00
Yukihiro "Matz" Matsumoto
d14fd77148
numeric.c (mrb_int_pow): make the function to take 2 operands.
2022-08-12 12:19:21 +09:00
dearblue
170118e4de
Avoid shadowing insn variables in OP_EXT3
2022-08-12 11:12:18 +09:00
dearblue
3c2fcb5e74
Protect prepared arguments when GC occurs in cipush()
...
When `cipush()` extends "callinfo", GC may occur.
In this case, there was a problem that prepared arguments were spoiled depending on the situation when `cipush()` is called.
Therefore, in the problematic part, `cipush()` is prepared first, and then the arguments are prepared.
The reason for passing `CINFO_DIRECT` to `cipush()` is that it is simply ignored in the `MRB_CATCH()` part of `mrb_vm_exec()`.
Also, the argument processing parts of `mrb_funcall_with_block()` and `mrb_yield_with_class()` are combined and made independent as `funcall_args_capture()`.
2022-08-11 15:25:29 +09:00
Yukihiro "Matz" Matsumoto
8cdf14c06b
numeric.c (int_rounding): unify code duplication.
2022-08-10 13:38:24 +09:00
Yukihiro "Matz" Matsumoto
4e735eb8ba
numeric.c (flo_rounding): refactor float rounding methods.
2022-08-10 13:38:24 +09:00
Yukihiro "Matz" Matsumoto
7ffdb4c30e
numeric.c: implement ndigits truncation for rounding methods.
...
- ceil
- floor
- round
- truncate
2022-08-10 13:38:23 +09:00
Yukihiro "Matz" Matsumoto
abec98c681
numeric.c: implement ceil, floor, round, truncate methods in C.
...
- ISO 15.2.8.3.14 Integer#ceil
- ISO 15.2.8.3.17 Integer#floor
- ISO 15.2.8.3.20 Integer#round
- ISO 15.2.8.3.26 Integer#truncate
2022-08-10 13:38:23 +09:00
Yukihiro "Matz" Matsumoto
7340ad1c8b
Merge pull request #5764 from dearblue/red-protect
...
Check `MRB_GC_RED` with `mrb_gc_protect()`
2022-08-09 23:01:55 +09:00
Yukihiro "Matz" Matsumoto
9f7cef2d42
Merge pull request #5763 from dearblue/realloc-fullgc
...
Perform Full-GC from `mrb_realloc_simple()` by `MRB_GC_STRESS + MRB_DEBUG`
2022-08-09 14:00:18 +09:00