mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:36:59 +00:00
[vm/bytecode] Fix entry point when optimized code is cleared but bytecode remains
If interpreter is enabled and a function has bytecode, then its entry point should be set to 'interpreter call' instead of 'lazy compile' when clearing code. Fixes https://github.com/dart-lang/sdk/issues/35128 Change-Id: Ie714ac9c4d1ffef181512c5785c374e9de22ab95 Reviewed-on: https://dart-review.googlesource.com/c/84180 Commit-Queue: Régis Crelier <regis@google.com> Auto-Submit: Alexander Markov <alexmarkov@google.com> Reviewed-by: Régis Crelier <regis@google.com>
This commit is contained in:
parent
802db45879
commit
f4a80a8466
|
@ -53,11 +53,19 @@ class SkippedCodeFunctions {
|
|||
// If the code wasn't strongly visited through other references
|
||||
// after skipping the function's code pointer, then we disconnect the
|
||||
// code from the function.
|
||||
if (FLAG_enable_interpreter && Function::HasBytecode(func)) {
|
||||
func->StorePointer(&(func->ptr()->code_),
|
||||
StubCode::InterpretCall_entry()->code());
|
||||
uword entry_point = StubCode::InterpretCall_entry()->EntryPoint();
|
||||
func->ptr()->entry_point_ = entry_point;
|
||||
func->ptr()->unchecked_entry_point_ = entry_point;
|
||||
} else {
|
||||
func->StorePointer(&(func->ptr()->code_),
|
||||
StubCode::LazyCompile_entry()->code());
|
||||
uword entry_point = StubCode::LazyCompile_entry()->EntryPoint();
|
||||
func->ptr()->entry_point_ = entry_point;
|
||||
func->ptr()->unchecked_entry_point_ = entry_point;
|
||||
}
|
||||
if (FLAG_log_code_drop) {
|
||||
// NOTE: This code runs while GC is in progress and runs within
|
||||
// a NoHandleScope block. Hence it is not okay to use a regular Zone
|
||||
|
|
|
@ -6091,6 +6091,9 @@ void Function::SwitchToUnoptimizedCode() const {
|
|||
}
|
||||
|
||||
void Function::SwitchToLazyCompiledUnoptimizedCode() const {
|
||||
#if defined(DART_PRECOMPILED_RUNTIME)
|
||||
UNREACHABLE();
|
||||
#else
|
||||
if (!HasOptimizedCode()) {
|
||||
return;
|
||||
}
|
||||
|
@ -6105,9 +6108,14 @@ void Function::SwitchToLazyCompiledUnoptimizedCode() const {
|
|||
|
||||
const Code& unopt_code = Code::Handle(zone, unoptimized_code());
|
||||
if (unopt_code.IsNull()) {
|
||||
// Set the lazy compile code.
|
||||
// Set the lazy compile or interpreter call stub code.
|
||||
if (FLAG_enable_interpreter && HasBytecode()) {
|
||||
TIR_Print("Switched to interpreter call stub for %s\n", ToCString());
|
||||
SetInstructions(Code::Handle(StubCode::InterpretCall_entry()->code()));
|
||||
} else {
|
||||
TIR_Print("Switched to lazy compile stub for %s\n", ToCString());
|
||||
SetInstructions(Code::Handle(StubCode::LazyCompile_entry()->code()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6115,6 +6123,7 @@ void Function::SwitchToLazyCompiledUnoptimizedCode() const {
|
|||
|
||||
AttachCode(unopt_code);
|
||||
unopt_code.Enable();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Function::set_unoptimized_code(const Code& value) const {
|
||||
|
|
|
@ -75,7 +75,6 @@ dart_developer_disabled_env_test: RuntimeError
|
|||
[ $compiler == dartkb && $strong ]
|
||||
io/code_collection_test: RuntimeError # Reruns the same script (dill file without AST) without passing --enable-interpreter or --use-bytecode-compiler.
|
||||
io/dart_std_io_pipe_test: Pass, Timeout # Please triage
|
||||
io/file_lock_test: Skip # Times out, issue 35128
|
||||
io/platform_resolved_executable_test/00: RuntimeError # Reruns the same script (dill file without AST) without passing --enable-interpreter or --use-bytecode-compiler.
|
||||
io/platform_resolved_executable_test/01: RuntimeError # Reruns the same script (dill file without AST) without passing --enable-interpreter or --use-bytecode-compiler.
|
||||
io/platform_resolved_executable_test/02: RuntimeError # Reruns the same script (dill file without AST) without passing --enable-interpreter or --use-bytecode-compiler.
|
||||
|
|
Loading…
Reference in a new issue