summaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)Author
2020-11-30Fixed print catch handler address in codedump; ref #5200dearblue
It became 32 bits in #5200, but only the upper 16 bits were printed.
2020-11-29Use `MRB_SYM` in `src/gc.c`KOBAYASHI Shuji
2020-11-29Merge pull request #5203 from komainu8/fix-heap-buffer-overflowYukihiro "Matz" Matsumoto
Fix heap buffer overflow when dump irep
2020-11-29Fix heap buffer overflow when dump irepHorimoto Yasuhiro
Currently, the size of writing in heap by write_irep_record() is bigger than The size that is calculated by get_irep_record_size. Therefore, irep is dumped over the size of allocating memory when we execute dump_irep().
2020-11-29Change the catch handler address to 32 bitsdearblue
Follow commit 7150c6753933f12a2ba63769fb7b3a44cfcddd3d .
2020-11-26Create presym files for each build targetKOBAYASHI Shuji
Previously, presym files were always created in `build/{presym,presym.inc}`. However, this constraint is inconvenient because it is common to use multiple build configurations and build targets in a single mruby tree. Therefore, change to create presym file for each build target.
2020-11-26Fix a bug in `find_symbol()`; fix #5192Yukihiro "Matz" Matsumoto
2020-11-26Make `OP_JMP*` operand address to be relative.Yukihiro "Matz" Matsumoto
Jump target address is `operand (16bit)` + `address of next instruction`. In addition, `ilen` was made `uint32_t` so that `iseq` length limitation of 65536 is removed. Only jump target address should be within signed 16bit (-32768 .. 32767).
2020-11-26Small refactoring regarding symbols for clarity.Yukihiro "Matz" Matsumoto
2020-11-26Include `mruby.h` instead of `mrbconf.h` directly.Yukihiro "Matz" Matsumoto
2020-11-26Avoid memory leak when `mrb_read_irep()` fails.Yukihiro "Matz" Matsumoto
2020-11-25Move inline `iseq` in `array.c` to `array.rb`.Yukihiro "Matz" Matsumoto
There's no efficiency difference since `cdump` is implemented.
2020-11-25Fix C source compilation with `MRB_USE_ALL_SYMBOLS`; ref #5187KOBAYASHI Shuji
However, compiling by `mrbc` fails with another issue (#5116).
2020-11-24Add `#include <mrbconf.h>` at the head of `fmt_fp.c`; #5185Yukihiro "Matz" Matsumoto
2020-11-24Merge pull request #5186 from shuujii/optimize-presym_findYukihiro "Matz" Matsumoto
Optimize `presym_find`
2020-11-24Fix compiler errors from `MRB_NO_FLOAT`; #5185Yukihiro "Matz" Matsumoto
Also added `no-float.rb` target in `build_config`.
2020-11-24Optimize `presym_find`KOBAYASHI Shuji
Chang to compare string length first. ### Benchmark #### Code * https://github.com/shuujii/mruby-presym_find-benchmark #### Result ```console Previous: 10.240772M i/s (25M times in 2.441222s) New: 16.412985M i/s (25M times in 1.523184s) ```
2020-11-23Fix unintended variable shadowingWataru Ashihara
2020-11-22Remove `mrb_str_buf_new()` and `MRB_STR_BUF_MIN_SIZE`; close #5171Yukihiro "Matz" Matsumoto
2020-11-22Fix GC mark leaks for `MRB_TT_BREAK`; fix #5168dearblue
2020-11-22Fix size of local variable array in struct dumped fileKOBAYASHI Shuji
2020-11-22Merge pull request #5167 from dearblue/singleton-methodYukihiro "Matz" Matsumoto
Improved `Object#define_singleton_method`
2020-11-21Improved `Object#define_singleton_method`dearblue
Integrate the implementation with `Module#define_method`. - Introduce the internal function `mrb_mod_define_method_m()` (no static) - The `Object#define_singleton_method` method can now accept a second argument
2020-11-21Rename `MRB_{ENABLE,DISABLE}_` to `MRB_{USE,NO}_`; close #5163KOBAYASHI Shuji
| Previous Name | New Name | |------------------------------|-------------------------| | MRB_ENABLE_ALL_SYMBOLS | MRB_USE_ALL_SYMBOLS | | MRB_ENABLE_SYMBOLL_ALL | MRB_USE_ALL_SYMBOLS | | MRB_ENABLE_CXX_ABI | MRB_USE_CXX_ABI | | MRB_ENABLE_CXX_EXCEPTION | MRB_USE_CXX_EXCEPTION | | MRB_ENABLE_DEBUG_HOOK | MRB_USE_DEBUG_HOOK | | MRB_DISABLE_DIRECT_THREADING | MRB_NO_DIRECT_THREADING | | MRB_DISABLE_STDIO | MRB_NO_STDIO | | ENABLE_LINENOISE | MRB_USE_LINENOISE | | ENABLE_READLINE | MRB_USE_READLINE | | DISABLE_MIRB_UNDERSCORE | MRB_NO_MIRB_UNDERSCORE | | DISABLE_GEMS | MRB_NO_GEMS | * `MRB_ENABLE_SYMBOLL_ALL` seems to be a typo, so it is fixed. * `MRB_` prefix is added to those without. * The previous names can also be used for compatibility.
2020-11-21Merge pull request #5162 from ↵Yukihiro "Matz" Matsumoto
shuujii/move-some-.rake-files-to-tasks-directory-for-consistency Move some `.rake` files to `tasks` directory for consistency
2020-11-21Reserve `OP_SENDVK` for the future keyword arguments like Ruby3.0.Yukihiro "Matz" Matsumoto
2020-11-21Fix infinite loop bug from `super` when method is prepended.Yukihiro "Matz" Matsumoto
2020-11-21Fix module order of `#include`; ruby-bug:7844Yukihiro "Matz" Matsumoto
2020-11-21Unable for the `MRB_TT_CPTR` object to have a singleton classdearblue
This object is treated as an immediate value.
2020-11-21Move some `.rake` files to `tasks` directory for consistencyKOBAYASHI Shuji
2020-11-21Update `Float#to_s` to keep trailing zero as CRuby does; ref 68cebb6Yukihiro "Matz" Matsumoto
2020-11-20Refactor `src/mruby_core.rake`KOBAYASHI Shuji
2020-11-18Revert "Check if irep->reps is NULL in lv_defined_p"Yukihiro "Matz" Matsumoto
2020-11-18Use `mrb_int_value()` instead of `mrb_fixnum_value()`; fix #5142Yukihiro "Matz" Matsumoto
2020-11-18Merge pull request #5147 from hifoolno/patch1Yukihiro "Matz" Matsumoto
Check if irep->reps is NULL in lv_defined_p
2020-11-18Check if irep->reps is NULL in lv_defined_pZhang Xiaohui
2020-11-18Merge pull request #5143 from ↵Yukihiro "Matz" Matsumoto
shuujii/use-mrb_int_value-instead-of-mrb_fixnum_value-in-src-hash.c Use `mrb_int_value` instead of `mrb_fixnum_value` in `src/hash.c`
2020-11-18Check if irep->reps is NULLZhang Xiaohui
2020-11-18Use `mrb_int_value` instead of `mrb_fixnum_value` in `src/hash.c`KOBAYASHI Shuji
2020-11-17Revert half of 9fbf0ef8.Yukihiro "Matz" Matsumoto
I misunderstand the meaning of #4483. Sorry.
2020-11-17Detect overflow in `flo_shift()`.Yukihiro "Matz" Matsumoto
2020-11-17Refactoring integer ranges.Yukihiro "Matz" Matsumoto
- Remove `mrb_ssize` - Fix `MRB_FIXNUM_{MIN,MAX}` to 32 bits on `MRB_NAN_BOXING`
2020-11-17Refactor integer division.Yukihiro "Matz" Matsumoto
2020-11-17Simplify `mrb_num_div_int()`.Yukihiro "Matz" Matsumoto
2020-11-16Merge pull request #5139 from shuujii/avoid-undefined-behaviorYukihiro "Matz" Matsumoto
Avoid undefined behavior
2020-11-16Avoid undefined behaviorKOBAYASHI Shuji
### ASAN report (`MRB_INT32`) ```console $ bin/mruby -ve '-0x40000000' mruby 3.0.0preview (2020-10-16) 00001 NODE_SCOPE: 00001 NODE_BEGIN: 00001 NODE_NEGATE: 00001 NODE_INT 40000000 base 16 irep 0x6070000001e0 nregs=2 nlocals=1 pools=0 syms=0 reps=0 iseq=9 file: -e /mruby/src/codedump.c:173:49: runtime error: left shift of 49152 by 16 places cannot be represented in type 'int' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /mruby/src/codedump.c:173:49 in 1 000 OP_LOADI32 R1 -1073741824 1 006 OP_RETURN R1 1 008 OP_STOP /mruby/src/vm.c:1138:7: runtime error: left shift of 49152 by 16 places cannot be represented in type 'mrb_int' (aka 'int') SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /mruby/src/vm.c:1138:7 in ```
2020-11-16Simplify `obj_free`KOBAYASHI Shuji
2020-11-15Fix that large integer is not GCed with Word-boxingKOBAYASHI Shuji
### Example (32-bit Word-boxing) ```ruby # example.rb int_count = ObjectSpace.count_objects[:T_INTEGER]||0 int = 1<<30 p (ObjectSpace.count_objects[:T_INTEGER]||0) - int_count int = nil GC.start p (ObjectSpace.count_objects[:T_INTEGER]||0) - int_count ``` #### Before this patch: ```console $ bin/mruby example.rb 1 1 ``` #### After this patch: ```console $ bin/mruby example.rb 1 0 ```
2020-11-14Integer overflow in operations should cause `RangeError`.Yukihiro "Matz" Matsumoto
2020-11-14Integer operation should result in Integer.Yukihiro "Matz" Matsumoto
Should raise `RangeError` if the operation overflows.