Commit Graph

14192 Commits

Author SHA1 Message Date
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 b832856978 Merge branch 'sasq64-get-args-array' 2022-08-24 16:50:02 +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 7c0f7e2665 parse.y: allow NUMPARAMs (e.g. _1) as hash keys; fix #5785 2022-08-23 18:36:26 +09:00
Yukihiro "Matz" Matsumoto f587edd849 pack.c: need extra space for the terminal NULL. 2022-08-23 15:05:27 +09:00
Yukihiro "Matz" Matsumoto a641f146fc codegen.c (gen_assignment): use nsym() instead of simple type cast. 2022-08-23 11:30:54 +09:00
Yukihiro "Matz" Matsumoto 108875c972 codegen.c (gen_assignment): support NODE_COLON3 as lhs; fix #5752
We should allow `::C = 1` for example.
2022-08-23 07:53:23 +09:00
Yukihiro "Matz" Matsumoto c6daaa8c07 struct.c (make_struct): use preallocated symbols. 2022-08-22 16:12:59 +09:00
Yukihiro "Matz" Matsumoto 35a5678899 mruby-pack/pack.c: make base64_dec_tab a static array of chars. 2022-08-21 19:25:16 +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
Yukihiro "Matz" Matsumoto 563010697e doc/guides/compile.md: add rake clean tip; ref #5784 [ci skip] 2022-08-20 12:54:30 +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 490d805577 Merge pull request #5783 from jbampton/patch-1
Use Super-Linter Slim Image
2022-08-17 12:58:54 +09:00
John Bampton 890d48463a Use Super-Linter Slim Image
Should improve workflow time.

https://github.com/github/super-linter#slim-image
2022-08-17 08:53:06 +10:00
Yukihiro "Matz" Matsumoto 993c388cce bigint.c (mrb_bint_idiv): remove unused function. 2022-08-16 15:45:54 +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 6a7fa26411 Merge pull request #5782 from haramako/crash-on-resume-from-cfunc
Protect when call Fiber#resume from C function.
2022-08-14 17:31:56 +09:00
Yukihiro "Matz" Matsumoto 83e8fd54f4 Merge pull request #5779 from dearblue/debug.h
Make definition of `mrb_irep` by `typedef` in `mruby.h`
2022-08-14 17:27:11 +09:00
HARADA Makoto dc65b1faf1 fiber.c: add fiber_check_cfunc in fiber_resume(). 2022-08-13 15:52:52 +09:00
Yukihiro "Matz" Matsumoto 3365388164 Merge pull request #5780 from dearblue/doc/mrb_value
Match the `mrb_value` documentation to the current implementation
2022-08-13 14:06:26 +09:00
dearblue 61c68927a2 Match the mrb_value documentation to the current implementation 2022-08-12 22:35:35 +09:00
dearblue 1e72c61b0f Make definition of mrb_irep by typedef in mruby.h
Eliminated invisible dependencies from `mruby/debug.h` to `mruby/irep.h`.
2022-08-12 22:25:27 +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
Yukihiro "Matz" Matsumoto 15184c50f7 Merge pull request #5778 from dearblue/shadowing-insn
Avoid shadowing `insn` variables in `OP_EXT3`
2022-08-12 12:18:32 +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
Yukihiro "Matz" Matsumoto 78a3200fa5 etc.c (mrb_obj_id): separate object_id and hash values.
It's OK for hash values to conflict. But object_id is not (in theory).
2022-08-08 23:00:13 +09:00
dearblue 520df805a9 Check MRB_GC_RED with mrb_gc_protect()
When `gc_protect()` is called from `mrb_obj_alloc()`, unnecessary overhead is eliminated.
2022-08-08 22:10:22 +09:00
dearblue 71c398f298 Perform Full-GC from mrb_realloc_simple() by MRB_GC_STRESS + MRB_DEBUG
It also fills the GC'ed object area with `0xff` for debugging purposes.
2022-08-08 21:44:11 +09:00
Yukihiro "Matz" Matsumoto f653e89227 etc.c: refactor boxing/unboxing float values. 2022-08-07 20:43:31 +09:00