Skip to content

Commit

Permalink
Revert "Introduce IKG into kernel-service to support incremental comp…
Browse files Browse the repository at this point in the history
…ilation."

This reverts commit f596d44.

BUG=

Review-Url: https://codereview.chromium.org/3002553003 .
  • Loading branch information
aam committed Aug 14, 2017
1 parent f596d44 commit c35510d
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 558 deletions.
3 changes: 1 addition & 2 deletions runtime/include/dart_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -3139,8 +3139,7 @@ typedef struct {
DART_EXPORT Dart_KernelCompilationResult
Dart_CompileSourcesToKernel(const char* script_uri,
int source_files_count,
Dart_SourceFile source_files[],
bool incremental_compile);
Dart_SourceFile source_files[]);

#define DART_KERNEL_ISOLATE_NAME "kernel-service"

Expand Down
7 changes: 0 additions & 7 deletions runtime/tests/vm/vm.status
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,6 @@ dart/redirection_type_shuffling_test/none: RuntimeError # Issue 29201
dart/regress29620_test: RuntimeError
dart/spawn_shutdown_test: SkipSlow

[ ($compiler != dartk) ]
cc/IsolateReload_KernelIncrementalCompile: Skip
cc/IsolateReload_KernelIncrementalCompileAppAndLib: Skip
cc/IsolateReload_KernelIncrementalCompileGenerics: Skip

[ ($compiler == dartk) && ($runtime == vm) ]
cc/CanonicalizationInScriptSnapshots: Fail
cc/Class_ComputeEndTokenPos: Crash
Expand Down Expand Up @@ -328,7 +323,6 @@ cc/IsolateReload_EnumToNotEnum: Skip
cc/IsolateReload_ExportedLibModified: Crash
cc/IsolateReload_ImportedLibModified: Crash
cc/IsolateReload_ImportedMixinFunction: Crash
cc/IsolateReload_KernelIncrementalCompileGenerics: Crash # Issue 30322
cc/IsolateReload_LibraryHide: Crash
cc/IsolateReload_LibraryLookup: Fail
cc/IsolateReload_LibraryShow: Crash
Expand Down Expand Up @@ -421,7 +415,6 @@ cc/Service_TokenStream: Fail
cc/InjectNativeFields1: Crash
cc/InjectNativeFields3: Crash
cc/Service_TokenStream: Crash
cc/IsolateReload_KernelIncrementalCompileAppAndLib: Crash # Issue 30420

[ ($compiler == dartk) && ($runtime == vm) && ($system == macos) ]
cc/IsolateReload_DanglingGetter_Class: Crash
Expand Down
7 changes: 3 additions & 4 deletions runtime/vm/dart_api_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5889,16 +5889,15 @@ Dart_CompileToKernel(const char* script_uri) {
DART_EXPORT Dart_KernelCompilationResult
Dart_CompileSourcesToKernel(const char* script_uri,
int source_files_count,
Dart_SourceFile sources[],
bool incremental_compile) {
Dart_SourceFile sources[]) {
#ifdef DART_PRECOMPILED_RUNTIME
Dart_KernelCompilationResult result;
result.status = Dart_KernelCompilationStatus_Unknown;
result.error = strdup("Dart_CompileSourcesToKernel is unsupported.");
return result;
#else
return KernelIsolate::CompileToKernel(script_uri, source_files_count, sources,
incremental_compile);
return KernelIsolate::CompileToKernel(script_uri, source_files_count,
sources);
#endif
}

Expand Down
211 changes: 0 additions & 211 deletions runtime/vm/isolate_reload_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,217 +67,6 @@ TEST_CASE(IsolateReload_FunctionReplacement) {
EXPECT_EQ(10, SimpleInvoke(lib, "main"));
}

TEST_CASE(IsolateReload_IncrementalCompile) {
const char* kScriptChars =
"main() {\n"
" return 42;\n"
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
int64_t value = 0;
result = Dart_IntegerToInt64(result, &value);
EXPECT_VALID(result);
EXPECT_EQ(42, value);

const char* kUpdatedScriptChars =
"main() {\n"
" return 24;\n"
"}\n"
"";
lib = TestCase::ReloadTestScript(kUpdatedScriptChars);
EXPECT_VALID(lib);
result = Dart_Invoke(lib, NewString("main"), 0, NULL);
result = Dart_IntegerToInt64(result, &value);
EXPECT_VALID(result);
EXPECT_EQ(24, value);
}

TEST_CASE(IsolateReload_KernelIncrementalCompile) {
// clang-format off
Dart_SourceFile sourcefiles[] = {
{
"file:///test-app",
"main() {\n"
" return 42;\n"
"}\n",
},
{
"file:///.packages", "untitled:/"
}};
// clang-format on

Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
NULL /* resolver */, true /* finalize */, true /* incrementally */);
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
int64_t value = 0;
result = Dart_IntegerToInt64(result, &value);
EXPECT_VALID(result);
EXPECT_EQ(42, value);

// clang-format off
Dart_SourceFile updated_sourcefiles[] = {
{
"file:///test-app",
"main() {\n"
" return 24;\n"
"}\n"
""
}};
// clang-format on
{
void* kernel_pgm = NULL;
char* error = TestCase::CompileTestScriptWithDFE(
"file:///test-app",
sizeof(updated_sourcefiles) / sizeof(Dart_SourceFile),
updated_sourcefiles, &kernel_pgm, true /* incrementally */);
EXPECT(error == NULL);
EXPECT_NOTNULL(kernel_pgm);

lib = TestCase::ReloadTestKernel(kernel_pgm);
EXPECT_VALID(lib);
}
result = Dart_Invoke(lib, NewString("main"), 0, NULL);
result = Dart_IntegerToInt64(result, &value);
EXPECT_VALID(result);
EXPECT_EQ(24, value);
}

TEST_CASE(IsolateReload_KernelIncrementalCompileAppAndLib) {
// clang-format off
Dart_SourceFile sourcefiles[] = {
{
"file:///test-app.dart",
"import 'test-lib.dart';\n"
"main() {\n"
" return WhatsTheMeaningOfAllThis();\n"
"}\n",
},
{
"file:///test-lib.dart",
"WhatsTheMeaningOfAllThis() {\n"
" return 42;\n"
"}\n",
},
{
"file:///.packages", "untitled:/"
}};
// clang-format on

Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
NULL /* resolver */, true /* finalize */, true /* incrementally */);
EXPECT_VALID(lib);
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
int64_t value = 0;
result = Dart_IntegerToInt64(result, &value);
EXPECT_VALID(result);
EXPECT_EQ(42, value);

// clang-format off
Dart_SourceFile updated_sourcefiles[] = {
{
"file:///test-lib.dart",
"WhatsTheMeaningOfAllThis() {\n"
" return 24;\n"
"}\n"
""
}};
// clang-format on
{
void* kernel_pgm = NULL;
char* error = TestCase::CompileTestScriptWithDFE(
"file:///test-app",
sizeof(updated_sourcefiles) / sizeof(Dart_SourceFile),
updated_sourcefiles, &kernel_pgm, true /* incrementally */);
EXPECT(error == NULL);
EXPECT_NOTNULL(kernel_pgm);

lib = TestCase::ReloadTestKernel(kernel_pgm);
EXPECT_VALID(lib);
}
result = Dart_Invoke(lib, NewString("main"), 0, NULL);
result = Dart_IntegerToInt64(result, &value);
EXPECT_VALID(result);
EXPECT_EQ(24, value);
}

TEST_CASE(IsolateReload_KernelIncrementalCompileGenerics) {
// clang-format off
Dart_SourceFile sourcefiles[] = {
{
"file:///test-app.dart",
"import 'test-lib.dart';\n"
"class Account {\n"
" int balance() => 42;\n"
"}\n"
"class MyAccountState extends State<Account> {\n"
" MyAccountState(Account a): super(a) {}\n"
"}\n"
"main() {\n"
" return (new MyAccountState(new Account()))\n"
" .howAreTheThings().balance();\n"
"}\n",
},
{
"file:///test-lib.dart",
"class State<T> {\n"
" T t;"
" State(this.t);\n"
" T howAreTheThings() => t;\n"
"}\n",
},
{
"file:///.packages", "untitled:/"
}};
// clang-format on

Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
NULL /* resolver */, true /* finalize */, true /* incrementally */);
EXPECT_VALID(lib);
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
int64_t value = 0;
result = Dart_IntegerToInt64(result, &value);
EXPECT_VALID(result);
EXPECT_EQ(42, value);

// clang-format off
Dart_SourceFile updated_sourcefiles[] = {
{
"file:///test-app.dart",
"import 'test-lib.dart';\n"
"class Account {\n"
" int balance() => 24;\n"
"}\n"
"class MyAccountState extends State<Account> {\n"
" MyAccountState(Account a): super(a) {}\n"
"}\n"
"main() {\n"
" return (new MyAccountState(new Account()))\n"
" .howAreTheThings().balance();\n"
"}\n",
}};
// clang-format on
{
void* kernel_pgm = NULL;
char* error = TestCase::CompileTestScriptWithDFE(
"file:///test-app",
sizeof(updated_sourcefiles) / sizeof(Dart_SourceFile),
updated_sourcefiles, &kernel_pgm, true /* incrementally */);
EXPECT(error == NULL);
EXPECT_NOTNULL(kernel_pgm);

lib = TestCase::ReloadTestKernel(kernel_pgm);
EXPECT_VALID(lib);
}
result = Dart_Invoke(lib, NewString("main"), 0, NULL);
result = Dart_IntegerToInt64(result, &value);
EXPECT_VALID(result);
EXPECT_EQ(24, value);
}

TEST_CASE(IsolateReload_BadClass) {
const char* kScript =
"class Foo {\n"
Expand Down
Loading

0 comments on commit c35510d

Please sign in to comment.