Commit 3f74809f authored by Kunshan Wang's avatar Kunshan Wang

µVM-Client API (partial).

parent 827b6411
......@@ -1122,6 +1122,9 @@ have any exception clause and is not an OSR point.
NOTE: ``TAILCALL`` is semantically similar to calling a function and
immediately return the returned value, but reuses the current frame.
If the callee is not defined, the Client will handle this by defining the
function. After returning from the Client, this instruction will be tried again.
..
For LLVM users:
......@@ -1137,7 +1140,7 @@ have any exception clause and is not an OSR point.
function calls.
- Arguments will not be automatically zero or sign-extended or truncated for
the programmer. Conversions must be explicitly done before calling.
- The ``func`` type in µVM is a dedicated function reference, not a pointer.
- The ``func`` type in µVM is a dedicated function reference, not a pointer.
- All parameters are passed by value and parameters are SSA Values. To pass
on-stack data or arrays, use ``alloca`` and pass ``iref``.
- The keep-alive clause is unique to µVM for OSR.
......@@ -2638,16 +2641,15 @@ return value:
| 0xE0 | sig | func | argList | excClause |
+------+-----+------+---------+-----------+
The ``NEWSTACK`` instruction creates a new stack with a new stack frame for the
*func* function with arguments of *argList*.
The new stack is in the **READY<void>** state. When a thread is bound to this
newly created stack, it will start execution at the beginning of the *func*
function.
The ``NEWSTACK`` instruction creates a new stack with *func* as the stack-bottom
function and *argList* as its arguments.
This instruction continues exceptionally if the µVM cannot allocate the new
stack.
If the callee is not defined, the Client will handle this by defining the
function. After returning from the Client, this instruction will be tried again.
For LLVM users: There is no native facilities provided by the official LLVM,
but `Dolan, Muralidharan and Gregg
<http://dl.acm.org/citation.cfm?id=2400695>`__ proposed an extension to LLVM
......@@ -2742,9 +2744,6 @@ keepAliveClause
The ``SWAPSTACK`` instruction unbinds the current thread with the current stack
and rebinds it to another stack *swappee*.
In a SWAPSTACK operation, the current stack is called the **swapper** and the
stack to swap to is called the **swappee**.
If the *curStackClause* is ``RET_WITH``, then the swapper will enter the
``READY<T1>`` state. If the *curStackClause* is ``KILL_OLD``, then the swapper
will enter the ``DEAD`` state.
......
This diff is collapsed.
This diff is collapsed.
......@@ -87,10 +87,10 @@ Names and Identifiers
---------------------
Many entities in the µVM are **identified**. An identified entity has an
identifiers (ID) and optionally a name. An identifier (ID) is a 32-bit integer.
identifiers (ID) and optionally a name. An identifier (ID) is a 32-bit integer.
A name is a string starting with a ``@`` or a ``%`` and followed by many
characters in the set: ``[0-9a-zA-Z_-.]``. Both, if present, uniquely identifies
an **identified** entity.
characters in the set: ``[0-9a-zA-Z_-.]``. An ID uniquely identifies an
*identified* entity. A name also uniquely identifies an *identified* entity.
NOTE: This specification does not define what is an "entity". An English
dictionary would define "entity" as "a thing with distinct and independent
......@@ -470,6 +470,8 @@ where:
* ``Params`` is a list of names for the formal parameter list, and
* ``Body`` is a sequence of instructions, constants and labels.
A version of function is an identified entity.
..
NOTE: The version is required for each definition. Although calling a
......@@ -586,7 +588,7 @@ which is one of the following:
- ``NEW``, ``NEWHYBRID``, ``ALLOCA``, ``ALLOCAHYBRID``
- ``LOAD``, ``STORE``, ``CMPXCHG``, ``ATOMICRMW``
- ``TRAP``, ``WATCHPOINT``
- ``NEWSTACK``
- ``NEWSTACK``, ``SWAPSTACK``
- Some common instructions via the generic ``COMMINST`` instruction
- ``BRANCH``, ``BRANCH2``, ``SWITCH``
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment