dart-sdk/runtime/platform
Martin Kustermann d215ab6d73 [vm] Assign top-level classes cids outside 16-bit range
Right now we assign class ids to top-level classes, abstract classes as
well as concrete classes. All of them have allocated from a 16-bit pool
of ids. The VM FATAL()s once it hits that limit.

Customers who run very large programs (significant amount of generated
code) on the Dart VM have started to hit this 16-bit class limit.

Concrete classes can have instances in the heap. Our current heap layout
only allows 16-bit class ids to be encoded in the header word. To avoid
increasing the size of heap objects or shrinking the size of the identity
hash code to 16-bit we keep class ids in object headers to be 16-bit.

Abstract classes cannot have instances in the heap. Though their class
ids are encoded in type objects. Furthermore we sort classes in
AOT/AppJIT mode to perform fast class-id range checks. To avoid impacting
this optimization we treat abstract classes the same way as concrete
classes.

Top-level classes cannot have instances in the heap. Their class ids are
only used in the runtime code, for example for hot-reload as well as
part of the service protocol.

=> We can allocate class ids outside the 16-bit range for top-level
classes, thereby freeing a significant amount of space in the 16-bit
range.

This CL does exactly that: We change classid_t to be int32_t. The
ClassLayout::id_ can now be assigned ids outside 16-bit range for
top-level classes. To do this we keep dart classes and top level classes
as separate arrays in the ClassTable.

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

See also b/160229360

Change-Id: I6710a644e7b0ab2d4f4c792bef8e1f91cb117421
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153607
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-07-09 18:33:32 +00:00
..
address_sanitizer.h [vm] Fix LSAN when used without ASAN. 2020-05-12 17:38:19 +00:00
allocation.h VM: Re-format to use at most one newline between functions 2017-07-13 08:08:37 -07:00
assert.cc [build] Remove last platform -> vm and bin -> vm dependencies. Fix some ODR violations. 2019-04-22 20:15:43 +00:00
assert.h [vm, io] Fix some MemorySanitizer issues. 2020-02-27 17:50:43 +00:00
atomic.h [vm] Require explicit loads and stores when using AcqRelAtomic. 2020-03-19 16:19:59 +00:00
BUILD.gn Reland "Revert "Add an --os=fuchsia option to build.py:"" 2020-06-18 00:24:31 +00:00
elf.h [vm/aot] Add a GNU build ID to direct-to-ELF snapshots. 2020-06-16 12:46:24 +00:00
floating_point.h [gardening] Fix import to fix Flutter build 2019-09-06 09:08:49 +00:00
floating_point_win.cc Rename TARGET_OS_* to HOST_OS_*. 2017-03-15 13:11:05 -07:00
floating_point_win.h Make header include guards great again 2016-10-26 00:26:03 -07:00
globals.h [vm] Assign top-level classes cids outside 16-bit range 2020-07-09 18:33:32 +00:00
growable_array.h [vm] Fix various UBSan failures. 2020-05-07 19:40:18 +00:00
hashmap.cc [vm] Propagate more UTF8 conversion errors 2018-09-06 02:23:21 +00:00
hashmap.h [vm] Propagate more UTF8 conversion errors 2018-09-06 02:23:21 +00:00
leak_sanitizer.h [vm] Fix LSAN when used without ASAN. 2020-05-12 17:38:19 +00:00
memory_sanitizer.h [vm, io] Fix some MemorySanitizer issues. 2020-02-27 17:50:43 +00:00
platform_sources.gni [vm] Fix some TSAN failures. Migrate remaining uses of AtomicOperations to std::atomic. 2019-10-21 16:26:39 +00:00
safe_stack.h [vm] Fix various UBSan failures. 2020-05-07 19:40:18 +00:00
signal_blocker.h VM: Re-format to use at most one newline between functions 2017-07-13 08:08:37 -07:00
splay-tree-inl.h [ VM ] Updated splay-tree licenses, added V8 project authors to AUTHORS 2019-04-30 19:50:46 +00:00
splay-tree.h [ VM ] Updated splay-tree licenses, added V8 project authors to AUTHORS 2019-04-30 19:50:46 +00:00
syslog.h [build] Remove last platform -> vm and bin -> vm dependencies. Fix some ODR violations. 2019-04-22 20:15:43 +00:00
syslog_android.cc [build] Remove last platform -> vm and bin -> vm dependencies. Fix some ODR violations. 2019-04-22 20:15:43 +00:00
syslog_fuchsia.cc [build] Remove last platform -> vm and bin -> vm dependencies. Fix some ODR violations. 2019-04-22 20:15:43 +00:00
syslog_linux.cc [build] Remove last platform -> vm and bin -> vm dependencies. Fix some ODR violations. 2019-04-22 20:15:43 +00:00
syslog_macos.cc [build] Remove last platform -> vm and bin -> vm dependencies. Fix some ODR violations. 2019-04-22 20:15:43 +00:00
syslog_win.cc [build] Remove last platform -> vm and bin -> vm dependencies. Fix some ODR violations. 2019-04-22 20:15:43 +00:00
text_buffer.cc [dart/vm]: fix bug in TextBuffer capacity 2019-05-01 22:26:41 +00:00
text_buffer.h [vm] Move some string utils from runtime/vm to runtime/platform. 2018-03-01 02:07:46 +00:00
thread_sanitizer.h [vm] Fix TSAN failures related to object headers and GC task phases. 2019-10-09 21:48:20 +00:00
unaligned.h [vm] Fix various UBSan failures. 2020-05-07 19:40:18 +00:00
undefined_behavior_sanitizer.h [vm] Fix various UBSan failures. 2020-05-07 19:40:18 +00:00
unicode.cc [dart/fuzzer] Mechanism for target functions 2019-05-02 18:12:19 +00:00
unicode.h [vm] Adjust internal UTF-8 encoder to match dart:convert. 2020-06-29 16:10:13 +00:00
utils.cc [vm] Fix various UBSan failures: AOT. 2020-05-12 20:28:11 +00:00
utils.h [build] Support --clang when building dart sdk on Windows. 2020-06-25 03:36:41 +00:00
utils_android.cc [build] Support --clang when building dart sdk on Windows. 2020-06-25 03:36:41 +00:00
utils_android.h [vm/compiler] bit utilities 2019-10-07 18:13:06 +00:00
utils_fuchsia.cc [build] Support --clang when building dart sdk on Windows. 2020-06-25 03:36:41 +00:00
utils_fuchsia.h Add dart::ComponentContext() for Fuchsia 2020-04-21 19:09:25 +00:00
utils_linux.cc [build] Support --clang when building dart sdk on Windows. 2020-06-25 03:36:41 +00:00
utils_linux.h [vm/compiler] bit utilities 2019-10-07 18:13:06 +00:00
utils_macos.cc [build] Support --clang when building dart sdk on Windows. 2020-06-25 03:36:41 +00:00
utils_macos.h [vm/compiler] bit utilities 2019-10-07 18:13:06 +00:00
utils_win.cc [build] Support --clang when building dart sdk on Windows. 2020-06-25 03:36:41 +00:00
utils_win.h [vm/compiler] bit utilities 2019-10-07 18:13:06 +00:00