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
Parameter unboxing has been buggy across graph-intrinsics which was uncovered by moving SIMD value type bootstrap implementations from C++ to Dart.
Martin pointed out we have code paths for unboxed parameters on graph-intrinsics. It looks to me like they are not actively exercised because other conditions prevent that from happening.
Which doesn't make sense on first sight. We should unbox parameters here and inline this, why aren't we?
I think we should eventually review those parts and see if it works properly or whether pragma combinations like those two above are just a workaround for a bug.
In general, graph intrinsics should not prevent unboxing of the parameters and/or result. Smi intrinsics might be a bit special because they have specialized inline cache stubs which do not expect to see unboxed arguments.
There are 2 cases:
when parameter unboxing is prevented by other means (external implementation, pragma), graph intrinsics can assert that they always take boxed parameter and not handle unboxed parameter (because handling an unboxed parameter would be a dead code). This is done via VerifyParameterIsBoxed.
if parameter could be both boxed and unboxed, graph intrinsic can convert it to boxed representation via CreateBoxedParameterIfNeeded or explicitly unbox it as needed. Also, if result can be both boxed and unboxed, graph intrinsic should use CreateBoxedResultIfNeeded and CreateUnboxedResultIfNeeded to convert the result.
Rewriting fallbacks of graph intrinsics from external to Dart moves intrinsic from case 1 to case 2, so we should be careful to update graph intrinsics as needed.
However, even better way would be to replace all graph intrinsics with FlowGraphBuilder::BuildGraphOfRecognizedMethod implementation which handles boxing/unboxing in a general way.
Activity
alexmarkov commentedon Sep 23, 2026
In general, graph intrinsics should not prevent unboxing of the parameters and/or result. Smi intrinsics might be a bit special because they have specialized inline cache stubs which do not expect to see unboxed arguments.
There are 2 cases:
when parameter unboxing is prevented by other means (external implementation, pragma), graph intrinsics can assert that they always take boxed parameter and not handle unboxed parameter (because handling an unboxed parameter would be a dead code). This is done via
VerifyParameterIsBoxed.if parameter could be both boxed and unboxed, graph intrinsic can convert it to boxed representation via
CreateBoxedParameterIfNeededor explicitly unbox it as needed. Also, if result can be both boxed and unboxed, graph intrinsic should useCreateBoxedResultIfNeededandCreateUnboxedResultIfNeededto convert the result.Rewriting fallbacks of graph intrinsics from external to Dart moves intrinsic from case 1 to case 2, so we should be careful to update graph intrinsics as needed.
However, even better way would be to replace all graph intrinsics with
FlowGraphBuilder::BuildGraphOfRecognizedMethodimplementation which handles boxing/unboxing in a general way.