You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dead-code elimination removes textfieldGetString calls used in conditional branches #11
Perry's codegen eliminates textfieldGetString() calls when the result variable is only used inside a conditional branch (e.g., if (user.length > 0)).
Reproduction
constuserRaw=textfieldGetString(userField);constuser=(typeofuserRaw==='string'&&userRaw.length>0) ? userRaw : '';constpassRaw=textfieldGetString(passField);constpass=(typeofpassRaw==='string'&&passRaw.length>0) ? passRaw : '';// user and pass are only used inside this if:if(user.length>0&&pass.length>0){uri='mongodb://'+encodeURIComponent(user)+':'+encodeURIComponent(pass)+'@'+host;}
The textfieldGetString(userField) and textfieldGetString(passField) calls are eliminated entirely (confirmed via Rust debug prints — only 4 of 6 expected calls execute).
The same code pattern works for name/host/port because those variables are used unconditionally in later code.
Expected Behavior
Side-effectful native function calls should never be eliminated, even if the result is only used conditionally.
Fixed in v0.4.37 (bf9779d). The calls were not actually eliminated by DCE — they executed, but the return values were corrupted due to the same NaN-boxing bug as #10. When the I64 string pointer was bitcast to F64 without STRING_TAG, the runtime couldn't identify the value as a string, making it appear as undefined. This made it look like the calls were eliminated since the result variables held garbage.
Activity
fix: is_string locals NaN-boxed with STRING_TAG for function args (v0…
proggeramlug commentedon Mar 31, 2026
Fixed in v0.4.37 (bf9779d). The calls were not actually eliminated by DCE — they executed, but the return values were corrupted due to the same NaN-boxing bug as #10. When the I64 string pointer was bitcast to F64 without STRING_TAG, the runtime couldn't identify the value as a string, making it appear as
undefined. This made it look like the calls were eliminated since the result variables held garbage.