|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
RASM instructions.
See:
Description
Class Summary | |
Abs | Absolute value (negation if less than zero). |
Add | Addition. |
And | Bitwise/logical and. |
BranchFalse | Jumps to the given location (addr) if the value boolean is false. |
BranchTrue | Jumps to the given location (addr) if the value boolean is true. |
BuildList | Make a list of length n where each element of the list is a copy of value. |
Call | Call a function or procedure. |
Comment | Comment. |
Concat | String concatenation. |
Connect | Connect two channels together. |
DeclareDeviceWithState | Associate a register with an integer value. |
Delay | Delay the executing thread for dt time units. |
Div | Division. |
Dup | Duplicate the top stack element. |
Eql | Equality. |
Error | Signal a runtime error. |
Exch | Exchange the top two stack elements. |
Exit | Terminate the executing thread. |
Geq | Greater than or equal to. |
Get | Peek a value from a channel. |
GetArg | Push a copy of the i'th value (based at 0) of the stack frame onto the top of the stack. |
GetType | Get the type of value. |
Gt | Greater than. |
Index | Duplicate the j'th element on the stack at the top of the stack. |
Insert | Assign to a list value. |
IsAvailable | Test channel for availability. |
Jump | Jump to the location given by the label popped off the stack. |
KillStackRange | Delete all the values from the current stack frame apart from the m bottom-most items and the n top-most items. |
LabelChannel | Label a channel according to an external specification. |
LabelDevice | Label a thread according to an external specification. |
Length | Get the length of the list. |
Leq | Less than or equal to. |
Line | Line identification directive. |
Load | Read from register. |
Lt | Less than. |
MakeChannel | Create a new communications channel. |
MakeList | Make a list. |
MakeRegister | Create a new register. |
MakeUnion | For making unions. |
Mod | Remainder. |
Mult | Multiplication. |
NDChoice | Non-deterministic jump. |
NDValue | Non-deterministic random number generator. |
Neg | Negation. |
Neq | Inverted equality. |
Noop | No operation. |
Not | Bitwise/logical inversion. |
OpenUnion | For unmaking unions (the reverse of makeUnion). |
Or | Bitwise/logical (inclusive) or. |
Parallel | Execute in parallel. |
Pop | Remove one item from the top of the stack. |
PopAll | Clears the current stack frame. |
Project | Get the index'th item of list. |
Push | Pushes the argument onto the stack. |
Put | Poke a value to a channel. |
PutArg | Reverse of getArg which assigns value to the i'th position in the stack frame. |
PutForward | First half of a channel write. |
Read | A complete read from a channel. |
Release | Sends an acknowledgement on an input channel, chanId. |
Return | Return from function or procedure. |
Roll | Roll the stack contents like the PostScript roll operator. |
SetType | Type casting. |
Shl | Shift left without check for overflow. |
Shr | Shift right with sign extension and no check for underflow. |
Shrz | Shift right with zero extension and no check for underflow. |
SignalForward | Sends a request on an output channel, chanId. |
Sleep | Cause the thread to become descheduled until something happens. |
Split | Split a list up into its elements and length. |
StatelessDevice | Mark thread as stateless. |
StaticStackBase | Mark stack contents as static. |
Store | Write to register. |
Sub | Subtraction. |
TclExec | Execute an external command. |
WaitFor | Wait for channel to become readable. |
WaitGet | Wait for channel to become readable, and then read it. |
WaitRelease | Waits for an output channel, chanId, to be released. |
Write | A complete write to a channel. |
Xor | Bitwise/logical exclusive or. |
RASM instructions. Used to control the behaviour of Rainbow threads (indeed, currently the only implementation of Rainbow threads is based on RASM.)
RASM (which is short for Rainbow ASseMler) is based on a threaded, simple stack model of computation. Each thread contains a stack of objects, most of which are immutable values, but which can also consist of types (which are first-class values in RASM, though there aren't all that many operations that you can perform on them), channel referencess (which are the only approved way of communicating between threads) and register references (which are used to provide state that is monitorable by the outside world, like variables in Yellow.)
All RASM instructions are defined in terms of the
transformation they perform to their executing thread's stack. Thus,
the instruction Exch
whose stack transformation is:
x y y x
can be seen as popping the two top elements off the stack and pushing them back on in reverse order. (The rest of the stack is unmodified.)
Some RASM instructions perform their actions relative
to the bottom of the current stack frame (no instructions can access
anywhere on the stack outside the current stack frame except for
Call
and Return
whose purpose is,
in part, to create and destroy stack frames), and the special symbol
is used to indicate
this. An example is the instruction GetArg
which is mainly
used to retrieve parameters passed by the current stack frame's caller
or local values placed at the bottom of the stack frame below the
working area.
Some instructions are actually implemented as macros
in terms of others. This only matters in practise if you are looking
at the assembler output from a code block; from a programming and code
generation point-of-view (i.e. so long as you are using the mandated
interface based on RASMCode
and RASMList
) there is no difference between an instruction that is
implemented directly and an instruction that is implemented as a
macro. It just makes it far easier to enforce consistency and
correctness of implementation...
RASMThread
,
Rainbow Implementors Guide
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |