Precompute per-parameter interop binding flags#2719
Merged
Conversation
Interop argument binding re-derived three per-parameter-type facts on every call: typeof(JsValue).IsAssignableFrom(parameterType), the generic-shape test hidden inside IsGenericParameter (which forced a boxing argument.ToObject() detour for every argument, including plain int parameters), and the JsValue[] params-signature check. MethodDescriptor now classifies each parameter once into InteropParameterFlags; MethodInfoFunction.TryCall and MethodDescriptor.Call branch on the cached flags. Resolved generic methods re-classify their own parameters (their ParameterInfos differ from the descriptor's). The general conversion branch computes the boxed argument lazily now that the generic probe no longer produces it as a side effect. Conversion semantics are unchanged - the same conversions run, only constant-per-method reflection checks and the needless pre-boxing are gone. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
lahma
enabled auto-merge (squash)
July 21, 2026 11:20
This was referenced Jul 22, 2026
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.
Part of the V8-gap performance campaign (#1775 follow-up). Profiling
interop-method-callsshowedMethodInfoFunction.TryCallat 15.9% self — and most of it is constant-per-method work re-derived on every call.Change
Interop argument binding re-derived three per-parameter-type facts per argument per call:
typeof(JsValue).IsAssignableFrom(parameterType), the generic-shape test hidden insideIsGenericParameter(which forced a boxingargument.ToObject()detour for every argument, including plainintparameters), and theJsValue[]params-signature check.MethodDescriptornow classifies each parameter once intoInteropParameterFlags;MethodInfoFunction.TryCallandMethodDescriptor.Callbranch on the cached flags. Resolved generic methods re-classify their own parameters (theirParameterInfos differ from the descriptor's). The general conversion branch computes the boxed argument lazily now that the generic probe no longer produces it as a side effect. Conversion semantics are unchanged — the same conversions run in the same order; only constant-per-method reflection checks and the needless pre-boxing are gone.Numbers (default BDN job, same-base A/B)
Three rows (TwoArgs, Overloaded, Params) initially read +3–4% on single launches; a launchCount-5 verification on both sides shows them statistically tied (+0.2%, +0.3%, −2.1%) — layout bimodality, not regressions.
Gates
Rebased on current main (includes #2716–#2718): Jint.Tests 3658/3595 (net10/net472), PublicInterface 114/114 both TFMs, Test262 99,431 passed / 0 failed.
🤖 Generated with Claude Code