8085a97a63
Instead of handling FFI related execution state and safepoint in assembly handle it in runtime code. The transition needs to be done before JumpToFrame unwinds stack because unwinding destroys exit frame and this can't be done at safepoint as GC might be traversing the stack. An incorrect order of operation was manifesting as crashes in GC when one isolate in a group was encountering a lot of exceptions thrown from an FFI call and another isolate is triggering GCs. To catch this in the future added a bit of validation to ExitSafepoint runtime call which triggers when --use-slow-path is enabled. Though after refactoring this code does not trigger this code path anymore because it was completely removed - but it is better than nothing. This CL also removes a lot of unnecessary complexity which was associated with handling this transition in the stub itself. TEST=ffi/vmspecific_handle_test Bug: b/408377905 Cq-Include-Trybots: dart/try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-mac-debug-simarm64_arm64-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try Change-Id: Ia073cb6bb9e1b5a0ea8514c7e048cee6019b84d6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420324 Commit-Queue: Slava Egorov <vegorov@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
132 lines
9.4 KiB
C++
132 lines
9.4 KiB
C++
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef RUNTIME_VM_RUNTIME_ENTRY_LIST_H_
|
|
#define RUNTIME_VM_RUNTIME_ENTRY_LIST_H_
|
|
|
|
namespace dart {
|
|
|
|
#define RUNTIME_ENTRY_LIST(V) \
|
|
V(AllocateArray) \
|
|
V(AllocateMint) \
|
|
V(AllocateDouble) \
|
|
V(AllocateFloat32x4) \
|
|
V(AllocateFloat64x2) \
|
|
V(AllocateInt32x4) \
|
|
V(AllocateTypedData) \
|
|
V(AllocateClosure) \
|
|
V(AllocateContext) \
|
|
V(AllocateObject) \
|
|
V(AllocateRecord) \
|
|
V(AllocateSmallRecord) \
|
|
V(AllocateSuspendState) \
|
|
V(BoxDouble) \
|
|
V(BoxFloat32x4) \
|
|
V(BoxFloat64x2) \
|
|
V(BreakpointRuntimeHandler) \
|
|
V(SingleStepHandler) \
|
|
V(CloneContext) \
|
|
V(CloneSuspendState) \
|
|
V(DoubleToInteger) \
|
|
V(FixCallersTarget) \
|
|
V(FixCallersTargetMonomorphic) \
|
|
V(FixAllocationStubTarget) \
|
|
V(InlineCacheMissHandlerOneArg) \
|
|
V(InlineCacheMissHandlerTwoArgs) \
|
|
V(StaticCallMissHandlerOneArg) \
|
|
V(StaticCallMissHandlerTwoArgs) \
|
|
V(Instanceof) \
|
|
V(SubtypeCheck) \
|
|
V(TypeCheck) \
|
|
V(InstantiateType) \
|
|
V(InstantiateTypeArguments) \
|
|
V(NoSuchMethodFromCallStub) \
|
|
V(NoSuchMethodFromPrologue) \
|
|
V(OptimizeInvokedFunction) \
|
|
V(TraceICCall) \
|
|
V(PatchStaticCall) \
|
|
V(RangeError) \
|
|
V(RangeErrorUnboxedInt64) \
|
|
V(WriteError) \
|
|
V(NullError) \
|
|
V(NullErrorWithSelector) \
|
|
V(NullCastError) \
|
|
V(ArgumentNullError) \
|
|
V(DispatchTableNullError) \
|
|
V(ArgumentError) \
|
|
V(ArgumentErrorUnboxedInt64) \
|
|
V(IntegerDivisionByZeroException) \
|
|
V(ReThrow) \
|
|
V(InterruptOrStackOverflow) \
|
|
V(Throw) \
|
|
V(DeoptimizeMaterialize) \
|
|
V(RewindPostDeopt) \
|
|
V(UpdateFieldCid) \
|
|
V(InitInstanceField) \
|
|
V(InitStaticField) \
|
|
V(LateFieldAlreadyInitializedError) \
|
|
V(LateFieldAssignedDuringInitializationError) \
|
|
V(LateFieldNotInitializedError) \
|
|
V(CompileFunction) \
|
|
V(ResumeFrame) \
|
|
V(SwitchableCallMiss) \
|
|
V(NotLoaded) \
|
|
V(FfiAsyncCallbackSend) \
|
|
V(AllocateSubtypeTestCache) \
|
|
V(GetFieldForDispatch) \
|
|
V(AdjustArgumentsDesciptorForImplicitClosure) \
|
|
V(ClosureArgumentsValid) \
|
|
V(ResolveCallFunction) \
|
|
V(InterpretedInstanceCallMissHandler) \
|
|
V(InvokeNoSuchMethod) \
|
|
V(ResumeInterpreter)
|
|
|
|
// Note: Leaf runtime function have C linkage, so they cannot pass C++ struct
|
|
// values like ObjectPtr.
|
|
|
|
#define LEAF_RUNTIME_ENTRY_LIST(V) \
|
|
V(intptr_t, DeoptimizeCopyFrame, uword, uword) \
|
|
V(void, DeoptimizeFillFrame, uword) \
|
|
V(void, StoreBufferBlockProcess, Thread*) \
|
|
V(void, OldMarkingStackBlockProcess, Thread*) \
|
|
V(void, NewMarkingStackBlockProcess, Thread*) \
|
|
V(uword /*ObjectPtr*/, EnsureRememberedAndMarkingDeferred, \
|
|
uword /*ObjectPtr*/ object, Thread* thread) \
|
|
V(double, LibcPow, double, double) \
|
|
V(double, DartModulo, double, double) \
|
|
V(double, LibcFmod, double, double) \
|
|
V(double, LibcFloor, double) \
|
|
V(double, LibcCeil, double) \
|
|
V(double, LibcTrunc, double) \
|
|
V(double, LibcRound, double) \
|
|
V(double, LibcCos, double) \
|
|
V(double, LibcSin, double) \
|
|
V(double, LibcTan, double) \
|
|
V(double, LibcAcos, double) \
|
|
V(double, LibcAsin, double) \
|
|
V(double, LibcAtan, double) \
|
|
V(double, LibcAtan2, double, double) \
|
|
V(double, LibcExp, double) \
|
|
V(double, LibcLog, double) \
|
|
V(uword /*BoolPtr*/, CaseInsensitiveCompareUCS2, uword /*StringPtr*/, \
|
|
uword /*SmiPtr*/, uword /*SmiPtr*/, uword /*SmiPtr*/) \
|
|
V(uword /*BoolPtr*/, CaseInsensitiveCompareUTF16, uword /*StringPtr*/, \
|
|
uword /*SmiPtr*/, uword /*SmiPtr*/, uword /*SmiPtr*/) \
|
|
V(void, EnterSafepoint) \
|
|
V(void, ExitSafepoint) \
|
|
V(ApiLocalScope*, EnterHandleScope, Thread*) \
|
|
V(void, ExitHandleScope, Thread*) \
|
|
V(LocalHandle*, AllocateHandle, ApiLocalScope*) \
|
|
V(void, PropagateError, Dart_Handle) \
|
|
V(void, MsanUnpoison, void*, size_t) \
|
|
V(void, MsanUnpoisonParam, size_t) \
|
|
V(void, TsanLoadAcquire, void*) \
|
|
V(void, TsanStoreRelease, void*) \
|
|
V(bool, TryDoubleAsInteger, Thread*) \
|
|
V(void*, MemoryMove, void*, const void*, size_t)
|
|
|
|
} // namespace dart
|
|
|
|
#endif // RUNTIME_VM_RUNTIME_ENTRY_LIST_H_
|