Commit graph

23 commits

Author SHA1 Message Date
Clement Skau
2d36c85ff8 [vm] Removes support for --causal-async-stacks
All existing embedders have been opted into --lazy-async-stacks, the
VM also uses it as it's default in all configurations.

After this CL, any user of --causal-async-stacks will get an error
message when trying to use it.
=> In any such case, please simply remove the flag.

TEST=Exhaustive CQ.

Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: Ia440afcf2dba464aa8b8cf381b93bbac8eb9f8dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172564
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-12-01 07:27:14 +00:00
Martin Kustermann
14ea27e65b [vm/concurrency] Make thread_registry not depend on [Isolate], move mutator thread from thread registry to isolate
The thread registry is creating [Thread] objects when threads enter an
isolate (as mutator or helper). Once threads exit an isolate, the
[Thread] structure is returned and the thread registry will put it
into a cache for later re-use.

The mutator [Thread] object is an exception: Exiting and entering the
isolate as mutator will always use the same cached [Thread] object.

We want to eventually use one thread registry for an entire isolate
group. There will therefore be multiple mutator threads per thread registry.
We therefore move the cached mutator thread from the thread registry to the
[Isolate] object.

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

Change-Id: Id27dff886d79ca76f6e05320151aeb72c8ba5140
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108720
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-07-11 13:36:02 +00:00
Diogenes Nunez
38aba43111 Renames the isolate's mutator_thread_ to scheduled_mutator_thread_
The isolate's mutator_thread_ field actually represents the mutator
thread scheduled by the isolate. This was confused with the
mutator thread created by the thread_registry, which is a singleton.

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

Review-Url: https://codereview.chromium.org/2999583002 .
2017-08-07 15:54:49 -07: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
Srdjan Mitrovic
b9426418d8 Get rid of deprecated methods accessing mutator_thread_ instead of current thread
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1410643008 .
2015-10-20 10:26:08 -07:00
Srdjan Mitrovic
ab20fa00da Move no_callback_scope_depth_ and cha_ from isolate -> thread
Add checks for background compilation:
- Dart code may not be invoked
- Object allocation must happen in old space

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1401413002 .
2015-10-13 14:29:43 -07:00
Daniel Andersson
fc8286ae71 Migrate NoSafepointScope to Thread, so that helper threads can successfully call Heap::Allocate (but only for old space).
Safepointing is not yet implemented, so helper threads can only allocate when growth control is off and no Dart code is running. But extend unit test to ensure this code path remains exercised as more functionality is added.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1250463004 .
2015-07-22 15:09:54 -07:00
Daniel Andersson
3ab5fa1aaa Migrate handle scope fields to Thread.
This enables creating a HandleScope for any thread, and
is another step towards removing BaseIsolate.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1236403004 .
2015-07-16 19:17:30 -07:00
Daniel Andersson
7f890eeecf Support per-thread zones and stack resources.
This is needed to enable parallel marking/sweeping (and in the future, compilation) tasks to have their own zone allocations and to safely call code that relies on various scoped constructs (stack resources).

The next step is to migrate the scopes like NoSafepointScope, NoHandleScope, etc. from isolate- to thread-based interfaces.

NOTE: This is a copy of issue 1204303003.

BUG=

Review URL: https://codereview.chromium.org//1226403003 .
2015-07-09 11:22:26 -07:00
Daniel Andersson
c7e9dd2f99 Assert helper threads do not (yet) attempt to access the "current zone".
This guards against a sweeper thread trying to directly allocate in the "current zone".
This assertion will be removed when the "current zone" has completely migrated into Thread.

BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1185013005.
2015-06-17 08:25:26 -07:00
koda@google.com
89daba5454 Split Thread/Isolate instances, but still maintain 1:1 relationship.
The life cycle of Thread is still coupled with the life cycle of Isolate, but the added indirection allows the migration work to proceed, at negligible performance impact.

This is a small step towards making Thread different from Isolate and allow a many-to-one relationship. In particular, in prepares for being able to have the sweeper have some minimal separate state from the main thread (eliminating the current fake-isolate hack).

Concretely, it moves the thread-local storage key into the Thread class, but for now, keeps a "main_thread" in Isolate for quick access in native/runtime_entry.
Also moves cha_ field to Thread (the first of many fields that will move).

To summarize, this CL enables the next steps:
- moving other fields from Isolate to Thread without circular include-dependencies
- replacing sweeper's fake Isolate with a helper Thread (referencing the original Isolate)

Also add 'volatile' to local variables that clang thinks could be clobbered.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44703 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-25 22:41:33 +00:00
koda@google.com
e3a345a84b Rename NoGCScope -> NoSafepointScope.
The old name makes less sense in the context of concurrent GC (and multiple threads in general).

Document the intended semantics of this (DEBUG-only) guard scope.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44616 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-20 22:08:25 +00:00
koda@google.com
c1008f15c0 Save top StackResource in entry frame.
This avoids relying on stack address order, which enables us to benefit from AddressSanitizer's detect_stack_use_after_return feature.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43927 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-20 20:46:31 +00:00
koda@google.com
280dc6fbd4 Introduce simple Thread class to support gradual refactoring of interfaces.
This first iteration of Thread just forwards a subset of the BaseIsolate methods.

The plan is to first add Thread/Zone-based interfaces where appropriate, deprecate their Isolate-based versions, and finally remove them once all callsites have been migrated.

This CL only demonstrates a small part of this migration, for BitVector and some of the compiler classes. There are thousands of additional call-sites that will need to be updated.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43073 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 14:14:16 +00:00
koda@google.com
044fc59fb6 Temporarily move vm_tag_ from BaseIsolate to Isolate.
This field is used by performance sensitive generated code.

Moving it out of BaseIsolate will simplify the first step towards replacing BaseIsolate with an actual thread state abstraction. It will later be migrated to that thread class (along with many other fields of Isolate).

Also remove an unused accessor from Isolate.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42884 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-14 21:18:49 +00:00
johnmccutchan@google.com
25146ce058 Basic tag infrastructure
BUG=
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33701 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-14 16:16:21 +00:00
asiva@google.com
3af18cc4c0 1. Restructure reusable handles to make individual Scopes for each handle type
2. Add a convenience macro to make use of reusable handle scopes easier

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33471 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-08 00:26:29 +00:00
asiva@google.com
8e27430ddd - Create isolate specific resuable handles and use them in the hot lookup paths.
- Create a ResuableHandleScope class which ensures that we do not end up
  recursively reusing handles leading to corruption.

This change shows Dart2JSCompileAll runtime change from 739931 to about
645035 on my local machine.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24373 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-24 22:41:01 +00:00
asiva@google.com
c64871d699 First set of changes towards cleaning up the bytearray access APIs
- Added unimplemented versions of Dart_ByteArrayAcquireData and
  Dart_ByteArrayReleaseData
- Added infrastructure to prevent callbacks into an API function that
  allocates a new object on the Dart heap or invokes dart code.
- Removed the old Dart_ByteArrayGet* access functions as it was felt that
  they have become redundant once we provide direct access to the internal
  data pointers.
- Removed DARTSCOPE_NOCHECKS as it seems to be redundant after the change
  to not create explicit stack zones on each Dart API call.
Review URL: https://codereview.chromium.org//12036098

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17958 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-31 23:56:48 +00:00
tball@google.com
2cd8436c5a Changed StackZone and ApiZone to be containers for Zone.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13707 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-16 22:05:40 +00:00
tball@google.com
76d7c9b105 Renamed Zone->StackZone, BaseZone->Zone, in preparation for changing isolate->get_zone() to return what was called the BaseZone instead of its wrapper. The GetBaseZone() methods were not renamed, to help the next CL.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13314 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-05 19:52:55 +00:00
turnidge@google.com
5f30febb45 Inline the StackResource constructor/destructor.
This yields a 29% improvement on the Benchmark_UseDartApi microbenchmark.

To do this, I had to split a few fields from Isolate into a
BaseIsolate class.  Sort of yucky.
Review URL: https://chromiumcodereview.appspot.com//10008030

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6288 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-06 18:00:51 +00:00