summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler
AgeCommit message (Collapse)Author
2020-11-04Fix a bug with big negative integers.Yukihiro "Matz" Matsumoto
2020-11-04Add a new instruction `OP_LOADI32`.Yukihiro "Matz" Matsumoto
That loads 32 bit integer bypassing pool access.
2020-11-03Merge pull request #5112 from shuujii/fix-dependencies-of-y.tab.oYukihiro "Matz" Matsumoto
Fix dependencies of `y.tab.o`
2020-11-03Fix dependencies of `y.tab.o`KOBAYASHI Shuji
In the case of `y.tab.o`, `y.tab.d` was not read, so `y.tab.c` was not recompiled by updating header files. It seemed that the cause was overwriting the rake rule, so I deleted unnecessary settings.
2020-11-03Add new instructions to handle symbols/literals >255; fix #5109Yukihiro "Matz" Matsumoto
New instructions: * OP_LOADL16 * OP_LOADSYM16 * OP_STRING16 Size of pools, symbols are `int16_t` but offset representation in the bytecode was 8 bits. Size of child `irep` array is `int16_t`, too but this change does not address it.
2020-11-02Replace `R-assignment` by `single-line pattern matching`.Yukihiro "Matz" Matsumoto
Since `R-assignment` in CRuby is abandoned. Single-line pattern matching in `mruby` only matches single local variable at the moment. Currently it works as a right assignment to a local variable. It will be enhanced in the future.
2020-10-28Fixed build with `conf.enable_cxx_exception`dearblue
The problem was manifested by commit 5069fb15e41998dffef8e0ba566b3a82be369ba3.
2020-10-16Add startless range (another part of #5085)Yukihiro "Matz" Matsumoto
Ref #5093; close #5085
2020-10-15Merge branch 'work_for_merge' of https://github.com/zubycz/mruby into ↵Yukihiro "Matz" Matsumoto
zubycz-work_for_merge
2020-10-15Fix out of bound access in `parse.y`.Yukihiro "Matz" Matsumoto
2020-10-13Introduce endless range (a part of #5085)taiyoslime
Co-Authored-By: n4o847 <[email protected]> Co-Authored-By: smallkirby <[email protected]>
2020-10-12Avoid `unsigned int`; Use `mrb_int` instead.Yukihiro "Matz" Matsumoto
2020-10-12Raname `mrb_exc_new_str_lit()` to `mrb_exc_new_lit()`.Yukihiro "Matz" Matsumoto
It uses `mrb_str_new_lit()` internally, but it doesn't need to express it in the name of the function (macro).
2020-10-12Use `mrb_int_value()` instead of `mrb_fixnum_value()`.Yukihiro "Matz" Matsumoto
Where fixnum overflow can happen.
2020-10-12Reorganize `Integer` system.Yukihiro "Matz" Matsumoto
- Integrate `Fixnum` and `Integer` - Remove `Integral` - `int / int -> int` - Replace `mrb_fixnum()` to `mrb_int()` - Replace `mrb_fixnum_value()` to `mrb_int_value()`. - Use `mrb_integer_p()` instead of `mrb_fixnum_p()`
2020-10-12Rename `MRB_TT_FIXNUM` to `MRB_TT_INTEGER`.Yukihiro "Matz" Matsumoto
We still have `#define MRB_TT_FIXNUM MRB_TT_INTEGER` for compatibility.
2020-10-12Make `Proc#parameters` to support keyword arguments; fix #5066Yukihiro "Matz" Matsumoto
TODO: Unlike CRuby, mruby's `Proc#parameters` does not distinguish required keyword arguments and optional keyword arguments currently.
2020-10-12Rename float configuration option names.Yukihiro "Matz" Matsumoto
- `MRB_WITHOUT_FLOAT` => `MRB_NO_FLOAT` - `MRB_USE_FLOAT` => `MRB_USE_FLOAT32` The former is to use `USE_XXX` naming convention. The latter is to make sure `float` is 32bit float and not floating point number in general.
2020-10-12Rename `OP_JUW` instruction to `OP_JMPUW`.Yukihiro "Matz" Matsumoto
2020-10-12Fix typo `_hander` -> `_handler`.Yukihiro "Matz" Matsumoto
2020-10-12Replace global jump with catch handler implementationdearblue
When a global jump occurs, look at the catch handler table to determine where to jump. In that case, `pc` already shows the following instruction, but since the table shows `begin_offset ... end_offset`, the comparison is done with `begin_offset < pc && pc <= end_offset`. If there is a corresponding handler, move `pc` to `handler.target_offset` and continue running the VM. When a global jump across `ensure` is made by `return`, `break`, `next`, `redo` and `retry`, the extended `RBreak` object saves and restores the C-level execution position. This extended `RBreak` can have tag information, which makes it a pseudo coroutine (the "tag" mimics CRuby). The implementation of pseudo coroutines by `RBreak` is summarized by `CHECKPOINT_RESTORE ... CHECKPOINT_MAIN ... CHECKPOINT_END` and `throw_tagged_break` / `unwind_ensure` macros. The restart of processing is branched by `RBREAK_TAG_FOREACH(DISPATCH_CHECKPOINTS)`. - Not only `rescue` blocks but also `ensure` blocks are now sandwiched between `OP_EXCEPT` and `OP_RAISEIF`. - Remove the function `ecall()`. It is no longer necessary to re-enter the VM to perform an "ensure block". This will resolves #1888. - Added instruction `OP_JUW` (Jump while UnWind). It jumps unconditionally like `OP_JMP`, but searches the catch handler table and executes the ensure block. Since it searches the catch handler table, it is much heavier than `OP_JMP`.
2020-10-12Extended `OP_EXCEPT` and `OP_RAISE` (`OP_RAISEIF`) instructionsdearblue
- `OP_EXCEPT` checks if `mrb->exc` is `NULL`, `MRB_TT_EXCEPTION` or `MRB_TT_BREAK`. If `mrb->exc` is `NULL`, it will be replaced with `nil`. - If `OP_RAISE` is `nil`, it does nothing and the immediately following instruction is executed (like `OP_NOP`). Also, in case of `RBreak` object, it moves to the processing for `break`. With this change, the instruction name is changed from `OP_RAISE` to `OP_RAISEIF`.
2020-10-12Extended mruby binary formatdearblue
The catch handler table is combined with iseq block. This is to prevent the structure from growing by adding a field for the catch handler table to the `mrb_irep` structure. "iseq block" and "catch handler table": [number of catch handler table (2 bytes)] [number of byte code (4 bytes)] [iseq (any bytes)] [catch handlers (multiple of 7 bytes)] catch handler: [catch type (1 byte)] [begin offset (2 bytes)] [end offset (2 bytes)] [target offset (2 bytes)] catch type: enum mrb_catch_type (0 = rescue, 1 = ensure) begin offset: Includes the specified instruction address end offset: Does not include the specified instruction address target offset: replaces pc with the specified instruction address This table is not expanded by `read_irep_record_1()`. The necessary elements are expanded one by one when used.
2020-10-12You don't need to keep index in local variables info in `irep`.Yukihiro "Matz" Matsumoto
2020-10-12Remove `OP_EXT[123]` from operands.Yukihiro "Matz" Matsumoto
2020-10-12Allow `rescue` modifier in endless method definitions.Yukihiro "Matz" Matsumoto
2020-10-12Implement endless-def as in CRuby [Feature#16746].Yukihiro "Matz" Matsumoto
2020-10-12Rightward-assign by ASSOC.Yukihiro "Matz" Matsumoto
[ruby-bugs:15921]
2020-10-12Avoid including `limits.h` and `stdint.h` before `mruby.h`.Yukihiro "Matz" Matsumoto
They are included from `mruby.h` anyway, and including it ahead can cause some errors regarding `INT32_MAX` etc. with C++ compiler.
2020-10-12Add casts to silence warnings.Yukihiro "Matz" Matsumoto
2020-10-12Clarify the use of `MRB_64BIT` and `MRB_INT64` in `dump.c` and `load.c`.Yukihiro "Matz" Matsumoto
- `MRB_64BIT`: the size of a pointer is 64 bits - `MRB_INT64`: the size of `mrb_int` is 64 bits
2020-10-12Generate C struct from `irep` instead of binary dump.Yukihiro "Matz" Matsumoto
2020-10-12Replace entire `irep->pool`.Yukihiro "Matz" Matsumoto
Changes: - `pool format is completely replaced - supported types: `STR`, `INT32`, `INT64`, `FLOAT` - `FLOAT` may be replaced by binary representation in the future - insert `NUL` after string literals in `mrb` files - `irep->pool` no longer store values in `mrb_value` - instead it stores in `mrb_pool_value` - less allocation - `mrb_irep` can be stored in ROM
2020-10-12Rename `struct mrb_locals` to `struct mrb_lvinfo`.Yukihiro "Matz" Matsumoto
That stands for "local variable information".
2020-10-12Constify `irep` members.Yukihiro "Matz" Matsumoto
- `pool` - `syms` - `reps`
2020-10-12Add `y.tab.c` to remove Bison from build dependencies; ref 4ce3997cKOBAYASHI Shuji
I sometimes see Bison related problems in setting up build environments. Therefore to remove Bison from build time dependencies, add `y.tab.c` generated by Bison to the repository. The reduction of dependency at build time also reduces the labor and time for setup and installation in CI. In addition, a path in `#line` directive is converted to a relative path so that its path is constant regardless of development environments.
2020-10-12Use `mrb_funcall_id()` extensively.Yukihiro "Matz" Matsumoto
Except for support files e.g. `mruby-test/driver.c`, which are not target of symbol collection via `rake gensym`.
2020-10-12Use more `MRB_QSYM()`.Yukihiro "Matz" Matsumoto
2020-10-12Use `MRB_QSYM()` instead of `MRB_OPSYM()`.Yukihiro "Matz" Matsumoto
2020-10-12Use `MRB_OPSYM()` instead of `mrb_intern_lit()`.Yukihiro "Matz" Matsumoto
2020-10-12Add `MRB_SYM()` for inline symbols.Yukihiro "Matz" Matsumoto
2020-09-10Update `y.tab.c`; ref #4933Yukihiro "Matz" Matsumoto
2020-09-10Merge pull request #4933 from dearblue/variablesYukihiro "Matz" Matsumoto
Fix take over file scope variables with `mruby` and `mirb` command
2020-08-11Fix `mrb_int` and `size_t` combination warnings.Yukihiro "Matz" Matsumoto
2020-06-09Update `OP_HASH` generation to support big hash creation.Yukihiro "Matz" Matsumoto
2020-06-05Change arena index from `mrb_int` to `int`.Yukihiro "Matz" Matsumoto
2020-06-02Remove `patch_irep()` in `mruby-eval`dearblue
- It can now deal with operands in the range of `OP_EXT*`. - It can now call the same method as the variable name without arguments. ```ruby def a "Safe!" end a = "Auto!" eval "a()" # call method `a` ```
2020-05-25Add `y.tab.c` to remove Bison from build dependencies; ref 4ce3997cKOBAYASHI Shuji
I sometimes see Bison related problems in setting up build environments. Therefore to remove Bison from build time dependencies, add `y.tab.c` generated by Bison to the repository. The reduction of dependency at build time also reduces the labor and time for setup and installation in CI. In addition, a path in `#line` directive is converted to a relative path so that its path is constant regardless of development environments.
2020-05-15Remove `YYERROR_VERBOSE` which no longer supported since `bison 3.6`.Yukihiro "Matz" Matsumoto
Instead we added `%define parse.error verbose`.
2020-05-09Fix boundary check for `OP_LOADI16`; ref fa8668cdearblue
It was making a negative integer if the highest-order bit of a 16-bit integer was 1. no patched: ```ruby p 0x7fff # => 32767 p 0x8000 # => -32768 p 0xffff # => -1 p 0x10000 # => 65536 ```