Commit 5422904a authored by Kunshan Wang's avatar Kunshan Wang

THREADLOCAL clause in the NEWTHREAD inst.

Like the `new_thread` API call, the NEWTHREAD instruction needs to take
a thread-local objref as a parameter, too. This clause is optional. If
omitted, it defaults to `NULL`.
parent 94fe2b71
......@@ -2749,13 +2749,17 @@ or existing) to a given stack.
``NEWTHREAD`` Instruction
``NEWTHREAD`` *stack* *newStackClause *excClause*
``NEWTHREAD`` *stack* *threadLocalClause* :sub:`opt` *newStackClause* *excClause*
+ *threadLocalClause* ::= ``THREADLOCAL`` ``(`` *threadLocal* ``)``
+ *newStackClause* ::= ``PASS_VALUES`` ``<`` *Ts2* ``>`` ``(`` *vals* ``)``
+ *newStackClause* ::= ``THROW_EXC`` *exc*
*variable* of ``stackref``: The stack to bind the new thread to.
*variable* of ``ref<T>`` for any *T*: The initial thread-local object
reference of the created thread. If omitted, it defaults to ``NULL``.
*new stack clause*: Determines how to bind to the *stack*.
......@@ -2773,6 +2777,10 @@ The ``NEWTHREAD`` instruction creates a new thread which immediately binds to
*stack*, passing values or raising exceptions to it according to the
The *threadLocalClause* determines the initial thread-local object reference of
the newly created thread. If it is omitted, the thread-local object reference
will be ``NULL``.
This instruction continues exceptionally if Mu cannot create the new thread. The
exception parameter receives NULL.
......@@ -2788,6 +2796,16 @@ exception parameter receives NULL.
%stack = ...
%thread = NEWTHREAD %stack THROW_EXC %some_exception
Create a new thread with a thread-local objref::
.typedef @my_threadlocal_t = struct<...> // an arbitrary type
%stack = COMMINST @uvm.new_stack <[@sig]> @func
%tlobj = NEW <@my_threadlocal_t>
%thread = NEWTHREAD %stack THREADLOCAL(%tlobj)
PASS_VALUES <...> (...)
``SWAPSTACK`` Instruction
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