Repository navigation
fix: create objects without code generation when eval is forbidden, keep the host's gc, and reclaim per VM - #105
Conversation
…on when the page forbids eval
…heck, restore late snapshot references, and make four ref tests deterministic
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
This PR fixes several issues from the 0.2.0 changes: adds eval-blocked fallbacks using closures for object constructors and field accessors, makes reclaim callbacks per-VM instead of global, leaves the host's globalThis.gc untouched while keeping an internal job-ending wrapper, fixes finalizable detection to match HotSpot (only a single return bytecode is empty), and makes snapshot restore handle references added during referent decoding. Tests are updated to not depend on collection timing and to run under --disallow-code-generation-from-strings.
review-bot, model nvidia/nemotron-3-ultra-550b-a55b:free, verdict approve
…eep the host's gc, and reclaim per VM (#105)
What this changes
Fixes review findings on the 0.2.0 changes in #104, before they reach master.
src/runtime.ts) were built withnew Function, which throws there. The first such error now switches them to closures with computed keys. With eval allowed, the generated code is unchanged.globalThis.gcis left as the host set it. java-web keeps its job-ending wrapper internal (setGc,collector()), sogc({ execution: "async" })still returns a Promise after a VM starts.JVM.haltremoves it. A second VM in the same process no longer replaces the first VM's, and a halted VM is no longer kept alive by it.finalize()counts as a finalizer unless its body is a singlereturn, as in HotSpot, so a nativefinalize()counts.docs/support.mdsaysSystem.gc()needs a host collector under Node.Tests
node --disallow-code-generation-from-stringsand compare them with HotSpot. Before this change,ctorForthrew anEvalErrorunder that flag. ObjectLayout, VarHandles and MiscUnsafe also match HotSpot under it.gcis the same function afterrunNodeand still returns a Promise forgc({ execution: "async" }).-Xmx16m) match HotSpot 25.0.5.1.pnpm typecheckandpnpm testpass. The Java2D tests pass only with no display set, as before.