summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2021-03-29Revert "Fix `SIGSEGV` with mruby-method + mruby-catch"revert-5391-throwYukihiro "Matz" Matsumoto
2021-03-29Merge pull request #5391 from dearblue/throwYukihiro "Matz" Matsumoto
Fix `SIGSEGV` with mruby-method + mruby-catch
2021-03-28numeric.c: function renaming.Yukihiro "Matz" Matsumoto
- `mrb_num_div_int(mrb,x,y)` -> `mrb_div_int(mrb,x,y)` - `mrb_num_div_flo(mrb,x,y)` -> `mrb_div_flo(x,y)` They are internal function not supposed to be used outside of the core.
2021-03-27Fix `SIGSEGV` with mruby-method + mruby-catchdearblue
Previously, the following code would cause a `SIGSEGV`. ```ruby mm = method(:throw) define_method(:throw, ->(*args) { mm.call(*args) }) catch { |tag| throw tag } ``` I think the reason is in the `mrb_yield_with_class()` function: - Even if a C function is called, `CI_ACC_SKIP` is used - `cipop()` is not done if globally jumping from a C function
2021-03-27Move default `Integer#/` from `rational.c` to `complex.c`.Yukihiro "Matz" Matsumoto
2021-03-26complex.rb: add test for arithmetic operators. [ci skip]Yukihiro "Matz" Matsumoto
Tests for (`Float` or `Integer`) `op` `Complex`. Also added test dependency to `mruby-rational` since `int_div` definition relies on `Rational` when `MRB_USE_RATIONAL` is defined.
2021-03-26rational.rb: add test for arithmetic operators.Yukihiro "Matz" Matsumoto
Tests for (`Float` or `Integer`) `op` `Rational`.
2021-03-25rational.c: fix wrong `funcall` method in `rational_mul`.Yukihiro "Matz" Matsumoto
2021-03-25rational.c: inline `mrb_rational_eq()`.Yukihiro "Matz" Matsumoto
It removes non-static function, so that strictly saying, it's an incompatible change. But the function was added recently and I am sure no one uses it yet.
2021-03-24rational.c: implement `Rational#<=>` in C.Yukihiro "Matz" Matsumoto
2021-03-24rational.c: implement `Rational#/` and `#quo` in C.Yukihiro "Matz" Matsumoto
2021-03-24rational.c: implement `Rational#*` in C.Yukihiro "Matz" Matsumoto
2021-03-24rational.c: implement `Rational#-` in C.Yukihiro "Matz" Matsumoto
2021-03-24fixup! rational.c: prepare utility function `rat_to_flo()`.Yukihiro "Matz" Matsumoto
2021-03-24rational.c: prepare utility function `rat_to_flo()`.Yukihiro "Matz" Matsumoto
This function takes `struct mrb_rational*` and returns converted `mrb_float` value.
2021-03-24rational.c: implement `Rational#+` in C.Yukihiro "Matz" Matsumoto
2021-03-24complex.c: use `mrb_num_div_flo` to avoid copying function.Yukihiro "Matz" Matsumoto
This change relies that `mrb_num_div_flo` does not use `mrb` inside.
2021-03-24rational.c: check integer overflow in `rational_minus`.Yukihiro "Matz" Matsumoto
2021-03-24complex.rb: unary plus (`+@`) to return self avoiding copying.Yukihiro "Matz" Matsumoto
2021-03-24complex.c: implement `Complex` addition and subtraction in C.Yukihiro "Matz" Matsumoto
2021-03-24complex.c: override float division to support `Complex`.Yukihiro "Matz" Matsumoto
2021-03-24Use `div_flo` (copy of `mrb_num_div_flo`) for float division.Yukihiro "Matz" Matsumoto
2021-03-24Use `mrb_num_div_flo` for float division.Yukihiro "Matz" Matsumoto
This function handles zero division properly. Also fixed bugs that multiply numbers instead of division.
2021-03-24Fix infinite recursive call bugs in integer division.Yukihiro "Matz" Matsumoto
2021-03-24complex.c: implement `Complex#/` and `#quo` in C.Yukihiro "Matz" Matsumoto
2021-03-24complex.c: implement `Complex#*` in C.Yukihiro "Matz" Matsumoto
2021-03-24rational.rb: avoid 'NaNi` representation.Yukihiro "Matz" Matsumoto
Use `NaN*i` as CRuby does.
2021-03-23Add `timeout-minutes' to GitHub workflow. [ci skip]Yukihiro "Matz" Matsumoto
2021-03-22Merge pull request #5387 from shuujii/use-global-defines-for-mruby-bin-debuggerYukihiro "Matz" Matsumoto
Use global defines for `mruby-bin-debugger`
2021-03-22Merge pull request #5388 from ↵Yukihiro "Matz" Matsumoto
shuujii/reorganize-types-for-ObjectSpace.count_objects Reorganize types for `ObjectSpace.count_objects`
2021-03-22nintendo_switch.rb: remove trailing white spaces; #5386Yukihiro "Matz" Matsumoto
2021-03-22Reorganize types for `ObjectSpace.count_objects`KOBAYASHI Shuji
#### Addition - T_COMPLEX - T_RATIONAL #### Deletion - T_FALSE - T_FREE - T_TRUE - T_SYMBOL - T_UNDEF
2021-03-22Merge pull request #5386 from LanzaSchneider/masterYukihiro "Matz" Matsumoto
Add example for cross-compiling to Nintendo Switch
2021-03-22Merge pull request #5385 from ↵Yukihiro "Matz" Matsumoto
shuujii/add-configuration-for-MinGW-cross-compilation Add configuration for MinGW cross compilation [ci skip]
2021-03-22Use global defines for `mruby-bin-debugger`KOBAYASHI Shuji
2021-03-22Use global defines for `Rational` and `Complex`.Yukihiro "Matz" Matsumoto
2021-03-22build: provide global defines by `build.defines`.Yukihiro "Matz" Matsumoto
2021-03-22codegen.c: fix integer size warnings.Yukihiro "Matz" Matsumoto
along with repeated calls of `strlen()`.
2021-03-21Add example for cross-compiling to Nintendo SwitchLanza
Cross Compiling configuration for the Nintendo Switch, it requires Nintendo SDK
2021-03-21Add configuration for MinGW cross compilation [ci skip]KOBAYASHI Shuji
With this cross compiler configuration, all tests for full-core gembox on Windows on GitHub Actions were successful.
2021-03-21command.rb: replace `%w()` to plain `[]`.Yukihiro "Matz" Matsumoto
2021-03-21complex.c: define `Complex#==` in C.Yukihiro "Matz" Matsumoto
This change also fixes the error caused by `rational.c` that calls `mrb_complex_eq()`, which had been undefined.
2021-03-21memsize.c: handle `MRB_TT_RATIONAL` and `MRB_TT_COMPLEX`.Yukihiro "Matz" Matsumoto
2021-03-20rational.c: fix `MRB_TT_RATIONAL` and `MRB_TT_COMPLEX` confusion.Yukihiro "Matz" Matsumoto
2021-03-20random.c: fixed seed underflow bug.Yukihiro "Matz" Matsumoto
`MRB_INT_MIN` does not have a corresponding positive value.
2021-03-19complex.c: overhaul complex operators.Yukihiro "Matz" Matsumoto
- define `MRB_TT_COMPLEX` - change object structure (`struct RComplex`) - add memory management for `MRB_TT_COMPLEX` - avoid operator overloading as much as possible - as a result, performance improved a log - should work with and without `Rational` defined
2021-03-19rational.c: overhaul rational operators.Yukihiro "Matz" Matsumoto
- define `MRB_TT_RATIONAL` - change object structure (`struct RRational`) - add memory management for `MRB_TT_RATIONAL` - avoid operator overloading as much as possible - implement division overloading in C - as a result, performance improved a lot
2021-03-19numeric.c: avoid integer overflow; close #5384Yukihiro "Matz" Matsumoto
Since `mruby` does not have `Bignum`, `Float#divmod` could overflow, so it will return `Float` values when the divided value does not fit in `mrb_int`. This behavior will be changed when `Bignum` is introduced to `mruby` in the future.
2021-03-19`Float#divmod` with zero should cause `ZeroDivisionError`; #5384Yukihiro "Matz" Matsumoto
2021-03-18Merge branch 'dearblue-break-in-conf'Yukihiro "Matz" Matsumoto