Commit Graph

129 Commits

Author SHA1 Message Date
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
Regis Crelier 7f57ebcfa1 Remove signature classes from the VM.
They were used as the class of closure instances and as the type class of
function types.
All closure instances now have class _Closure and function types are represented
by a new class FunctionType extending AbstractType.
Fix issue 24567 and add regression test.

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

Review URL: https://codereview.chromium.org/1584223006 .
2016-01-19 16:32:59 -08:00
Ivan Posva 28412d153e - Fix Isolate.spawn when running from snapshot.
- Avoid access to Isolate.resolvePackageUri when not needed. Fixes Dartium based test.

TBR

Review URL: https://codereview.chromium.org/1591573004 .
2016-01-14 23:24:07 -08:00
Ivan Posva 6d066c7e53 Add package config support to dart:isolate
- Add "static Future<Uri> get packageRoot;",
  "static Future<Uri> get packageConfig;" and
  "static Future<Uri> resolvePackageUri(Uri packageUri)" to Isolate class.
- Added "Uri packageRoot, Uri packageConfig, bool automaticPackageResolution: false" parameters to spawnUri.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1553233002 .
2016-01-12 18:19:04 -08:00
Zachary Anderson 1ce512b69f Fix Shutdown race.
This CL fixes a race during VM shutdown in which the embedder's
isolate creation callback is passed an invalid isolate data pointer.

BUG=http://dartbug.org/25351
R=asiva@google.com

Review URL: https://codereview.chromium.org/1560853002 .
2016-01-08 12:30:57 -08:00
Florian Schneider fbdce6a59e VM: Const-correctness fixes.
Three types of fixes:
1. Remove redundant const_cast
2. Remove const_cast by adding const when appropiate.
3. Remove const_cast by removing const (e.g. places where we call free with it)

For now I only fixed places where the fix is local enough - i.e. does not require
changed a large amount of code.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1526123002 .
2015-12-15 19:24:40 +01:00
Zachary Anderson a0970835f0 Adds a special case for sending an int over a port with the native API.
This improves dart <=> C++ IPC round-trip-times for Mojo by 10-20%.

BUG=

Review URL: https://codereview.chromium.org/1499853004 .
2015-12-11 16:07:16 -08:00
Ryan Macnak f380c23711 Throw an exception when attempting to use Isolate.spawnUri under precompilation.
R=srdjan@google.com

Review URL: https://codereview.chromium.org/1502473002 .
2015-12-04 10:13:15 -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
Todd Turnidge 08b3164bf3 Add the --i-like-slow-isolate-spawn flag for those who like slow spawning.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1469063003 .
2015-11-23 14:18:33 -08:00
Todd Turnidge 71b3d5aba8 Start isolates in a separate thread.
R=asiva@google.com

Review URL: https://codereview.chromium.org/1447353002 .
2015-11-18 11:02:32 -08:00
Srdjan Mitrovic cd98aff665 Getting rid of Isolate::current_zone() usage. Pass thread instead of isolate where it makes sense.
BUG=
R=hausner@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1424703004 .
2015-10-26 15:31:50 -07:00
Ivan Posva 60eab65aa0 - Implement package map parameter when spawning isolate.
BUG=
R=lrn@google.com

Review URL: https://codereview.chromium.org/1403693002 .
2015-10-12 09:05:37 -07:00
Ivan Posva ba6c0ace3e - Add getters for the current packageRoot or packageMap to the Isolate class.
- Simplify loading in builtin.dart.

BUG=
R=asiva@google.com, lrn@google.com

Review URL: https://codereview.chromium.org//1334353002 .
2015-10-03 06:53:13 -07:00
Ivan Posva fe03640e85 - Implement VM parts of https://codereview.chromium.org/1240743003/
- Pass additional state in the IsolateSpawnState to set
  error and exit handlers, as well as fatal errors on isolate start.

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1244733002 .
2015-07-20 16:46:54 +02:00
Ivan Posva f5e3f94019 Fix http://dartbug.com/23578:
- Complete revamp of isolate-specific flags.
- Associate flags with the isolate on creation.
- Dart_CreateIsolate and associate callback do take an
  extra flags argument.
- Make sure to clear IC data array when clearing code.

BUG=23578

Review URL: https://codereview.chromium.org//1162033005
2015-06-07 17:57:34 +02:00
Lasse R.H. Nielsen 5a843ebbf3 Add "checked" parameter to Isolate.spawnUri.
R=iposva@google.com

Review URL: https://codereview.chromium.org//1154673004
2015-06-03 12:32:52 +02:00
Daniel Andersson 6542a451c3 Refactor Isolate -> Thread in NativeArguments and exception handler jump.
Further reduces the one-to-one assumption about isolates and threads: native entries now ask the thread for its isolate, rather than the other way around.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1156143003
2015-05-26 16:49:51 -07:00
John McCutchan 51d8bae199 Revert "Hide Isolate pointer from embedder"
This reverts commit 014e694ba7.

Revert "Fix fall out from hide isolate pointer change"

This reverts commit 966aafbc81.

Revert "Fix build"

This reverts commit d7b03ba7b0.

BUG=

Review URL: https://codereview.chromium.org//1140263005
2015-05-19 11:41:42 -07:00
John McCutchan 014e694ba7 Hide Isolate pointer from embedder
BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1130753006
2015-05-18 14:06:10 -07:00
turnidge@google.com fb591fc36a Continue improving the documentation for the vm service protocol.
Clean up the protocol a bit as I go.

---

Addendum:

Clean up inconsistencies between field and function ownership in the protocol.

Change the names of implicit closure functions (!)

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44923 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-06 19:24:47 +00:00
koda@google.com f4419287aa Prepares for multiple threads by further decoupling Thread from Isolate.
- Replace Isolate::SetCurrent with more explicit Thread::Enter/ExitIsolate.
- Lazily initialize Thread instances when entering an isolate, to avoid new API calls for embedders.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44835 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-01 17:48:11 +00: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
johnmccutchan@google.com 172baa03ff Service isolate rework take 2
Review URL: https://codereview.chromium.org//889443002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43306 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-29 18:31:27 +00:00
johnmccutchan@google.com db271b0477 Revert r43217, r43215, r43208, r43207, and r43202.
Reverting because of some isolate spawn issues (on Windows, and pub bots).

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43219 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-27 22:56:18 +00:00
johnmccutchan@google.com 66aa470fc6 * Create vm-service isolate at Dart_Initialize time.
* Remove Service create callback.
* Simplify creation of service isolate.
* Creation is done on thread pool.
* Use vm-service isolate for loading in standalone embedder.
* Remove import of dart:io from builtin library.

performance changes:

no service isolate:

$ ./tools/test.py -m release
Test configuration: none_vm_release_ia32
[01:27 | 100% | +12363 | -    0]

$ ./tools/test.py -m release
Test configuration: none_vm_release_ia32
[01:27 | 100% | +12363 | -    0]

always start service isolate (as a thread pool task):

$ ./tools/test.py -m release
Test configuration: none_vm_release_ia32
[01:45 | 100% | +12363 | -    0]

$ ./tools/test.py -m release
Test configuration: none_vm_release_ia32
[01:44 | 100% | +12363 | -    0]

service does I/O (calls to Dart_LoadScript block until service is running):

$ ./tools/test.py -m release
Test configuration: none_vm_release_ia32
[01:55 | 100% | +12363 | -    0]

$ ./tools/test.py -m release
Test configuration: none_vm_release_ia32
[01:55 | 100% | +12363 | -    0]

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43202 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-27 19:45:48 +00:00
asiva@google.com ca1c3241c4 Fix for issue 21398.
Accept only 'literal-like' objects when sending messages to isolates
spawned using spawnURI. Allow all objects for isolates spawned using
spawnFunction.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42793 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-12 23:14:30 +00:00
iposva@google.com fd69128004 - Allow an isolate to be started in paused state.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42576 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-30 23:52:37 +00:00
lrn@google.com cf724d70a9 Add Isolate.current getter, returning the current isolate as an Isolate object.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42499 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-19 07:04:29 +00:00
iposva@google.com 320ffa23a1 - Implement hashCode and == for Capability.
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42102 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-04 12:17:48 +00:00
ajohnsen@google.com 0491f4e887 Per isolate package root.
BUG=
R=iposva@google.com, ricow@google.com, sgjesse@google.com, turnidge@google.com

Committed: https://code.google.com/p/dart/source/detail?r=40534

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40581 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-23 05:46:14 +00:00
ajohnsen@google.com 38619425c2 Revert "Per isolate package root."
Revert "Fix test in checked mode."

The Dartium branch is locked atm, making it impossible to land this and have green Dartium bots.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40540 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-22 11:13:28 +00:00
ajohnsen@google.com a058d07806 Per isolate package root.
BUG=
R=iposva@google.com, sgjesse@google.com, turnidge@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40534 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-22 08:07:06 +00:00
ricow@google.com 69bed3d030 Revert revision 39617 "Create isolates in a separate thread."
This is breaking dartium with:
BrowserOutput.stderr:
  ../../dart/runtime/vm/dart_api_impl.cc:1614: error: Dart_EnterScope expects there to be a current isolate. Did you forget to call Dart_CreateIsolate or Dart_EnterIsolate?

R=vsm@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39638 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-28 09:52:59 +00:00
turnidge@google.com 3cd24f8ebf Create isolates in a separate thread.
Previously the parent isolate waited for the child isolate to fully
load, which was not ideal.  This change fixes that.

If you run on mac, you may need to raise your open file limit to make mandel_isolate_test pass:

ulimit -n 1024

Default open file limit on the mac is low.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39617 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 19:47:06 +00:00
turnidge@google.com c48496b873 Refactor isolate startup code in preparation for making isolate spawning more truly non-blocking.
Instead of passing a startup message to the new isolate, pass all
necessary information in to _startIsolate directly.  The new isolate
sends its control port and capabilities back to the parent.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39423 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-20 19:57:09 +00:00
iposva@google.com 4835041da9 - Account for number of pending tasks in old-space collections.
- Protect access to the free lists.
- MutexLocker/MonitorLocker do not need to be StackResources.

R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39396 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-20 03:54:14 +00:00
iposva@google.com 14ecdbd66a - Separate the thread implementation used in bin/ and vm/
to allow us to make VM specific changes.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39172 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-12 23:19:53 +00:00
iposva@google.com 5686b6a793 - Implement Isolate.pause and Isolate.resume.
- Implement a minimum Capability functionality.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37982 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-03 12:56:02 +00:00
iposva@google.com fd8565b071 - Add a minimal implementation of Capability.
- Make RawReceivePort and SendPort VM internal objects.
- Rationalize the creation of ports and their handling within the VM.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35325 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 19:44:03 +00:00
iposva@google.com 0977a3bf2b - First step in refactoring ports with the goal of moving
them closer into the VM implementation.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34438 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-26 17:30:39 +00:00
fschneider@google.com 16857e0b13 Revert r32930 (Add more timing information in the VM to track time...)
It caused severe performance regressions that should be addressed.

TBR=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32959 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-24 12:15:55 +00:00
asiva@google.com 6d313d3797 Add more timing information in the VM to track time spent is dart code Vs native code.
R=johnmccutchan@google.com, turnidge@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32930 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 21:30:29 +00:00
regis@google.com 7830430adf Implement eager instantiation and canonicalization of type arguments at run
time using a cache in uninstantiated type arguments.
Remove InstantiatedTypeArguments class.
Fix a bug in optimized code: do not update unused type test cache for Smi.
Fix a bug in optimized code on ARM and MIPS in type test cache lookup.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32447 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-07 19:54:33 +00:00
turnidge@google.com b891e78325 Post-meetup feature extravaganza.
Remodel the top-level isolate summary page.

Add variables to stack frames in the stack trace.

Stop putting small integers and bools in the object id ring.

Rework how we pass down null references (and null-like references like
uninitialized values).

Collect all isolate timers by default.

Change the lifetime of IsolateSpawnState so that we can refer to it
later to know how an isolate started up.  Stop pretending that
IsolateSpawnState is a void*.  Clean up vestigial IsolateStartData.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32128 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-29 18:40:12 +00:00
iposva@google.com 781f737c6a First round of http://dartbug.com/15922:
- Address warnings about 64-bit to 32-bit conversions.
- Remove heap profiler.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31867 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-16 05:05:35 +00:00
iposva@google.com 1e8061f060 - Remove the reply_port from the VM internal message object.
- Adjust all the uses of this API.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31205 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-17 21:11:18 +00:00
lrn@google.com ed814958fc Fix VM not accepting static methods for Isolate.spawn.
BUG= http://dartbug.com/3011

Committed: https://code.google.com/p/dart/source/detail?r=30300

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30442 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-20 09:14:30 +00:00
lrn@google.com a43c644f63 Make SendPortImpl_internalSend not take a reply port as argument.
The reply port is still there in the internal Message structure,
where it is used by control messages.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30302 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-15 11:28:23 +00:00
lrn@google.com ab18829ae4 Revert "Fix VM not accepting static methods for Isolate.spawn."
Comitted by mistake.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30301 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-15 11:23:47 +00:00