mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-07 08:33:50 +08:00
Stage S4 of the two-tier design: dynamic-tier code reads, writes and calls properties through per-site inline caches keyed on hidden-class shapes. - Runtime: scr_js_object.c (dynTier) attaches shapes to the existing checked objects: a shape is a node of the thread's transition tree over key sequences, computed on an object's first cache miss, and objects past 64 keys stay unshaped (dictionary mode). Attributes and the prototype are tested live on every hit. The dyn-tier build of scr_json.c (SCR_JS_TIER) resets a shape on every key-set change; typed programs keep linking the ordinary build. - Sites: ir/js-ic.ts recognizes the lowering's property helpers by structure; calls to them from dynamic-tier functions, and method dispatch outside module initializers, become sites with a zeroed thread-local ScrJsIc. backend/llvm/js-ic.ts tests entry 0 inline (own property or one prototype link), probes out of line, and keeps the helper as the noinline cold slow path. Array length and dense number-key element reads are inline. - Numbers: jsval reads of number properties are immediates, and a jsval number stored over an unshared number cell updates it in place; the jsval pass feeds cache stores jsvals and stops boxing discarded compound-assignment results. `%` and bitwise operators get integer paths. Static functions are untouched: typed programs compile to byte-identical LLVM and executables, and every static function of programs with dynamic code is byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>