User Tools

Site Tools


dana-system-calls

Dana provides a number of “system calls” in its runtime. These calls provide a range of low-level functionality.

General utilities

dana.getByteArrayOf(x)

This returns a writable array of type byte[]. It only works on primitive types and record types.

dana.getAddressOf(x)

This returns an int indicating the address in memory of the given item.

dana.getIDC()

This returns an IDC of the Dana runtime. This IDC can then be queried for further interfaces that the runtime provides (such as io.Output).

dana.htod(int x)

This converts an integer value in the host machine's native format to Dana's format for integer representation (i.e. network big endian).

dana.dtoh(int x)

This converts an integer value in Dana's format for integer representation (i.e. network big endian) to the host machine's native format.

dana.isConnected(IDC intf)

This operation checks if a particular required interface is connected to something, returning true if so and false otherwise.

Runtime adaptation

dana.rewire(IDC intfA, IDC intfB)

This connects a required interface (intfA) to a provided interface (intfB).

dana.pause(IDC intf)

This pauses a selected required interface of a given component, meaning that any attempts to instantiate new objects via this required interface, or destroy existing objects, are held until the required interface is resumed.

dana.resume(IDC intf)

This resumes a previously paused required interface of a given component, releasing any held operations and allowing objects to be instantiated and destroyed again via this required interface.

dana.getComponent(IDC requiredInterface)

Typically used as part of runtime adaptation, this operation queries the given required interface to return the component to which it is currently connected (or null if it has no current wiring).

dana.getObjects(IDC intfA)

Typically used as part of runtime adaptation, this gets a list of currently-active objects instantiated over the given required interface (intfA).

dana.pauseObject(IDC com, Object o)

Typically used as part of runtime adaptation, this prevents further function calls from entering the given object, instead holding those calls at the point of invocation. The supplied component reference must be the one from which object is currently sourced.

dana.resumeObject(Object o)

Typically used as part of runtime adaptation, this re-enables function calls to enter the given object, and also resumes any previous held calls.

dana.adaptConstruct(IDC source, Object shareState)

Typically used as part of runtime adaptation, instantiates a new object from source in such a way that it shares transfer state with the object shareState. Note that this operation does not call the constructor of the object being instantiated.

dana.adaptConstructFree(IDC source)

Typically used as part of runtime adaptation, instantiates a new object from source in such a way that it has a fresh new transfer state instance. Note that this operation does not call the constructor of the object being instantiated.

dana.getObjectInterface(Object o, Type t)

Typically used as part of runtime adaptation, this operation queries the given object for an interface of the given type, returning the same instance of that object by with the type of the requested interface (if present).

dana.rewireObject(Object x, Object y)

Typically used as part of runtime adaptation, this adapts object x such that it uses the implementation (and internal state) of object y. This operation returns a third object which represents object x as known by its previous implementation before it was rewired.

dana.waitForObject(Object x)

Typically used as part of runtime adaptation, this waits for all in-progress function calls in object x to finish.

dana.adaptDestroy(IDC com, Object x)

Typically used as part of runtime adaptation, this destroys the given object and calls AdaptDestructor:destroy on the object if available, or else calls Destructor:destroy on the object if available. The component reference provided must the component from which this object is currently sourced.

dana.halt(IDC ofComponent, Object x)

This operation forces all computation in the given object to stop (including all threads that have stack frames passing through this object), blocking until this is true. Note that this operation is currently experimental as it does not deal with blocking native library calls – if any computation active in, or passing through, Object x is currently in a blocking native library call, this may cause dana.halt to block indefinitely.

dana-system-calls.txt · Last modified: 2017/11/13 08:28 by barryfp

Page Tools