Commit graph

16 commits

Author SHA1 Message Date
Vyacheslav Egorov 1dd4559271 [vm] Add Native->VM transitions when dereferencing API handles.
For example setting return value unwraps handles and stores
raw pointer values to the stack which might race with GC
in another thread.

This CL adds assertions in helper methods from Api class which
unwrap API handles and fixes all places that were revealed by
those assertions.

Caveat: we still permit to check whether handle contains
Smi or not without entering VM state - because GC does not
change this property.

Bug: b/127482366
Change-Id: I59f08c2a91935995514fb70607c2777aa2844d94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95654
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-03-08 00:06:37 +00:00
Zach Anderson 42702e2c64 [vm] Spot fixes for Fuchsia
Change-Id: I4714f92cd2732875df584fc816228fb4b88f5828
Reviewed-on: https://dart-review.googlesource.com/c/88285
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2019-01-03 19:04:10 +00:00
Ryan Macnak 7514ce941e [vm] Assert handles are only allocated when the thread is preventing safepoints.
Threads in the native or blocked states don't prevent safepoints, so they may run concurrently with a safepoint operation like GC. It is not safe for handles to be allocated while the GC is visiting them, so these threads must not allocate handles. Assert only threads in the VM or generated states, which prevent safepoints until they check in, may allocate handles. (Generated code does not allocate handles, but leaf runtime entries remain in the generated state.)

Bug: https://github.com/dart-lang/sdk/issues/34883
Change-Id: I1a211778f7ef96b53a2405f0ee9dde7871b122b6
Reviewed-on: https://dart-review.googlesource.com/c/81540
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-31 19:51:52 +00:00
Ryan Macnak b8760fed67 [vm, compiler] Remove ASTs and AST flow graph builder.
Change-Id: I4d3c6500577d5285ced327954040dab42ba92341
Reviewed-on: https://dart-review.googlesource.com/c/78823
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-10-10 18:00:21 +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
Ben Konyi f2fd150ea0 Added new type of unit test, RAW_UNIT_TEST_CASE, which is used for tests that can be flaky if run while the VM is alive. Tests created using the RAW_UNIT_TEST_CASE macro will run after the VM has shutdown to avoid having any worker threads contaminating the test results.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2666133002 .
2017-01-31 15:16:38 -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
Ivan Posva 5be5d54529 - Refactor Symbol allocation to expect a thread parameter.
- Preallocate all tokens as symbols to avoid repeated lookups.
- Pass thread/zone where useful while doing this change.
- Avoid allocating symbols for error messages.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1870343002 .
2016-04-11 16:28:29 -07:00
John McCutchan d295b9c311 Remove many features when building product mode
Move all JSON printing code from object.cc to object_service.cc.

Not compiled in:

- Service protocol
- Debugger
- Debugger API
- JSONStream
- ObjectIdRing
- Profiler service
- Object JSON printing

Size of dart_bootstrap before: 5670365 bytes
Size of dart_bootstrap after: 5287631 bytes

Reduction in size: 382734 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1660063002 .
2016-02-05 09:55:51 -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 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
johnmccutchan@google.com f4c3119a2e Add Service ID zones to service protocol
- Add ServiceIdZone interface for getting temporary ids.
- Add RingServiceIdZone which uses the isolate's object id ring.
- Add GrowableServiceIdZone which uses a growable array.
- Unit tests for ServiceIdZones.
- JSONStream has a service id zone.
- Default service id zone is ring with eager id allocation.
- All service RPCs can include a _serviceIdZone parameter.
- Value of _serviceIdZone can be Ring.NewId or Ring.ExistingId.
- All ObjectIdRing usage in object.cc has been replaced with `jsobj.AddServiceId("id", *this);`
- Add a policy for id reuse to ObjectIdRing::GetIdForObject
- ObjectIdRing can dump its contents to JSON.
- Add _dumpRingRequests RPC which dumps the isolate's ring.
- _getCrashDump includes complete object id ring.

R=turnidge@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45754 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-12 23:48:01 +00:00
rmacnak@google.com 2396c11a3c Treat null like the object it is in the Observatory and Service.
BUG=http://dartbug.com/20649
R=turnidge@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39616 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 19:36:29 +00:00
zra@google.com 7d0b680f95 Adds Simulator Longjmp and enables many tests for arm64.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35603 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-30 23:07:47 +00:00
zra@google.com 2fe51715e5 Begins work on ARM64, first assembler test.
Most new code is in constants_arm64.h and
{assembler,disassembler,simulator}_arm64.{h,cc}

The rest of the CL just #def's out tests, modifies status files,
and adds UNIMPLEMENTED functions, etc.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34654 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-02 17:39:32 +00:00
johnmccutchan@google.com 7f993f87ee Object ID Ring with tests
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25063 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-16 18:31:25 +00:00