| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
Fix up 89cfc1520717257073012ec07105c551e4b8af7c.
|
|
https://bugs.ruby-lang.org/issues/20478
|
|
|
|
|
|
At least LLDB needs an actual variable not only casts to access the
type in debugger sessions.
|
|
|
|
|
|
|
|
Blocks and keywords are allowed in regular index.
Also update NEWS to make this more clear.
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
Recently, `TestRubyLiteral#test_float` fails randomly.
```
1) Error:
TestRubyLiteral#test_float:
ArgumentError: SyntaxError#path changed: "(eval at /home/chkbuild/chkbuild/tmp/build/20240527T050036Z/ruby/test/ruby/test_literal.rb:642)"->"(eval at /home/chkbuild/chkbuild/tmp/build/20240527T050036Z/ruby/test/ruby/test_literal.rb:642)"
```
https://rubyci.s3.amazonaws.com/s390x/ruby-master/log/20240527T050036Z.fail.html.gz
According to Launchable, the first failure was on Apr 30.
This is just when 528c4501f46fbe1e06028d673a777ef124d29829 was
committed. I don't know if the change is really the cause, but I want to
revert it once to see if the random failure disappears.
|
|
|
|
Since 140512d2225e6fd046ba1bdbcd1a27450f55c233, `else` without
`rescue` has been a syntax error.
|
|
I think this fixes the following random test failure that could not be
fixed for a long time:
```
1) Failure:
TestSymbol#test_inspect_under_gc_compact_stress [/home/chkbuild/chkbuild/tmp/build/20240522T003003Z/ruby/test/ruby/test_symbol.rb:126]:
<":testing"> expected but was
<":\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"">.
```
The value passed to this function is the return value of `rb_id2str`, so
it is never collected. However, if auto_compact is enabled, the string
may move and `RSTRING_PTR(str)` became invalid.
This change prevents the string from being moved by RB_GC_GUARD.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Prepare `lhs` as `$:$` before `assignable` and update it there.
Remove `ripper_assignable` which is no longer used.
|
|
Prepare `path` as `$:$` before `const_decl` and update it there.
Remove `ripper_const_decl` which is no longer used.
|
|
Now it is used only for wheter `opt_paren_args` is `none`. Introduce
a new special node to distinguish an empty parentheses from it .
|
|
|
|
|
|
Ripper DSL uses these values for callbacks, but does not need indexes.
|
|
|
|
|
|
|
|
* Add types to `tLAMBDA` and `tSTRING_DBEG` to store corresponding
information when returning these tokens.
* Add `enum lex_state_e state` to `%union` for `tSTRING_DBEG`.
|
|
In the past, these codes were used by both parser and ripper.
On ripper, the type of LHS is `<val>` then type cast was needed.
However currently these are only used by parser then no need to
cast.
|
|
|
|
|
|
|
|
of `VALUE`
This change reduces parser's dependency on ruby object.
|
|
|
|
|
|
rb_ast_dispose does not free the rb_ast_t causing it to be leaked. This
commit changes it to use rb_ast_free instead.
For example:
require "ripper"
10.times do
100_000.times do
Ripper.sexp("")
end
puts `ps -o rss= -p #{$$}`
end
Before:
27648
32512
37376
42240
47232
52224
57344
62208
67072
71936
After:
22784
22784
22784
22784
22912
22912
22912
22912
22912
22912
|
|
|
|
|
|
|
|
This reduces dependency on VALUE.
|
|
|
|
|
|
This patch adds `int line_count` field to `rb_ast_body_t` structure.
Instead, we no longer cast `script_lines` to Fixnum.
## Background
Ref https://github.com/ruby/ruby/pull/10618
In the PR above, we have decoupled IMEMO from `rb_ast_t`.
This means we could lift the five-words-restriction of the structure
that forced us to unionize `rb_ast_t *` and `FIXNUM` in one field.
## Relating refactor
- Remove the second parameter of `rb_ruby_ast_new()` function
## Attention
I will remove a code that assigns -1 to line_count, in `rb_binding_add_dynavars()`
of vm.c, because I don't think it is necessary.
But I will make another PR for this so that we can atomically revert
in case I was wrong (See the comment on the code)
|
|
Parser should not depend on functions defiend on "ruby_parser.c".
|
|
This patch removes the `VALUE flags` member from the `rb_ast_t` structure making `rb_ast_t` no longer an IMEMO object.
## Background
We are trying to make the Ruby parser generated from parse.y a universal parser that can be used by other implementations such as mruby.
To achieve this, it is necessary to exclude VALUE and IMEMO from parse.y, AST, and NODE.
## Summary (file by file)
- `rubyparser.h`
- Remove the `VALUE flags` member from `rb_ast_t`
- `ruby_parser.c` and `internal/ruby_parser.h`
- Use TypedData_Make_Struct VALUE which wraps `rb_ast_t` `in ast_alloc()` so that GC can manage it
- You can retrieve `rb_ast_t` from the VALUE by `rb_ruby_ast_data_get()`
- Change the return type of `rb_parser_compile_XXXX()` functions from `rb_ast_t *` to `VALUE`
- rb_ruby_ast_new() which internally `calls ast_alloc()` is to create VALUE vast outside ruby_parser.c
- `iseq.c` and `vm_core.h`
- Amend the first parameter of `rb_iseq_new_XXXX()` functions from `rb_ast_body_t *` to `VALUE`
- This keeps the VALUE of AST on the machine stack to prevent being removed by GC
- `ast.c`
- Almost all change is replacement `rb_ast_t *ast` with `VALUE vast` (sorry for the big diff)
- Fix `node_memsize()`
- Now it includes `rb_ast_local_table_link`, `tokens` and script_lines
- `compile.c`, `load.c`, `node.c`, `parse.y`, `proc.c`, `ruby.c`, `template/prelude.c.tmpl`, `vm.c` and `vm_eval.c`
- Follow-up due to the above changes
- `imemo.{c|h}`
- If an object with `imemo_ast` appears, considers it a bug
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
This function returned VALUE before. False made sense back then.
Now that it returns a pointer. NULL should be used instead.
|