Erik Corry
c8ad75d44a
[VM] Make classes movable in sliding compactor
...
Store class sizes off heap so we can determine the size
of their instances even while the classes are moving.
R=rmacnak@google.com
Change-Id: I7b935114f76eb8b6aaa57d65e5b7cc0070afa75f
Bug: https://github.com/dart-lang/sdk/issues/30978
Reviewed-on: https://dart-review.googlesource.com/52104
Commit-Queue: Erik Corry <erikcorry@google.com >
Reviewed-by: Ryan Macnak <rmacnak@google.com >
2018-04-26 09:38:25 +00:00
Ryan Macnak
d9c3190e44
[vm] Remove some bin -> vm includes.
...
Change-Id: Id304de9618a299a201b946a901a54352772f56fb
Reviewed-on: https://dart-review.googlesource.com/48704
Reviewed-by: Siva Annamalai <asiva@google.com >
Reviewed-by: Zach Anderson <zra@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
2018-03-28 23:16:09 +00:00
Martin Kustermann
cf8a6063f8
[VM] Improve AssertAssignable/InstanceOf by having a fast case for non-generic, instantiated types
...
When the type to test against is instantiated and has no type arguments
there is a high probability that we receive instances of that class or
subclasses at runtime.
This CL therefore extends the fast-path of AssertAssignable/InstanceOf
by checking whether the instance class id is within the cid ranges that
directly/indirectly implement/extend the type to test against.
Currently we have an almost depth-first preorder numbering of class ids
in AOT, but there are exceptions. So each class can have a number of
cid-ranges as subclasses / classes which implement it's interface.
This seems to improve performance of dart-aot-v2
* flutter stock build by 15+%
* DeltaBlueClosures by 10+%
and reduces code size on
* flutter gallery by -3%
Issue https://github.com/dart-lang/sdk/issues/31798
Change-Id: I07dd91589cc3fcd8c5952bdba339e2e2a459e08e
Reviewed-on: https://dart-review.googlesource.com/35620
Commit-Queue: Martin Kustermann <kustermann@google.com >
Reviewed-by: Régis Crelier <regis@google.com >
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
2018-01-25 07:13:42 +00:00
Ryan Macnak
b0f203db19
[vm-service] Include external sizes in the allocation table.
...
Bug: https://github.com/dart-lang/sdk/issues/30380
Change-Id: Ieec5adf13548b73bac886816d4a2174de7585880
Reviewed-on: https://dart-review.googlesource.com/7685
Commit-Queue: Ryan Macnak <rmacnak@google.com >
Reviewed-by: Todd Turnidge <turnidge@google.com >
2017-09-25 18:33:07 +00:00
Erik Corry
c6a199e40b
Sort class IDs before training AppJIT snapshots
...
R=fschneider@google.com , rmacnak@google.com
BUG=
Review-Url: https://codereview.chromium.org/2699853002 .
2017-02-20 12:14:17 +01:00
Siva Annamalai
d77809e15f
Fix the following tsan errors:
...
1. Race updating the allocation stats for a class
WARNING: ThreadSanitizer: data race (pid=16346)
Write of size 8 at 0x7bac00011930 by thread T4:
#0 dart::AllocStats<long>::AddOld(long, long) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/class_table.h:56 (dart+0x000000769278)
#1 dart::ClassTable::UpdateAllocatedOld(long, long) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/class_table.cc:423 (dart+0x00000076923a)
#2 dart::Object::Allocate(long, long, dart::Heap::Space) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/object.cc:1880 (dart+0x00000092ddff)
#3 dart::Array::New(long, long, dart::Heap::Space) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/object.cc:21586 (dart+0x00000098d3fd)
Previous write of size 8 at 0x7bac00011930 by thread T3:
#0 dart::AllocStats<long>::AddOld(long, long) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/class_table.h:56 (dart+0x000000769278)
#1 dart::ClassTable::UpdateAllocatedOld(long, long) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/class_table.cc:423 (dart+0x00000076923a)
#2 dart::Object::Allocate(long, long, dart::Heap::Space) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/object.cc:1880 (dart+0x00000092ddff)
#3 dart::Array::New(long, long, dart::Heap::Space) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/object.cc:21586 (dart+0x00000098d3fd)
#4 dart::Array::New(long, dart::Heap::Space) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/object.cc:21575 (dart+0x000000932f6d)
2. Race while updating c++ table entry into Object::builtin_vtables_
WARNING: ThreadSanitizer: data race (pid=16346)
Atomic write of size 8 at 0x00000210c970 by main thread:
#0 __tsan_atomic64_compare_exchange_val <null> (dart+0x0000005bad8a)
#1 dart::AtomicOperations::CompareAndSwapWord(unsigned long*, unsigned long, unsigned long) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/atomic_linux.h:63 (dart+0x00000074b744)
#2 dart::ClassTable::Register(dart::Class const&) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/class_table.cc:127 (dart+0x000000767cbc)
#3 dart::Isolate::RegisterClass(dart::Class const&) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/isolate.cc:170 (dart+0x0000008e0046)
#4 dart::RawClass* dart::Class::New<dart::Array>() /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/object.cc:2037 (dart+0x000000931055)
Previous read of size 8 at 0x00000210c970 by thread T3:
#0 dart::ClassTable::Register(dart::Class const&) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/class_table.cc:130 (dart+0x000000767cc9)
#1 dart::Isolate::RegisterClass(dart::Class const&) /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/isolate.cc:170 (dart+0x0000008e0046)
#2 dart::RawClass* dart::Class::New<dart::Array>() /usr/local/google/home/asiva/workspace/dart-ws3/sdk/out/DebugX64/../../runtime/vm/object.cc:2037 (dart+0x000000931055)
BUG=
R=regis@google.com
Review-Url: https://codereview.chromium.org/2602123002 .
2016-12-29 13:20:58 -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
Ryan Macnak
6a5a868a4e
AOT: Reassign class ids so class hierarchies have contiguous ranges.
...
R=fschneider@google.com
Review URL: https://codereview.chromium.org/2281263002 .
2016-08-26 16:17:05 -07:00
Ryan Macnak
6b5f29fb70
Reload: Don't free the saved class table while another thread may be reading it.
...
Fixes #27016 .
R=asiva@google.com , johnmccutchan@google.com
Review URL: https://codereview.chromium.org/2240283002 .
2016-08-12 16:12:25 -07:00
Ryan Macnak
9470c085c3
Fix allocation stats for cross-compiled AOT targeting ARM or MIPS.
...
Resolves disagreement between SIMARM and ARM on the size of ClassHeapStats. Fixes assertion failures in AllocStats::Verify.
R=fschneider@google.com
Review URL: https://codereview.chromium.org/2172803002 .
2016-07-21 16:04:57 -07:00
Ryan Macnak
a6f954b0f3
Don't track allocations in product mode.
...
R=fschneider@google.com
Review URL: https://codereview.chromium.org/2143153002 .
2016-07-12 14:15:02 -07:00
Zachary Anderson
a503570e3a
Fuchsia: Initial check-in.
...
Instructions to build and run are in README.fuchsia.
R=asiva@google.com
Review URL: https://codereview.chromium.org/2117593002 .
2016-07-01 12:42:05 -07:00
Ryan Macnak
524fbc1e0f
Use clustered serialization for full snapshots.
...
Retain the recursive-descent format for script and message snapshots.
Flutter gallery app on a Nexus 4
- Snapshot, excluding instruction/rodata sections 3429177 -> 2874997B (-16%)
- InitOnce 54.1 -> 8.4ms (-84%)
- InitializeIsolate 374.3 -> 170.8ms (-54%)
R=asiva@google.com
Review URL: https://codereview.chromium.org/2032153003 .
2016-06-29 19:50:06 -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
Ryan Macnak
4b112c6d25
Precompilation: drop unused types and type arguments and empty classes and libraries.
...
precompiled dart2js arm 20748837 -> 20639848 (-0.52%)
precompiled flutter asteriods arm64 8926398 -> 8782136 (-1.6%)
R=regis@google.com
Review URL: https://codereview.chromium.org/1686773002 .
2016-02-22 14:05:03 -08:00
Ivan Posva
4f392df85e
Fix some more shorten-64-to-32 warnings:
...
- Remove duplicate check for javascript integer overflow.
- Make sure the BitField class knows the type it is
encoding into.
BUG=
R=asiva@google.com
Review URL: https://codereview.chromium.org/1644223006 .
2016-02-02 13:58:06 -08:00
Daniel Andersson
b62e3204ed
Make old-space heap stats safe for parallel marking.
...
Record live count/size stats locally in each marking task and sum the
results at the end.
This is needed for parallel (and later, concurrent) marking.
This also yields a more compact representation of
the stats compared to ClassHeapStats, which interleaves new/old/etc.
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//1346333003 .
2015-09-16 15:09:05 -07:00
John McCutchan
ec675a3b0d
Enable allocation tracing for classes owned by vm isolate
...
- Don't store the allocation tracing toggle bit in the class.
- Make sure that array and context slow path stubs are added to the code object's static call table.
- Add missing MaybeTraceAllocation to context allocation stub.
R=fschneider@google.com
Review URL: https://codereview.chromium.org//1292723002 .
2015-08-14 06:55:05 -07:00
Regis Crelier
5e2dbbbba4
This fixes a typo.
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//1271013005 .
2015-08-04 16:46:08 -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
Florian Schneider
0cf617ef13
VM: Refactor allocation stats code and remove duplicate code.
...
Make context allocation stub shared between isolates.
The fast-path used in optimized code still has isolate-specific
addresses inlined for performance reasons.
Common functions are moved into class_table.h/.cc.
This is a preparation for adding an isolate-independent version of the
allocation code and allocation tracking code.
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//1241863002 .
2015-07-17 15:15:33 +02:00
Florian Schneider
141d6bdcd2
Make subtype test cache stub shared between isolates.
...
Also remove an the unused pp paramters from LoadIsolate on ARM64.
BUG=
R=koda@google.com
Review URL: https://codereview.chromium.org//1235843003 .
2015-07-13 15:42:16 +02:00
John McCutchan
598c67001b
Update Assembler::TryAllocate to support inline allocation tracing
...
- Track whether class allocation should be traced in existing ClassHeapStats structure.
- Emit compare and branch at top of ::TryAllocate
These changes appear to be performance neutral.
An alternative approach is to deoptimize all code that inlined allocations for a specific class. I do not think this is a good approach because we will spoil the water- allocations that aren't occurring in the (optimized steady state) running program will appear in the allocation profile. This will make the data much less actionable bordering on misleading. The approach used in this CL will guarantee the allocation profile aligns with the actual running program.
R=regis@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//1213013002 .
2015-07-10 12:19:01 -07:00
koda@google.com
d4481420e0
Copy-on-write class table for concurrent reading.
...
Make ClassTable::At thread safe by keeping old copies of the class table.
They can be safely deallocated during the stop-the-world phase of GC.
This avoids making a copy for every sweeper task, and is the first step towards removing the fake Isolate workaround.
R=iposva@google.com
Review URL: https://codereview.chromium.org//816773005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43048 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-21 18:13:12 +00:00
koda@google.com
f0959282a3
Fix build (make Verify public).
...
R=zra@google.com
TBR=zra@google.com
Review URL: https://codereview.chromium.org//744643003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41866 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-20 20:18:02 +00:00
koda@google.com
f346d2ec7a
Fix allocation stats bug on ARM; add unit test.
...
Also add sanity checks to ClassHeapStats.
Array allocation stub was using an address instead of a size for the allocation size.
R=zra@google.com
Review URL: https://codereview.chromium.org//747463002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41862 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-20 19:20:17 +00:00
fschneider@google.com
855541d88e
Make subtype test stubs isolate-specific.
...
This avoids loading the current isolate from the context
register and makes those stubs not depend on having the context
stored in the CTX register.
R=vegorov@google.com
Review URL: https://codereview.chromium.org//605533003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40714 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-26 16:06:30 +00:00
iposva@google.com
2ee3263277
- Add and enable concurrent sweeper.
...
- Keep separate lists for normal sized executable and data pages.
R=koda@google.com
Review URL: https://codereview.chromium.org//503363005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39593 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 13:37:55 +00:00
koda@google.com
015211b474
Track per-class promotion stats.
...
This will be useful for allocation policy and heap growth policy.
Also include these stats in the VM service.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//487973002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39415 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-20 17:57:12 +00:00
koda@google.com
bd979f84d5
Send allocation stats with each class and show in class view.
...
For each class, if there are any allocations, shows current number of instances, shallow size, and the already existing link for retained size.
Also refactor code in ClassTable to reduce duplication.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//345543003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37566 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-20 20:17:42 +00:00
turnidge@google.com
9243ffc4ff
Always use the same json for null in the vm service.
...
PrintToJSONStream -> PrintJSON.
ALSO:
Fix <em> tags in the Observatory.
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//257053003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35532 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-29 18:10:02 +00:00
koda@google.com
00ae3f7848
Fix accumulated size stats for fixed-size instances.
...
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//249843003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35321 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 18:17:03 +00:00
koda@google.com
9a8671276b
Add class and address information to heap map; display on hover.
...
Display a string like "String @ 0xe97c3328" while hovering over the map.
Also add page separators (black).
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//204103009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34195 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-20 18:56:45 +00:00
asiva@google.com
a01ab16991
1. When reading a full snapshot use the class id from the snapshot instead
...
of generating a new one. This ensures that assumptions made about the
class id when generating a snapshot will still hold in the version that
runs from a snapshot.
2. remove ObjectHistogram code as it is not used anymore and has been replaced
by VM service.
R=johnmccutchan@google.com , regis@google.com
Review URL: https://codereview.chromium.org//187133004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33340 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-05 19:24:02 +00:00
johnmccutchan@google.com
0f79171efb
Add user resetable accumulator to allocation profiler.
...
Display aggregate of new and old space in a separate table.
Speed up display of tables by 10x.
Fix heap display bug (heap stats were always for new space).
Keep sort across refreshes.
R=turnidge@google.com
Review URL: https://codereview.chromium.org//173013004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33220 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-03 15:39:06 +00:00
johnmccutchan@google.com
9ca09b50e7
Track live instance and allocation counts for classes.
...
R=iposva@google.com
Review URL: https://codereview.chromium.org//51653006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31978 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-22 19:21:22 +00:00
johnmccutchan@google.com
c86bdc5bcf
Expose field data, use class id, and merge all collections into "objects"
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//24075002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27684 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 00:59:42 +00:00
iposva@google.com
9eab35b19c
- Remove redundant include of platform/globals.h.
...
Review URL: https://codereview.chromium.org//14367034
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21860 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-23 06:55:17 +00:00
srdjan@google.com
d5ad183f5b
Add --use_cha (default true, switch to false if you use dynamic class loading). Use CHA to specify receiver class if no subclasses of the receiver exist, eliminate check class computation.
...
Remove all optimized code whenever we load scripts/libraries/snapshots. Currently this occurs only when no Dart frame is live on stack. Future change (deoptimization) will allow dynamic class loading in presence of live Dart frames.
The cost of removing all optimized code is supposed to be low. If that assumptions turns out to be false I can add more elaborate tracking of optimized functions.
Review URL: https://chromiumcodereview.appspot.com//10825483
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11106 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 22:31:49 +00:00
regis@google.com
3790edb5e1
Move class hierarchy analysis to its own source.
...
Review URL: https://chromiumcodereview.appspot.com//10827450
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11097 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 21:09:28 +00:00
regis@google.com
34a5754f3e
Add HasSubclasses function to class hierarchy analysis.
...
Review URL: https://chromiumcodereview.appspot.com//10829446
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11008 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 00:16:46 +00:00
regis@google.com
fea5f83714
Implement class hierarchy analysis in the VM.
...
Add test.
Review URL: https://chromiumcodereview.appspot.com//10828399
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11006 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-20 23:38:09 +00:00
vegorov@google.com
858b6d53e1
In generated code for ia32 don't load object's class directly from class_ field.
...
Instead look it up in class table by class index taken from object's tags.
Review URL: https://chromiumcodereview.appspot.com//10447064
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8101 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-30 12:25:49 +00:00
hausner@google.com
b00ae2d1a0
Introduce remote objects in Debugger protocol
...
Review URL: https://chromiumcodereview.appspot.com//10407071
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7864 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-22 18:06:34 +00:00
iposva@google.com
a59c00c448
- Grow the class table as needed instead of preallocating.
...
Review URL: https://chromiumcodereview.appspot.com//10311006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7235 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-02 13:22:02 +00:00
iposva@google.com
3b2781bbc8
- Increase number of classes possible.
...
Review URL: https://chromiumcodereview.appspot.com//10269026
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7186 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-01 12:54:49 +00:00
iposva@google.com
d8c7c1ada6
- Add a class index to the classes.
...
- Add a class table which assigns individual ids to classes.
Review URL: https://chromiumcodereview.appspot.com//9965042
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7183 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-01 09:20:40 +00:00