Commit Graph

38 Commits

Author SHA1 Message Date
Ryan Macnak b1c09ecd8f [vm] Make naming more consistent when converting between handles, tagged and untagged pointers.
Currently we have things called XPtr which are not what you get from ptr().

Old world:
handle->raw() returns RawObject* (tagged)
raw_obj->ptr() returns RawObject* (untagged)

After 6fe15f6df9:
handle->raw() returns ObjectPtr
obj_ptr->ptr() returns ObjectLayout*

New world:
handle->ptr() returns ObjectPtr
obj_ptr->untag() returns UntaggedObject*

TEST=ci
Change-Id: I6c7f34014cf20737607caaf84979838300d12df2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149367
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-15 23:32:02 +00:00
Regis Crelier b3bca1821c [VM/runtime] Decouple representation of function signatures from Function objects.
This fixes issue https://github.com/dart-lang/sdk/issues/43088

This CL improves on https://dart-review.googlesource.com/c/sdk/+/166920 by keeping the names of type parameters.

See go/dart-vm-signatures for motivation for this change.

TEST=existing suites

Change-Id: Ia82f1d322f72d07b2fb253cf914f9b868025c71e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176981
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-01-07 23:45:37 +00:00
Vyacheslav Egorov 5f490fabf7 [vm/compiler] Track LR state in ARM/ARM64 backends
Assembler now always knows whether LR contains return address
or can be safely cloberred.

TEST=tested through normal test suite

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-ffi-android-release-arm64-try,vm-ffi-android-release-arm-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-android-release-arm64-try
Change-Id: I0b436509389cfd29ee413fd28930fb2d6b07616e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174468
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-12-10 15:51:27 +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
Victor Lima b951498903 [vm/aot] Allow static methods to have unboxed args and return
Static methods and constructors may receive unboxed parameters.
This change adds a bitmap to the RawFunction object indicating
which parameters are unboxed and their types. Also, the stack frame
bitmap was updated to include new bits for those parameters.

The ArgumentsDescriptor object was updated to store not only the number
of arguments, but also their size, since 32-bit platforms would use two
words for each int64 and double value.

In addition, static methods that return non-nullable integers
and doubles may return these values unboxed.

Dart AOT x64:

TypedData.Uint8ClampedListViewVarBench  +11.73%
DeltaBlue                               +9.32%
Meteor (Intel Xeon)                     +4.64%

Flutter release android-armv8:

velocity_tracker_bench                  -2.32% (less is better)

flutter_gallery_readonlydata_size       +0.18%
flutter_gallery_total_size              +0.13%
flutter_gallery_instructions_size       +0.12%

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

Change-Id: I97e310f8f30213920af2333fbdedf193d03db5c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135313
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-05 15:17:04 +00:00
Ryan Macnak e1ffe76a36 [vm] Replace StubEntry with Code handles.
StubEntry was holding raw pointers across safepoints in several places in the compiler.

Bug: https://github.com/dart-lang/sdk/issues/34934
Change-Id: Id17cb7651f4d3508915c8cb90f5cb2353df6dac0
Reviewed-on: https://dart-review.googlesource.com/c/85040
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-21 17:45:11 +00:00
Alexander Aprelev ce427ac14f Revert "Revert "Introduce StaticCallNode::kNoRebind and use that in implicit closures.""
This reverts commit ade37f931e.

This re-lands RebindRule change with fixes for the "-mdebug--hot-reload" test failures.

Original commit is reverted in patch set 1.
Fixes are in following patch sets.

Bug:
Change-Id: I49375af9b891323fe05c670d77cbf880964aae54
Reviewed-on: https://dart-review.googlesource.com/9361
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2017-09-28 19:43:32 +00:00
Dmitry Stefantsov ade37f931e Revert "Introduce StaticCallNode::kNoRebind and use that in implicit closures."
This reverts commit 97393fd961.

TBR=aam@google.com

Change-Id: I8fc5f644e994faa20aa8b5c54f8d6227a054e39d
Reviewed-on: https://dart-review.googlesource.com/9220
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-28 08:44:48 +00:00
Alexander Aprelev 97393fd961 Introduce StaticCallNode::kNoRebind and use that in implicit closures.
Change-Id: I6219462fed278dbb90361c2084eed886c9245097

Revert "Revert "Introduce inline cache reload rule attribute to static call AST node and ICData.""

This reverts commit 162283c2f3.

This re-lands the change with original revert in Patch set 1, actual bug fix in next patch set.

Bug:
Change-Id: I6219462fed278dbb90361c2084eed886c9245097
Reviewed-on: https://dart-review.googlesource.com/8760
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-09-28 03:26:22 +00:00
Alexander Aprelev 162283c2f3 Revert "Introduce inline cache reload rule attribute to static call AST node and ICData."
This reverts commit 68a727fa5c.

Revert "Fix ICData::New() invocation. Follow-up to 68a727fa5cf5."

This reverts commit ac06b1c8ea.

Revert "Fix last ICData::New() invocation. Follow-up to 68a727fa5cf5."

This reverts commit da26ffc4de.

Bug:
Change-Id: Ia2d4e6a3c3a3a329982c90aded11e72bf25a9a34
Reviewed-on: https://dart-review.googlesource.com/8402
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2017-09-26 02:08:17 +00:00
Alexander Aprelev ac06b1c8ea Fix ICData::New() invocation. Follow-up to 68a727fa5c.
Bug:
Change-Id: I0d5ce24a62bca1af14d77de6172a3885f0e66c28
Reviewed-on: https://dart-review.googlesource.com/8244
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2017-09-25 20:42:52 +00:00
Vyacheslav Egorov 8a179fb953 [VM, Compiler] Move compiler to a separate folder.
New folder structure (nested under vm/):

- compiler/
-   jit/         - JIT specific code
-   aot/         - AOT specific code
-   backend/     - all middle-end and back-end code (IL, flow graph)
-   assembler/   - assemblers and disassemblers
-   frontend/    - front ends (AST -> IL, Kernel -> IL)

compiler/README.md would be the documentation root for the compiler
pipeline

Bug: https://github.com/dart-lang/sdk/issues/30575
Change-Id: I2dfd9688793bff737f7632ddc77fca766875ce36
Reviewed-on: https://dart-review.googlesource.com/2940
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-09-04 15:15:18 +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
Régis Crelier 9aafded095 Pass type argument vector to generic functions (if --reify-generic-functions is
true, still false per default).
Work in progress, not functional yet (passed vector is still ignored in callee).

R=vegorov@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2859673002 .
2017-05-18 14:03:47 -07:00
Ryan Macnak 8b96a31c7f Move runtime functions to the more logical runtime_entry.cc.
Make --trace-runtime-calls respect the isolate filter.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2827873002 .
2017-04-19 10:22:04 -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
Ryan Macnak 7ff2dd4117 Optimize AOT's switchable calls for the monomorphic case.
The call sequence is very similar to a classic IC call, except the guarded class and the target are loaded indirectly from the constant pool instead of as immediates. In the monomorphic case, we call directly to the expected target with a class check in the callee. In the unlinked, polymorphic and megamorphic cases, we call a stub; these case are now call-through instead of call-and-return.

Every code, except stubs involved in switchable calls, includes the class check sequence at the beginning. So we now distinguish between a checked and an unchecked entry point. Generated code except the switchable call continues to use the unchecked entry point.

PC offsets are calculated relative to the beginning of the instruction stream, rather than either entry point.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2226893002 .
2016-08-12 11:18:35 -07:00
John McCutchan c0eb4d9dc0 Remember inside an ICData if it is for a static call or an instance call
- [x] Add an is static call bit to ICData
- [x] Rewrite the reset ICData iterators to rely on that bit rather than the function's ic data map

BUG=

Review URL: https://codereview.chromium.org/2064693003 .
2016-06-13 13:23:57 -07:00
John McCutchan 48c8ffa7f3 Initial isolate reload support
This is a cut of the work that Todd and I collaborated on in the reload branch.

In this CL, we've dropped the loader port hacks, in other words, on stack reloading in the standalone embedder does not work yet.

- [x] Support for hot reloading of isolate source code
- [x] Unit test harness and many tests
- [x] Service protocol and Observatory support
- [x] Product build does not include support for hot reloading.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1965823002 .
2016-05-17 12:19:06 -07:00
Ivan Posva 5be5d54529 - Refactor Symbol allocation to expect a thread parameter.
- Preallocate all tokens as symbols to avoid repeated lookups.
- Pass thread/zone where useful while doing this change.
- Avoid allocating symbols for error messages.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1870343002 .
2016-04-11 16:28:29 -07:00
John McCutchan d77d376124 Replace intptr_t with TokenDescriptor
- Use TokenDescriptor instead of intptr_t for all token positions.
- Use TokenDescriptor in raw_object instead of int32_t.
- TokenDescriptor is a POD with an int32_t (this shrinks the size of AST and IR nodes by 32-bits on 64-bit architectures).

There are some cleanups I plan on doing as a follow up CL:

- Replace TokenDescriptor::value() with TokenDescriptor::TokenPos()

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

Review URL: https://codereview.chromium.org/1644793002 .
2016-02-02 10:15:44 -08:00
John McCutchan 77101d63e3 Source positions for constructors and lots of async machinery
- Rework token position address space.
- Use ClassifyingTokenPositions::kMethodExtractor for the token position of a method extractor.
- Plumb token positions through all of Ast Transformer.
- Plumb token positions for temporary expressions, etc in Flow Graph Builder.
- Add token positions for parts of the await machinery.
- Move ClassifyingTokenPositions into token.h.
- Remove default token position of Scanner::kNoSourcePos for many IR instructions.
- A couple of unit tests.
- Use synthetic token positions for synthetic AstNodes.
- Fix SLEB128 encoding / decoding + test
- s/Scanner::kNoSourcePos/Token::kNoSourcePos.
- Remove >= 0 and < 0 checks against token positions and use helpers instead.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1589643002 .
2016-01-19 15:01:08 -08:00
Ryan Macnak dd7250323d Re-assign registers on ARM so PP and CODE_REG are below R7 (FP on iOS).
Also update descriptions of register availability in instrinsics.

1) Mechanical replacement in *arm.* files except the simulator and constants_arm.h (with sed).

R5 -> R9
R6 -> R8
R8 -> R10
R9 -> R5
R10 -> R6

2) Change register aliases.

CTX = R10 -> CTX = R6
PP = R9 -> PP = R5
ICREG = R5 -> ICREG = R9
CODE_REG = R10 -> CODE_REG = R6
THR = R8 -> THR = R10

3) Fixup users of ldrd/strd to have valid register pairs.

bigint_lsh
bigint_absadd
bigint_abssub
bigint_sqradd
TYPED_ARRAY_ALLOCATION
InlineArrayAllocation
AllocateArrayStub
AllocateContextStub

4) Fix PushList in MegamorphicMissStub to keep runtime call arguments in the right order.

BUG=http://dartbug.com/24683
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1419223003 .
2015-10-26 11:05:32 -07:00
Florian Schneider 63a8e5227d VM: More abstract interface for generating stub calls.
This makes the code in the code generator independent from how stubs
are actually called (i.e. directly embedding the target address, or
indirectly by loading the target address from the code object).

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1270803003 .
2015-08-05 10:18:35 +02:00
Regis Crelier 23982c63e9 Load immediates via the constant pool on armv5te and armv6.
Fixes #23306

R=zra@google.com

Review URL: https://codereview.chromium.org//1250323002 .
2015-07-24 08:27:50 -07:00
Florian Schneider 8d38a58c18 Make array allocation stub shared between isolates.
This allows to make the last explicitly named stubs shared between isolates.

When sharing code stubs, we can't do patching at their entry anymore.
Therefore, I had to remove patching support of the array allocation stub.
Is this a functionality we want to keep?

The change is mostly performance-neutral because optimized code has an inlined fast
path for array allocation and only uses the stub for the slow-case.

The only isolate-specific stubs left are object allocation stubs which are
associated with their Class are per-isolate.

Since this CL removes any isolate-specific stubs from StubCode, it becomes AllStatic.

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1247783002 .
2015-07-23 12:56:16 +02:00
asiva@google.com f85f986bda Make isolate specific stub code accessors instance methods instead
of static. This allows use of isolate without having to call
Isolate::Current() when using these accessors.

R=johnmccutchan@google.com, srdjan@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38040 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-07 21:25:00 +00:00
iposva@google.com d36cd610cb - Use isolate where it is appropriate.
- Do not emit an name for ExternalLabel.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36662 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 10:15:50 +00:00
regis@google.com e0ab99b0b2 Remember all deopt reasons in ic_data, not just the last one.
Remember if a JS warning was issued in ic_data.
Save a word in ic_data on 64-bit platforms.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35457 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-25 23:45:14 +00:00
hausner@google.com 0c434b3073 Rename kDummyTokenIndex to kNoSourcePos
Addresses comment to previous change list.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31969 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-21 23:46:26 +00:00
fschneider@google.com cd54507fc2 Mark native functions when they are created.
Until now the parser marked native functions as native when parsing.

This may be too late for some functions. E.g. the native typed list
constructor may not be invoked because the intrinsic code is executed
instead (unless for example new-space allocation fails).

This causes missing type information when optimizing functions using
those recognized factory functions like Uint8List._new.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30846 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-04 10:32:43 +00:00
srdjan@google.com fa7817bf79 Change static calls in unoptimized code to always call via a stub. Using ICData, the call count of static calls is collected as well.
TODO: Use call frequency to guide inlining.

R=asiva@google.com, hausner@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24307 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 23:35:10 +00:00
srdjan@google.com 47de186e76 Store arguments descriptor in ICData. Remove loading of arguments descriptor at unoptimized call site (the ones using ICData).
R=asiva@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24239 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-20 16:29:39 +00:00
srdjan@google.com 71340907c2 Cosmetic change: s/arg_descriptor/args_descriptor/
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24103 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-17 17:31:00 +00:00
regis@google.com e586529325 Change the order of loading ic_data and arguments descriptor prior to an
instance call on ARM.
Review URL: https://codereview.chromium.org//12964007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20500 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-25 23:50:41 +00:00
regis@google.com 6a701789b9 Decode ic data and arguments descriptor passed in calls on ARM.
Review URL: https://codereview.chromium.org//12518016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19827 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-11 23:15:48 +00:00
regis@google.com 8c44be4313 Add support for object pool that will be used on ARM and MIPS architectures.
Modify code patching infrastructure to accept code object, which is necessary to
get to the object pool containing patchable target addresses.
Modify assembler test infrastructure to provide associated code object.
Review URL: https://codereview.chromium.org//12260026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18604 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-15 23:55:31 +00:00
regis@google.com 0bf36986ec Add test skeletons for arm and mips.
Review URL: https://codereview.chromium.org//11929037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17330 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-18 23:46:48 +00:00