summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core
AgeCommit message (Collapse)Author
2019-10-11Move exception raising to `scope_new`.Yukihiro "Matz" Matsumoto
Besides that fix bugs that mistakenly calls `raise_error` that emits code to raise runtime error instead of `codegen_error` that terminates code generation immediately.
2019-10-04Refactor local variables addition in optional/keyword arguments.Yukihiro "Matz" Matsumoto
2019-10-03Add local variable reordering to `kwargs`; ref #4746Yukihiro "Matz" Matsumoto
2019-10-03Need to reorder local variables defined in `opt`; fix #4746Yukihiro "Matz" Matsumoto
For example, local variables in the following def: ```ruby def foo(a = (not_set = true), &block) ... end ``` should be `a, block, not_set`, but were `a, not_set, block`.
2019-10-03Refactor `append_gen` function.Yukihiro "Matz" Matsumoto
2019-10-02Merge pull request #4736 from dearblue/ast-strdumpYukihiro "Matz" Matsumoto
Escape the AST string
2019-10-01Support `NODE_LITERAL_DELIM` in `mrb_parser_dump`KOBAYASHI Shuji
#### Before this patch: ```terminal $ bin/mruby -v -e '%w[1 2]' mruby 2.0.1 (2019-04-04) 00001 NODE_SCOPE: 00001 NODE_BEGIN: 00001 NODE_WORDS: 00001 NODE_STR "1" len 1 00001 node type: 85 (0x55) 00001 NODE_STR "2" len 1 (snip) ``` #### After this patch: ```terminal $ bin/mruby -v -e '%w[1 2]' mruby 2.0.1 (2019-04-04) 00001 NODE_SCOPE: 00001 NODE_BEGIN: 00001 NODE_WORDS: 00001 NODE_STR "1" len 1 00001 NODE_LITERAL_DELIM 00001 NODE_STR "2" len 1 (snip) ```
2019-10-01Support `NODE_SYMBOLS` in `mrb_parser_dump`KOBAYASHI Shuji
#### Before this patch: ```terminal $ bin/mruby -v -e '%i[1]; %I[#{2}]' mruby 2.0.1 (2019-04-04) 00001 NODE_SCOPE: 00001 NODE_BEGIN: 00001 node type: 87 (0x57) 00001 node type: 87 (0x57) (snip) ``` #### After this patch: ```terminal $ bin/mruby -v -e '%i[1]; %I[#{2}]' mruby 2.0.1 (2019-04-04) 00001 NODE_SCOPE: 00001 NODE_BEGIN: 00001 NODE_SYMBOLS: 00001 NODE_STR "1" len 1 00001 NODE_SYMBOLS: 00001 NODE_STR "" len 0 00001 NODE_BEGIN: 00001 NODE_INT 2 base 10 00001 NODE_STR "" len 0 (snip) ```
2019-10-01Support `NODE_WORDS` in `mrb_parser_dump`KOBAYASHI Shuji
#### Before this patch: ```terminal $ bin/mruby -v -e '%w[1]; %W[#{2}]' mruby 2.0.1 (2019-04-04) 00001 NODE_SCOPE: 00001 NODE_BEGIN: 00001 node type: 86 (0x56) 00001 node type: 86 (0x56) (snip) ``` #### After this patch: ```terminal $ bin/mruby -v -e '%w[1]; %W[#{2}]' mruby 2.0.1 (2019-04-04) 00001 NODE_SCOPE: 00001 NODE_BEGIN: 00001 NODE_WORDS: 00001 NODE_STR "1" len 1 00001 NODE_WORDS: 00001 NODE_STR "" len 0 00001 NODE_BEGIN: 00001 NODE_INT 2 base 10 00001 NODE_STR "" len 0 (snip) ```
2019-09-30Support `NODE_DSYM` in `mrb_parser_dump`KOBAYASHI Shuji
#### Before this patch: ```terminal $ bin/mruby -v -e ':"#{1}"; ["#{2}": 0]' mruby 2.0.1 (2019-04-04) 00001 NODE_SCOPE: 00001 NODE_BEGIN: 00001 node type: 83 (0x53) 00001 NODE_ARRAY: 00001 NODE_KW_HASH: 00001 key: 00001 node type: 83 (0x53) 00001 value: 00001 NODE_INT 0 base 10 (snip) ``` #### After this patch: ```terminal $ bin/mruby -v -e ':"#{1}"; ["#{2}": 0]' mruby 2.0.1 (2019-04-04) 00001 NODE_SCOPE: 00001 NODE_BEGIN: 00001 NODE_DSYM: 00001 NODE_DSTR: 00001 NODE_STR "" len 0 00001 NODE_BEGIN: 00001 NODE_INT 1 base 10 00001 NODE_STR "" len 0 00001 NODE_ARRAY: 00001 NODE_KW_HASH: 00001 key: 00001 NODE_DSYM: 00001 NODE_DSTR: 00001 NODE_STR "" len 0 00001 NODE_BEGIN: 00001 NODE_INT 2 base 10 00001 NODE_STR "" len 0 00001 value: 00001 NODE_INT 0 base 10 (snip) ```
2019-09-29Print missing `:` before newline in `mrb_parser_dump`KOBAYASHI Shuji
2019-09-29Escape the AST stringdearblue
2019-09-28Remove unused node type in `codegen()`KOBAYASHI Shuji
2019-09-28Replace `mrb_sym_name` with `mrb_sym_dump`; ref #4684Yukihiro "Matz" Matsumoto
2019-09-26Use type predicate macros instead of `mrb_type` if possibleKOBAYASHI Shuji
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for all `enum mrb_vtype`).
2019-09-25Rename symbol-to-string functions; close #4684Yukihiro "Matz" Matsumoto
* mrb_sym2name -> mrb_sym_name * mrb_sym2name_len -> mrb_sym_name_len * mrb_sym2str -> mrb_sym_str
2019-09-15Merge pull request #4512 from lopopolo/patch-1Yukihiro "Matz" Matsumoto
Support parsing a Regexp literal with 'o' option
2019-09-14Revert "Update `%pure-parser` to `%define api.pure` for newer `bison`; fix ↵Yukihiro "Matz" Matsumoto
#4706" The `bison` on MacOS does not support `%define api.pure`. This reverts commit f7c9f1f796d83b9316917681ea068ff648248425.
2019-09-14Update `%pure-parser` to `%define api.pure` for newer `bison`; fix #4706Yukihiro "Matz" Matsumoto
2019-08-31Skip `nil?` method call in `if` conditionals.Yukihiro "Matz" Matsumoto
Compile `if expr.nil?` to use `OP_JMPNIL` instead of calls.
2019-08-20Fixed a bug in the `OP_JMPNOT` optimization (13eaff4); fix #4644Yukihiro "Matz" Matsumoto
2019-08-19Merge pull request #4639 from dearblue/suppress-Wstringop-truncationYukihiro "Matz" Matsumoto
Suppress warnings for `strncat()`
2019-08-18Suppress warnings for `strncat()`dearblue
`strncat()` also needs `'\0'`.
2019-08-18Prohibit changes to iseq in principledearblue
2019-08-17Remove unnecessary `OP_JMPNOT` for `unless` statement.Yukihiro "Matz" Matsumoto
2019-08-16Avoid creating unnecessary empty arrays on splat.Yukihiro "Matz" Matsumoto
But this changes requires `OP_ARYCAT` and `OP_ARYPUSH` to accept `nil` as their first operand. Alternative VMs (e.g. `mruby/c`) that understand mruby bytecode need to be updated.
2019-08-12Remove unnecessary prototypes from 'keywords`; fix #4628Yukihiro "Matz" Matsumoto
2019-08-05Use new specifiers/modifiers of `mrb_vfromat()`KOBAYASHI Shuji
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in my environment than before the introduction of new specifiers/modifiers (5116789a) with this change. ------------+-------------------+-------------------+-------- BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO ------------+-------------------+-------------------+-------- mruby | 593416 bytes | 593208 bytes | -0.04% libmruby.a | 769048 bytes | 767264 bytes | -0.23% ------------+-------------------+-------------------+-------- BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613, so I put it back.
2019-07-27Fix line number bug; fix #4513Yukihiro "Matz" Matsumoto
Also fix the misfeature introduced in 23783a4, that ignores newlines between method chains.
2019-07-17Revert #4300KOBAYASHI Shuji
Originally, it was not necessary to change. I made mistake.
2019-07-15Unify type of line number to `uint16_t`KOBAYASHI Shuji
2019-06-17Support parsing a Regexp literal with 'o' optionRyan Lopopolo
CRuby supports a 'o' `Regexp` option for `Regexp` literals, e.g. `/foo/o` that disables multiple interpolation passes. This commit adds support for parsing such literals. Nothing is done with the option, it is consumed and ignored by the parser.
2019-06-17Fixed indentation in parse.yYukihiro "Matz" Matsumoto
2019-06-17Allow newlines and comments between method calls.Yukihiro "Matz" Matsumoto
2019-06-17Support `&.` at the beginning of the line.Yukihiro "Matz" Matsumoto
2019-06-17Fixed wrong behavior on `..` at the beginning of the line.Yukihiro "Matz" Matsumoto
2019-05-16Enable `YYSTACK_USE_ALLOCA`.Yukihiro "Matz" Matsumoto
It used heap allocated memory for the parser stack, but there's possibility of parser termination by exceptions. In that case, the parser stack memory is leaked. We were afraid of stack consumption, but parser stack size is only 4KB, so we don't have to worry about it (at least for the parser).
2019-05-15FixUkrainskiy Sergey
2019-05-15Small refactoringUkrainskiy Sergey
2019-05-15Initial suffix supportUkrainskiy Sergey
2019-05-03Clean duplicate codedearblue
Removed duplicates in the code entered for "Concatenate string literal".
2019-04-14Merge pull request #4376 from dearblue/leak-symbolsYukihiro "Matz" Matsumoto
Fix leaked function symbols
2019-04-14Fix leaked function symbolsdearblue
- `free_heap()` in src/gc.c - `symhash()` in src/symbol.c - `no_optimize()` in mrbgems/mruby-compiler/core/codegen.c
2019-04-14Fix string index for appendingdearblue
`sizeof(string-literal)` is included `'\0'` character
2019-04-14Fix hexdigits convertiondearblue
2019-04-12Deallocate `s->lines` in `codegen_error`; ref #4370Yukihiro "Matz" Matsumoto
2019-04-12The number of local variables should be less than 1024; fix #4370Yukihiro "Matz" Matsumoto
The `env` stores stack length in a 10 bit field. See `MRB_ENV_STACK_LEN()` macro.
2019-04-11Fix buffer overflows in parser.Clayton Smith
2019-04-10Rename `itoa` to `dump_int` to avoid name crash; ref #4173Yukihiro "Matz" Matsumoto
2019-04-08Avoid using `snprintf` when `MRB_DISABLE_STDIO` is set; fix #4173Yukihiro "Matz" Matsumoto