Commit Graph

51 Commits

Author SHA1 Message Date
Ryan Macnak d36adbacaf [vm] Remove the VM isolate.
The former contents of the VM isolate are now included into each isolate group. This makes each isolate group's heap independent, and in particular allows each heap to be allocated to a separate pointer cage (not done in this CL).

The duplicated stubs that allowed PC relative calls are removed, since the originals can now be the target of PC relative calls.

The bootstrapping needing to load an AppJIT or AppAOT snapshot is reduced to allocating the oddballs. The code is entirely dropped in the AOT runtime, but the JIT runtime still has it to allow for flags to affect the compilation of the stub code. Further refactoring might be able to remove this for the JIT runtime too, with only gen_snapshot knowing how to bootstrap.

Class serialization no longer distinguishes predefined classes.

The page containing null is marked as never-evacuate. null, false and true must not move because the compiler relies on their low bits having certain patterns for some optimizations. (Previously, the entire VM isolate heap never moved.)

Compaction is disabled for IA32. Due to register pressure, some stub calls must not use a scratch register and embed the address of Code.

The page containing the call-through-safepoint stub is frozen when running with --write-protect-code and the stub is created at runtime (instead of loaded from an AppJIT or AppAOT snapshot). This stub must remain executable even during a safepoint, as a foreign call might during return during a safepoint and only block after the stub directs it to the runtime.

The snapshot symbols are renamed to kDartSnapshotData and kDartSnapshotText. There is no need to distinguish the VM isolate's snapshot, and snaphots are per isolate group not per isolate. Aliases with the old names are added to ease migration.

Some global flags that were automatically set based on the VM isolate's snapshot are now isolate group flags and automatically set by the isolate group's snapshot.

TEST=ci
Change-Id: Iee82016057d609112e9b021d178fc3d4d18b5044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500621
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-05-18 11:35:03 -07:00
Alexander Markov 00eac588c2 [vm] Remove transition_sentinel and detection of cyclic initialization of legacy static fields
Since null safety, all static fields with initializers are implicitly
late. This change cleans up transition_sentinel which was used in
the detection of cyclic initialization of legacy static fields.

TEST=ci

Change-Id: I6a990dc8ba030f5bd40eb0b86706cbfb0f725e33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373520
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-06-27 18:29:58 +00:00
Alexander Markov dc30f815f1 [vm] Inline local functions declared in outer functions
Previously, inliner was able to inline closure calls only when closure
was allocated in the current function (or in a function which was
inlined so far). This is not true for local functions declared in outer
functions (they are allocated at declaration site).

Now, when calling local functions, target of closure call is always
known regardless of where the function is declared, so calls to local
functions can be inlined.

TEST=runtime/tests/vm/dart/inline_local_functions_il_test.dart
Fixes https://github.com/dart-lang/sdk/issues/52695
Fixes https://github.com/dart-lang/sdk/issues/15558

Change-Id: I0e51dbaf63a6d4427bff366b40414ca5fac3d418
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311465
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-06-27 19:42:15 +00:00
Ryan Macnak 2bfecc160b [vm] Update to constexpr in runtime/vm.
TEST=build
Change-Id: I2dd8ae69764af27f480a19995b491e98f52476ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293902
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-04-12 22:18:54 +00:00
Ryan Macnak f9a6a5bdd2 [vm] Update NULL to nullptr in runtime/vm.
TEST=build
Change-Id: I2834ef7cf7cb7c8770f8167a2438cbedcee5c623
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292063
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-04-10 18:15:12 +00:00
Ryan Macnak 49a135ab7e [vm] Extend the hash_table.h templates to support weak sets.
Make the canonical string table weak.

Remove incorrect assumption that a symbol not already existing implies there is no target. This would be true but for all the call-through-field/method-extractor nonsense.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50648
Bug: b/265897936
Change-Id: I463807a5d8c064888abbdc3dc75e916c2bdc8fa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279273
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-01-18 20:16:11 +00:00
Emmanuel Pellereau 3b97b75a99 Revert "[vm] Extend the hash_table.h templates to support weak sets."
This reverts commit a1dd92d345.

Reason for revert: breaks google (b/265897936)

Original change's description:
> [vm] Extend the hash_table.h templates to support weak sets.
>
> Make the canonical string table weak.
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/50648
> Change-Id: I04d84a917bd71469d43483cefba8165628b9a63f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278673
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,asiva@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I5f5f1dc3327d02165c3cec70b74a61ce9ef9667b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/50648
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279280
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
2023-01-18 10:02:06 +00:00
Ryan Macnak a1dd92d345 [vm] Extend the hash_table.h templates to support weak sets.
Make the canonical string table weak.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50648
Change-Id: I04d84a917bd71469d43483cefba8165628b9a63f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278673
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-01-17 21:45:02 +00:00
Ryan Macnak bb21c8c02d [vm] Load canonical sets with spare capacity so a few inserts can happen during startup without trigging a rehash.
TEST=assert
Change-Id: I0cc09604a81fdfcc2bc6cd05c4748a2a8e161262
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214314
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-27 22:01:43 +00:00
Alexander Aprelev 94a40a6b09 [vm/concurrency] Do symbol table lookup without read lock.
Instead use acq/rel atomics for symbol table read/write.

Symbol lock read and write acquisition time(per simple lock acquisition time tracking from https://github.com/dart-lang/sdk/issues/46252#issue-910738294) reduced from
===
IsolateGroup main shutting down:
RWlock read: 1211 ms, write: 151
===
to
===
IsolateGroup main shutting down:
RWlock read: 7 ms, write: 63
===

Bug: https://github.com/dart-lang/sdk/issues/46252

TEST=IsolateSpawn on tsan

Change-Id: Ic8605c18511eba08a21202ca030b527af0a0fbc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207340
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-07-27 20:54:07 +00:00
Vyacheslav Egorov d82ecdfe01 [vm] Fix GCC build
TEST=tools/gn.py --no-clang -m release -a x64, ninja -C out/ReleaseX64

Change-Id: I923ae50de25e8936507c665091d57870a33f7fa1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192306
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-22 15:08:04 +00:00
Vyacheslav Egorov ae37ff098a [vm] Compact serialization for canonical sets
This CL changes how canonical sets for some specific types are written
into the root snapshot: instead of writing canonical set as a separate
object we reorder objects within a canonical cluster in such a way that
the order matches order of elements in the backing store of a canonical
set and then we write canonical set layout out using differential
encoding (essentially writing gaps between elements instead of writing
absolute indices).

This significantly reduces the overhead of having canonical sets in the
snapshot while maintaining fast deserialisation: for example on build
microbenchmark this brings regression in the snapshot size from 4% to
.3%.

On sizeopt benchmarks:

  flutter_gallery_app_so_gzip_size   -1.5%
  flutter_gallery_app_so_size        -4.7%
  flutter_gallery_total_heap_size   -16.2%


TEST=ci

Change-Id: I2be7fd073668e9b52098e2acda9f11d128cfda95
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,pkg-linux-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185381
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-03-08 14:21:01 +00:00
Ryan Macnak 25fd0200ef [vm] Replace recanonicalization in primary snapshots with weak constant tables.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Icc4a3ebf861dca5172a0cfa2cd2eea266e814d0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181480
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-02-10 01:21:07 +00:00
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
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 f3031b6b79 Reland "[vm] Handle sentinel in the IL serializer and Array-backed hash maps."
Reverse use of the backing store and transition sentinel as bookkeeping values. Use transition sentinel to mark unused entries, since it has a short object id during clustered serialization. Use the backing store to mark deleted entries; deletion seems to only be used for enum values during a hot reload.

Change-Id: I52f0edcbc7e26f73843500cd378da31ea3b1e0ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137680
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-02-27 23:21:23 +00:00
Ryan Macnak 02f69a713e Revert "[vm] Handle sentinel in the IL serializer and Array-backed hash maps."
This reverts commit 62396cac55.

Reason for revert: Code size regressions likely due to the hash map change

Original change's description:
> [vm] Handle sentinel in the IL serializer and Array-backed hash maps.
> 
> Fixes crashes in vm/dart when use_nnbd = true.
> 
> Change-Id: Ieeb45227208cc6219f536130df38249d902dfe7f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137462
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,asiva@google.com,liama@google.com

Change-Id: I789bd219a7ab335771fcc0b39f25e9d0104945e0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137640
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-02-27 18:08:43 +00:00
Ryan Macnak 62396cac55 [vm] Handle sentinel in the IL serializer and Array-backed hash maps.
Fixes crashes in vm/dart when use_nnbd = true.

Change-Id: Ieeb45227208cc6219f536130df38249d902dfe7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137462
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-02-27 01:43:24 +00:00
Alexander Aprelev 59b8a9c4bb [vm] Free readonly header bit so it can be used for other uses.
This is reland of https://dart-review.googlesource.com/c/sdk/+/97340 rebased on top of removal of GraphMarked bit, which was not compatible with this ReadOnly->InVMIsolateHeap change(due to how write-pages are not covered by Contains check)

Change-Id: I34c6421afb4baeafa5a449787020dab9fa800d05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97545
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-03-22 23:46:51 +00:00
Alexander Aprelev 34af8b95e5 Revert "[vm] Free readonly header bit so it can be used for other uses."
This reverts commit 59931e3340 as it
breaks jitk and optcounter bots.

Change-Id: If87ce52ac3d4015608436bfd7ee661ea1414dc7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97480
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-03-21 06:23:50 +00:00
Alexander Aprelev 59931e3340 [vm] Free readonly header bit so it can be used for other uses.
Rely on vm_isolate()->heap()->Contains() instead of header bit check.

Change-Id: Ibf66b9910aea5003dd3dee539704deeb72c61ada
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97340
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-21 00:02:56 +00:00
Ryan Macnak 980e5c7b57 [vm] Mark VM isolate objects at heap finalization instead of allocation.
Avoids unnecessary branching in allocation.

Also, rename the VMHeap bit to ReadOnly to reflect its current usage.

Change-Id: Ic6060eec263cef0a3fc92f253dff976cea45bdb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95063
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-03-07 00:20:30 +00:00
Ryan Macnak 1a890ff07d [test] Dump symbol and type tables in determinism test.
Bug: https://github.com/dart-lang/sdk/issues/35092
Change-Id: I0647d8e4fe14a3ea19298dbe8b839f2db28755ab
Reviewed-on: https://dart-review.googlesource.com/c/84685
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-19 19:03:38 +00:00
Ryan Macnak 9b5a931b06 [vm] Replace most runtime/vm uses of OS::Print with OS::PrintErr.
Leave --print-snapshot-sizes on stdout because it is parsed by Flutter benchmarks.

Replace all runtime/bin uses of OS::Print with Log::Print.

Bug: https://github.com/dart-lang/sdk/issues/32134
Change-Id: I74aacfb410cdfa9270d06e7f6ab0534520c7c7ba
Reviewed-on: https://dart-review.googlesource.com/60021
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-06-13 19:51:40 +00:00
Samir Jindel c31b9a461d [vm/kernel] Reference constants in Dill by offset into constants table.
Summary:

The constants table contains a concatenation of the variable-length encodings of
each constant used in the serialized component. Previously, we referenced the
constants in the code by index into the constants table, which requires reading
potentially the entire constants table to dereference. Now, we refer to the
constant by the binary offset into the constants table, which allows us to peek
into it in constant time.

Test Plan:

The constants table is used by all the precompiler modes, so the new encoding
will inherit the coverage of the existing encoding.

Results from debug and release precompiler bots are available under the
"cl-linux-try" button.

Change-Id: I4782bc0035d0b0cbd5bd6b9d086561ea601286c8
Reviewed-on: https://dart-review.googlesource.com/55470
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-05-21 15:54:08 +00:00
Erik Corry 42e2a555be [VM] Reland 'Use quadratic probing in hash_table.h'
This was reverted due to https://github.com/dart-lang/sdk/issues/31944 which
now looks unrelated. Originally reviewed at
https://dart-review.googlesource.com/c/sdk/+/34760

R=kustermann@google.com

Change-Id: I78d54e9081bbeac36d01a843f4d281a076c00748
Reviewed-on: https://dart-review.googlesource.com/36340
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2018-01-22 22:54:45 +00:00
Erik Corry 79c1472085 Revert "[VM] Use quadratic probing in hash_table.h"
This reverts commit 3ad4bff4e7.

Reason for revert: failures in language_2/cyclic_type_test/03
Original change's description:
> [VM] Use quadratic probing in hash_table.h
> 
> On my workload this reduces the probing by 19% for the CanonicalType
> table, and reduces the number of insertions that take 25 probes or
> more by 74%. Max load is reduced from 0.75 to 0.71.  The size is now
> a power of 2 so we can use masking instead of integer division, and
> we use quadratic probing in order to reduce clustering.
> 
> R=​kustermann@google.com
> 
> Change-Id: I806197680a839dac99b7c7f5f09d2bce4d015235
> Reviewed-on: https://dart-review.googlesource.com/34760
> Commit-Queue: Erik Corry <erikcorry@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,erikcorry@google.com

Change-Id: If1b917d5b8200add80ddfcc7427b134bfb1bee38
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/35320
Reviewed-by: Erik Corry <erikcorry@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2018-01-17 15:44:18 +00:00
Erik Corry 3ad4bff4e7 [VM] Use quadratic probing in hash_table.h
On my workload this reduces the probing by 19% for the CanonicalType
table, and reduces the number of insertions that take 25 probes or
more by 74%. Max load is reduced from 0.75 to 0.71.  The size is now
a power of 2 so we can use masking instead of integer division, and
we use quadratic probing in order to reduce clustering.

R=kustermann@google.com

Change-Id: I806197680a839dac99b7c7f5f09d2bce4d015235
Reviewed-on: https://dart-review.googlesource.com/34760
Commit-Queue: Erik Corry <erikcorry@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-01-17 13:57:47 +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
Florian Schneider 017257a64f VM: Only update hash table stats when needed for printing.
The counters for growing and collisions are not needed otherwise.

This avoid data races on concurrent reads (which would previously
update the counters, even if reporting is disabled)

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2575913002 .
2016-12-14 10:34:12 -08: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
Zachary Anderson e933f28a18 Remove some uses of STL map.
This CL removes the use of STL map from freelist.cc by adding
MallocDirectChainedHashMap in hash_map.h and adding an iterator for
BaseDirectChainedHashMap there.

It also removes a use of STL map from hash_table.h that was dead code.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2083103002 .
2016-06-22 08:32:37 -07:00
Siva Annamalai 65c4aaee17 - Add a new constructor to the hash table classes that allow handles to be passed in instead of creating new ones for every lookup/insertion
- Use reusable handles in Symbols::New and Symbols::Lookup with the new constructor defined above

R=hausner@google.com

Review URL: https://codereview.chromium.org/1934263003 .
2016-05-02 17:07:31 -07:00
Siva Annamalai fc3156db11 Add usage and collision details to the hash table data structure in order to determine effectiveness of the hash function.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1882763002 .
2016-04-13 09:08:52 -07:00
Ivan Posva dacf846df0 - Avoid calling % in a loop when probing.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1884583004 .
2016-04-12 16:26:43 -07:00
Ivan Posva 23a4e3da53 - Ensure that we do not enter symbols twice: Set the canonical bit
on a String once we know it is canonical.
- Bug fix in hash set implementation.

BUG=

Review URL: https://codereview.chromium.org/1876363003 .
2016-04-11 22:05:43 -07:00
Srdjan Mitrovic 8e23dcced3 Make function lookup in classes thread-safe:
- Do not create/add function when looking them up  in TryCreatICData
- Do not allow background compilation to add/remove functions
- Cache function hash array as it may change or be set to null.

Check VMObject only if FLAG_verify_handles is true.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1709273003 .
2016-02-18 16:03:29 -08:00
Siva Annamalai 8359b9e20c Do not include resolved_names_ and loaded_scripts_ consistently in both the full and script snapshots. Initialize the resolved names cache correctly in both cases when reading the snapshot.
This reduces the isolate snapshot size from 255324 to 249714.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1588783002 .
2016-01-13 16:42:29 -08:00
Srdjan Mitrovic d732b68b8c oneee# Enter a description of the change.
Collect interfaces without GrowableObjectArray

Concat to symbol without temporary String creation

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1311693003 .
2015-08-28 08:24:17 -07:00
Daniel Andersson f722d4d2b2 Migrate to Zone-based handle allocation interface in hash table and symbol table.
This is used by the compiler through "NewSymbol".

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

Review URL: https://codereview.chromium.org//1292433004 .
2015-08-19 09:35:01 -07:00
koda@google.com 4543995374 Clear the handle returned by HashTable::Release in ~HashTable.
This is a fix to the issue of EnsureCapacity retaining old arrays until the end of the current handle scope.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40817 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-30 17:05:19 +00:00
koda@google.com 32078e2ebb Add 'Clear' method to HashMap/HashSet templates.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40415 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-17 23:44:51 +00:00
asiva@google.com 1179458f38 Precreate handles for the key object and smi values and use these
handles in the find and insert methods instead of allocating a new
handle each time.

R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39479 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-21 23:57:48 +00:00
koda@google.com 50bb605a6a Handle-like interface for HashTable.
A combination of two independent interface changes:
1. Constructor takes a RawArray* and allocates its own Array handle.
2. Release provides access to the entire handle, rather than just the raw.

This results in a very clean usage pattern, like:
  FooTable table(get_foo_table());
  table.Insert(obj);
  ...
  set_foo_table(table.Release());

Having the isolate inside HashTable also allows faster allocation of temporary handles.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38794 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-31 19:50:23 +00:00
koda@google.com 3ddcda9ab8 Reimplement Symbols using hash table template.
In the process, add hash table support for materializing an Object key from a lookup key on demand.

Also use this to simplify CompressedTokenStream.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38710 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-29 22:47:56 +00:00
koda@google.com 1cdcb12b4e Add VM class for Map/LinkedHashMap.
Introduces a new internal class for the most common case, the default Map.

Passes all functionality tests.
Slow: Dart side simply calls into runtime for now.
Hidden behind "--use_internal_hash_map".

Add copies of hash map tests to exercise this implementation.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38588 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-25 20:04:11 +00:00
koda@google.com 7dfd991f9f Resubmit r37716: Hash tables templates, wrapping Array.
(Patch Set 1 is identical to r37716; Patch Set 2 renames some typedefs to avoid confusing MSVC)

Highly customizable to support various internal uses as well as the basis for user-level classes.

Use in Library's resolved names cache.

Next step is to add new instance classes for the user-level maps/sets (akin to GrowableObjectArray).

TBR=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37800 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-27 22:34:00 +00:00
koda@google.com 486a4527a5 Revert r37716 due to Windows compilation errors.
TBR=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37719 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 01:45:48 +00:00
koda@google.com b77bd818f7 Attempt to fix Windows compilation error.
TBR=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37718 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 01:27:26 +00:00