Yukihiro "Matz" Matsumoto
d1909320d9
mruby-compiler: fixed a bug in string literal merge; fix #6491
2025-03-17 09:17:38 +09:00
Yukihiro "Matz" Matsumoto
eb455c19fe
mruby-compiler: prohibit singleton methods for literals
...
We have checked `def (literal).m` style but not `def literal.m` style.
In addition, `NODE_INT` check is newly added.
2025-03-14 23:28:42 +09:00
Yukihiro "Matz" Matsumoto
5bc00bf199
mruby-compiler: detect super without surrounding method; close #6271
2025-03-11 21:21:50 +09:00
Yukihiro "Matz" Matsumoto
111fe4b3be
mruby-compiler: generate OP_SSEND from Complex and Rational literals
2025-03-07 17:17:45 +09:00
Yukihiro "Matz" Matsumoto
37d3d34036
mruby-compiler: use OP_SSEND for backquote calls
2025-03-07 17:17:42 +09:00
Yukihiro "Matz" Matsumoto
4ea5510937
mruby-compiler (merge_op_string): fix #6477
...
If two merging strings are the same and registered at the bottom of the
pool, we should not remove the slot from the pool.
2025-03-07 17:17:37 +09:00
Yukihiro "Matz" Matsumoto
cb3b94346e
mruby-complier (gen_call): remove duplicate MRB_OPSYM_2(); #6471
2025-01-27 12:36:14 +09:00
Yukihiro "Matz" Matsumoto
69024d9a36
mruby-compiler (gen_call): operator optimization with self; close #6471
...
If the left operand is `self`, the previous (reverted) change disabled
optimization with operators. This is sort of a hack, but it works.
2025-01-26 23:14:19 +09:00
Yukihiro "Matz" Matsumoto
acddb3945b
mruby-compiler (gen_call): adjust spacing
2025-01-26 20:08:01 +09:00
Yukihiro "Matz" Matsumoto
6731d59f06
Revert "mruby-compiler (gen_call): use OP_SSEND for self.foo() calls"
...
This reverts commit 583aa985c8f3117a833a38f0d27753a090503f17; #6471
2025-01-26 19:52:01 +09:00
Yukihiro "Matz" Matsumoto
d7559253de
mruby-compiler: need to add proper type cast for C++
2024-12-28 11:39:22 +09:00
Yukihiro "Matz" Matsumoto
32d11d86ff
mruby-compiler (new_lit_str2): move declarations to the point needed
2024-12-26 09:58:01 +09:00
Yukihiro "Matz" Matsumoto
648495a4b3
mruby-compiler (mrb_prev_pc): remove unnecessary local variable
2024-12-25 12:40:33 +09:00
Yukihiro "Matz" Matsumoto
160935dc24
mruby-compiler (mrb_prev_pc): add assertion to ensure pc within iseq
2024-12-25 12:39:57 +09:00
Yukihiro "Matz" Matsumoto
dbcb5b5a6d
mruby-compiler (merge_pool_str): check whether merged string is in the pool
2024-12-25 12:39:34 +09:00
Yukihiro "Matz" Matsumoto
890a8362b6
mruby-compiler (new_lit_str2): fixed a bug in pool string equality check
2024-12-25 12:39:34 +09:00
Yukihiro "Matz" Matsumoto
6687bddba3
mruby-compiler (gen_addsub): merge 2 literal strings str + str
...
Unlike previous attempt, this change can merge sequence of plus
operations (e.g. `str + str + str`). Need more tests though.
2024-12-25 12:39:34 +09:00
Yukihiro "Matz" Matsumoto
b44372599e
mruby-compiler (codegen): combine literal str + str to one string
2024-12-25 12:39:34 +09:00
Yukihiro "Matz" Matsumoto
583aa985c8
mruby-compiler (gen_call): use OP_SSEND for self.foo() calls
2024-12-20 10:05:09 +09:00
Yukihiro "Matz" Matsumoto
18cc2cea41
mruby-compiler (codegen): loop info may be NULL (retry)
2024-12-17 10:41:23 +09:00
Yukihiro "Matz" Matsumoto
a77b9b4bab
mruby-compiler (codegen): loop info may be NULL (redo)
2024-12-17 10:41:23 +09:00
Yukihiro "Matz" Matsumoto
ac6436556b
Merge pull request #6440 from dearblue/redo
...
Fix `redo` keyword
2024-12-06 23:42:44 +09:00
Hoshiumi Arata
3034b0847a
codegen: fix NODE_NEGATE for bigints
2024-12-04 17:57:50 +09:00
Yukihiro "Matz" Matsumoto
77e08c9193
ops.h: rename OP_LOADI to OP_LOADI8
...
OP_LOADI stores an 8 bit integer to a register, so we renamed the
instruction name to describe the behavior more precisely, like
OP_LOADI16 and OP_LOADI32.
2024-12-01 19:16:54 +09:00
dearblue
9a67bdb6aa
Fix redo keyword
...
Add `OP_NOP` to distinguish `retry` and jump targets while maintaining instruction compatibility.
Ideally, it might be preferable to separate them into `OP_REDO`.
fixed #6439
2024-12-01 11:40:17 +09:00
dearblue
939659e2db
Allow redo from nested LOOP_BEGIN and LOOP_RESCUE
2024-12-01 11:34:10 +09:00
Yukihiro "Matz" Matsumoto
e05dbf7bbc
mruby-compiler (mrb_irep_remove_lv): remove the function altogether
...
Recent changes make mrb_irep_remove_lv() used no longer. Removing this
function would not make any compatibility issue, since it's an internal
function.
2024-11-29 17:09:44 +09:00
Yukihiro "Matz" Matsumoto
1e41c47ebf
Merge pull request #6429 from hoshiumiarata/fix_num_params_as_hash_key
2024-11-21 11:47:00 +09:00
Hoshiumi Arata
386cd771e7
Fix numbered parameters when used as hash keys
2024-11-20 00:31:44 +09:00
Hoshiumi Arata
d5823623ed
Change the limits of OP_ADDI and OP_SUBI from 0-127 to 0-255.
2024-11-19 23:36:22 +09:00
Yukihiro "Matz" Matsumoto
628f057482
Merge pull request #6419 from hoshiumiarata/fix_numparams_in_lambda
2024-11-15 16:17:03 +09:00
Hoshiumi Arata
9fe2a5c46a
parser: setup numbered parameters in new_lambda and adjust dump_prefix offset
2024-11-13 22:19:27 +09:00
Hoshiumi Arata
cc2ec53807
parser: support numbered parameters when used as a singleton
2024-11-13 00:22:49 +09:00
dearblue
ff9c03fde4
Put #include <stdlib.h> in parse.y
...
ref. #6388
2024-11-06 22:29:29 +09:00
Yukihiro "Matz" Matsumoto
49525fa207
mempool.c: renamed from pool.c
...
To avoid confusion with pools in irep, we renamed region-based memory
manager from pool to mempool.
- rename pool.c to mempool.c
- separate mempool.h
- rename all mrb_pool to mrb_mempool
So if someone is using pool.c functions (I suppose no one does though),
they need to rename all `mrb_pool` to `mrb_mempool` and include
`mruby/mempool.h` header at the top.
2024-10-31 14:06:10 +09:00
Yukihiro "Matz" Matsumoto
62ef5db13e
irep.h: rename mrb_pool_value to mrb_irep_pool
...
mrb_pool_value is a structure that represents a value in the irep
literal pool and is unrelated to mrb_pool, which performs region-based
memory management. It has been renamed mrb_irep_pool to avoid confusion.
2024-10-29 20:34:53 +09:00
Yukihiro "Matz" Matsumoto
b95ca53e5c
mruby-compiler: revert ce2fdb7; close #6388
...
The commit was to stop warnings from Visual C but unexpectedly caused
compilation errors on some configuration.
2024-10-22 14:46:12 +09:00
Yukihiro "Matz" Matsumoto
51fd065722
mruby-compiler (parser_yylex): skip sign if bigint starts with +
...
To reserve memory (1 byte) and avoid error (fixed by 11cff8f ).
2024-10-22 14:45:48 +09:00
Yukihiro "Matz" Matsumoto
06f45f8635
mruby-compiler (codegen): detect too-deep nesting error; fix #6270
2024-10-15 21:10:10 +09:00
Yukihiro "Matz" Matsumoto
e29f3d64b2
mruby-compiler: stop malloc/free warnings from Visual Studio build
2024-10-11 09:10:44 +09:00
Yukihiro "Matz" Matsumoto
9c5812a463
mruby-compier: keep stack reference to passed block after modifying &b
...
To mark `MRB_PROC_ORPHAN` we need to keep track of passed block, even
after the assignment to the block argument. And `yield` should use the
original block; #5786 , #5791 , #6369
2024-09-26 02:48:16 +09:00
leviongit
87801ed5f1
codegen.c,parse.y: remove flattening of yield arguments; fix #6346
...
this commit changes the parse tree of the `yield` node, allowing for
proper keyword argument generation
2024-09-09 10:06:31 +02:00
dearblue
cfe410f466
Must not depend on the “host” build to generate mruby-compiler/core/y.tab.c
...
“mruby-compiler” should be able to generate `y.tab.c` files through a separate build configuration if it is not added to the ‘host’ build.
In the example above, the “host/mrbc” build should generate the `y.tab.c` file.
2024-08-25 11:17:56 +09:00
Yukihiro "Matz" Matsumoto
56a82009aa
Revert "The lex_state after literals should be EXPR_ENDARG."; fix #6298
...
This reverts commit e98823f189 .
2024-08-10 19:17:49 +09:00
Yukihiro "Matz" Matsumoto
3141b9424c
mruby-compiler/y.tab.c: it will be generated by Lrama from parse.y
...
No longer need to bundle in the repository.
2024-06-10 15:34:16 +09:00
Yukihiro "Matz" Matsumoto
fbe21a0321
tools/lrama: bundle Lrama 0.6.9 (copied from CRuby source)
2024-06-10 14:26:26 +09:00
Yukihiro "Matz" Matsumoto
d6da2d4760
mruby-compiler: use @1 in parse.y to enable YYLTYPE
...
This change itself does nothing good, but it is a preparation for the
future Bison to Lrama migration. As of 0.6.9, Lrama has a compatibility
issue for grammar files without `@n`.
2024-06-10 08:23:36 +09:00
Yukihiro "Matz" Matsumoto
889af10090
mruby-compiler: prohibit dynamic assignment to constants; #3521
...
Along with some declaration adjustments to minimize `y.tab.c` diff.
2024-06-05 18:56:11 +09:00
Yukihiro "Matz" Matsumoto
87b358a342
Including header files in include/* by <>
2024-03-26 13:59:59 +09:00
Yukihiro "Matz" Matsumoto
a810b9bca8
mruby-compiler/codegen.c: stop too aggressive optimization; fix #6210
...
The old code assumes unary minus (`-@`) does not cause any side effect
(including errors). Considering the code like `-nil; nil`, the
assumption was too aggressive.
2024-03-19 13:38:05 +09:00