[vm] Make vm/cc/Inliner_InlineForceOptimized test less fragile

This test verifies how deoptIds and environments are set
when inlining force-optimized functions.

The problem is that it looks at the chain of inlined calls:

foo() {
  call1 -> Pointer.fromAddress
}

Pointer.fromAddress() {
  call2 -> _fromAddress
}

// force-optimized
_fromAddress() { ... }

During inlining of force-optimized callee, its instructions
should receive deoptId/env from inlined call site.
In this case, the call site is 'call2'.

However, the test has been matching deoptId/env with 'call1'.

It was a mere coincidence that deoptIds of call1 and call2
were the same. Any attempt to make a change which would
affect deoptIds within Pointer.fromAddress breaks this test.

In order to fix this, a simpler setup is now used:

foo() {
  call1 -> newHash()
}

// force-optimized
newHash() { ... }

Also, the check for deoptId of outermost environment is dropped as
in this case there are no multiple environments.

In addition, also remove the duplicate pragma from _fromAddress.

TEST=vm/cc/Inliner_InlineForceOptimized

Change-Id: I1f592a74dfb8b7c2f67f3b0a51e7f7b74bf358eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502801
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov
2026-05-12 06:03:38 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 4c9d7e54cb
commit 66b54232ee
3 changed files with 11 additions and 11 deletions
-1
View File
@@ -81,7 +81,6 @@ int sizeOf<T extends SizedNativeType>() {
throw UnimplementedError("$T");
}
@pragma("vm:idempotent")
@pragma("vm:recognized", "other")
@pragma("vm:idempotent")
external Pointer<T> _fromAddress<T extends NativeType>(int ptr);