| Age | Commit message (Collapse) | Author |
|
The instructions for `PM_CLASS_VARIABLE_OR_WRITE_NODE` were incorrect as
they were missing a `putnil`, a `defined`, and a `branchunless`.
I verified this is fixed via the instructions and running the following:
`RUBY_ISEQ_DUMP_DEBUG=prism make test/csv/interface/test_read_write.rb`.
These new instructions can't go in the defined function because
`defined?(@@fop ||= 1)` should return "assignment" not "class variable".
Instructions before:
```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(30,11)>
0000 putnil ( 30)[Li]
0001 defined class variable, :@@foo, true
0005 branchunless 14
0007 getclassvariable :@@foo, <is:0>
0010 dup
0011 branchif 20
0013 pop
0014 putobject 1
0016 dup
0017 setclassvariable :@@foo, <is:0>
0020 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:29 (29,0)-(29,11)>
0000 getclassvariable :@@foo, <is:0> ( 29)[Li]
0003 dup
0004 branchif 13
0006 pop
0007 putobject 1
0009 dup
0010 setclassvariable :@@foo, <is:0>
0013 leave
```
Instructions after:
```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(30,11)>
0000 putnil ( 30)[Li]
0001 defined class variable, :@@foo, true
0005 branchunless 14
0007 getclassvariable :@@foo, <is:0>
0010 dup
0011 branchif 20
0013 pop
0014 putobject 1
0016 dup
0017 setclassvariable :@@foo, <is:0>
0020 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:29 (29,0)-(29,11)>
0000 putnil ( 29)[Li]
0001 defined class variable, :@@foo, true
0005 branchunless 14
0007 getclassvariable :@@foo, <is:0>
0010 dup
0011 branchif 20
0013 pop
0014 putobject 1
0016 dup
0017 setclassvariable :@@foo, <is:0>
0020 leave
```
Fixes ruby/prism#2064
|
|
This commit adjusts the local table size to be consistent regardless
of the number of anonymous locals.
|
|
The previous implementation was incorrect since it was just checking for all keys in assoc nodes to be static literals but the actual check is that all keys in assoc nodes must be symbol nodes.
This commit fixes that implementation, and, also, aliases the flag to `PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS` so that ruby/ruby can start using the new flag name.
I intend to later change the real flag name to `PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS` and remove the alias.
https://github.com/ruby/prism/commit/f5099c79ce
|
|
Benchmark:
```
require "benchmark"
puts(Benchmark.measure do
ary = 1_000_000.times.map { IO::Buffer.for("") }
10.times { GC.start(full_mark: false) }
end)
```
Before:
```
14.330119 0.051497 14.381616 ( 14.445106)
```
After:
```
7.481152 0.040166 7.521318 ( 7.535209)
```
|
|
|
|
This PR fixes two bugs when compiling optional keyword parameters:
- It moves keyword parameter compilation to STEP 5 in the parameters
sequence, where the rest of compilation happens. This is important
because keyword parameter compilation relies on the value of
body->param.keyword->bits_start which gets set in an earlier step
- It compiles array and hash values for keyword parameters, which
it didn't previously
|
|
Fix https://github.com/ruby/prism/pull/2073
https://github.com/ruby/prism/commit/0f747d9240
|
|
|
|
When passing the keyword splat to [], it cannot be mutable, because
mutating the keyword splat inside [] would result in changes to the
keyword splat passed to []=.
|
|
|
|
To match the versions that will be included in final ruby release.
https://github.com/rubygems/rubygems/commit/84394919fb
|
|
Previously, T_DATA and T_FILE objects did not have their instance
variables freed on exit which would be reported as a memory leak with
RUBY_FREE_ON_EXIT. This commit changes it to use obj_free which also
frees the generic instance variables.
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
|
|
|
|
For Ruby re-distributors, automatic user-install might be the right
default. Therefore printing warning about installing into user directory
is not always desirable. Let the default_user_install method be
customizable.
https://github.com/rubygems/rubygems/commit/2320dba544
|
|
This problem is quite specific to our dev environment, but I guess the
fix could be handy for other situations.
After merging a change to treat default gems as regular gems, I get this
when trying to run `rubocop` on our repo:
```
$ bin/rubocop --only Performance/RegexpMatch
Could not find json-2.6.3 in locally installed gems
Run `bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb` to install missing gems.
```
However, when running the suggested command, nothing changes and I still
get the same error:
```
$ bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb
Using ast 2.4.2
Using bundler 2.4.10
Using json 2.6.3
Using parallel 1.23.0
Using racc 1.7.1
Using parser 3.2.2.3
Using rainbow 3.1.1
Using regexp_parser 2.8.1
Using rexml 3.2.5
Using rubocop-ast 1.29.0
Using ruby-progressbar 1.13.0
Using unicode-display_width 2.4.2
Using rubocop 1.52.1
Using rubocop-performance 1.14.2
Bundle complete! 2 Gemfile dependencies, 14 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
$ bin/rubocop --only Performance/RegexpMatch
Could not find json-2.6.3 in locally installed gems
Run `bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb` to install missing gems.
```
The problem is that our `bin/rubocop` script uses the development
version of Bundler (which has the change causing the problem), but the
advice recommands the default version of Bundler, which does not yet
have the change.
This commit changes the advice to recommend to use the same version of
Bundler that run into the problem in the first place.
So in the above situation you now get:
```
$ bin/rubocop --only Performance/RegexpMatch
Could not find json-2.6.3 in locally installed gems
Run `/Users/deivid/code/rubygems/rubygems/bundler/exe/bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb` to install missing gems.
```
And running that fixes the problem:
```
$ /Users/deivid//rubygems/rubygems/bundler/exe/bundle install --gemfile /Users/deivid/code/rubygems/rubygems/tool/bundler/lint_gems.rb
Fetching gem metadata from https://rubygems.org/.........
Fetching json 2.6.3
Installing json 2.6.3 with native extensions
Bundle complete! 2 Gemfile dependencies, 14 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
```
https://github.com/rubygems/rubygems/commit/10a9588c6d
|
|
in RubyGems
https://github.com/rubygems/rubygems/commit/59a85388b9
|
|
https://github.com/rubygems/rubygems/commit/929b521f3a
|
|
https://github.com/rubygems/rubygems/commit/30db1eb4a5
|
|
https://github.com/rubygems/rubygems/commit/e015200ffa
|
|
https://github.com/rubygems/rubygems/commit/ffa2f03489
|
|
https://github.com/rubygems/rubygems/commit/1139e90931
|
|
https://github.com/rubygems/rubygems/commit/1d61c7686b
|
|
This reverts commit https://github.com/rubygems/rubygems/commit/091b4fcf2b99.
https://github.com/rubygems/rubygems/commit/dcade3235f
|
|
|
|
#20005]
This is a C API for extensions to resolve and get function symbols of other extensions.
Extensions can check the expected symbol is correctly loaded and accessible, and
use it if it is available.
Otherwise, extensions can raise their own error to guide users to setup their
environments correctly and what's missing.
|
|
The symbol resolved by dln_symbol will eventually be passed to
extensions. The error handling of dln_sym is also separated into
dln_sym_func because the new call resolving symbols will not raise
LoadError.
|
|
|
|
|
|
|
|
|
|
https://github.com/ruby/prism/commit/43c4232cfc
|
|
|
|
Match order of METADATA_LINK_KEYS to order used by rubygems.org in Links model.
Add missing download_uri key.
https://github.com/rubygems/rubygems/commit/d2922cd6e9
|
|
Co-authored-by: Matthew Draper <matthew@trebex.net>
|
|
nevinera/add-json-output-option-to-bundle-outdated"
This reverts commit https://github.com/rubygems/rubygems/commit/a4ac5116b8ea, reversing
changes made to https://github.com/rubygems/rubygems/commit/8a6b180d0ae5.
https://github.com/rubygems/rubygems/commit/a1efe4015d
|
|
|
|
Bootsnap modified full feature path to require. We can't handle it for
warning correctly.
|
|
this follows up 4e6861d3376eb7857d2b0a947c97b6fec8e5bf37
|
|
Improved performance / reduced allocations
https://github.com/rubygems/rubygems/commit/b04726c9a7
|
|
|
|
https://github.com/rubygems/rubygems/commit/34d6c6c72f
|
|
|
|
|
|
Since ruby trunk will be 3.4 very soon
https://github.com/rubygems/rubygems/commit/36dd9a35dc
|
|
I looked at this at RubyConf with Kevin, and we noticed that there was a
`putobject` empty string missing from the instructions. I just got back
around to implementing this and pushing a PR and while doing that
noticed that we also have a `getspecial` when we want a `getglobal`.
This change adds the `putobject` instruction and replaces the
`getspecial` with a `getglobal`. If we look at the parsetree for the
following code:
```ruby
$pit = '.oo'; if /"#{$pit}"/mix; end
```
We can see it has a `NODE_GVAR` and the [Ruby
compiler](https://github.com/ruby/ruby/blob/a4b43e92645e46ee5a8c9af42d3de57cd052e87c/compile.c#L10024-L10030) shows that should
use `getglobal.
```
@ NODE_SCOPE (id: 14, line: 1, location: (1,0)-(22,36))
+- nd_tbl: (empty)
+- nd_args:
| (null node)
+- nd_body:
@ NODE_BLOCK (id: 12, line: 22, location: (22,0)-(22,36))
+- nd_head (1):
| @ NODE_GASGN (id: 0, line: 22, location: (22,0)-(22,12))*
| +- nd_vid: :$pit
| +- nd_value:
| @ NODE_STR (id: 1, line: 22, location: (22,7)-(22,12))
| +- nd_lit: ".oo"
+- nd_head (2):
@ NODE_IF (id: 11, line: 22, location: (22,14)-(22,36))*
+- nd_cond:
| @ NODE_MATCH2 (id: 10, line: 22, location: (22,14)-(22,36))
| +- nd_recv:
| | @ NODE_DREGX (id: 2, line: 22, location: (22,17)-(22,31))
| | +- nd_lit: "\""
| | +- nd_next->nd_head:
| | | @ NODE_EVSTR (id: 4, line: 22, location: (22,19)-(22,26))
| | | +- nd_body:
| | | @ NODE_GVAR (id: 3, line: 22, location: (22,21)-(22,25))
| | | +- nd_vid: :$pit
| | +- nd_next->nd_next:
| | @ NODE_LIST (id: 7, line: 22, location: (22,26)-(22,27))
| | +- as.nd_alen: 1
| | +- nd_head:
| | | @ NODE_STR (id: 6, line: 22, location: (22,26)-(22,27))
| | | +- nd_lit: "\""
| | +- nd_next:
| | (null node)
| +- nd_value:
| @ NODE_GVAR (id: 9, line: 22, location: (22,14)-(22,36))
| +- nd_vid: :$_
+- nd_body:
| @ NODE_BEGIN (id: 8, line: 22, location: (22,32)-(22,32))
| +- nd_body:
| (null node)
+- nd_else:
(null node)
```
I'm struggling with writing a failing test, but the before/after
instructions show that `getglobal` is correct here. I compared the
instructions for the other `InterpolatedMatchLastLine` node tests
and they also used `getglobal`. I've edited the existing
`InterpolatedLastMatchLineNode` test so that it will use that instruction when
copied out of the test. Without the quotes it thinks it's just a
`MatchLastLineNode`.
Incorrect instructions:
```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(22,36)>
0000 putstring ".oo" ( 22)[Li]
0002 setglobal :$pit
0004 putobject "\""
0006 getglobal :$pit
0008 dup
0009 objtostring <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE>
0011 anytostring
0012 putobject "\""
0014 toregexp 7, 3
0017 getglobal :$_
0019 send <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil
0022 branchunless 30
0024 jump 26
0026 putnil
0027 jump 31
0029 pop
0030 putnil
0031 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:21 (21,0)-(21,36)>
0000 putstring ".oo" ( 21)[Li]
0002 setglobal :$pit
0004 putobject "\""
0006 getglobal :$pit
0008 dup
0009 objtostring <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE>
0011 anytostring
0012 putobject "\""
0014 toregexp 7, 3
0017 getspecial 0, 0
0020 send <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil
0023 branchunless 31
0025 jump 27
0027 putnil
0028 jump 32
0030 pop
0031 putnil
0032 leave
```
Fixed instructions:
```
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(22,36)>
0000 putstring ".oo" ( 22)[Li]
0002 setglobal :$pit
0004 putobject "\""
0006 getglobal :$pit
0008 dup
0009 objtostring <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE>
0011 anytostring
0012 putobject "\""
0014 toregexp 7, 3
0017 getglobal :$_
0019 send <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil
0022 branchunless 30
0024 jump 26
0026 putnil
0027 jump 31
0029 pop
0030 putnil
0031 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:21 (21,0)-(21,36)>
0000 putstring ".oo" ( 21)[Li]
0002 setglobal :$pit
0004 putobject "\""
0006 getglobal :$pit
0008 dup
0009 objtostring <calldata!mid:to_s, argc:0, FCALL|ARGS_SIMPLE>
0011 anytostring
0012 putobject "\""
0014 toregexp 7, 3
0017 getglobal :$_
0019 send <calldata!mid:=~, argc:1, ARGS_SIMPLE>, nil
0022 branchunless 30
0024 jump 26
0026 putnil
0027 jump 31
0029 pop
0030 putnil
0031 leave
```
|
|
../prism_compile.c: In function ‘pm_compile_node’:
../prism_compile.c:2330:20: warning: zero-length gnu_printf format string [-Wformat-zero-length]
2330 | rb_bug("");
| ^~
|
|
We use xfree on the other end, so we need to use a form of xmalloc here.
Co-authored-by: Matthew Draper <matthew@trebex.net>
|
|
Co-authored-by: Matthew Draper <matthew@trebex.net>
|
|
We didn't free the old ST before overwriting it which caused a leak.
Found with RUBY_FREE_ON_EXIT.
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
|
|
This test fails fairly frequently on MinGW:
https://github.com/ruby/ruby/actions/runs/7195712496/job/19598924253#step:11:168
https://github.com/ruby/ruby/actions/runs/7191246799/job/19585627182#step:11:168
and we aren't actively working on stabilizing tests for MinGW.
|