Clean up IA32 Assembler's code_
#48852
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
vm-technical-debt
This label tries to capture all the technical debt that we have accumulated in the Dart VM
assembler_ia32.h
has a field,code_
, which is not present in any of the other assemblers:sdk/runtime/vm/compiler/assembler/assembler_ia32.h
Line 1093 in 618db8a
It is only read in one place:
sdk/runtime/vm/compiler/assembler/assembler_ia32.cc
Lines 2699 to 2704 in 618db8a
And set in one place:
sdk/runtime/vm/object.cc
Lines 17254 to 17256 in 618db8a
Note how we're setting the field through a getter:
sdk/runtime/vm/compiler/assembler/assembler_ia32.h
Line 1046 in 618db8a
This is already fishy, but this quirk is also causing a different bug, whereby we incorrectly set the Code object in Dart frames to the current Code, instead of the Code being called.
For example, in
FfiCallInstr
we commonly do the following across all architectures:sdk/runtime/vm/compiler/backend/il_ia32.cc
Lines 1039 to 1041 in 618db8a
Except, on IA32
EnterDartFrame
calls the abovePushCodeObject
which we saw always pushes whatever is incode_
, and not what is inCODE_REG
, as the comment otherwise claims (which is correct on other archs.):sdk/runtime/vm/compiler/assembler/assembler_ia32.cc
Lines 2706 to 2709 in 618db8a
This ultimately has the effect that FFI ExitFrames have a duplicate FfiTrampoline Code object in them where they should have Null, which in turn affects stack traces, etc.
Aside: This might also affect other users of
EnterDartFrame
, but I haven't checked.The text was updated successfully, but these errors were encountered: