Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unexpected object (Class with non mode agnostic constants, full)" error on IA32 #43626

Closed
alexmarkov opened this issue Sep 30, 2020 · 2 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. NNBD Issues related to NNBD Release

Comments

@alexmarkov
Copy link
Contributor

The following tests fail for this reason on IA32 in NNBD strong mode:

vm/dart/appjit_determinism_test
vm/dart/appjit_cha_deopt_test
vm/dart/appjit_load_static_licm_test
--- Command "vm" (took 25.000156s):
DART_CONFIGURATION=ReleaseIA32 out/ReleaseIA32/dart --optimization-counter-threshold=100 --deterministic --sound-null-safety --enable-experiment=non-nullable --ignore-unrecognized-flags --packages=/b/s/w/ir/.packages /b/s/w/ir/runtime/tests/vm/dart/appjit_cha_deopt_test.dart

exit code:
255

stdout:
+ out/ReleaseIA32/dart --optimization-counter-threshold=100 --deterministic --sound-null-safety --enable-experiment=non-nullable --ignore-unrecognized-flags --packages=/b/s/w/ir/.packages --snapshot=/b/s/w/itXZmp55/OIRSAB/app.jit --snapshot-kind=app-jit /b/s/w/ir/runtime/tests/vm/dart/appjit_cha_deopt_test_body.dart --train

Command stdout:
OK(Trained)


Command stderr:
Unexpected object (Class with non mode agnostic constants, full): 0xf7780321 Library:'dart:core' Class: _ImmutableList@0150898

running [TRAINING RUN] out/ReleaseIA32/dart --optimization-counter-threshold=100 --deterministic --sound-null-safety --enable-experiment=non-nullable --ignore-unrecognized-flags --packages=/b/s/w/ir/.packages --snapshot=/b/s/w/itXZmp55/OIRSAB/app.jit --snapshot-kind=app-jit /b/s/w/ir/runtime/tests/vm/dart/appjit_cha_deopt_test_body.dart --train:

Command stdout:
OK(Trained)


Command stderr:
Unexpected object (Class with non mode agnostic constants, full): 0xf7780321 Library:'dart:core' Class: _ImmutableList@0150898

stderr:
Unhandled exception:
Expect.fail('[TRAINING RUN] Process finished with non-zero exit code -6')
#0      Expect._fail (package:expect/expect.dart:704:5)
#1      Expect.fail (package:expect/expect.dart:282:5)
#2      reportError (file:///b/s/w/ir/runtime/tests/vm/dart/snapshot_test_helper.dart:37:10)
#3      runBinary (file:///b/s/w/ir/runtime/tests/vm/dart/snapshot_test_helper.dart:110:5)
<asynchronous suspension>
#4      runDart (file:///b/s/w/ir/runtime/tests/vm/dart/snapshot_test_helper.dart:62:10)
#5      runAppJitTest.<anonymous closure> (file:///b/s/w/ir/runtime/tests/vm/dart/snapshot_test_helper.dart:180:34)
#6      withTempDir (file:///b/s/w/ir/runtime/tests/vm/dart/snapshot_test_helper.dart:119:14)
#7      runAppJitTest (file:///b/s/w/ir/runtime/tests/vm/dart/snapshot_test_helper.dart:176:9)
#8      main (file:///b/s/w/ir/runtime/tests/vm/dart/appjit_cha_deopt_test.dart:17:5)
#9      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:301:19)
#10     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

--- Re-run this test:
python tools/test.py -n dartk-strong-linux-release-ia32 vm/dart/appjit_cha_deopt_test

The problem is that on IA32 app-jit snapshots (Snapshot::kFullJIT) are silently replaced with Snapshot::kFull.

We have checks to detect constants which might require legacy erasure. Those checks are supposed to run only for core snapshot with core libraries which is shared between weak and strong mode. However, those checks trigger for Snapshot::kFull which is also used on IA32 for application snapshots (which can contain arbitrary constants).

if (s->kind() == Snapshot::kFull && RequireLegacyErasureOfConstants(cls)) {
s->UnexpectedObject(cls, "Class with non mode agnostic constants");
}

I think we should find another way to distinguish core snapshots with core libraries. Maybe we should add a VM option and specify it when building core snapshot of core libraries. @rmacnak-google Do you know a better way?

/cc @crelier

@alexmarkov alexmarkov added area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. NNBD Issues related to NNBD Release labels Sep 30, 2020
@rmacnak-google
Copy link
Contributor

I should note that app-jit does not imply kFullJIT nor vice versa. A core-jit snapshot will also have kFullJIT. If the erasure should only trigger for core snapshots rather than app snapshots, we should write another bit in the snapshot / carry a bit in the writer to distinguish the two.

@alexmarkov
Copy link
Contributor Author

I think the idea is to check that core snapshot with core libraries (platform) doesn't have constants which require legacy erasure, so the same snapshot can be safely used both in weak and strong modes. All snapshots with code including core-jit cannot be shared (reused) between weak and strong modes. We're also not reusing application snapshots and we cannot guarantee that there are no such constants, so we shouldn't do the check.

@alexmarkov alexmarkov self-assigned this Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. NNBD Issues related to NNBD Release
Projects
None yet
Development

No branches or pull requests

2 participants