Revert "[vm/bytecode] Switch kernel service dill to bytecode if building Dart SDK with --bytecode"

This reverts commit beee442625.

Reason for revert: StackOverflow on language_2/deep_nesting_expression_test/01 in interpreted mode.

Original change's description:
> [vm/bytecode] Switch kernel service dill to bytecode if building Dart SDK with --bytecode
> 
> Temporary setting of FLAG_enable_interpreter is avoided in the VM unit tests as
> this flag is global and used by kernel service isolate while running tests.
> Flipping this flag causes assertion failures in kernel isolate's background compiler
> or infinite loop between LazyCompile stub and CompileFunction as AttachBytecode
> doesn't set entry point to InterpretCall.
> 
> The less intrusive way to ensure compilation of functions in unit tests is to set
> FLAG_compilation_counter_threshold to 0.
> 
> Change-Id: Ia46ff8d03d66ab8b147b9d89336548c4a9c29f5d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113123
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,regis@google.com

Change-Id: I67cd03a56f9a2d29aa6597d38779e77ca3a16b18
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113480
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov 2019-08-16 22:39:52 +00:00 committed by commit-bot@chromium.org
parent 6b531b2ba4
commit ea7348c5f0
5 changed files with 19 additions and 26 deletions

View file

@ -46,10 +46,8 @@ RawFunction* GetFunction(const Library& lib, const char* name) {
void Invoke(const Library& lib, const char* name) {
// These tests rely on running unoptimized code to collect type feedback. The
// interpreter does not collect type feedback for interface calls, so set
// compilation threshold to 0 in order to compile invoked function
// immediately and executed compiled code.
SetFlagScope<int> sfs(&FLAG_compilation_counter_threshold, 0);
// interpreter does not collect type feedback for interface calls.
SetFlagScope<bool> sfs(&FLAG_enable_interpreter, false);
Thread* thread = Thread::Current();
Dart_Handle api_lib = Api::NewHandle(thread, lib.raw());

View file

@ -231,14 +231,14 @@ DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
Exceptions::PropagateError(Error::Cast(result));
}
}
if (function.HasBytecode() && (FLAG_compilation_counter_threshold != 0)) {
if (function.HasBytecode()) {
// If interpreter is enabled and there is bytecode, LazyCompile stub
// (which calls CompileFunction) should proceed to InterpretCall in order
// to enter interpreter. In such case, compilation is postponed and
// triggered by interpreter later via CompileInterpretedFunction.
return;
}
// Fall back to compilation.
// No bytecode, fall back to compilation.
} else {
ASSERT(!function.HasCode());
}

View file

@ -152,7 +152,7 @@ RawObject* DartEntry::InvokeFunction(const Function& function,
}
// If we have bytecode but no native code then invoke the interpreter.
if (function.HasBytecode() && (FLAG_compilation_counter_threshold != 0)) {
if (function.HasBytecode()) {
ASSERT(thread->no_callback_scope_depth() == 0);
SuspendLongJumpScope suspend_long_jump_scope(thread);
TransitionToGenerated transition(thread);
@ -160,7 +160,7 @@ RawObject* DartEntry::InvokeFunction(const Function& function,
arguments, thread);
}
// Fall back to compilation.
// No bytecode, fall back to compilation.
}
const Object& result =

View file

@ -1528,7 +1528,7 @@ ISOLATE_UNIT_TEST_CASE(Profiler_FunctionInline) {
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
SetFlagScope<int> sfs(&FLAG_optimization_counter_threshold, 30000);
SetFlagScope<int> sfs2(&FLAG_compilation_counter_threshold, 0);
SetFlagScope<bool> sfs2(&FLAG_enable_interpreter, false);
const char* kScript =
"class A {\n"
@ -1814,7 +1814,7 @@ ISOLATE_UNIT_TEST_CASE(Profiler_InliningIntervalBoundry) {
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
SetFlagScope<int> sfs(&FLAG_optimization_counter_threshold, 30000);
SetFlagScope<int> sfs2(&FLAG_compilation_counter_threshold, 0);
SetFlagScope<bool> sfs2(&FLAG_enable_interpreter, false);
const char* kScript =
"class A {\n"
@ -2162,8 +2162,8 @@ ISOLATE_UNIT_TEST_CASE(Profiler_BasicSourcePositionOptimized) {
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
// Optimize quickly.
SetFlagScope<int> sfs(&FLAG_optimization_counter_threshold, 5);
SetFlagScope<int> sfs2(&FLAG_compilation_counter_threshold, 0);
SetFlagScope<int> sfs2(&FLAG_optimization_counter_threshold, 5);
SetFlagScope<bool> sfs3(&FLAG_enable_interpreter, false);
const char* kScript =
"class A {\n"
" var a;\n"
@ -2348,8 +2348,8 @@ ISOLATE_UNIT_TEST_CASE(Profiler_SourcePositionOptimized) {
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
// Optimize quickly.
SetFlagScope<int> sfs(&FLAG_optimization_counter_threshold, 5);
SetFlagScope<int> sfs2(&FLAG_compilation_counter_threshold, 0);
SetFlagScope<int> sfs2(&FLAG_optimization_counter_threshold, 5);
SetFlagScope<bool> sfs3(&FLAG_enable_interpreter, false);
const char* kScript =
"class A {\n"
@ -2574,8 +2574,8 @@ ISOLATE_UNIT_TEST_CASE(Profiler_BinaryOperatorSourcePositionOptimized) {
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
// Optimize quickly.
SetFlagScope<int> sfs(&FLAG_optimization_counter_threshold, 5);
SetFlagScope<int> sfs2(&FLAG_compilation_counter_threshold, 0);
SetFlagScope<int> sfs2(&FLAG_optimization_counter_threshold, 5);
SetFlagScope<bool> sfs3(&FLAG_enable_interpreter, false);
const char* kScript =
"class A {\n"
@ -2654,9 +2654,11 @@ ISOLATE_UNIT_TEST_CASE(Profiler_BinaryOperatorSourcePositionOptimized) {
EXPECT(walker.Down());
EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
EXPECT(walker.Down());
EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
EXPECT_EQ(1, walker.CurrentExclusiveTicks());
EXPECT(walker.Down());
if (!FLAG_enable_interpreter) {
EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
EXPECT_EQ(1, walker.CurrentExclusiveTicks());
EXPECT(walker.Down());
}
EXPECT_STREQ("B.boo", walker.CurrentName());
EXPECT_EQ(1, walker.CurrentNodeTickCount());
EXPECT_EQ(1, walker.CurrentInclusiveTicks());

View file

@ -101,13 +101,6 @@ template("kernel_service_dill") {
"--output=" + rebase_path(output),
rebase_path(kernel_service_script),
]
if (dart_platform_bytecode) {
args += [
"--gen-bytecode",
"--drop-ast",
]
}
}
}