193 Commits

Author SHA1 Message Date
Lothar Scholz 06f90a3b45 Make source compilable with C++17
Changes applied:

- Removing "register" keyword
- Fixing const pointer to pointer assignments
- Adding type casts to rb_malloc calls
2017-12-23 01:10:43 +01:00
Yukihiro "Matz" Matsumoto 05129ab9b3 Check if destinations are too distant; fix #3900 fix #3901 2017-12-15 17:57:45 +09:00
Yukihiro "Matz" Matsumoto 7ae20e0785 Simplify MRB_WITHOUT_FLOAT condtion 2017-11-08 08:45:59 +09:00
YAMAMOTO Masaya 625f9f6fa3 Merge branch 'master' of github.com:mruby/mruby 2017-11-04 01:23:12 +09:00
Yukihiro "Matz" Matsumoto 93f5f22577 Heavily refactored how lexical scope links are implemented; fix #3821
Instead of `irep` links, we added a `upper` link to `struct RProc`.
To make a space for the `upper` link, we moved `target_class` reference.
If a `Proc` does not have `env`, `target_class` is saved in an `union`
shared with `env` (if a `Proc` has env, you can tell it by `MRB_PROC_ENV_P()).
Otherwise `target_class` is referenced from `env->c`. We removed links
in `env` as well.

This change removes 2 members from `mrb_irep` struct, thus saving 2
words per method/proc/block. This also fixes potential memory leaks
due to the circular references caused by a link from `mrb_irep`.
2017-10-28 00:29:30 +09:00
Yukihiro "Matz" Matsumoto 07cf7b16f3 Add some peephole optimizations 2017-10-28 00:29:30 +09:00
Yukihiro "Matz" Matsumoto e59ad60327 do/end blocks to work with rescue/ensure/else; CRuby2.5 2017-10-17 08:17:31 +09:00
Carlo Prelz af3d5d6c8a Correct a small error in parse.y, which causes the reading of unassigned memory (triggers an error when address sanitizer is active) 2017-10-12 09:54:02 +02:00
YAMAMOTO Masaya acdc2d1f24 Add MRB_WITHOUT_FLOAT 2017-10-11 17:58:11 +09:00
Nobuyoshi Nakada 82983330a3 Fix parse error on TRICK2013/yhara 2017-10-09 08:56:46 +09:00
Nobuyoshi Nakada 1c2a2827b3 Replace lvar_defined with local_var_p 2017-10-09 08:54:25 +09:00
Tomasz Dąbrowski 2e239a296e fix: mrbgems\mruby-compiler\core\parse.y(3455): warning C4244: 'function': conversion from 'intptr_t' to 'int', possible loss of data 2017-09-27 14:42:27 +02:00
Yukihiro "Matz" Matsumoto 381850280c The [] special method call should be able to take a block. 2017-09-25 20:44:50 +09:00
Yukihiro "Matz" Matsumoto e98823f189 The lex_state after literals should be EXPR_ENDARG. 2017-09-25 20:44:04 +09:00
Yukihiro "Matz" Matsumoto e01d35ef79 The symbols should not take brace blocks. 2017-09-25 20:22:36 +09:00
Yukihiro "Matz" Matsumoto 5760226e71 Remove temporary limitation of OP_EPOP.
After f68f5f6, the operand of `OP_EPOP` should have been `1`.
Now we have removed the limitation.
2017-09-12 12:41:02 +09:00
Yukihiro "Matz" Matsumoto 7f4b57bb20 Restrict OP_EPOP operand to 1; ref #3789 2017-09-05 21:11:41 +09:00
Yukihiro "Matz" Matsumoto 1260d3b68a Add `__ENCODING__' support.
`__ENCODING__' returns the current encoding name (string), unlike
CRuby that returns the encoding object.
2017-08-28 22:42:06 +09:00
Yukihiro "Matz" Matsumoto f1fa5bf1c6 Remove integer type mismatch warnings from parse.y. 2017-08-28 22:31:02 +09:00
Christopher Aue 3366894a40 Fixed register windows of OP_SENDs generated by NODE_{DREGX,REGX}; ref #3783 2017-08-23 18:16:05 +02:00
Christopher Aue 84d8ecc1d7 Fixed register windows of OP_SENDs generated by NODE_OP_ASGN; ref #3783 2017-08-23 18:15:44 +02:00
Christopher Aue 4aca9ef98e Refactored code around generation of OP_SEND in NODE_OP_ASGN 2017-08-23 18:15:38 +02:00
Christopher Aue 1221f7676e Fixed register windows of OP_SENDs generated by NODE_{FOR,SYMBOLS}; ref #3783 2017-08-23 18:15:27 +02:00
Christopher Aue c040c8d92b Tested register windows of OP_SENDs generated by NODE_{RESCUE,HASH,ALIAS}; ref #3783 2017-08-23 18:15:08 +02:00
Christopher Aue c6596cf26a Fixed register windows of OP_SENDs generated by NODE_{SCALL,CASE,YIELD,UNDEF}; ref #3783 2017-08-23 18:12:35 +02:00
Yukihiro "Matz" Matsumoto 0d865a77d5 c (mrbc_context) may be NULL; fix #3787 2017-08-22 09:47:10 +09:00
Yukihiro "Matz" Matsumoto 834523945e Replace stack pop() by push_n(2); pop_n(3); fix #3783
To calculate correct register windows size. The fix was suggested
by Christopher Aue.
2017-08-19 11:56:04 +09:00
Yukihiro "Matz" Matsumoto 8bf492f127 Reduce integer type mismatch warnings in VC. 2017-08-12 09:35:35 +09:00
Yukihiro "Matz" Matsumoto d077a5f0a6 scan_hex may be used to parse both unicode and hex escape.
The error checks for both usage should be separated; ref #3774
2017-08-11 14:25:02 +09:00
Yukihiro "Matz" Matsumoto 56d4e41d76 Fixed a wrong condition in scan_hex; fix #3774 2017-08-11 14:14:30 +09:00
Christopher Aue 2fadddcd20 Replaced tabs with spaces 2017-08-09 21:56:27 +02:00
Yukihiro "Matz" Matsumoto 8f62957888 Support break within rescue clauses; fix #3767 ref #3721 2017-08-09 12:25:20 +09:00
Yukihiro "Matz" Matsumoto 36dbfd9bda Change return type of scan_oct from int to int32_t. 2017-08-05 01:06:36 +09:00
Yukihiro "Matz" Matsumoto e86c252a99 Left shift of signed integers is undefined behavior in C; fix #3762 2017-08-05 01:06:36 +09:00
Yukihiro "Matz" Matsumoto 1fc9a3019d Initialize potentially uninitialized local variable. 2017-07-24 16:46:27 +09:00
Yukihiro "Matz" Matsumoto 7fa9321c18 while|until should have the value from break; fix #3735 2017-07-12 14:56:48 +09:00
Yukihiro "Matz" Matsumoto aee1476ebd Provide better way to check compile errors.
Now you can just call `mrb_load_*` functions then check
`context->parser_nerr > 0` if the return value is `undef`,
instead of calling `mrb_parse_*` functions independently.
ref #3248 #3331
2017-06-28 16:04:40 +09:00
Yukihiro "Matz" Matsumoto 15945e14b9 Revert "Make mrb_load_exec a static function."
This reverts commit 7944d9a6d4.
Because it voids #3248 and #3331. But we should add better way
to check whether compile errors occur without duplicated callings.
2017-06-28 16:00:59 +09:00
Yukihiro "Matz" Matsumoto d0717efda6 Should raise an exception if break called in ensure; fix #3721 2017-06-23 18:08:04 +09:00
Yukihiro "Matz" Matsumoto 7944d9a6d4 Make mrb_load_exec a static function. 2017-06-23 17:56:12 +09:00
Yukihiro "Matz" Matsumoto b9f771dc50 Handles exceptions from code generation phase; fix #3695 2017-06-07 13:29:08 +09:00
Yukihiro "Matz" Matsumoto fc7096f18a Limit recursion level of codegen(); fix #3690 2017-06-05 13:18:31 +09:00
Yukihiro "Matz" Matsumoto 7f417ade42 Revert "Update NODE_BLOCK check logic in void_expr_error."
This reverts commit 31e30686b0.
2017-06-02 13:31:03 +09:00
Yukihiro "Matz" Matsumoto 31e30686b0 Update NODE_BLOCK check logic in void_expr_error. 2017-06-02 13:01:29 +09:00
Yukihiro "Matz" Matsumoto 0f2f021330 Fixed a bug in void_expr_error. 2017-06-02 12:06:40 +09:00
Yukihiro "Matz" Matsumoto b59d244c0d Add more precise void expression checks; ref #3686 2017-06-02 11:53:26 +09:00
Yukihiro "Matz" Matsumoto a893877b0d Check for super using OP_ARGARY; fix #3678
It generates a wasted empty array for each `super` call though.
It should be fixed in the future, if possible.
2017-06-01 09:38:42 +09:00
Yukihiro "Matz" Matsumoto cbd4aae41c Mark the proc object representing top-level as an internal object; #3621 2017-05-29 14:13:17 +09:00
Yukihiro "Matz" Matsumoto 5e1a6a2cc2 Make gen_assignment() to support NODE_SCALL; ref #3658 2017-05-25 12:40:49 +09:00
Clayton Smith bf30b8e8bf Change return back to break in the default case. 2017-05-12 14:43:12 -04:00