Commit graph

15 commits

Author SHA1 Message Date
Vyacheslav Egorov f496e538f4 [vm] Decouple assemblers from runtime.
This is the next step towards preventing compiler from directly peeking
into runtime and instead interact with runtime through a well defined
surface. The goal of the refactoring to locate all places where compiler
accesses some runtime information and partion those accesses into two
categories:

- creating objects in the host runtime (e.g. allocating strings, numbers, etc)
during compilation;
- accessing properties of the target runtime (e.g. offsets of fields) to
embed those into the generated code;

This change introduces dart::compiler and dart::compiler::target namespaces.

All code in the compiler will gradually be moved into dart::compiler namespace.
One of the motivations for this change is to be able to prevent access to
globally defined host constants like kWordSize by shadowing them in the
dart::compiler namespace.

The nested namespace dart::compiler::target hosts all information about
target runtime that compiler could access, e.g. compiler::target::kWordSize
defines word size of the target which will eventually be made different
from the host kWordSize (defined by dart::kWordSize).

The API for compiler to runtime interaction is placed into compiler_api.h.

Note that we still permit runtime to access compiler internals directly -
this is not going to be decoupled as part of this work.

Issue https://github.com/dart-lang/sdk/issues/31709

Change-Id: If4396d295879391becfa6c38d4802bbff81f5b20
Reviewed-on: https://dart-review.googlesource.com/c/90242
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-25 16:45:13 +00:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07: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
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Srdjan Mitrovic edccf3af0a Cleanup: we are not patching entries any longer
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1376963002 .
2015-09-30 10:22:59 -07:00
Florian Schneider bac82e2592 VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

BUG=
R=koda@google.com, rmacnak@google.com

Committed: 1d343e5a7b

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-19 13:21:09 +02:00
Florian Schneider 7af7a2db87 Revert "VM: New calling convention for generated code."
This reverts commit 1d343e5a7b.

Because of Windows test failures.

BUG=
TBR=whesse@google.com

Review URL: https://codereview.chromium.org//1343373003 .
2015-09-16 13:46:05 +02:00
Florian Schneider 1d343e5a7b VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-16 13:05:58 +02:00
Florian Schneider b5966db69e VM: Clean up and fix bugs in instructions patterns
Fix bug in DecodeLoadWordFromPool: used Array::element_offset instead of ObjectPool::element_offset.
This only worked because they accidentally return the same value.

Remove virtual methods from InstructionsPatterns on ia32 and x64. Instead use a template for code reuse.
This avoids among others vtables for the *Pattern classes and saves >= 4K in VM binary code size.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1301963003 .
2015-08-21 09:31:36 +02:00
John McCutchan baa34257fc Track prologue offset of Code and use for more precise return addresses
- Remember the prologue offset in the Code object.
- Size of Code object does not change.
- Use the prologue offset to assist in locating the return address of the current frame.
- Prologue offset + instruction pattern matching will be accurate for all Dart code, most intrinsic prefixed Dart code, and some stub code.
- By default only collect Dart frames (normal Dart developers only care about Dart frames)

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1150633002
2015-05-21 18:35:19 -07:00
johnmccutchan@google.com f2333f63a5 Add Function based profile tree
Profiler improvements:
- Track Functions in profile and build Function based trie
- Associate code objects with functions
- Created cpu_profile.dart library
- Major speed improvements for disassembly view
- Fix truncation of disassembly comments
- Ability to get code object ticks from disassembly view
- Inlining mini-map in disassembly view.
- Remove a bunch of unused data from profile service response
- In some cases a caller PC that is better than the PC marker is inserted into the stack trace
- Inlined functions are expanded
- Ability to clear profile
- New flag '--keep_code' which keeps deoptimized code around for use by the profiler.

General fixes:
- Fix caching in service library
- Remove pubspec.yaml before running pub get

R=asiva@google.com, rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44067 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 18:48:55 +00:00
zra@google.com df2054dae7 Sets a register aside on x64 for use as a pool-pointer. It is loaded and restored from the code object on Frame entry and exit. All LoadObject calls that can, and many calls and jumps through ExternalLabels now use the pool-pointer. The --compiler-stats flag when running dart2js indicates that code size is reduced ~13%, and more is probably possible.
R=fschneider@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27295 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-09 15:39:26 +00:00
kmillikin@google.com 41e77a0a9e Initial implementation of a flow-graph builder for Dart's AST.
Visit the AST and generate an instruction (ie, not basic-block) flow
graph.

The flow graph for the simple function:

main() {
  var f = 1;
  var n = 5;
  while (n > 0) {
    f = f * n;
    n = n - 1;
  }
  print(f);
}

is:

       1: StoreLocal(f, #1)
       2: StoreLocal(n, #5)
       3: [join]
       4: t0 <-LoadLocal(n)
       5: t0 <-InstanceCall(>, t0, #0)
       6: if t0 goto(7, 15)
       7: [target]
       8: t0 <-LoadLocal(f)
       9: t1 <-LoadLocal(n)
      10: t0 <-InstanceCall(*, t0, t1)
      11: StoreLocal(f, t0)
      12: t0 <-LoadLocal(n)
      13: t0 <-InstanceCall(-, t0, #1)
      14: StoreLocal(n, t0) goto 3
      15: [target]
      16: t0 <-LoadLocal(f)
      17: StaticCall(print, t0)
      18: return #null

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9414003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4460 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 15:20:13 +00:00
srdjan@google.com 5f43c05de7 Implement new inline cache. Delete a lot of unused code (most of change).
Review URL: http://codereview.chromium.org//8379013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@706 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-25 18:35:49 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00