Commit Graph

26 Commits

Author SHA1 Message Date
Jens Johansen e7766c950e Debugging in kernel shaping up.
This introduces

- a list of valid token positions, so debugging actually
  starts to work, and the observatory can be loaded without crash.

- a list of valid yield positions, so stepping over await stuff
  works as expected.

- Adding "DebugStepCheckInstr" to the kernel generated il so stepping
  over await stuff works as expected, we can break in empty methods etc.

With this, approximately 80% of the service tests pass in kernel mode.

R=kmillikin@google.com

Committed: https://github.com/dart-lang/sdk/commit/2d5147be9d7435c06dd892d145d8717b6d1f62d5
Review-Url: https://codereview.chromium.org/2632183002 .
2017-01-31 11:59:06 +01:00
Jens Johansen d0e0ef52ef Revert "Debugging in kernel shaping up."
This reverts commit 2d5147be9d.

INTPTR_MAX doesn't exist on all builders.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2664143002 .
2017-01-31 11:26:46 +01:00
Jens Johansen 2d5147be9d Debugging in kernel shaping up.
This introduces

- a list of valid token positions, so debugging actually
  starts to work, and the observatory can be loaded without crash.

- a list of valid yield positions, so stepping over await stuff
  works as expected.

- Adding "DebugStepCheckInstr" to the kernel generated il so stepping
  over await stuff works as expected, we can break in empty methods etc.

With this, approximately 80% of the service tests pass in kernel mode.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2632183002 .
2017-01-31 11:01:29 +01:00
Martin Kustermann e97bcc5475 VM: [Kernel] Partial support for metadata annotations
The CL adds metadata support for Fields/Classes/Functions/Constructors. There
are other places where annotations can be put in the Dart language but the
Kernel IR currently does not store it in the AST.

Whenever a element (e.g. a function) gets annotated, the VM will make a [Field] for this
element whos value is an array of evaluated constant metadata annotations.

This CL attaches to these [Fields] a `kernel_function` which is then used to do the constant
evaluation.

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2632253002 .
2017-01-18 10:51:24 +01:00
Jens Johansen b2b00e8909 TokenPositions on more nodes when running from Kernel
Utilize the offsets added in previous CLs.
While this doesn't by it self give anything that resembles
a good debugging experience, it should now be possible to
set *some* breakpoints and actually break on them.

Because of the way observatory works (and because of an
unfinished Script::GenerateLineNumberArray (for kernel))
the formatting of the code you try to load up and 'debug'
has to be quite specific (e.g. no indentation at all),
and even then it mostly doesn't work.

This is step #3 in introducing these things, next step(s) will be
fixing stuff like the above.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2628693004 .
2017-01-13 13:10:20 +01:00
Kevin Millikin a39234eede Small cleanups in the Kernel FlowGraphBuilder
- The flow graph builder is only used to visit Statements and
  Expressions so it does not need TreeVisitor as a base class.  This
  will make refactoring it easier.

- The TranslationHelper is bound to a Thread so we do not need
  Thread::Current where we have a TranslationHelper.

- BlockExpression does not exist in Kernel any more, so it can be
  removed from the C++ AST implementation.

BUG=
R=kustermann@google.com

Review-Url: https://codereview.chromium.org/2624513005 .
2017-01-10 10:50:56 +01:00
Jens Johansen aecb572d76 Include source in kernel.
- For now include source uncompressed.
- When running from kernel, use token position 0
  (i.e. dummy, but 'real' position) as start and end on functions
  and classes to enable Observatory to run with the dill file.
- Debugging does not work, but one can browse the source in
  Observatory.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2587673004 .
2017-01-03 14:33:16 +01:00
Jens Johansen 760c048798 Set correct script on fields in kernel.
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2583153002 .
2017-01-03 09:56:49 +01:00
Martin Kustermann ff8951a515 VM: [Kernel] Allocate objects in KernelReader/kernel::FlowGraphBuilder in Heap::kOld if appropriate
If we generate too much surviving objects in Heap::kNew during program reading
time or flow graph construction time we trigger (very aggressive) growth of new
space.

R=vegorov@google.com

Review URL: https://codereview.chromium.org/2539173002 .
2016-12-01 13:51:29 +01:00
Vyacheslav Egorov 8eceda053f VM: [Kernel] Don't add implicit getters for top level fields into the library dictionary.
Tree shaker can't cope with this and produces incorrect snapshots that contains tree shaken classes.

R=kustermann@google.com
BUG=

Review URL: https://codereview.chromium.org/2536683002 .
2016-11-28 15:50:24 +01:00
Vyacheslav Egorov 73ef820ec1 VM: [Kernel] Relax assertions in SSA construction and in Kernel loading.
- Kernel-to-IL translation leaves behind some unused constants without temp indices assigned.

- Let compile time errors propagate instead of failing with FATAL error in the post load class finalization.

R=kustermann@google.com
BUG=

Review URL: https://codereview.chromium.org/2528763002 .
2016-11-24 16:19:22 +01:00
Jens Johansen f0da43445e Use field.RawOwner() for initializer to keep correct script.
E.g.

file1:
------------
library crash;

part "file2.dart";

main() {
  print(field2);
}

crash() {
  try {
    throw "Crashing!";
  } catch(exception, stacktrace) {
    print(stacktrace);
  }
}

file2:
------------
part of crash;

var field2 = crash();

We want something like

#0      crash (whatnot/file1.dart:11:5)
#1      field2 (whatnot/file2.dart:3:14) <-- good line
#2      field2 (whatnot/file2.dart:3:5)
#3      main (whatnot/file1.dart:6:9)

and not like

#0      crash (whatnot/file1.dart:11:5)
#1      field2 (whatnot/file1.dart:3:14) <-- bad line
#2      field2 (whatnot/file2.dart:3:5)
#3      main (whatnot/file1.dart:6:9)

R=kmillikin@google.com

Review URL: https://codereview.chromium.org/2519133004 .
2016-11-24 09:27:25 +01:00
Martin Kustermann 1aff626804 VM: [Kernel] Split kernel API into 3 steps: ([read binary], parse-binary, bootstrap, load program)
This avoids reading and parsing the kernel binary multiple times and avois
having it multiple times in memory (we don't free the 'kernel::Program*' object
ATM).

R=kmillikin@google.com

Review URL: https://codereview.chromium.org/2525623002 .
2016-11-23 09:26:15 +01:00
Martin Kustermann d41ea8ca6a VM: [Kernel] Fix bad-merge after rebasing
Review URL: https://codereview.chromium.org/2513393005 .
2016-11-21 17:31:20 +01:00
Martin Kustermann 27aeb31a8d VM: [Kernel] Cherry-pick from dart-lang/kernel_sdk
Do not eagerly finalize types in procedures.

Translate types in procedures without finalizing them.  This change
supercedes https://chromereviews.googleplex.com/516397015/.

Review URL: https://chromereviews.googleplex.com/521117013 .

R=vegorov@google.com

Review URL: https://codereview.chromium.org/2521603002 .
2016-11-21 16:43:53 +01:00
Martin Kustermann 63af3f56ee VM: [Kernel] Cherry-pick from dart-lang/kernel_sdk
Fix a trio of issues in type finalization.

1. We were using is_type_finalized to detect classes that had already been
   initialized by DilReader::ReadPreliminaryClass.  This state is not
   guaranteed by this function, however is_cycle_free is.

2. In the VM, classes that were created type finalized were not marked as
   cycle free because finalization did not consider them so cycle-freeness
   didn't matter.  We would therefore try to initialize these classes with
   DilReader::ReadPreliminaryClass and mutate types in them.  This causes
   them to have unfinalized types but still have is_type_finalized true.

3. Types in top-level procedures were not necessarily finalized.  A simple
   way to achieve this is to finalize each library's top-level class.

Review URL: https://chromereviews.googleplex.com/520437013 .

R=kmillikin@google.com

Review URL: https://codereview.chromium.org/2514373002 .
2016-11-21 16:38:30 +01:00
Vyacheslav Egorov 46fcf14475 VM: [Kernel] Don't use Parser::ParseStaticFieldInitializer for fields that come from Kernel.
Introduce separate function kernel::ParseStaticFieldInitializer to handle these fields.

R=kustermann@google.com
BUG=

Review URL: https://codereview.chromium.org/2515763002 .
2016-11-21 15:53:00 +01:00
Jens Johansen 63e9c7641b Merge of source position information from kernel-sdk.
I.e. use offsets (on some nodes) in the dill file to
get stacktraces with line- and column numbers.

"sdk" version of "kernel-sdk"s
https://chromereviews.googleplex.com/520617013/

R=kmillikin@google.com

Review URL: https://codereview.chromium.org/2512653002 .

Committed: https://github.com/dart-lang/sdk/commit/6fd3a42edb4c7902a49811318de6bb6b18dbd829
2016-11-21 14:13:46 +01:00
Jens Johansen 1056c562aa Revert "Merge of source position information from kernel-sdk."
The commit broke 2 tests:
vm/cc/IsolateReload_TypeIdentityGeneric
vm/cc/SourceReport_Coverage_AllFunctions_ForceCompile

This reverts commit 6fd3a42edb.

BUG=

Review URL: https://codereview.chromium.org/2517953002 .
2016-11-21 11:16:29 +01:00
Jens Johansen 6fd3a42edb Merge of source position information from kernel-sdk.
I.e. use offsets (on some nodes) in the dill file to
get stacktraces with line- and column numbers.

"sdk" version of "kernel-sdk"s
https://chromereviews.googleplex.com/520617013/

R=kmillikin@google.com

Review URL: https://codereview.chromium.org/2512653002 .
2016-11-21 10:19:31 +01:00
Vyacheslav Egorov 30e01bcd67 VM: [Kernel] Relax assertion in Script::GetTokenLocation().
Kernel binaries do not carry token streams.

Introduce a dummy URI to identify dummy Script objects created for Kernel entities.

R=rmacnak@google.com
BUG=

Review URL: https://codereview.chromium.org/2511883002 .
2016-11-18 15:58:16 +01:00
Vyacheslav Egorov 23fd1a184b VM: Support bootstrapping core libraries from Kernel binaries instead of source.
BUG=http://dartbug.com/27590
R=asiva@google.com

Review URL: https://codereview.chromium.org/2485993002 .
2016-11-16 13:56:20 +01:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Martin Kustermann ab172a32d9 VM: [Kernel] Remove special-casing in FGB which is now handled by the frontend
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2473593003 .
2016-11-02 19:54:11 +01:00
Martin Kustermann 75eb4a6fc2 [Kernel] Remove handling of mixin classes in kernel support, since they are desugared in the frontend
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2466413004 .
2016-11-02 09:54:17 +01:00
Vyacheslav Egorov f67ce21068 VM support for running Kernel binaries.
BUG=
R=asiva@google.com, fschneider@google.com

Review URL: https://codereview.chromium.org/2411823003 .
2016-10-15 22:48:46 +02:00