Commit Graph

32 Commits

Author SHA1 Message Date
cshapiro@google.com 9108ddb9a2 Do not use C++ const references in the C interface.
Review URL: http://codereview.chromium.org//9017018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2711 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-21 17:50:38 +00:00
asiva@google.com bde808f44b Changes to create an application snapshot which can be layered on top
after an isolate is created and initialized.

Added an option --use_script_snapshot which creates a snapshot of the specified script in an isolate, shuts that down and restarts on a new isolate and loads the script from the snapshot buffer and executes it.
Review URL: http://codereview.chromium.org//8970004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2609 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 02:04:24 +00:00
cshapiro@google.com 32f55ce37b Implement weak persistent handles in the Dart API.
Review URL: http://codereview.chromium.org//8984006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2607 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 01:44:53 +00:00
turnidge@google.com 0b833d4977 Add support for interrupting an isolate in the vm. Interrupts are
implemented by extending the existing support for stack overflow
checking in the vm.  When an interrupt is scheduled for an isolate, we
overwrite the isolate's stack limit with a value guaranteed to cause a
stack overflow.

We support multiple kinds of interrupts, encoded in the low bits of
the stack limit.

Add Dart_InterruptIsolate and Dart_InterruptIsolateCallback to the
dart embedding api to allow the embedder to request and handle
interrupts.

Add EXPECT_SUBSTRING(needle, haystack) testing macro.
Review URL: http://codereview.chromium.org//8851008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2529 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-16 18:41:20 +00:00
turnidge@google.com 3b9026f21d If an unhandled exception occurs in Dart_RunLoop, pass it out to the caller.
Review URL: http://codereview.chromium.org//8918028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2438 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-14 18:27:58 +00:00
hausner@google.com 75918306af First debugger API unit test
Add unit test file, expose more debugger functionality in the API.
Review URL: http://codereview.chromium.org//8872049

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2320 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-09 19:29:37 +00:00
cshapiro@google.com aae8784962 Add an interface for retrieving the value of unsigned 64-bit integers.
With this change, IntegerValue is renamed to IntegerToInt64 for symmetry
with the new IntegerToUint64 interface.  Also uses of UInt64 have been
replaced with Uint64 for naming consistency.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2317 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-09 17:25:44 +00:00
cshapiro@google.com 59541fef4c Use specialized unwrapping methods for reading Double and Bool values.
Review URL: http://codereview.chromium.org//8888031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2292 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-08 23:50:40 +00:00
hausner@google.com 9159389495 First bits of external debugger API
The debugger API is in a separate set of files. Embedders do not have
to include the debug api if they don't need to.
Review URL: http://codereview.chromium.org//8826007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2198 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-07 22:13:49 +00:00
asiva@google.com 7ddd0f0b89 First step towards generation of application script snapshots
- Introduce 3 kinds of snapshots (full, application script and messages)
- Added a dart API function to be used for generating an application snapshot
  and for loading the script from an application snapshot.

Next step is to introduce special handling in the WriteTo and ReadFrom
snapshot functions for 'kind == Snapshot::kScript'
Review URL: http://codereview.chromium.org//8772061

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2105 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-06 00:34:49 +00:00
turnidge@google.com 1abf65b434 Add Dart_IsExternalString and Dart_ExternalStringGetPeer to the dart
embedding api.
Review URL: http://codereview.chromium.org//8775039

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2080 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-05 17:55:01 +00:00
turnidge@google.com 7c2a96158e Stop using void* types in the dart embedding api.
Review URL: http://codereview.chromium.org//8761007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1988 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-01 18:18:06 +00:00
podivilov@google.com c692646f07 Introduce Dart_SetVMFlags API function.
It should be possible to set command line arguments without providing isolate init callback.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1972 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-01 11:59:35 +00:00
asiva@google.com b53c955b37 - Refactor the isolate callback mechanism to also include creation of the
isolate, this enables creation of isolates using a snapshot
- remove source buffers of corelib, coreimpl-lib and builtin-lib from the binary
Review URL: http://codereview.chromium.org//8673002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1958 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-01 00:30:25 +00:00
turnidge@google.com cf23dbad75 Add a mid-sized integration test for the Dart Embedding Api which
demonstrates how to create a custom isolate abstraction.  In this
test, we use an event queue to share a single thread among our custom
isolates.

Add a callback which allows embedders to see when a port is created.
Not sure if I should keep this or not.

New apis:
  Dart_CreatePort() -- allocates a port id and adds a port->isolate mapping.
  Dart_IsolateHasActivePorts() -- does the current isolate have open ports?
  (this name a bit awkward...)

Bail out of PortMap::ClosePorts() early if there are no open ports.
This suppresses calls to the close_port_callback when there are no
open ports.

Use DART_CHECK_VALID to provide better error output when the test lib
has errors.

-------------------------
Sample output of the test:

-- (isolate=0x815600) Constructing isolate
-- Enter: CustomIsolateImpl_start --
-- Adding port (7111) -> isolate (0x830800) --
-- Adding StartEvent to queue --
-- Exit: CustomIsolateImpl_start --
-- Adding port (7112) -> isolate (0x815600) --
-- Posting message dest(7111) reply(0) --
-- Adding MessageEvent to queue --
-- Starting event loop --
>> StartEvent with isolate(0x830800)--
-- (isolate=0x830800) Running isolateMain
$$ MessageEvent with dest port 7111--
-- (isolate=0x830800) Received: 42
-- Posting message dest(7112) reply(0) --
-- Adding MessageEvent to queue --
$$ MessageEvent with dest port 7112--
-- Closing port (7112) --
-- Adding ShutdownEvent to queue --
-- (isolate=0x815600) Received: 43
<< ShutdownEvent with isolate(0x815600)--
-- Finished event loop --
Review URL: http://codereview.chromium.org//8588040

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1906 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-29 21:55:13 +00:00
turnidge@google.com beebe26bf8 Reorder the functions in dart_api_impl.cc to match dart_api.h.
Review URL: http://codereview.chromium.org//8636021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1759 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-22 19:42:38 +00:00
turnidge@google.com a31b5a59f7 Start using UNWRAP_NONNULL to check inputs to dart api functions.
Improve a few error messages.

Lots of testing.
Review URL: http://codereview.chromium.org//8528018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1712 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-21 19:09:51 +00:00
cshapiro@google.com 1cff31c3d0 Implement external strings.
External strings refer to character data in memory located outside of
the managed heap.  This memory is considered to be owned by the
embedding application.  To help with the management of external
memory, the virtual machine allows the embedding application to
register for a "death notice" when an external string object is
garbage collected.  A death notice takes the form of a callback
invoked by the garbage collector with the address of the external
memory.  Death notices will be implemented in the garbage collector by
future commit.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1679 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-19 00:33:23 +00:00
asiva@google.com 2d88131bfe Fix prototype of Dart_Initialize.
Review URL: http://codereview.chromium.org//8574075

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1635 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-17 21:59:38 +00:00
turnidge@google.com 8c64adf13e Deal with unhandled exceptions the same way in all Dart api functions.
--

Terminology change: invalid handles are now called error handles.

Unhandled exceptions used to be a kind of valid handle.  Now they are
a kind of error handle.

For the Dart_Invoke* functions, this means that the standard
error-checking blob drops from two tests to one test and is
harder to mess up.

Many other Dart api functions (Dart_ToString, for example) previously
dealt with unhandled exceptions by turning them into terse error
messages.  Now these functions preserve information about the
exceptions and generate better error messages.

Changed Dart_HandleMessage to return success/failure.  It seemed to fit.

--

Details:

Dart_IsValid becomes Dart_IsError (negated sense).

Dart_GetError now knows how to print a stack trace semi-nicely.

Dart_ExceptionOccurred -> Dart_IsUnhandledException.

Renamed ApiFailure class to ApiError to fit better.

ApiError now has a "data" pointer that points to either an error
message string or to an unhandled exception object.

Documentation changes aplenty.
Review URL: http://codereview.chromium.org//8501034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1470 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-11 19:31:04 +00:00
turnidge@google.com 04d38885a3 Renaming:
Dart_ObjectToString -> Dart_ToString
Dart_Objects_Equal -> Dart_ObjectEquals
Dart_IsInstanceOf -> Dart_ObjectIsType
Dart_ReThrowException -> Dart_RethrowException

Added:

Dart_IsSame: === operation

Added a couple of tests.
Review URL: http://codereview.chromium.org//8490016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1326 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-08 19:18:22 +00:00
turnidge@google.com 9a3434cd17 Allow printf-style arguments for Dart_Error and Api::Error.
Convert one error message to use the new facility for testing
purposes.  The rest of the errors will be improved in follow-on
changes.

Add tests.

Minor comment fixes in dart_api_impl.h.
Review URL: http://codereview.chromium.org//8492015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1276 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-08 00:12:59 +00:00
turnidge@google.com 9a118fbb49 Add Dart_Null, Dart_True, and Dart_False.
Fix Dart_NewPersistentHandle so it won't break if passed one of these
persistent handles.

Reviewer: Should I document that these new functions return a
persistent handle?
Review URL: http://codereview.chromium.org//8446009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1230 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-05 00:09:36 +00:00
ager@google.com 68166663f9 Renaming Array -> List in the VM API.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1195 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-04 12:25:53 +00:00
turnidge@google.com d7c536d677 Reorganize dart_api.h and add a bunch of documentation.
Review URL: http://codereview.chromium.org//8343045

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1034 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-01 18:11:36 +00:00
turnidge@google.com 45ab0f6d65 DART_CHECK_VALID -- abort on an invalid handle.
EXPECT_VALID -- check handle validity in unit tests.
Review URL: http://codereview.chromium.org//8401010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@970 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-31 20:18:07 +00:00
turnidge@google.com e756497a78 Refactor the dart api a bit:
- Dart_Result is gone.  Dart_Handle mostly replaces it.
- Name/signature changes
  - IsValidResult -> IsValid
  - GetErrorCString -> GetError
  - many more...
- Make details of persistent handle freelist private.
- Add persistent "True" handle to api state.

Things I am not doing in this changelist:

- Documentation updates
Review URL: http://codereview.chromium.org//8380020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@778 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-26 20:38:41 +00:00
turnidge@google.com 0caed71c26 Add Dart_GetNativeArgumentCount() and a test.
Review URL: http://codereview.chromium.org//8382017

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@667 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-24 23:44:29 +00:00
turnidge@google.com 368f37895f Use the distinguished class, ApiFailure, to signal when a Dart_Result is
invalid.

We eventually plan to drop the Dart_Result type entirely, but this change allows us to try out the functionality before we munge the user-visible api.
Review URL: http://codereview.chromium.org//8334009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@566 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-19 18:41:33 +00:00
turnidge@google.com 0e98d4ae64 Allow embedders to provide custom message delivery for an isolate.
==============

Added Dart_SetPostMessageCallback and Dart_SetClosePortCallback.
These allow the embedder to provide custom message/port behavior
for their application. The vm provides standard implementations
that work with the standard run loop.

Added Dart_HandleMessage, which processes one message on the
current isolate. Embedders can use this to write their own
message processing loops. Rewrote code to use this internally.

Added Isolate::StandardRunLoop() to share code between
Dart_RunLoop and lib/isolate.cc

Changed the interface to PortMap::PostMessage. PostMessage is
now agnostic to message delivery mechanism. Note that PortMap is
now out of the "ReceiveMessage" business entirely. Moved
MessageQueue and friends out to message_queue.cc/h.

Moved the monitor from the Isolate into the MessageQueue. No
need for outsiders to mess. Added MessageQueue::Wait. Moved
monitor locking from PortMap into MessageQueue itself, which was
easier for me to reason about. Wrote some tests.

Removed PortMessage::Handle. The code turned into Dart_HandleMessage.

Regularized the nomenclature around ports. Type is now always
Dart_Port instead of intptr_t. Variables end in _port instead of
_id. Use the term "dest" instead of "target" or "send".

Added a family of new tests to port_test.

Added EXPECT_NE to the test framework.
Review URL: http://codereview.chromium.org//8297004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@516 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-18 17:54:07 +00:00
asiva@google.com 0b30a49971 5419598: Add a setjmp around the isolate spawning code so that parse errors
are caught and reported as errors.
5417103: Add a setjmp around Dart_Run_Loop so that parse errors
are caught and reported as errors.
Review URL: https://chromereviews.googleplex.com/3553012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@140 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-06 18:33:36 +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