Commit Graph

27 Commits

Author SHA1 Message Date
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
koda@google.com 5ef8d94639 Hash tables templates, wrapping Array.
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).

R=asiva@google.com

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

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