Repository navigation
Conversation
IronRuby.Tests on Debug, the matrices in seven modes and the JIT matrices again on the fixed build, the probes, all five ruby/spec suites, the timing and start-up pass on 540bdb0, after the two fixes the gate made (havlak2's unlocked method-table reads, json's case dispatch of Symbol whens). AWFY is about 9% faster than master in both orders (Sieve 0.45, Json 0.92). Round 6's entries are marked gated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf72QWuzxr68CADMiwZ
…ironruby into HEAD # Conflicts: # Util/perf/LEDGER.md
…n split bytes, TracePoint attribute calls, float messages, source_location of core methods
…designs): a narrow literal's body keeps the light site; EndPark publishes with a release write # Conflicts: # Util/perf/LEDGER.md
# Conflicts: # Util/perf/LEDGER.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf72QWuzxr68CADMiwZ
…data; boot evals precompiled
…one per level of recursion # Conflicts: # Src/Ruby/Compiler/Ast/Definitions/MethodDefinition.cs # Src/Ruby/Runtime/RubyOps.cs # Util/perf/LEDGER.md
perf/iter2 recorded [BlockNotKept] on Integer#downto as rejected (Permute's instructions up, time level); perf/permute takes it with parked scopes for each level of a recursion and measures Permute at 0.933. A line under iter2's entry says so, so the two entries do not contradict each other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf72QWuzxr68CADMiwZ
# Conflicts: # Util/perf/LEDGER.md
…; an anonymous * read back for super # Conflicts: # Util/perf/LEDGER.md
…e/ensure and is_a? in typed bodies # Conflicts: # Util/perf/LEDGER.md
…n Hash on the one-value walk; Hash#any? Hash's own # Conflicts: # Util/perf/LEDGER.md
…; a body recompiled when a bound callee is # Conflicts: # Util/perf/LEDGER.md
…nnot see its $~ gives the matching methods its own match sink # Conflicts: # Src/Ruby/Compiler/Ast/Definitions/MethodDefinition.cs # Util/perf/LEDGER.md
…ack by an epoch move that changed nothing it was built on is kept # Conflicts: # Util/perf/LEDGER.md
…perf/kwsplatlight # Conflicts: # Src/Ruby/Runtime/Calls/RubyCallAction.cs # Src/Ruby/Runtime/Calls/RubyCallSignature.cs # Util/perf/LEDGER.md
… as measured The implementation perf/intivar measured; the next commit takes the runtime part out again (see Util/perf/LEDGER.md, Rejected, perf/intivar). It is kept in the history as the starting point for a later attempt. An Integer the method JIT holds as an int or a long goes into an IntLocation (a long and a cached box) in the raw shapes Float locations already use: SetIVarLong and WriteAttrLong store it, GetIVarInt/GetIVarLong and ReadSelfAttrInt/ReadSelfAttrLong read it without a box and deopt where GuardInt/GuardLong would, ValueOf boxes it for everything else. A typed store over an Int32 or Int64 promotes the object (its class's later instances are born raw) unless the value is one the small-integer cache boxes; a raw write of such a value stores the cached box. A Bignum is never in a location. RubyClass.FloatsRaw becomes BornRaw. The generic @x read and the JIT's GetIVar try a raw object's cached read inline before going out of line, as the attr_reader dispatcher already did. Util/ivar-matrix.rb and Util/jit-matrix.rb (section 21) get Integer rows: read back across the cache, Int32, Int64 and Bignum ranges, type changes, identity and hash, YAML, Marshal, inspect, instance_variable_get/set, remove, freeze, dup/clone, Ractor.make_shareable, binding, a subclass with more variables, promotion with plain and born-raw objects at one site, the raw tree's growth and removal, too complex, and two threads; Util/ivar-stress.rb's promotion part gets typed Integer updates. Util/bench/intivar-shapes.rb times the shapes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf3ugNj2V7fGRBP5ScY
…ejected perf/intivar (58013a9) stored an Integer the method JIT holds as an int or a long in an IntLocation, as Float instance variables are stored. It saved the 24-byte box of a typed write past the small-integer cache (a counter 0.91, an attr write 0.89, Random#next 0.93 by clock, alloc.rb Json -17%), but AWFY's Bounce, whose class becomes born raw, ran 31% slower over ten alternating rounds (36,702 -> 48,136 us, no overlap), a generic read of a raw object 14% slower, and no AWFY benchmark faster. Most of AWFY's Integer ivar writes are not in typed code at all (methods the JIT refuses, writes in loops neither tier compiles, writes that are the method's value). The runtime goes back to the base; the matrix rows (ivar-matrix, jit-matrix section 21), the stress part and Util/bench/intivar-shapes.rb stay for the next attempt, their comments pointing at 58013a9. Both matrices print CRuby's output on the base. The ledger entry (Rejected, perf/intivar) has the measurements, why it lost, and what would make it pay; gap 2 and perf/permute's entry point at it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf3ugNj2V7fGRBP5ScY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf3ugNj2V7fGRBP5ScY
… the tree is
Forwardable's delegators put the location that defined them into their text (the
warning about forwarding to a private method), so 36 of the 56 evals reline makes
name the tree's root: they were recorded with the tree startup-files.rb ran in, and
only that tree's runs claimed them. The release image (and every build from another
checkout) compiled them from text, and so did perf/bootparse's own base in another
worktree.
startup-files.rb now writes the tree's root in a text as ${ROOT}, as it already did
in the path; IronRuby.Aot puts the tree it compiles for in its place, and
PrecompiledCode.HashEvalCode hashes a text with the tree's root (the compiled-for
root ahead of time, the tree the library runs from at run time) as RootMarker. The
compiled code's frozen strings that name the tree are rebased like its other strings
(PrecompiledCode.Rooted), so the warning names the tree the code runs in. An eval
that would still tie the library to its tree (a symbol naming it) is left out rather
than making the whole library unusable in a moved tree.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf3UZ2No6CbZeXnCbPA
LambdaDefinition (`->(x) { }') kept 73 methods out of light frames, for no
reason but that IsScopeFree had no case for it. A lambda literal is a literal
block made into a lambda over the scope variable, which a light frame with
literal blocks makes on demand when the literal runs; its return, next and
break leave the lambda (its own LambdaUnwinder filter), and its arity is its
own.
Letting every literal in was measured first (Util/bench/lambda-shapes.rb,
callgrind): a lambda made on no call 0.840, on one call in eight 0.901, but on
every call 1.042 and returned 1.033 - the scope is made either way, later.
So only a method none of whose lambda literals is on the path every call takes
(HasUnconditionalLambda: not in a statement, condition, loop body, case value
or the left of &&/||/||=) is let in. IR_LIGHT_LAMBDA=0 turns it off.
Census +19 light frames, none lost; 47 stay out as "made on every call".
Checked with the new Util/light-lambda-matrix.rb plus light-entry, hot-shapes,
block-pass and jit in the gate's modes and with the switch off; specs
language/lambda, core/proc, core/kernel/lambda; new test
Method_LightFrameLambda1 and 164 named IronRuby.Tests pass both ways.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf6g69LY1MArBPyLTVu
String(5), String(nil) and String(:sym) took about 1 us against CRuby's
120-210 ns. Everything that was not a String went to the prelude's
__ir_string__, which asks what MRI's rb_check_funcall asks the long way
round: #respond_to?(:to_str), method(:respond_to?).owner (a Method object
per call), Kernel#respond_to? through bind_call, then #to_s through
__send__.
__ir_plain_to_s__ (KernelOps) answers what rb_String does in C for an
object whose class has no #to_str in any visibility, the built-in
#respond_to? and #respond_to_missing?, BasicObject's #method_missing and a
public #to_s: rb_check_string_type then finds nothing to call, and
rb_convert_type calls #to_s. The class's answer is kept per class against
the global method version, as IListOps.IsBuiltinMethod's is; #to_s is
called through a call site, so a class's own #to_s, a redefined
Integer#to_s and a singleton #to_s are what is called, and, as in MRI, no
refinement is seen. A #to_s that gives something other than a String is
the TypeError rb_convert_type raises; anything else answers nil and goes to
__ir_string__ unchanged, nothing called yet. IR_PLAIN_TO_S=0 turns it off.
The message for a #to_s or #to_str that gives nil, true or false now names
its class, as MRI's conversion_mismatch does: "can't convert X to String
(X#to_s gives NilClass)", where it said "gives nil" - in both paths.
Clock (Util/perf/ab.rb, four rounds, ns, CRuby / unchanged / this):
String(5) 181 / 1036 / 147, String(nil) 124 / 912 / 119, String(:sym)
213 / 1048 / 151, String(1.5) 380 / 1199 / 300, String("a") 41 / 104 /
99. Two rows are new in core-small.rb.
Util/kernel-string-matrix.rb (new: Strings and their subclasses, nil,
true, false, Integers, Bignums, Floats, NaN, Symbols, Rationals, Arrays,
Hashes, Structs, classes, main; to_str first, to_str nil then to_s,
to_str and to_s giving an Integer, nil, true, false, a Symbol or a String
subclass; private and protected to_str and to_s, no to_s, respond_to?
saying no or yes, respond_to_missing?, method_missing, to_s raising and
called once, anonymous classes, singleton to_s and to_str; BasicObjects;
Integer#to_s, NilClass#to_s and TrueClass#to_s redefined, Symbol#to_str
defined, Float#respond_to? and Integer#method_missing defined, to_str,
private to_s and a module added after a first call; Kernel.String,
method(:String), arity, threads, backtrace; refined to_s): five lines move
to CRuby's output (the messages) and none away; the four left (a private
to_str and a method_missing for to_str, which MRI calls; Rational's,
Complex's and main's #to_s encodings) are as before. The same by
default, IR_PLAIN_TO_S=0, IR_LIGHT_FRAMES=0, -X:NoJIT -X:NoOSR,
-X:NoJITCalls and R2R. numeric-conversion, coerce, io-conversion,
string-methods, caller and hot-shapes print what they did in those
modes, callable-parameters too but for a prelude line number. ruby/spec
core/kernel (String_spec, Integer_spec and Float_spec among its 118
files): the same examples on both builds. IronRuby.Tests: the 36 tests
that call String() or check conversion messages pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf5ABnT4ogE8wHNcyDK
… done Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf5ABnT4ogE8wHNcyDK
…ironruby into gate-base8 # Conflicts: # Util/perf/LEDGER.md
__ir_string__ asked object.respond_to?(:to_str) and called #to_str
publicly, so String() of an object with a private or protected #to_str, or
with a #method_missing that answers to_str, went straight to #to_s; and a
private #respond_to? of the object's own was a NoMethodError. MRI's
rb_check_string_type asks rb_check_funcall: a #respond_to? of the object's
own is called whatever its visibility (with priv = true) and vetoes the
call; otherwise #to_str in any visibility is called; otherwise a
#method_missing of the object's own is tried (check_funcall_missing), and
any NoMethodError it raises means "no conversion" unless the object answers
#to_str by then (check_funcall_failed).
__ir_check_to_str__ asks in that order. The #to_s step had the same two
faults: its custom #respond_to? is now called with __send__, and its
NoMethodError rescue follows check_funcall_failed instead of reading
e.receiver, which a NoMethodError made without one cannot answer ("no
receiver is available").
Util/kernel-string-matrix.rb gains thirteen probes (method_missing
raising NoMethodError for to_str, for another name, an ArgumentError,
answering nil or an Integer; private respond_to?; protected to_str; the
same for #to_s); ten lines move to CRuby 4.0's output and none away, by
default and with IR_PLAIN_TO_S=0. What is left (Rational's, Complex's and
main's #to_s encodings) is not String()'s. IronRuby.Tests
Kernel_StringCheckFuncall1 (new) has CRuby 4.0's output.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf5ABnT4ogE8wHNcyDK
…d and rejected The census counts of `MethodCall each' (716 first, 567 alone) and `map' (402, 301) are the screen's first refusal; it never walks the block. Walking the block as a while body moved 2 methods off `never'; letting the block's own locals in too, 87 of 28,377, all to `maybe', none to `compiles'. AWFY's hot iteration is SOM's own Vector#each and each_index; app-shapes changed 2 of 922 methods. The emitter was not written; the code is not kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf6g69LY1MArBPyLTVu
MRI reports each call at its own line - that of its name, for a chained
`.m` on the next line - in a backtrace, caller, binding and an eval's
default file name ("(eval at f.rb:42)"). IronRuby kept a line per
statement, so a call on a later line of a statement that spans lines
reported the statement's first line: [1,\n eval('__FILE__')].last named
line 41, and so did caller from such a call, a raise inside it, and
the outer call of a nested call on another line.
The bridge now gives a call node the line of its name (prism's
message_loc), and the generator tracks the line the frame is at while
it transforms (ScopeBuilder.CurrentLine: a statement's, set before its
children; the definition's at a method's or block's start; unknown
after a statement nested in an expression). A MethodCall whose line
differs from a known current line is wrapped in a sequence point and
SourceLineMarker for its line before it and for the current line after
it (AstGenerator.AddCallLine), so the call it is an argument of reports
its own line again. A statement on one line has no such call and gets
nothing; nor does a call where the line is unknown. The interpreter maps
instructions to sequence points and pays nothing at run time; compiled
code stores the line in its frame record, in multi-line statements
only. The method JIT and the light frames report the right lines with
it (checked hot and with -X:NoJIT and IR_LIGHT_FRAMES=0).
IR_CALL_LINES=0 turns it off.
Measured by clock against the same merge without the change (ab.rb -r
8, base / new / IR_CALL_LINES=0): frame-cost new/base 0.93-1.09 on
every shape, app-shapes json_parse, invoice_build, render, rules,
query_aggregate, set, time and pp within 0.96-1.06, the rest
(optparse, erb_result, uri, csv_parse, spreads of 70-450% on a loaded
machine) overlapping - level within the noise.
Backtrace_CallLine1 holds CRuby's output (arguments, chains with the
name on a later line, `.` at the end of a line, &., nested calls,
blocks, default arguments, a raise, TracePoint :line events unchanged).
All matrices, jit and nojit, against the same merge: caller-matrix's
eval row now agrees with CRuby 4.0; nothing else moved (string-race,
a race of threads without a GVL, differs from run to run).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf6ogoTAvVP9SXaSH7L
`Struct.new(:x, :y).new(1, h)', h marked by Hash.ruby2_keywords_hash, stored a
copy of h in CRuby's place of h itself. A Hash among the values sends
Struct#initialize to the prelude's __struct_initialize_slow__, whose
`__struct_initialize__(*args)' is a Ruby splat without `**' and so made the
marked hash keywords again (RubyCallFlags.HasRuby2KeywordsSplat) - a copy.
MRI's C rb_struct_initialize_m stores the values as they came.
The slow path's three stores splat with `**nil', which passes nothing and
keeps the list as it is.
Checked: new IronRuby.Tests Struct_Ruby2KeywordsHash1 with CRuby 4.0's output
(plain, splatted with `**{}', fewer values than members, keyword_init, a
re-initialize); core/struct specs and the struct matrices as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf51pjcdT3614WLaYSx
…ironruby into claude/cruby-test
Process.clock_getres(:TIMES_BASED_CLOCK_MONOTONIC, :hertz) raised "unexpected unit: hertz". MRI's clock_getres takes :hertz - and only it, not clock_gettime - and answers the clock's ticks per second as a Float (timetick2dblnum_reciprocal): 100.0 for the times()-based clocks. The prelude's clock_getres now does, from the resolution it reports, which is one over a whole number of ticks for every clock it has. CRuby's TestProcess#test_clock_getres_TIMES_BASED_CLOCK_MONOTONIC, _TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID and _CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID pass now; ruby/spec's core/process/clock_getres_spec passes on both builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
Marshal.dump($?) raised "no _dump_data is defined for class Process::Status", and Process::Status.allocate "allocator undefined". MRI marshals a status through rb_marshal_define_compat: an 'o' record of Process::Status holding the wait status and the pid as "status" and "pid" (process_status_dump), read back into a status equal to the first (process_status_load); Process::Status.allocate makes one with pid 0, which inspects as "#<Process::Status: uninitialized>" and dumps with neither. Marshal now writes and reads that record, and Status has a public constructor for allocate. CRuby's TestProcess#test_status, #test_status_kill and #test_pst_inspect pass now. ruby/spec's core/marshal and core/process/status pass on both builds; the marshal matrix is unchanged in every mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
IO.popen("foofoo=barbar env") raised Errno::ENOENT for a program named
"foofoo=barbar": a one-string command went to the shell only for a shell
metacharacter or a built-in. MRI's rb_exec_fillarg also counts an "=" in
the first word, ahead of any "/" (after which it is part of a path), as
an assignment preceding the command name, which only a shell can run.
The prelude's __spawn_command__ now does the same, off Windows.
CRuby's TestProcess#test_sh_env passes now. ruby/spec's core/process
spawn and exec, core/kernel system and backtick and core/io/popen specs
are unchanged (all pass on both builds); the spawn matrix is unchanged
in every mode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
Process::UID.re_exchangeable? was undefined, and sid_available? said
false on Linux. MRI answers both from what the platform has: setreuid or
setresuid for re_exchangeable?, setresuid or _POSIX_SAVED_IDS for
sid_available? - true on every Unix IronRuby runs on, false on Windows -
and from_name looks a user or group name up ("can't find user for x"),
taking an Integer as the id itself. The prelude's UID and GID modules
now have all three, the same on both modules. The privilege-changing
methods (change_privilege, grant_privilege, re_exchange, switch) are
still missing.
CRuby's TestProcess#test_uid_re_exchangeable_p and
#test_gid_re_exchangeable_p pass now; ruby/spec's core/process uid and
gid specs pass on both builds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
test_process and test_marshal re-swept after the round's fixes: 6,706 tests passing (from 6,694), one file without a summary (test_iseq), as before. test_process counts two more tests, the ones it runs only where Process::UID.sid_available? is true. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
Two places where round 12 and this branch's befd3a1 and 91b84a7 meet: - Array#sum. Round 12's Integer front loop in __array_sum__ (perf/yieldloop3, run by the OSR copy) adds with a plain `acc + x`. It is now entered only while Integer#+ and Rational#+ are the built-in ones (__builtin_exact_plus__?, asked once a call). Otherwise the loop below adds Integers and Rationals with __exact_add__, so a redefined Integer#+ is called in neither loop, as in MRI's rb_ary_sum. The front loop is still specialized (IR_OSR_VERBOSE: ruby4.rb:1494, no deopts). sum_blk, hash_sum and sum_blk_init are level with 4fce2e3 (ab.rb, 8 rounds, all within the spread). - defined?(@x) in the method JIT (perf/jitdefined). The bridge no longer writes `defined?(@x).freeze`, so the value form is the bare IsDefinedExpression. EmitDefinedInstanceVariable now makes the String the generic body makes: the deduplicated frozen US-ASCII literal (StringLiteral.TransformFrozen), with no #freeze call. That retires the `.freeze` form (IsFrozenDefinedInstanceVariable) and its guard on String#freeze and NilClass#freeze. C#a still specializes (IR_JIT_VERBOSE), and a redefined String#freeze is not called. jit-defined-matrix, array-sum-matrix (its redefined Integer#+ rows included) and yield-loop-matrix match CRuby in all six gate modes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf6ogoTAvVP9SXaSH7L
`@@x` and `@@x = v` kept 44 methods out of the method JIT on their own (197 census rows name them). A read now goes through JitRuntime.ClassVariableRead and a write through ClassVariableWrite, starting from the module the generic body would start from (GetInnerMostModuleForClassVariableAccess on the compile-time scope, so singleton classes are passed over as CRuby does). Both use the interpreter's lookup, split in RubyModule into a no-raise form, and deopt before any effect where the generic body would raise or act differently: a variable not found, one overtaken by a superclass's, a write to a frozen class or dummy singleton, and anything once Ractors have started. define_method bodies, outlined loops, `@@x ||=` and `@@x op= v` stay refused. Switch: IR_JIT_CLASS_VARIABLES=0. Census: 57 methods up, none down. app-shapes: 3 more specialized. Clock (cvar-shapes.rb): a read 133.9 -> 108.0 ns. Util/jit-cvar-matrix.rb (new, 23 rows) and jit, jit-calls, jit-const, jit-objops, jit-defined, hot-shapes print CRuby 4.0's output in all five modes and with the switch off; ruby/spec class variable specs pass; IronRuby.Tests passes. CRuby 4.0.10 segfaults reading a class variable after remove_class_variable, so the matrix has no row for that read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf7SFyMuNS8hE1vrTP2
klass.const_get("Foo::Bar") with a const_missing on klass that answers
klass called it for Foo and then raised NameError for Bar, and
c2.const_get("Bar", false) never reached the const_missing c2 inherits
from c1. Module#const_get called Module#const_missing's own body for a
segment it looked for without the inherited lookup (a later segment of a
path, or inherit = false) instead of sending const_missing to the module,
as MRI's rb_const_get_0 does with rb_funcall for every segment. It now
sends it through RubyModule.ConstantMissing, which the first segment's
lookup already used (and which is public for that).
CRuby's TestModule#test_nested_get_const_missing and
#test_const_get_evaled pass now. ruby/spec's core/module const_get,
const_missing and const_defined specs and language/constants_spec pass
on both builds; the delegate, error-message, jit-const, lexical-light and
loop-const matrices are unchanged in every mode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
…R's open
A rescued File.open("/nonexistent/zz") cost 56 us against CRuby's 3.4:
the FileStream threw DirectoryNotFoundException, the CLR's frames threw
it again, and only then was the Errno thrown. For a read-only open on
the operating system's own file system, faccessat(AT_FDCWD, full path,
F_OK, AT_EACCESS) resolves the path as open(2) does with the effective
ids; ENOENT or ENOTDIR from it is what the open would say, and the same
Errno, with the same message, is thrown at once. Anything else (the
file is there, EACCES, ELOOP, ENAMETOOLONG) goes on to the open as
before. IR_NATIVE_MISSING=0 restores the old code; other platforms keep
it.
A missing file 55.9 -> 37.3 us, ENOTDIR 55.8 -> 38.3; an open that
succeeds and File.read are level. What is left is that every Errno C#
throws is replaced by the prelude's SystemCallError.new, which takes the
whole trace at once.
Util/file-missing-matrix.rb (new) is the same with the switch on and
off and on the base build; EACCES under an unsearchable directory, run
as nobody, is unchanged and matches CRuby. ruby/spec file, io, dir,
Kernel#open and pathname are the same on both builds; IronRuby.Tests on
Debug passed; the census is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf79d6kw7Ccmpbk4Muq
ARGF.seek(4) before anything had been read raised "no stream to seek", and so did pos, pos= and rewind, where CRuby seeks in the first file. MRI calls next_argv before each of them: it opens the first file, or the next one when the current file has been read to its end, and only once every file is read says there is no stream. ARGF now does the same through prepare_current, which the partial reads already use; pos= says "no stream to set position", as MRI does, not "no stream to tell". CRuby's TestArgf#test_seek, #test_set_pos, #test_rewind and #test_tell pass now; ruby/spec's core/argf passes on both builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
ARGF.read(0, +"") after the last line of the last file had been read answered nil. MRI's argf_read returns its str when next_argv finds no stream: the buffer it was given, emptied, or nil without one. ARGF#read now answers the buffer in both of its branches (with and without a length). CRuby's TestArgf#test_read3 passes now; ruby/spec's core/argf, the Kernel#gets and #readlines specs and language/predefined_spec pass on both builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
ARGV[0] = nil; gets raised Errno::ENOENT for a file named "": ARGF made
the name with String(), which turns nil into "" and 1 into "1". MRI's
next_argv takes it with FilePathValue - #to_path, then a String or what
#to_str makes one - and anything else is a TypeError ("no implicit
conversion of nil into String"). ARGF now does the same.
CRuby's TestArgf#test_wrong_type passes now; ruby/spec's core/argf, the
Kernel#gets and #readlines specs and language/predefined_spec pass on
both builds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
test_module and test_argf re-swept after the round's fixes: 6,714 tests passing (from 6,706), one file without a summary (test_iseq), as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
A class variable defined both in a class and in a module prepended to it is "overtaken", and the error names the nearer one as overtaken by the further one. IronRuby walked #ancestors order, where the prepended module comes first, so it said "@@A of P1 is overtaken by A1" where CRuby 4.0 says "@@A of A1 is overtaken by P1". CRuby's CVAR_LOOKUP walks the superclass chain: the class itself, then the iclasses of its prepended modules, its origin skipped, then its mixins, and an included module that has prepends of its own comes before them the same way. TryResolveClassVariableNoRaise now walks in that order: per class in the superclass chain (or the module itself), the module, its prepends, its mixins, and within a list of mixins or prepends a module ahead of its own prepends. Which variable wins (the one furthest up) and where a write goes are unchanged where nothing is overtaken. The interpreter, class_variable_get/set and the method JIT share the lookup. Checked: a prepend of the class, of a superclass, of an included module, two prepends, a variable only in the prepend and a write to it print CRuby's output (new section of Util/jit-cvar-matrix.rb, read hot, in every mode). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf7SFyMuNS8hE1vrTP2
# shareable_constant_value: literal (or experimental_everything, # experimental_copy) changed nothing: prism wraps each constant write in # its scope in a ShareableConstantNode carrying the mode, and the bridge # unwrapped it. MRI's pm_compile_shareable_constant_value builds the # value written: a literal (scalars, strings, arrays and hashes of them) # deep-frozen whatever the mode; otherwise an array or hash built from its # elements, each treated the same way, and the whole made shareable; any # other value made shareable (a shareable copy, for experimental_copy) # when it is the whole value, and under literal checked to be shareable # already wherever it is, raising Ractor::IsolationError "cannot assign # unshareable object to B::C" (with "::C" for a path from the top and # "...::C" for one whose parent is no constant). The bridge now builds the # same, through two Kernel helpers standing in for RubyVM::FrozenCore's # make_shareable(_copy) and ensure_shareable, for plain, path, ||=, &&= # and operator writes. CRuby's TestParse#test_shareable_constant_value_simple, _literal_const_refs, _nested, _hash_with_keyword_splat, _unshareable_literal, _nonliteral, _literal_op_assign and _unfrozen pass now. ruby/spec's language suite is unchanged (the same on both builds). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
…method then changes nothing
MRI's str_modifiable and rb_check_frozen report a chilled string ("literal
string will be frozen in the future") before a method looks at anything. So
"ABC".upcase!, "abc".strip!, "abc".sub!(/z/, ""),
"abc".force_encoding("UTF-8"), "abc".encode!("UTF-8"), s.replace(s),
"abc".delete_prefix!("z"), "".reverse! and some 15 more warn although they
change nothing. IronRuby warned only on a write to the characters, so all of
those were silent.
MutableString.RequireNotFrozen, the check those methods make first, now
reports a chilled string as well as refusing a frozen one: the same single
flag test as before, with both bits in the mask. The prelude's
__ir_require_unfrozen__ (#prepend, #delete_prefix!, #delete_suffix!) is now
that check, in C#. #delete_prefix! and #delete_suffix! make it before they
convert their argument, as the comment above them already said and as MRI
does: "a".freeze.delete_prefix!(1) is a FrozenError, not a TypeError.
claude/cruby-test's ReportChilledMutation (409e75f, for setbyte and <<) stays
as it is.
Checked against CRuby 4.0: 36 no-op and ordinary calls on chilled literals,
including scrub! and freeze, which warn in neither. ruby/spec core/string,
symbol, language/string, io read, readpartial and sysread, library/stringio,
sprintf and marshal match the base. New IronRuby.Tests:
String_ChilledNoOpBang1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf6ogoTAvVP9SXaSH7L
module Zlib; end; Zlib::Error = 1; require "zlib" replaced the 1 with
the library's class, and so it did a Zlib::Error the program had
defined with another superclass. A library sets each class or module it
nests in another as a constant of the outer one, without looking at what
is there. MRI's rb_define_class_id_under raises TypeError for a constant
that is no class ("Zlib::Error is not a class (Integer)") and for a
class with another superclass ("superclass mismatch for class
Zlib::Error (Object is given but was StandardError)", the existing
superclass first, as MRI words it); rb_define_module_id_under for one
that is no module. LibraryInitializer.SetConstant now makes the same
checks for a class or module it is given, without running the outer
module's constant initializer to look. A class with the same superclass
is replaced as before.
CRuby's TestRequire#test_define_class_under passes now. Requiring every
C#-backed library and gem gives the same result on both builds, and
ruby/spec's library zlib, digest, stringio and openssl specs pass on
both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
test_parse and test_require re-swept after the round's fixes: 6,724 tests passing (from 6,714), one file without a summary (test_iseq), as before. One of the ten, TestRequire#test_require_with_loaded_features_pop, is no fix of this round's and may flip back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf5QpbMBfRqQTwBzNiD
…ble in Every `@@x` the method JIT compiled looked the variable up as the interpreter does: the class hierarchy lock, then a walk of the ancestors with a table lock each. A read cost about 105 ns where CRuby, which caches the lookup per instruction, takes about 45. RubyContext.ClassVariableVersion now moves whenever what a class variable name resolves to could change: a variable added to or removed from any module, a module's table copied, a mixin changing ancestors. JitRuntime.ClassVariableSite keeps the module the lookup found with the version read before it; while the version holds, an access goes to that module's table directly. The value is never cached, and the pair is one object replaced whole, so threads share a site. Frozen, dummy-singleton and Ractor checks stay on every access. IR_JIT_CVAR_CACHE=0 turns the cache off. Clock (Util/bench/cvar-shapes.rb, cache off -> on): a read 103.2 -> 69.1 ns, a subclass's read 106.7 -> 68.3, a write 134.1 -> 80.7. Util/jit-cvar-matrix.rb gains rows that move the version under a hot site (include and prepend bringing the variable above, an unrelated class gaining the name, writes from threads, class_variable_set) and prints CRuby 4.0's output in every mode and with the cache off, as do jit, jit-calls, jit-const, jit-defined and hot-shapes. ruby/spec class variable, prepend and include specs pass; IronRuby.Tests passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf7SFyMuNS8hE1vrTP2
MRI's io_getpartial makes the buffer modifiable (io_setstrbuf), reads, and sets the buffer's length only once read(2) has answered. A read that would block raises IO::EAGAINWaitReadable, or answers :wait_readable with exception: false, and leaves the buffer as it was: a buffer holding "keep" still holds "keep". IronRuby emptied it before trying, so a caller's buffer lost its contents on every EAGAIN. perf/iter found this. ReadOnceWithoutWaiting now checks the buffer can be changed up front (a frozen buffer is still refused first) and empties it only right before data goes in, or at the end of the stream or for a length of 0, which MRI's io_set_read_length empties it for too. Checked against CRuby 4.0: a pipe and a UNIX socket pair, raising and with exception: false, data, a length of 0, end of file, and a frozen buffer. ruby/spec io read_nonblock, readpartial, read and sysread, library/socket, stringio and openssl match the base. New IronRuby.Tests: IO_ReadNonblockKeepsBuffer1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf6ogoTAvVP9SXaSH7L
…d not built Stage 4's first piece of Docs/jit-resume-deopt.md, the one sound without resume: a typed body entering another receiver's typed body when that body is pure but too complex to inline. Counted on all of AWFY and on app-shapes with a temporary trace of each specialized body's purity: 7 pure non-inlinable bodies in AWFY, and the only callers they would let through are DeltaBlue's setup methods, which call through a constant. Richards and schedule have no such callee. Recorded under Rejected with the numbers; not built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf7SFyMuNS8hE1vrTP2
Round 13 of round thirty-seven (claude/cruby-test's rounds 8-10, perf/aotosr, perf/unkept and unkept2, perf/jitmasgn1, perf/jitslice and perf/jitsplatlit, at 7cde67e against master c4719ea) passed the gate: IronRuby.Tests 1,488 run, none failed; the matrices in seven modes with only the two known DIFFs; a probe file for the round as CRuby in four modes, the R2R host among them; ruby/spec's five suites with no unlisted failure; the census with 88 method-JIT ups and nothing down; AWFY 12 at a geomean of 0.905 and 0.891, and sum_blk at 0.83 of master's on the R2R host; start-up at 0.87-0.98 of master's. perf/crubydiff's round 23 waits for round 14. The round's entries are marked gated, and perf/yieldloop2's and 3's marks, which the merge undid, are put back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf72QWuzxr68CADMiwZ
…terned US-ASCII String; Array#sum and Enumerable#sum without a redefined Integer#+; no frame for operator <<, [] and []=; chilled literals warn at every frozen check; read_nonblock's buffer MutableString.RequireNotFrozen takes crubydiff's chilled check and keeps perf/unkept's mark on its FrozenError; JitCompiler keeps perf/jitslice's range slice and drops the `.freeze' form of defined?, which the bridge no longer writes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf72QWuzxr68CADMiwZ
…ocess setrlimit/clock_getres/groups/Status/UID-GID, spawn errors, frozen $0, const_get's const_missing, ARGF seek/pos/read, shareable_constant_value, library class redefinition errors (test/ruby 6,684 -> 6,724) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf72QWuzxr68CADMiwZ
…d, keepers clear the mark; read_nonblock and a missing File.open cheaper RubyEncoder (pack's format-modified check) and RubyTimeOps (Time#_dump of any year, _load's length check) keep claude/cruby-test's code, with perf/unkept3's mark on their throws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf72QWuzxr68CADMiwZ
…all count): Symbol-literal comparisons and class variables in typed bodies; cvar lookup in CRuby's prepend order RubyModule: claude/cruby-test's f68873f (a singleton class's class variables are its own and then its class's, cvar_front_klass) and perf/jitbody's 5eed1f3 (a class before its prepends, CVAR_LOOKUP's chain) both changed the class variable lookup. TryResolveClassVariableNoRaise, which the read and the method JIT's ClassVariableSite share, now does both: a singleton class of a class or module looks in its own table, then walks its class's chain in CRuby's order. Checked against CRuby 4.0 on both cases and an extended module's variable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf72QWuzxr68CADMiwZ
…atlit's entry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf72QWuzxr68CADMiwZ
Round 14 of round thirty-seven (perf/crubydiff's rounds 23-24, claude/cruby-test's rounds 11-14, perf/unkept3 and perf/enoent, perf/jitsymeq and perf/jitcvar with its cache, at 9242a1e against master c4719ea) passed the gate: IronRuby.Tests 1,511 run, none failed; the matrices in seven modes with only the two known DIFFs; a probe file for the round as CRuby in three modes; ruby/spec's five suites with no unlisted failure; the census with 99 method-JIT ups and nothing down; AWFY 12 at a geomean of 0.900 and 0.913. gem list's start-up is level with master again, where round 13 had it at 0.87-0.90: perf/aotosr compiles a startup-library def with a loop from source at its first call, nine of them for gem list now. perf/dmethjit is to move that compile behind its tier-up. The round's entries are marked gated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPwZf72QWuzxr68CADMiwZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This merges round thirty-seven of the perf loop. Thirteen subsessions each ran
/perf-step,/perf-coreor/perf-frameexperiments on their own branch, plus one fixing differences from CRuby. This branch merged their work in ten rounds and ran the/perf-gatechecks on every round before the next one. Each experiment, kept or rejected, has an entry inUtil/perf/LEDGER.md, and each round has a "Gate of ..." entry with its full results.What changes
downto;perf/havlakalloc,perf/heldrfc,perf/namedblock).begin/rescue/ensure,is_a?;to_i,empty?and!of objects;**restkeyword methods;self's ivars;yieldper iteration (stage 3a).**resttakes over the call's own hash;any?;$~/$_in string evals and fibers;LANG=C;Behaviour changes worth a look
5.to_stringand1.5.compare_to(2.0)now raise NoMethodError, as in CRuby;5.ToString("X")and5.CompareTo(3)still work. Before, a Rubycompare_tocalled on an Integer key hit the CLR method. This commit reverts alone if the snake_case names should stay.IR_LIGHT_STRAIGHT_LITERAL=0).IR_*=0) that restores the old behaviour; the ledger names each one.How it was checked
Each of rounds 4-10 was gated on Linux, net10.0 Release, against master (c4719ea since round 9):
Util/perf/gate-matrices.rb --all: run in six or more modes, plus every round's switches off at once. Each DIFF is explained in the round's gate entry.Util/spec-known-failures.txt.Round 10, at 3781af6 against master c4719ea:
C.UTF-8andLANG=C.The gate found one regression. AWFY Towers had been 2-7% slower than master since round 7, because the match sink was applied to methods with no regex. ce7bfe0 fixes it: pinned, Towers now takes 0.969 and 0.964 of master's time.
This PR's CI runs net11.0 only, so net10.0 can be run by hand with
gh workflow run ci.yml --ref claude/happy-gauss-95wm2j -f tfms=net10.0.🤖 Generated with Claude Code
https://claude.ai/code/session_01KPwZf72QWuzxr68CADMiwZ