Commit Graph

23 Commits

Author SHA1 Message Date
Vyacheslav Egorov a9ce969e53 [vm] Decouple growable_array.h and zone.h from thread.h
- Introduce a slimmed down version of thread.h, which just depends on the
Zone and StackResource.
- Introduce a layering check that would prevent the coupling in the future.

This is the first step towards decoupling compiler from runtime.

There are multiple reasons to introduce the decoupling but the main
reason currently is to introduce a controlled surface through which
compiler reaches into runtime to catch any places where runtime word size
might influence the compiler and then enable building compiler that
targets 32-bit runtime but is embedded into a 64-bit runtime.

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

Change-Id: Id63ebbaddca55dd097298e51c90d957a73fa476e
Reviewed-on: https://dart-review.googlesource.com/c/87182
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-11 20:47:10 +00:00
Martin Kustermann 31dd6683f8 [VM] Optimize performance of dart_boostrap in debug-kernel-strong mode.
Since the kernel reading helpers have been extended to not only work
with a kernel blob in C heap, but also work based on a [TypedData]
buffer in the VM heap, access to the [TypedData] buffer is on the hot
path now.

This hot path is slowing things down considerably, in particular due
to NoSafepoingScope's.

This CL removes a critical NoSafepoingScope when accessing the
[TypedData] in read-only mode.  It also allows passing in the [Thread]
directly, to avoid TLS lookups.

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

Change-Id: I91955bea5cd4eddbbd21c5d3bc6813504c2cece9
Reviewed-on: https://dart-review.googlesource.com/47222
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-21 10:24:29 +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
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
Srdjan Mitrovic 8c7a94e9f4 Preparation for moving reusable handles to thread and more cleanups: isolate -> thread based handle allocation.
BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org/1384403002 .
2015-10-06 10:17:12 -07:00
Daniel Andersson b739b6319f Add NoSafepointScope to ObjectPointerVisitor.
Also update some uses of NoHandleScope to NoSafepointScope, which basically means "do not risk GC here".

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1292063004 .
2015-08-13 12:59:32 -07:00
Daniel Andersson 32046b2eb8 Migrate stack resource unwinding to Thread.
Also remove some uses of deprecated StackResource constructor.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1261873005 .
2015-07-31 12:57:19 -07:00
Daniel Andersson c089a152ac Migrate most uses of Isolate::current_zone to Thread::zone.
After https://codereview.chromium.org/1204303003/ is submitted, the last remaining uses can go.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1220193009 .
2015-07-08 09:59:32 -07:00
koda@google.com 9c181ec6d5 Thread/Isolate refactoring: new(Isolate*) -> new(Zone*)
Refactor all remaning cases where the current zone is used through new(Isolate*) and remove this interface.

Removing this interface is needed to move towards multiple threads per isolate, and also makes the caller more aware of the scope of the zone used, reducing the risk of use-after-free.

Make the current thread and the stack zone created around native/runtime entries directly available in their body, saving an indirection (and optimized away if unused).

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44541 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-17 19:24:26 +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 554f25b53c Verify/document assumption about stack resource addresses.
We assume that addresses of stack resources refer to the actual stack and are ordered accordingly.
Using the AddressSanitizer with detect_stack_use_after_return will break this assumption.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43858 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-18 23:21:32 +00:00
koda@google.com 33b55e64e4 Isolate/Thread split: Isolate -> Zone for LocationSummary.
The isolate was being passed around, even though only its current zone was used.

Pass that zone directly instead, giving two benefits:
1. helps prepare for the upcoming Isolate/Thread split, where "new(isolate)" must go, and
2. saves a pointer indirection at the allocation sites.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42935 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 21:29:57 +00:00
fschneider@google.com 699add3afc VM: Make ZoneAllocated-objects that don't need a vtable smaller.
Remove virtual destructor from ZoneAllocated. Instead, subclasses
that need one have it explicitly declared.

This makes ZoneAllocated objects without virtual functions smaller
because there won't be a vtable for them.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37228 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-11 10:54:16 +00:00
iposva@google.com 3878793b10 - Reduce the number of Isolate::Current() calls.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36564 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-23 12:07:33 +00:00
jacobr@google.com 605b33c1bc fix cpp11 compile errors
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26387 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 20:24:11 +00:00
cshapiro@google.com da14bf70a7 Add attributions so printf like functions can have their arguments checked.
This change also corrects some misuses of format strings and format
arguments that discovered by the compiler checks.

Review URL: https://chromiumcodereview.appspot.com//10869063

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11912 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-06 00:58:25 +00:00
turnidge@google.com 2803d78dfd Change the zone allocation api.
Instead of passing a size in bytes to the allocation function, we now
have a templatized Alloc function:

  zone->Alloc<Type>(len)

This is better for security, as we can check for integer overflow in
the size computation before performing the allocation.  Before, we
often failed to check this.
Review URL: https://chromiumcodereview.appspot.com//10836061

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10254 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 21:51:44 +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
turnidge@google.com 1f5364cd3b Add support for native ports in the vm.
Dart_NewNativePort creates a port associated with a C handler
function.  When messages come in on this port, they are forwarded to
the C function for processing.

To support this, refactored PortMap so that it operates on a new
MessageHandler type instead of directly on Isolates.

For now, native ports have a dedicated single thread.  Eventually we
will back native ports (and possibly Isolates as well) by a shared
thread pool.
Review URL: https://chromiumcodereview.appspot.com//9169063

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3804 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 18:53:40 +00:00
sgjesse@google.com bf67f24098 Move assert.h/assert.cc from runtime/vm to runtime/platform
The purpose of this change is twofold:

1. Source in the bin directory can now use the same assertions as
   source in the vm directory. The ASSERT macro used by the code
   in runtime/bin was just defined to use assert from the standard
   C library.
2. Moving other implementation parts from runtime/vm to
   runtime/platform (e.g. classes Monitor and Mutex) for sharing
   between runtime/bin and runtime/vm will be easier as these
   implementations rely on these assertion macros.

Created two gypi files for the platform directory. One for the
headers and one for the source. The source one is only included
when building the VM library and will be present in libdart.a
when the dart executable is linked.

All the code for asserts is still in the dart namespace.

Also re-arranged the order of includes to be alphabetically in
the files touched.

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

BUG=
TEST=

Review URL: http://codereview.chromium.org//9189003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3335 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-16 12:28:10 +00:00
asiva@google.com 5cf3ad018a Changes to pass the current isolate to all runtime and native calls.
Review URL: http://codereview.chromium.org//8528010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1499 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-12 05:55:22 +00:00
asiva@google.com 2d388b751f Cache isolate in the StackTrace object to that we don't call
Isolate::Current in the destructor, HandleScope and Zone.
TBR=iposva (already reviewed change on other client).
Review URL: http://codereview.chromium.org//8523013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1427 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-10 21:08:18 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00