[Misc #21143]
Conceptually this makes sense and is more consistent with using
the `Name = Class.new(Superclass)` alternative method.
However the new class is still named before `inherited` is called.
The forwarding instructions should use the `ec` parameter passed to
vm_exec_core instead of trying to look up the EC via `GET_EC()`. It's
cheaper to get the local than to try looking up a global
Moving object_id dumping from ObjectSpace to the GC flags allows ObjectSpace
to not assume the FL_SEEN_OBJ_ID flag and instead move it to the responsibility
of the GC.
I see `Array.include?` as 2.4% runtime. Probably because of `LPAREN_CONVERSION_TOKEN_TYPES` but
the others will be faster as well.
Also remove some inline array checks. They are specifically optimized in Ruby since 3.4, but for now prism is for >= 2.7
ca9500a3fc
Temoprary backwards-compat code so that current users
don't break.
Eventually the Translation::Parser initializer should asser that the correct class is passed in.
66b0162b35
In a large application I profiled allocations while running `bundle
update` and found that this method was ~60% of allocations while
resolving (and Candidate#<=> is almost half of the total runtime).
This commit removes the array allocation in Candidate#<=> (and similar
methods since the implementations are so simple). The array is always
the same two elements so they can just be compared directly.
6a7c411ba7
Previously, vm_make_env_each() (used during proc
creation and for the debug inspector C API) picked up the
non-GC-allocated iseq that rb_vm_push_frame_fname() creates,
which led to a SEGV when the GC tried to mark the non GC object.
Put a real iseq imemo instead. Speed should be about the same since
the old code also did a imemo allocation and a malloc allocation.
Real iseq allows ironing out the special-casing of dummy frames in
rb_execution_context_mark() and rb_execution_context_update(). A check
is added to RubyVM::ISeq#eval, though, to stop attempts to run dummy
iseqs.
[Bug #21180]
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Previously, live range of `ast_value` ended on the call right before
rb_ast_dispose(), which led to premature collection and use-after-free.
We observed this crashing on -O3, -DVM_CHECK_MODE, with GCC 11.4.0 on
Ubuntu.
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
The code between the two ObjectSpace.count_objects could trigger a GC,
which could free string objects causing this test to fail.
We can see this failure on CI http://ci.rvm.jp/results/trunk-random2@ruby-sp2-noble-docker/5651016
TestHashOnly#test_AREF_fstring_key [test/ruby/test_hash.rb:1991]:
<197483> expected but was
<129689>.
If a custom rubygems source URI is long enough, Bundler may end up
raising an `ENAMETOOLONG` error and crash.
This commit fixes the problem by trimming the cache slug size to fit
usual OS requirements.
df40ff1e14
Co-authored-by: mbclu <mbclu@users.noreply.github.com>
Co-authored-by: martinemde <martinemde@users.noreply.github.com>
This has the following benefits:
* Avoid duplicated work in some specs that first build a repo, and then
overwrite it with a completely different set of gems.
* Reduce RSpec nesting and improve readability.
* The change also made surfaces several specs that were incorrect since
they were unintentionally not testing the right thing.
ed430883e0
When a Launchable server is unstable, a ReadTimeoutException occurs in the Launchable CLI. In such case, the Launchable CLI retries requests, which slows down CI execution. In this PR, I configured the environment variable SKIP_TIMEOUT_RETRY to disable retry attempts on requests(Link: https://github.com/launchableinc/cli/pull/992).
```
WARNING:urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Read timed out. (read timeout=15)")': /intake/organizations/ruby/workspaces/ruby/commits/collect/options
WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Read timed out. (read timeout=15)")': /intake/organizations/ruby/workspaces/ruby/commits/collect/options
WARNING:urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Read timed out. (read timeout=15)")': /intake/organizations/ruby/workspaces/ruby/commits/collect/options
HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Max retries exceeded with url: /intake/organizations/ruby/workspaces/ruby/commits/collect/options (Caused by ReadTimeoutError("HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Read timed out. (read timeout=15)"))
Exception in thread "main" javax.net.ssl.SSLException: Connection reset
at sun.security.ssl.Alert.createSSLException(Alert.java:127)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:331)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:274)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:269)
at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1572)
at sun.security.ssl.SSLSocketImpl.access$400(SSLSocketImpl.java:73)
at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:982)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
at com.launchableinc.ingest.commits.CommitGraphCollector.transfer(CommitGraphCollector.java:131)
at com.launchableinc.ingest.commits.CommitIngester.run(CommitIngester.java:145)
at com.launchableinc.ingest.commits.CommitIngester.main(CommitIngester.java:72)
Suppressed: java.net.SocketException: Broken pipe (Write failed)
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:81)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:362)
... 25 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:210)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:464)
at sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:68)
at sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1350)
at sun.security.ssl.SSLSocketImpl.access$300(SSLSocketImpl.java:73)
at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:966)
... 20 more
Couldn't get commit history from `/github/workspace/src`. Do you run command root of git-controlled directory? If not, please set a directory use by --source option.
HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Read timed out. (read timeout=60)
Command '['java', '-jar', '/root/.local/pipx/venvs/launchable/lib/python3.10/site-packages/launchable/jar/exe_deploy.jar', 'ingest:commit', '-endpoint',
```
3793952924