Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for "naked" instructions: global object pool, pc-relative static calls, faster indirect calls, potential code sharing #33274

Closed
mkustermann opened this issue May 30, 2018 · 5 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@mkustermann
Copy link
Member

After we no longer execute any code during AOT compilation (see #33185), we can start making "naked" instructions, i.e.:

  • use global object pool
  • use pc-relative static calls
  • faster instance calls
  • share more common code
@mkustermann mkustermann self-assigned this May 30, 2018
@a-siva a-siva added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label May 30, 2018
@a-siva
Copy link
Contributor

a-siva commented May 30, 2018

Can you elaborate on what is "naked" instructions ?

@rmacnak-google
Copy link
Contributor

Without an object header, not in heap page, etc.

Both the within snapshot duplication and and cross snapshot sharing are likely to make pc-relative calls tricky.

dart-bot pushed a commit that referenced this issue Jun 7, 2018
So far the frontend (parser, flow graph builder, ssa construction) were
aware of the actual frame layout.

This CL makes the indices we assign to [LocalVariable]s logical
indices, assigning:

  * M parameters the indices      1 ... M
  * N local variables the indices 0 -1 ... -(N-1)

The scope building, flow graph builder and ssa construction operate on
those logical indices.

When emitting actual code, the backend will translate those indices into
actual FP relative indices. This allows us to be more flexible in the
backend which frame layout we choose.

Issue #33274

Change-Id: I9a504bf97821c257aafd2b3430df9f4c9da4b442
Reviewed-on: https://dart-review.googlesource.com/57321
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Jun 11, 2018
This decouples the scope building from knowing about frame layout.

Issue #33274

Change-Id: I9058b242fb24f859f54d6e3660a5972df86d39e6
Reviewed-on: https://dart-review.googlesource.com/59093
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Aug 21, 2018
…rate code

This will allow us to have configurable frame layouts during
gen_snapshot/dart_bootstrap.

Issue #33274

Change-Id: I18945189034be1a585c1e2edcf53a4b7537204c2
Reviewed-on: https://dart-review.googlesource.com/59880
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
@mkustermann
Copy link
Member Author

Landed 8c30475 for this issue.

@mkustermann
Copy link
Member Author

Landed 33632ad for this issue.

dart-bot pushed a commit that referenced this issue Aug 23, 2018
This allows initializing a new pool from an old pool while preserving
the patchability bit.

Issue #33274

Change-Id: I369bb852aea8e183da2fbf7ca3571312dc5fda27
Reviewed-on: https://dart-review.googlesource.com/71162
Reviewed-by: Ryan Macnak <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
dart-bot pushed a commit that referenced this issue Aug 23, 2018
Issue #33274

Change-Id: I2e295a357939bc7c966c0658c344fcc4268669c1
Reviewed-on: https://dart-review.googlesource.com/71166
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Aug 23, 2018
Issue #33274

Change-Id: Ic27c89f1cffbad6c58ab3758f455d24863d9d675
Reviewed-on: https://dart-review.googlesource.com/71168
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
dart-bot pushed a commit that referenced this issue Aug 31, 2018
… ARM

This reduces AOT flutter gallery RX size by 0.81 %.

Issue #33274

Change-Id: I1a3c3f48af9ae5d89d3d89da1d86c798145dbd99
Reviewed-on: https://dart-review.googlesource.com/72383
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Sep 11, 2018
…ller tail-calls in various places

Decreases flutter gallery RX size by 1.5 % on ARM
Decreases flutter gallery RX size by 1.3 % on ARM64

Improves arm performance (significantly), e.g. DeltaBlue +6.8%, many typed data benchmarks +xx%
Improves arm64 performance, e.g. DeltaBlue +3.1%


Issue #33274

Change-Id: Iaa6cc31597e0bcde471ec2e966730c3f2c9fdd05
Reviewed-on: https://dart-review.googlesource.com/73180
Reviewed-by: Vyacheslav Egorov <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
dart-bot pushed a commit that referenced this issue Sep 11, 2018
…-obj in switchable calls

Decreases flutter gallery RX size by 0.5 % on ARM64
Increases ARM64 perf, e.g. by 3.8% DeltaBlue

Issue #33274

Change-Id: I32e9be0d1df2fc50d287761d75b6db60c187d225
Reviewed-on: https://dart-review.googlesource.com/73902
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
dart-bot pushed a commit that referenced this issue Sep 11, 2018
… performance

Decreases flutter gallery RX size by 0.5 % on ARM
Decreases flutter gallery RX size by 0.85 % on ARM64
Increases performance slightly of various benchmarks, e.g. DeltaBlue by 2.2% on ARM64-aot

Issue #33274

Change-Id: I258eae5bdc33d0220d0e73f60ad21824da5ec7f1
Reviewed-on: https://dart-review.googlesource.com/72762
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Oct 23, 2018
Issue #33274

Change-Id: I7ec37a57c968baa9a3099379cbecb306cd06b464
Reviewed-on: https://dart-review.googlesource.com/c/72780
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Oct 26, 2018
…et_table array

This is preparation for adding other kinds of static calls, e.g.
pc-relative calls.

Issue #33274

Change-Id: Ief83aa3571036fabd72c2f82f946ca4757c76cb1
Reviewed-on: https://dart-review.googlesource.com/c/81407
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
dart-bot pushed a commit that referenced this issue Oct 29, 2018
Issue #33274

Change-Id: Ie7189081b3acac53a80a399b1353261c2312da79
Reviewed-on: https://dart-review.googlesource.com/c/81641
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Nov 1, 2018
…ecompiler.cc

This is preparation work for a global object pool, which will not be attached
to the Code objects.

Issue #33274

Change-Id: Ia1746ea657fe6d8e9adb7552d6835425ff65542c
Reviewed-on: https://dart-review.googlesource.com/c/82064
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
dart-bot pushed a commit that referenced this issue Nov 1, 2018
Issue #33274

Change-Id: I0297c4bb502a1af28e3cf16646eade49f4cd0676
Reviewed-on: https://dart-review.googlesource.com/c/81827
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Nov 1, 2018
This makes the ImageWriter remember at which offsets it wrote
RawInstructions.

This is preparation work for allowing the ImageWriter write the
instructions in a specific order (currently instructions are written
"on-demand" when the object serializer encounters references to them)

Issue #33274

Change-Id: Ie50cf8a600dd4e9ce0413fe4189d4f2211f0325e
Reviewed-on: https://dart-review.googlesource.com/c/82065
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Nov 2, 2018
…SASSEMBLER is defined

This helps VM developers working with product mode.

Issue #33274

Change-Id: I1933dea6f2d88c4745c63be772cfe301259f4a9c
Reviewed-on: https://dart-review.googlesource.com/c/82583
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
dart-bot pushed a commit that referenced this issue Nov 2, 2018
…use kernel2kernel constant evaluation

Issue #33274

Change-Id: I3474ceaca807a03cb3813e97fa47c3e43e495e24
Reviewed-on: https://dart-review.googlesource.com/c/82600
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
dart-bot pushed a commit that referenced this issue Nov 6, 2018
… without handles

Issue #33274

Change-Id: Ib1a06c21ada1f12f3bc258c9284592c483d260f3
Reviewed-on: https://dart-review.googlesource.com/c/82586
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Nov 6, 2018
Issue #33274

Change-Id: I556272952e6d7846721c6d48ef0ffbae5891cfde
Reviewed-on: https://dart-review.googlesource.com/c/82587
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Dec 13, 2018
…iter in which order instructions should be written

Issue #33274

Change-Id: If8c967d3ecafc551938271ce52157c5c4f384dff
Reviewed-on: https://dart-review.googlesource.com/c/85764
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Dec 13, 2018
… mode

Start ordering instructions before writing them out in AOT snapshots.

This is done by:

  * discovery of relevant code objects
  * ordering of the code objects (currently simply discovery order)
  * relocate any pc-relative calls by patching up pc-relative calls with
    the actual distance
  * producing image writer commands which tell it in which order and at
    which .text offsets to write out instructions

Note: Our compiler currently does not emit any pc-relative calls. This
will be added later on.

Issue #33274

Change-Id: I0153c32a7427ea395e80489efadd5513fe7ca371
Reviewed-on: https://dart-review.googlesource.com/c/85745
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Dec 13, 2018
…e mapping table

This CL adds a [ReversePcLookupCache] which, based on a list of code
objects, builds up a binary searchable table for mapping PCs to Code
objects (where all the metadata is available, like stackmaps, ...).

This CL also adds stack walking support for "bare instruction" frames.

In a later part we will start emitting the sorted list of code objects
(via the new field in the object store) under a flag.

Issue #33274

Change-Id: I3c06c12bc0fb266dc1bd843a4a11b5208773151d
Reviewed-on: https://dart-review.googlesource.com/c/85746
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Dec 14, 2018
…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 #33274

Change-Id: I6c5dd2b1571e3a889b27e804a24c2986c71e03b6
Reviewed-on: https://dart-review.googlesource.com/c/85769
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Dec 14, 2018
…witchableCalls

If the --use-bare-instructions flag is enabled we will:

  * Make call sites load the target directly from the pool (instead of
    the code object) - this saves one instruction (and an indirect load)

  * Ensure the object pool will have direct entry addresses by:

     - Letting the clustered snapshot reader change any StubCode::UnlinkedCall()
       in the object pool by it's monomorphic entry
     - Change the code patcher to patch SwitchableCalls by writing the
       monomorphic entry into the pool (instead of the code object)

Issue #33274

Change-Id: I4e41fc8e4461bde477cc559a6a4fccaaf3a350b5
Reviewed-on: https://dart-review.googlesource.com/c/86160
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Dec 14, 2018
…allThroughCode/CallThroughFunction stubs

If the --use-bare-instructions flag is enabled we will:

  * Not load CODE_REG inside CallThroughCode (polymorphic case)

  * Not load CODE_REG inside CallThroughFunction (megamorphic case)

  * Store the EntryPoint of the function in the MegamorphicCache tables
    (instead of a Function pointer)

Issue #33274

Change-Id: I8aca689dc4e92ece897972da4ae202338527ac62
Reviewed-on: https://dart-review.googlesource.com/c/86928
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Jan 9, 2019
…instructions mode.

Now that we have a moving GC it's no longer sufficient to rely on callee-saving
behavior of PP.

This change also ensures that all calls go through RuntimeEntry::Call() .

Issue #33274

Change-Id: I159986dc18a9b201175fd4a7064a24a1533790ef
Reviewed-on: https://dart-review.googlesource.com/c/88711
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
dart-bot pushed a commit that referenced this issue Jan 9, 2019
… instructions mode

This saves around 1.5% RX on gallery in dart-aot (profile) mode when using bare instructions.

Issue #33274

Change-Id: I6b72e5d9ee9e3785d9adb46a7fc542f80a07f8ba
Reviewed-on: https://dart-review.googlesource.com/c/88449
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
dart-bot pushed a commit that referenced this issue Jan 17, 2019
…alls

This CL adds support to the ImageWriter to write opaque blocks of
trampoline bytes

The AOT code relocator is adapted to allow limited range calls and
inserts trampolines if need be. The algorithm tries to minimize the
number of trampolines added, which for small applications will be 0.

The unconditional pc-relative calls have limited range:
  * on ARM (+/-32 MB)
  * on ARM64 (+/-128 MB)

To avoid verbose code for doubly-linked list, this CL adds double_list.h

Issue #33274

Change-Id: I0354cf4b2dd58ed5de25d67fc818f0603a2ec501
Reviewed-on: https://dart-review.googlesource.com/c/89283
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Jan 17, 2019
…elative calls

This CL improves AOT code for StackOverflowInstr/CheckNullInstr:

  * On ARM we can do a conditional pc-relative calls for the stack overflow
    checks, getting rid of the slow-paths entirely.

  * On ARM64 we can do pc-relative calls on the slow path, avoiding an
    extra load.

Flutter gallery size impact (in bare instructions mode):
  * ARM: -3.7% RX
  * ARM64: -1.4% RX

Issue #33274

Change-Id: Ia1acd76ac6efa26642f99e1ce3e417100aa357f3
Reviewed-on: https://dart-review.googlesource.com/c/89620
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Jan 18, 2019
…RM64/X64

ARM write barrier goes from

   ldrne lr, [thr, #+508]
   blxne lr
to
   blne <offset>

ARM64 write barrier goes from (similarly X64)

   beq +8
   ldrx lr, [thr, #1056]
   blr lr
to
   beq +4
   bl <offset>

It reduces RX on arm/arm64 by around 0.9%

Though the write barrier wrappers stub has multiple entrypoints (one for
each available register).  Because of this, we modify the relocation
logic to support per-call offsets into the target.

To avoid making the assembler code depend on StubCode/FlowGraphCompiler,
we set a closure, which the assembler can call.

Issue #33274

Change-Id: I9e3d68260cab7ef19ea88f1235c78d6031819d6d
Reviewed-on: https://dart-review.googlesource.com/c/90063
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Jan 19, 2019
… walking

Issue #33274

Change-Id: Ib6afdbc80012326134d409c4065a680d67de3ed8
Reviewed-on: https://dart-review.googlesource.com/c/90064
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
dart-bot pushed a commit that referenced this issue Jan 23, 2019
…napshots

Issue #33274

Change-Id: I2dca1fb9a8807294fb756ea796bb7560bb6d17cc
Reviewed-on: https://dart-review.googlesource.com/c/90221
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
dart-bot pushed a commit that referenced this issue Jan 25, 2019
Issue #33274

Change-Id: I44850d5906143a53d6b1872eb729364c3a509f9a
Reviewed-on: https://dart-review.googlesource.com/c/91060
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Siva Annamalai <[email protected]>
@mraleph
Copy link
Member

mraleph commented Mar 16, 2019

This work has been completed. \o/

@mraleph mraleph closed this as completed Mar 16, 2019
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
…rate code

This will allow us to have configurable frame layouts during
gen_snapshot/dart_bootstrap.

Issue dart-lang#33274

Change-Id: I18945189034be1a585c1e2edcf53a4b7537204c2
Reviewed-on: https://dart-review.googlesource.com/59880
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
This allows initializing a new pool from an old pool while preserving
the patchability bit.

Issue dart-lang#33274

Change-Id: I369bb852aea8e183da2fbf7ca3571312dc5fda27
Reviewed-on: https://dart-review.googlesource.com/71162
Reviewed-by: Ryan Macnak <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
Issue dart-lang#33274

Change-Id: I2e295a357939bc7c966c0658c344fcc4268669c1
Reviewed-on: https://dart-review.googlesource.com/71166
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
… ARM

This reduces AOT flutter gallery RX size by 0.81 %.

Issue dart-lang#33274

Change-Id: I1a3c3f48af9ae5d89d3d89da1d86c798145dbd99
Reviewed-on: https://dart-review.googlesource.com/72383
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
…ller tail-calls in various places

Decreases flutter gallery RX size by 1.5 % on ARM
Decreases flutter gallery RX size by 1.3 % on ARM64

Improves arm performance (significantly), e.g. DeltaBlue +6.8%, many typed data benchmarks +xx%
Improves arm64 performance, e.g. DeltaBlue +3.1%


Issue dart-lang#33274

Change-Id: Iaa6cc31597e0bcde471ec2e966730c3f2c9fdd05
Reviewed-on: https://dart-review.googlesource.com/73180
Reviewed-by: Vyacheslav Egorov <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
…-obj in switchable calls

Decreases flutter gallery RX size by 0.5 % on ARM64
Increases ARM64 perf, e.g. by 3.8% DeltaBlue

Issue dart-lang#33274

Change-Id: I32e9be0d1df2fc50d287761d75b6db60c187d225
Reviewed-on: https://dart-review.googlesource.com/73902
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
… performance

Decreases flutter gallery RX size by 0.5 % on ARM
Decreases flutter gallery RX size by 0.85 % on ARM64
Increases performance slightly of various benchmarks, e.g. DeltaBlue by 2.2% on ARM64-aot

Issue dart-lang#33274

Change-Id: I258eae5bdc33d0220d0e73f60ad21824da5ec7f1
Reviewed-on: https://dart-review.googlesource.com/72762
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
…et_table array

This is preparation for adding other kinds of static calls, e.g.
pc-relative calls.

Issue dart-lang#33274

Change-Id: Ief83aa3571036fabd72c2f82f946ca4757c76cb1
Reviewed-on: https://dart-review.googlesource.com/c/81407
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
Issue dart-lang#33274

Change-Id: Ie7189081b3acac53a80a399b1353261c2312da79
Reviewed-on: https://dart-review.googlesource.com/c/81641
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
…ecompiler.cc

This is preparation work for a global object pool, which will not be attached
to the Code objects.

Issue dart-lang#33274

Change-Id: Ia1746ea657fe6d8e9adb7552d6835425ff65542c
Reviewed-on: https://dart-review.googlesource.com/c/82064
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
Issue dart-lang#33274

Change-Id: I0297c4bb502a1af28e3cf16646eade49f4cd0676
Reviewed-on: https://dart-review.googlesource.com/c/81827
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
…SASSEMBLER is defined

This helps VM developers working with product mode.

Issue dart-lang#33274

Change-Id: I1933dea6f2d88c4745c63be772cfe301259f4a9c
Reviewed-on: https://dart-review.googlesource.com/c/82583
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
Issue dart-lang#33274

Change-Id: I556272952e6d7846721c6d48ef0ffbae5891cfde
Reviewed-on: https://dart-review.googlesource.com/c/82587
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
…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 dart-lang#33274

Change-Id: I6c5dd2b1571e3a889b27e804a24c2986c71e03b6
Reviewed-on: https://dart-review.googlesource.com/c/85769
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
…witchableCalls

If the --use-bare-instructions flag is enabled we will:

  * Make call sites load the target directly from the pool (instead of
    the code object) - this saves one instruction (and an indirect load)

  * Ensure the object pool will have direct entry addresses by:

     - Letting the clustered snapshot reader change any StubCode::UnlinkedCall()
       in the object pool by it's monomorphic entry
     - Change the code patcher to patch SwitchableCalls by writing the
       monomorphic entry into the pool (instead of the code object)

Issue dart-lang#33274

Change-Id: I4e41fc8e4461bde477cc559a6a4fccaaf3a350b5
Reviewed-on: https://dart-review.googlesource.com/c/86160
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
…elative calls

This CL improves AOT code for StackOverflowInstr/CheckNullInstr:

  * On ARM we can do a conditional pc-relative calls for the stack overflow
    checks, getting rid of the slow-paths entirely.

  * On ARM64 we can do pc-relative calls on the slow path, avoiding an
    extra load.

Flutter gallery size impact (in bare instructions mode):
  * ARM: -3.7% RX
  * ARM64: -1.4% RX

Issue dart-lang#33274

Change-Id: Ia1acd76ac6efa26642f99e1ce3e417100aa357f3
Reviewed-on: https://dart-review.googlesource.com/c/89620
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
tekknolagi pushed a commit to tekknolagi/dart-assembler that referenced this issue Nov 3, 2020
…RM64/X64

ARM write barrier goes from

   ldrne lr, [thr, #+508]
   blxne lr
to
   blne <offset>

ARM64 write barrier goes from (similarly X64)

   beq +8
   ldrx lr, [thr, dart-lang#1056]
   blr lr
to
   beq +4
   bl <offset>

It reduces RX on arm/arm64 by around 0.9%

Though the write barrier wrappers stub has multiple entrypoints (one for
each available register).  Because of this, we modify the relocation
logic to support per-call offsets into the target.

To avoid making the assembler code depend on StubCode/FlowGraphCompiler,
we set a closure, which the assembler can call.

Issue dart-lang#33274

Change-Id: I9e3d68260cab7ef19ea88f1235c78d6031819d6d
Reviewed-on: https://dart-review.googlesource.com/c/90063
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

4 participants