Commit Graph

18 Commits

Author SHA1 Message Date
Ryan Macnak 6b91f92154 [vm] Move megamorphic miss handling into the megamorphic call stub.
This removes the only stub code with a function owner.

Change-Id: I629eb3a1b231430afaf0a2777032bba8eaddd2aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148124
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-15 20:28:21 +00:00
Ryan Macnak 6fe15f6df9 [vm] Represent tagged pointers as C++ value types instead of C++ pointer types.
This works around bugs in UndefinedBehaviorSanitizer and Clang.

Bug: b/28638298
Change-Id: I6be595f9664516019d28017d24559583a1ae3a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144354
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-25 05:21:27 +00:00
Ryan Macnak 67bb2b7819 [vm, compiler] Consistently use CallTargets instead of ICData or MegamorphicCache.
Bug: https://github.com/dart-lang/sdk/issues/37575
Change-Id: I15f3862af380b04498cb58c8658aa6de76212733
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114445
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-09-04 18:49:40 +00:00
Ryan Macnak 0176526799 [vm, compiler] Always clone MegamorphicCaches before accessing on a background compiler thread.
This is to prevent the compiler from becoming confused by mutations from the Dart execution thread.

Bug: https://github.com/dart-lang/sdk/issues/37575
Bug: https://github.com/dart-lang/sdk/issues/37595
Change-Id: I43c42feff54d76b780beb6e8d627f1b1641f4bee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114054
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-08-22 18:26:39 +00:00
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
Martin Kustermann f205292227 [VM] Bare instructions - Part 4: Add --use-bare-instructions flag to AOT compiler & runtime
This is the final CL which adds a new --use-bare-instructions flag to
the VM.

If this flag is set during AOT compilation, we will:

  * Build one global object pool (abbr: GOP) which all code objects
    share. This gop will be stored in the object store.  The PP register
    is populated in the enter dart stub and it is restored when
    returning from native calls.

  * Gets rid of the CODE_REG/PP slots from the dart frames. Instead the
    compiled code uses the global object pool, which is always in PP.

  * Starts emitting pc-relative calls for calls between two dart
    functions or when invoking a stub.
    Limitation: We only emit pc-relative calls between two code objects
    in the same isolate (this is because the image writer is writing
    instruction objects for vm-isolate/main-isolate seperately)

  * We do compile-time relocation of those static calls after the
    precompiler has finished its work, but before writing the snapshot.
    This patches all the instruction objects with pc-relative calls to
    have the right .text distance.

  * We emit a sorted list of code objects in ObjectStore::reverse_code_table,
    which will be used by the AOT runtime to go back from PC to Code
    objects (where all metadata, e.g. stack maps, catch entry moves, pc
    descriptors are available).

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

Change-Id: I6c5dd2b1571e3a889b27e804a24c2986c71e03b6
Reviewed-on: https://dart-review.googlesource.com/c/85769
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-12-14 16:03:04 +00:00
Aske Simon Christensen 8cb752f73b Revised "Eliminate dependencies on assemblers and code stubs in precompiled runtime."
Explicitly clear unbox_numeric_fields flag in PRODUCT builds. Fixes code bloat introduced by previous CL. New changes in Patch Set 2.

BUG= https://github.com/dart-lang/sdk/issues/30045
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/3006923002 .
2017-09-04 13:13:26 +02:00
Ryan Macnak 9ce7fb5929 Revert "Reapply "Eliminate dependencies on assemblers and code stubs in precompiled runtime.""
This reverts commit 8ee4436355.

This change caused a 63% increase in AOT snapshot size of Flutter Gallery.

Issue #30472

Review-Url: https://codereview.chromium.org/2997993002 .
2017-08-17 13:33:37 -07:00
Aske Simon Christensen 8ee4436355 Reapply "Eliminate dependencies on assemblers and code stubs in precompiled runtime."
Also exclude references to disassembler in precompiled mode.

New edits are in patch set #2.

BUG= https://github.com/dart-lang/sdk/issues/30045
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2994863002 .
2017-08-12 02:15:23 +02:00
Ryan Macnak 3afd223f90 [gardening] Revert "Eliminate dependencies on assemblers and code stubs in precompiled runtime."
This reverts commit 46c53882cc.

This changes introduced link errors on Windows.

Review-Url: https://codereview.chromium.org/3001463002 .
2017-08-09 15:49:51 -07:00
Aske Simon Christensen 46c53882cc Eliminate dependencies on assemblers and code stubs in precompiled runtime.
Guard all excluded code behind conditional compilation.

Removed precompiled runtime flag. Only preprocessor flag remains.

BUG= https://github.com/dart-lang/sdk/issues/30045
R=rmacnak@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2976723003 .
2017-08-09 22:21:34 +02: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
Ryan Macnak 9de6b3be0a Move selector and arguments descriptor into MegamorphicCache.
Towards making call sites swappable between ICs and MegamorphicCaches.

R=srdjan@google.com

Review URL: https://codereview.chromium.org/1420433004 .
2015-10-20 13:44:21 -07:00
Ryan Macnak 491b1d42f8 Reapply "Move megamorphic cache table into the Dart heap."
Prevent megamorphic miss function from losing its code:
 - Only include megamorphic function in precompiled snapshots.
 - Also put the megamorphic miss code in the object store.

R=asiva@google.com

Review URL: https://codereview.chromium.org//1339363002 .
2015-09-15 11:18:43 -07:00
Ryan Macnak 33b037125f Revert "Move megamorphic cache table into the Dart heap."
We're somewhere attempting to recompile the megamoprhic miss function.

Review URL: https://codereview.chromium.org//1334283004 .
2015-09-14 17:54:43 -07:00
Ryan Macnak 3068f1e092 Move megamorphic cache table into the Dart heap.
R=asiva@google.com

Review URL: https://codereview.chromium.org//1346473002 .
2015-09-14 17:11:55 -07:00
zra@google.com daf539e2f9 Fixes a couple problems with GC of unoptimized code.
1. Instead of making a pass before the Marking phase,
   this change does not visit code pointers in functions
   during marking. Then after marking, if the code has
   still not been marked, code pointers in functions
   are nulled out.
2. Since code pointers in functions may be nulled out,
   functions are no longer used as proxies for code in
   deoptimization info.

R=iposva@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30600 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-23 00:17:28 +00:00
kmillikin@google.com a119414b2f Cache lookups at megamorphic call sites in optimized code.
The function name and argument descriptor are mapped to a lookup cache
at compile time.  The cache maps class id to target function.  It is
resizable.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15889 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-10 09:48:52 +00:00