Skip to content

Commit c7bf131

Browse files
alexmarkovCommit Queue
authored andcommitted
[vm,dyn_modules] Support reachabilityFence and _nativeEffect from dart:_internal in bytecode
TEST=ci Change-Id: I68c7b74b6ccc75139b5690f3216c47ab843cc544 Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442245 Reviewed-by: Tess Strickland <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
1 parent 63082be commit c7bf131

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

pkg/dart2bytecode/lib/bytecode_generator.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,12 @@ class BytecodeGenerator extends RecursiveVisitor {
969969
late Procedure unsafeCast =
970970
libraryIndex.getTopLevelProcedure('dart:_internal', 'unsafeCast');
971971

972+
late Procedure reachabilityFence =
973+
libraryIndex.getTopLevelProcedure('dart:_internal', 'reachabilityFence');
974+
975+
late Procedure nativeEffect =
976+
libraryIndex.getTopLevelProcedure('dart:_internal', '_nativeEffect');
977+
972978
late Procedure iterableIterator =
973979
libraryIndex.getProcedure('dart:core', 'Iterable', 'get:iterator');
974980

@@ -3454,12 +3460,16 @@ class BytecodeGenerator extends RecursiveVisitor {
34543460
}
34553461
Arguments args = node.arguments;
34563462
final target = node.target;
3457-
if (target == unsafeCast) {
3458-
// The result of the unsafeCast() intrinsic method is its sole argument,
3459-
// without any additional checks or type casts.
3463+
// Handle built-in methods with special semantics.
3464+
if (target == unsafeCast || target == reachabilityFence) {
3465+
// Just evaluate argument.
34603466
assert(args.named.isEmpty);
34613467
_generateNode(args.positional.single);
34623468
return;
3469+
} else if (target == nativeEffect) {
3470+
// Skip over AST of the argument, return null.
3471+
asm.emitPushNull();
3472+
return;
34633473
}
34643474
if (target.isFactory) {
34653475
final constructedClass = target.enclosingClass!;

0 commit comments

Comments
 (0)