summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler
AgeCommit message (Collapse)Author
2017-04-18Changed evaluation order of `yield`; ref #3613Yukihiro "Matz" Matsumoto
So that `yield expr_with_error` will cause the error from the argument rather than `LocalJumpError` when no block is given.
2017-04-13Fixed a bug in NODE_XSTR code generation; fix #3605Yukihiro "Matz" Matsumoto
2017-04-12Exceptions may be raised in yyparse(); fix #3600Yukihiro "Matz" Matsumoto
2017-04-11OP_LAMBDA generation should honor VAL/NOVAL; fix #3580Yukihiro "Matz" Matsumoto
2017-04-03Unify `else` clause styleYukihiro "Matz" Matsumoto
2017-04-03Adjust exit point in `loop_pop()`; fix #3541Yukihiro "Matz" Matsumoto
2017-04-03NODE_SPLAT to pass VAL/NOVAL; fix #3532Yukihiro "Matz" Matsumoto
2017-04-03Remove unnecessary indirection; ref #3557Yukihiro "Matz" Matsumoto
2017-04-03Check before generating special operators (e.g. OP_ADD); fix #3557Yukihiro "Matz" Matsumoto
2017-04-01NODE_ASGN arguments may be 127 (CALL_MAXARGS) accidentally; fix #3559Yukihiro "Matz" Matsumoto
2017-04-01Argument order of __case_eqq was wrong; fix #3567Yukihiro "Matz" Matsumoto
2017-03-23Use MRB_PRId for NODE_NTH_REF; ref #3530Yukihiro "Matz" Matsumoto
2017-03-23Cast to mrb_int to silence a warning; fix #3530Yukihiro "Matz" Matsumoto
2017-03-20Use `snprintf()` to stringify fixnum numbers; ref #3492Yukihiro "Matz" Matsumoto
2017-03-19Fixed OP_RESCUE code generation bug; fix #3519Yukihiro "Matz" Matsumoto
916b8e let code executed with mrb->exc set, and may cause a crash like #3519. Instead modified OP_RESCUE again. To retrieve the exception object, we use `OP_RESCUE R(A), 0, 0` (old behavior). To compare the exception object and the class, we use `OP_RESCUE R(A), R(B), 1`. The reason we use OP_RESCUE for two instruction switched by operand C is to save the instruction space. As a result, the following code: ```ruby begin raise "a" rescue TypeError p 1 rescue RuntimeError p 2 end ``` will be compiled as: ``` irep 0x55cd1f565cb0 nregs=4 nlocals=1 pools=1 syms=4 reps=0 file: - 2 000 OP_ONERR 005 2 001 OP_LOADSELF R1 2 002 OP_STRING R2 L(0) ; "a" 2 003 OP_SEND R1 :raise 1 2 004 OP_JMP 023 2 005 OP_RESCUE R1 3 006 OP_GETCONST R2 :TypeError 3 007 OP_RESCUE R1 R2 cont 3 008 OP_JMPIF R2 010 3 009 OP_JMP 014 4 010 OP_LOADSELF R1 4 011 OP_LOADI R2 1 4 012 OP_SEND R1 :p 1 4 013 OP_JMP 024 5 014 OP_GETCONST R2 :RuntimeError 5 015 OP_RESCUE R1 R2 cont 5 016 OP_JMPIF R2 018 5 017 OP_JMP 022 6 018 OP_LOADSELF R1 6 019 OP_LOADI R2 2 6 020 OP_SEND R1 :p 1 6 021 OP_JMP 024 6 022 OP_RAISE R1 6 023 OP_POPERR 1 6 024 OP_STOP ```
2017-03-12Generate new OP_RESCUE; fix #3487Yukihiro "Matz" Matsumoto
The old OP_RESCUE took one operand A, which specifies a class to match with the exception. The new OP_RESCUE takes tree operands: A: the register to hold exception B: the matching exception; the match result will be stored here. C: the continuation; if C is zero, the exception will be stored to R(A) otherwise, the value from R(A) is used as a exception. Thus, ```ruby begin raise "a" rescue TypeError p 1 rescue RuntimeError p 2 end ``` will be compiled as ``` irep 0x557a06667aa0 nregs=4 nlocals=1 pools=1 syms=4 reps=0 file: /tmp/e.rb 2 000 OP_ONERR 005 2 001 OP_LOADSELF R1 2 002 OP_STRING R2 L(0) ; "a" 2 003 OP_SEND R1 :raise 1 2 004 OP_JMP 022 3 005 OP_GETCONST R2 :TypeError 3 006 OP_RESCUE R1 R2 3 007 OP_JMPIF R2 009 3 008 OP_JMP 013 4 009 OP_LOADSELF R1 4 010 OP_LOADI R2 1 4 011 OP_SEND R1 :p 1 4 012 OP_JMP 023 5 013 OP_GETCONST R2 :RuntimeError 5 014 OP_RESCUE R1 R2 cont 5 015 OP_JMPIF R2 017 5 016 OP_JMP 021 6 017 OP_LOADSELF R1 6 018 OP_LOADI R2 2 6 019 OP_SEND R1 :p 1 6 020 OP_JMP 023 6 021 OP_RAISE R1 6 022 OP_POPERR 1 6 023 OP_STOP ``` The new VM can accept old OP_RESCUE. The mruby compatible VM (namely mruby/c) should be updated to support the new OP_RESCUE behavior.
2017-03-12Enhance OP_RESCUE to take B operand fas matching exception; ref #3487Yukihiro "Matz" Matsumoto
2017-03-11OP_RETRUN to take B as matching exception; ref #3487Yukihiro "Matz" Matsumoto
2017-03-07`__FILE__` should not update `p->filename`; fix #3485Yukihiro "Matz" Matsumoto
2017-03-02Fixed a bug in register size calculation; fix #3479Yukihiro "Matz" Matsumoto
2017-03-02Reorganize C++ exceptions; ref #3470Yukihiro "Matz" Matsumoto
There are 3 levels of C++ exception handling: * default - no C++ exception (use setjmp/longjmp) * enable_cxx_exception (use C++ exceptions with C ABI) * enable_cxx_abi (use C++ ABI including exceptions)
2017-03-01Keep space for safe navigation operator; fix #3475Yukihiro "Matz" Matsumoto
2017-03-01Newlines in strings should be counted; fix #3477Yukihiro "Matz" Matsumoto
2017-02-28Ignore empty ensure clause.Yukihiro "Matz" Matsumoto
2017-02-28`return` (and `break`) should handle splat correctly; fix #3472Yukihiro "Matz" Matsumoto
2017-02-28Fix NODE_DREGX dump; ref #3471Yukihiro "Matz" Matsumoto
2017-02-28Fixed a bug in dregex option generation; fix #3471Yukihiro "Matz" Matsumoto
2017-02-28Update codegen.c commentsYukihiro "Matz" Matsumoto
2017-02-24replace "yylval" with "pylval" to make it compile with byacc.Tomoyuki Sahara
2017-02-13Fixed codegen error of redo in rescue; fix #3422Yukihiro "Matz" Matsumoto
The issue (and the fix) was reported by https://hackerone.com/dgaletic
2017-02-06Check maximum number of formal arguments.Yukihiro "Matz" Matsumoto
http://hkdnet.hatenablog.com/entry/2017/02/06/080000 (Japanese)
2017-02-04Jump address should fit in 16 bits range; fix #3426Yukihiro "Matz" Matsumoto
2017-01-23Fix a double free problem in codegen.c; fix #3378Yukihiro "Matz" Matsumoto
This issue was first reported by https://hackerone.com/geeknik The fix was proposed by @titanous
2017-01-23Fix memory leak; ref #3378Yukihiro "Matz" Matsumoto
The fix was proposed by @titanous
2017-01-21Fix incorrect parsing of block parameters.Clayton Smith
2017-01-20Remove problematic optimization.Clayton Smith
2016-12-18NODE_NEGATE cdr may not be code-node; fix #3348 ref #3324Yukihiro "Matz" Matsumoto
Reported by Denis Kasak https://hackerone.com/dkasak
2016-12-18Zero length heredoc still crashed; ref Shopify/mruby-internal#81Yukihiro "Matz" Matsumoto
2016-12-14remove debug code; ref #3344Yukihiro "Matz" Matsumoto
2016-12-13tLABEL should not come after conditional ternary; fix #3344Yukihiro "Matz" Matsumoto
2016-12-13void_expr_error(): n may be NULL.Yukihiro "Matz" Matsumoto
Reported from @clayton-shopify.
2016-12-13Fixed wrong condition in new_sym() that breaks symbol data.Yukihiro "Matz" Matsumoto
2016-12-13Failed to realloc irep->syms in certain condition.Yukihiro "Matz" Matsumoto
Also msym size changed to 512 from 256.
2016-12-10Merge pull request #3324 from bouk/mruby/bouk-negateYukihiro "Matz" Matsumoto
Don't generate code for NODE_NEGATE if the result isn't used Reported by https://hackerone.com/haquaman
2016-12-10Clear parsing_heredoc at the end of fileYukihiro "Matz" Matsumoto
2016-12-09Fix segfault in gen_values with NOVAL and more than 127 argsBouke van der Bijl
2016-12-08Fix segfault when undef is called with exactly 127 argumentsBouke van der Bijl
The issue is that when there are more than 126 arguments an array needs to be created to pass the arguments on with. Reported by https://hackerone.com/revskills
2016-12-07Promote load_exec to mruby API as mrb_load_exec (fixes #3248)Tomasz Dąbrowski
2016-12-07Don't generate code for NODE_NEGATE if the result isn't usedBouke van der Bijl
Reported by https://hackerone.com/haquaman
2016-12-05Reorganize heredoc rules; fix #3273Yukihiro "Matz" Matsumoto
The following codes used to be SyntaxError: (1) a = <<-EOD; hello EOD (2) <<-EOD.bla begin k EOD end