Commit Graph

305 Commits

Author SHA1 Message Date
Ryan Macnak 12b18466bb Reduce size of monomorphic checked entry.
Flutter gallery
VMIsolate(CodeSize): 112293
Isolate(CodeSize): 2065968
ReadOnlyData(CodeSize): 1721336
Instructions(CodeSize): 5625616
Total(CodeSize): 9525213
->
VMIsolate(CodeSize): 112292
Isolate(CodeSize): 2065966
ReadOnlyData(CodeSize): 1721336
Instructions(CodeSize): 5592336 -0.35%
Total(CodeSize): 9491930 -0.59%

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2403613002 .
2016-10-11 13:58:49 -07:00
Ryan Macnak 763daa9d06 Reapply "Lazy deopt without code patching."
When throwing to a frame scheduled for lazy deopt, update the continuation pc for that frame to be the catch handler.

Weaken new assert that the deopt pc belongs to the frame's code as the deopt pc for the last eager deopt in a function lies outside the code, after the call to the deopt stub.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2392613002 .
2016-10-03 11:31:48 -07:00
Ryan Macnak 4e9a473746 Revert "Lazy deopt without code patching."
This reverts commit 6cff17c59a.

Review URL: https://codereview.chromium.org/2382953004 .
2016-09-30 18:04:58 -07:00
Ryan Macnak 6cff17c59a Lazy deopt without code patching.
Keep a side table that maps a fp back to a deopt pc.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2380403003 .
2016-09-30 16:53:29 -07:00
John McCutchan bc119f28bb Relax zone allocation assertion
- [x] Allow allocation in any zone that is owned by the current thread not just the top zone.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2360963005 .
2016-09-23 13:06:14 -07:00
Ryan Macnak 6137d020b9 AOT: Use a cid range check when possible to implement type tests.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2314133003 .
2016-09-08 15:25:08 -07:00
Ryan Macnak e40b4fd2c5 Update some switchable call stub names and comments.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2272793004 .
2016-08-23 17:27:57 -07:00
Ryan Macnak 59c52a5b64 Partially implement DBC profiler.
- Fix setting exit frame info to indicate when we are executing Dart code.
 - Copy local pc to memory on call and return to make it accessible to the profiler. Since the profiler cannot access the local pc, the profiler is not accurate at the instruction level.
 - Teach the profiler's stack walker that the stack grows up for Dart frames on DBC.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2250823002 .
2016-08-19 16:48:34 -07: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
Lars Bak 4e7bb93773 - Optimized the call sequences for calling the megamorphic stub on all platforms.
- Optimized instructions in the megamorphic stubs on X64, IA32, ARM, and ARM64.
In a micro benchmark testing megamorphic calls using 71 different receiver types,
the execution times goes from 2.6 sec to 1.4 sec.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2131583002 .
2016-07-07 11:21:53 -07:00
Ryan Macnak 103e316f6a Reapply "Background finalization."
- Fix double-finalization by marking handles that are in a finalization queue.
 - Remember external size in words instead of bytes.
 - Add SlowFinalizer test.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2084193003 .
2016-06-22 16:26:49 -07:00
Ryan Macnak ae94be3f4d Revert "Background finalization."
This reverts commit d265a3db53.

Review URL: https://codereview.chromium.org/2088923002 .
2016-06-21 13:15:12 -07:00
Ryan Macnak d265a3db53 Reapply "Background finalization."
This reverts commit 7d9e75e0b6.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2080353002 .
2016-06-21 09:27:23 -07:00
Ryan Macnak 7d9e75e0b6 Revert "Background finalization."
This reverts commit 082829a00b.

Review URL: https://codereview.chromium.org/2041373004 .
2016-06-07 17:21:06 -07:00
Ryan Macnak 082829a00b Background finalization.
Flutter gallery app on Nexus 4:
 max weak handle processing (main thread): 17.7ms -> 1.1ms
 max scavenge (main thread): 21.0ms -> 17.1ms

BUG=flutter/flutter#3804
R=asiva@google.com

Review URL: https://codereview.chromium.org/2012973002 .
2016-06-07 14:38:37 -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
John McCutchan 7b42769cd0 Fix ARM build by moving field in Thread
BUG=

Review URL: https://codereview.chromium.org/1985763002 .
2016-05-16 10:58:21 -07:00
John McCutchan d1d3ba587b Cleanup timeline stream enabled flag so that it can be easily tested from an intrinsic
- Drop no-longer used globally enabled stream flags. This leaves just one source of truth.
- Kill 'Enabled()' for 'enabled()'.
- Store pointer to Timeline::DartStream in Thread.
- Store enabled as an uintptr_t instead of a bool to make it easier for generated code to access.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1975203003 .
2016-05-16 10:30:48 -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
Vyacheslav Egorov ee0f608ce4 Dart Byte Code interpreter.
This version is Clang/GCC only and does not support Windows because it uses computed goto's.

Only unoptimized mode is supported.

Architecture is described in constants_dbc.h and stack_frame_dbc.h.

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

Review URL: https://codereview.chromium.org/1858283002 .
2016-04-18 23:02:01 +02:00
Srdjan Mitrovic 1a9fc8b2fa Move CompilerStats from isolate to thread. Aggregate stats.
The mutator thread holds the aggregate values, the background compiler adds its value to it.

BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1841213003 .
2016-03-30 13:38:32 -07:00
John McCutchan 41d9f2d107 Add Thread TaskKind
BUG=
R=asiva@google.com, turnidge@google.com

Review URL: https://codereview.chromium.org/1814243002 .
2016-03-21 09:41:47 -07:00
Srdjan Mitrovic dda658f48a Restructure/fix thread pointer visiting; added some asserts.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1814853005 .
2016-03-17 13:25:46 -07:00
Siva Annamalai 56e888d4cd - Move
stack_limit_,
   stack_overflow_flags_,
   saved_stack_limit_,
   stack_overflow_count_ and
   other interrupts mask fields from Isolate structure to Thread structure

- Change the stack overflow check in the prolog to load the stack limit
  from the THR register, this removes the back to back dependent loads to
  load the stack limit from the Isolate structure

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

Review URL: https://codereview.chromium.org/1812753002 .
2016-03-17 12:57:36 -07:00
Ryan Macnak e386db978e Invoke CallToRuntime via Thread instead of ObjectPools.
Most functions use CallToRuntime for the stack overflow check.

precompiled dart2js arm 20388895 -> 20308640 (-0.39%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1778103003 .
2016-03-11 10:03:12 -08:00
Srdjan Mitrovic 4316d1bd17 Move sticky_error_ from isolate to thread
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1672853002 .
2016-02-05 15:46:55 -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
Siva Annamalai e72c1fb47d Implement safepointing of threads :
- uses thread execution status transition to track when a thread is in a safepoint or needs to block for a safepoint
 - introduces a monitor per Thread object
 - uses a per thread safepoint handshake between the thread requesting a safepoint and the requested thread.

The ThreadRegistry class now contains only the thread list for an isolate and the functionality of scheduling a thread onto an Isolate and unscheduling it from teh isolate. We could fold this functionality into the Isolate class in a different CL.

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

Review URL: https://codereview.chromium.org/1541073002 .
2016-02-01 10:57:34 -08:00
Siva Annamalai a0fedf3879 1. Add code to grow the heap instead of collecting garbage in Heap::AllocateOld when allocation is done by a non mutator thread which is at a safepoint. Garbage collection is triggered after the safepoint is done.
2. Add code to avoid multiple garbage collection requests on different threads to sync up and allow only one request to proceed at a time, other requests wait for this garbage collection request to be done and then proceed to allocation once the request is done.

R=iposva@google.com

Review URL: https://codereview.chromium.org/1562853003 .
2016-01-11 11:00:59 -08:00
Siva Annamalai b40775549f Fix for issue 25236
- Ensure that no new OSThreads are created once the VM is in shutdown mode
- Do not query thread_list_head_ without a lock (this leads to the race which causes two threads to delete the lock and TLS at the same time)

BUG=25236
R=zra@google.com

Review URL: https://codereview.chromium.org/1537543002 .
2015-12-18 10:16:28 -08:00
Ivan Posva e47ac24c79 - Make sure to prepare all threads for GC.
BUG=
R=asiva@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org/1533023002 .
2015-12-17 19:59:13 -08:00
Siva Annamalai 956d02f22d Make no_handle_scope_depth_ an int32_t field as that is what the accessor returns and there is check to ensure it;s value is < INT_MAX.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1530543002 .
2015-12-14 17:28:03 -08:00
Ryan Macnak 3e7212e194 Reapply "Precompilation/x64: Load float vector constants via Thread."
Fix unbalanced Enter/LeaveTestFrame in TestObjectCompare. Crashed on release + clang with the original change, and was failing on ASAN before that.

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

Review URL: https://codereview.chromium.org/1499763002 .
2015-12-04 09:46:21 -08:00
Ryan Macnak 7dfb517618 Revert "Precompilation/x64: Load float vector constants via Thread."
This reverts commit 9cf30c9697.

Review URL: https://codereview.chromium.org/1494323002 .
2015-12-03 14:19:21 -08:00
Ryan Macnak 9cf30c9697 Precompilation/x64: Load float vector constants via Thread.
Cannot put these in the object pool because some of these instructions
are used in intrinsics.

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

Review URL: https://codereview.chromium.org/1488403002 .
2015-12-03 13:35:31 -08:00
Siva Annamalai 01b69ebabc Move ApiLocalScope out of class ApiState into class Thread so that the API local handles and zone etc. are thread specific instead of being Isolate specific.
R=zra@google.com

Review URL: https://codereview.chromium.org/1473403003 .
2015-11-25 11:07:22 -08:00
Siva Annamalai 9e19d236ca - Add an OSThread structure which is the generic TLS structure for all C++
fields in a thread (i.e fields that are not Dart VM related)
- Split the Thread structure to be a pure Dart per thread structure and add
  a pointer to os_thread which points to the OSThread structure
- Change Schedule/UnSchedule to set the Dart Thread structure as the TLS of
  the thread when it is inside the Dart world and reset the TLS back to the
  OSThread strcuture when is exits the Dart World.
- Moved the stack_base and few stack size related functions to OSThread from Isolate

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

Review URL: https://codereview.chromium.org/1439483003 .
2015-11-19 13:45:10 -08:00
Ryan Macnak df64bb1619 - Annotate instructions that load objects from the ObjectPool or Thread.
- Remove disassembly tooltips.
- Surface whether a function has an intrinsic or is recognized.
- Mark intrinsified or ffi functions in the profile.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1439893002 .
2015-11-12 15:18:31 -08:00
John McCutchan 43b0ae00e7 Timeline service protocol support with Observatory UI
Service Protocol:
- _clearVMTimeline (clear timeline)
- _getVMTimeline (fetch timeline)
- _setVMTimelineFlag (control recording)
- _getVMTimelineFlag (...)
- _getVMTimeline service unit test

Observatory:
- timeline page with record on/off, clear timeline, and refresh buttons.
- trace-viewer based timeline view that runs in an iframe driven by a small javascript program

Misc:
- Fix default enable logic bugs
- Add 'Debugger Pause' timeline event
- Threads can have a name and that name will be displayed in Observatory
- Tighten up locking when printing JSON

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1406413006 .
2015-11-10 08:02:22 -08:00
Siva Annamalai 9dee5b7a15 Minor cleanup
- remove ThreadInterruptCallback typedef as it is not used anymore
 - move InterruptedThreadState to thread_interrupter.h

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1428373003 .
2015-11-06 14:15:16 -08:00
John McCutchan ceb12c4f69 Switch profiler from isolates to threads
- API breakage: Dart_IsolateBlocked, Dart_IsolateUnblocked -> Dart_ThreadDisableProfiling, Dart_ThreadEnableProfiling.
- Remove IsolateProfilerData.
- Move thread at blocking call count from isolate to thread.
- Always interrupt threads unless they are blocked.
- We can no longer count "idle" ticks.
- Only record sample if thread is the current mutator of an isolate.
- Refactor ThreadInterrupterCallback to ensure that Thread* is valid.

Threads are only ever sent signals if ThreadInterruptsEnabled is true. Which is controlled by two functions:

void DisableThreadInterrupts();
void EnableThreadInterrupts();

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

Review URL: https://codereview.chromium.org/1423473004 .
2015-11-04 07:59:16 -08:00
William Hesse cc4a5d2e7c Revert "Switch profiler from isolates to threads"
Reverts commit 6365c27f81 and
commit 8b9ed6cfb3.

They are causing flaky timeouts (hangs) on all vm cc tests on all Windows vm bots.

R=mit@google.com

Review URL: https://codereview.chromium.org/1425093006 .
2015-11-03 10:42:55 +01:00
John McCutchan 6365c27f81 Switch profiler from isolates to threads
- API breakage: Dart_IsolateBlocked, Dart_IsolateUnblocked -> Dart_ThreadDisableProfiling, Dart_ThreadEnableProfiling.
- Remove IsolateProfilerData.
- Move thread at blocking call count from isolate to thread.
- Always interrupt threads unless they are blocked.
- We can no longer count "idle" ticks.
- Only record sample if thread is the current mutator of an isolate.
- Refactor ThreadInterrupterCallback to ensure that Thread* is valid.

Threads are only ever sent signals if ThreadInterruptsEnabled is true. Which is controlled by two functions:

void DisableThreadInterrupts();
void EnableThreadInterrupts();

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

Review URL: https://codereview.chromium.org/1412733008 .
2015-11-02 12:47:52 -08:00
Siva Annamalai 5e4a3d7a65 Add IsMutatorThread to the Thread class and use it instead of MutatorThreadIsCurrentThread
Review URL: https://codereview.chromium.org/1408923005 .
2015-10-26 13:12:10 -07:00
John McCutchan b83e5a718e Fix ThreadIterator_AddFindRemove test
- A pointer test was unsafe because the allocator could recycle the address for a new thread.

Fixes #24692

R=asiva@google.com

Review URL: https://codereview.chromium.org/1425463004 .
2015-10-26 11:07:16 -07:00
Srdjan Mitrovic 8e14e2b459 Fix builds
BUG=

Review URL: https://codereview.chromium.org/1414343002 .
2015-10-20 11:20:22 -07:00
Srdjan Mitrovic 8915fb6fde More work for background compilation; move pending_functions_ from ObjectStore to Thread.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1409173002 .
2015-10-16 17:02:43 -07:00
John McCutchan da946fbf99 Simplify timeline backend
Now that we have a central list of all threads that are interacting with the VM we can stop relying on the Isolate's thread registry to cache timeline blocks.

- Move from caching blocks in the Isolate's thread registry and caching them in the Thread directly.
- This allows cached blocks to have events from multiple isolates, increasing usage density and reducing the number of blocks being cached at any given time.
- We no longer need a distinct global block, this allows me to remove a bunch of dead code.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1402383003 .
2015-10-16 13:36:58 -07:00
John McCutchan e36b9fa3bf Complete support for Windows TLS destructors
- Maintain a list of TLS destructors that should be run when a thread exits.
- Walk that list on thread exit and invoke destructors.

R=asiva@google.com

Review URL: https://codereview.chromium.org/1410493002 .
2015-10-16 10:00:44 -07:00
John McCutchan 1ec9d78b89 Call known TLS destructors on Windows
Partially fixes #23474 by freeing the MonitorWaitData and Thread objects on Windows when a thread exits.

Machinery to run a function at thread exit on Windows taken from Chromium's base.

R=asiva@google.com

Review URL: https://codereview.chromium.org/1391013006 .
2015-10-14 07:59:33 -07:00