org.erights.e.elang.smallcaps
Interface SmallcapsOps

All Known Implementing Classes:
SmallcapsActivation, SmallcapsEncoder, SmallcapsEncoderVisitor

public interface SmallcapsOps

Untamed: Each instruction of the Smallcaps instruction set begins with a byte holding one of the these opcodes.

See SmallcapsEncoderVisitor for an explanation of how these are used to encode the various Transformed-E expressions and patterns.

Author:
Mark S. Miller, Darius Bacon

Field Summary
static int ADDR_FRAME
          Enabled: Accesses the index'th instance variable.
static int ADDR_FRAME_SLOT
          Enabled: Accesses the value of the slot at the index'th instance variable.
static int ADDR_LITERAL
          Enabled: Accesses the index'th literal.
static int ADDR_LOCAL
          Enabled: Accesses the index'th local variable.
static int ADDR_LOCAL_SLOT
          Enabled: Accesses the value of the slot at the index'th local variable.
static int ADDR_OUTER_SLOT
          Enabled: Accesses the value of the slot at the index'th outer variable.
static int OP_ASSIGN
          Enabled: [rValue],[] => (OP_ASSIGN+addrMode)(index) => [],[]
static int OP_BIND
          Enabled: [rValue],[] => (OP_BIND+addrMode)(index) => [],[]
static int OP_BIND_SLOT
          Enabled: [rValue],[] => (OP_BIND_SLOT+addrMode)(index) => [],[]
static int OP_BRANCH
          Enabled: [optEjector, flag],[] => OP_BRANCH => [],[]
static int OP_CALL
          Enabled: [recip, args...],[] => OP_CALL(verb, arity) => [result],[]
static int OP_CALL_ONLY
          Enabled: [recip, args...],[] => OP_CALL_ONLY(verb, arity) => [],[]
static int OP_CDR_PATT
          Enabled:
static int OP_CHAR
          Enabled: [],[] => OP_CHAR(chr) => [chr],[]
static int OP_DUP
          Enabled: [x],[] => OP_DUP => [x, x],[]
static int OP_EJECTOR
          Enabled: [],[] => OP_EJECTOR(label) => [ejector],[handler]
[...],[...] => ejector(result) => [result],[]
static int OP_EJECTOR_ONLY
          Enabled: [],[] => OP_EJECTOR_ONLY(label) => [ejector],[handler]
[...],[...] => ejector(_) => [],[]
static int OP_END_HANDLER
          Enabled: [],[handler] => OP_END_HANDLER => [],[]
static int OP_FALSE
          Enabled: [],[] => OP_FALSE => [false],[]
static int OP_FLOAT64
          Enabled: [],[] => OP_FLOAT64(float64) => [float64],[]
static int OP_JUMP
          Enabled: [],[] => OP_JUMP(label) => [],[]
static int OP_LIST_PATT
          Enabled:
static int OP_NEG_INT
          Enabled: [],[] => OP_NEG_INT(wholeNum) => [-wholeNum],[]
static int OP_NOUN
          Enabled: [],[] => (OP_NOUN+addrMode)(index) => [value],[]
static int OP_NULL
          Enabled: [],[] => OP_NULL => [null],[]
static int OP_OBJECT
          Enabled: [ivars..., auditors...],[] => OP_OBJECT(seeBelow) => [object],[]
static int OP_POP
          Enabled: [x],[] => OP_POP => [],[]
static int OP_RETURN
          Enabled: [x],[] => OP_RETURN
static int OP_ROT
          Enabled: [x, y, z],[] => OP_ROT => [y, z, x],[]
static int OP_SCOPE
          Enabled: [],[] => OP_SCOPE => [scope],[]
static int OP_SEND
          Enabled: [recip, args...],[] => OP_SEND(verb, arity) => [result],[]
static int OP_SEND_ONLY
          Enabled: [recip, args...],[] => SEND_ONLY(verb, arity) => [],[]
static int OP_SLOT
          Enabled: [],[] => (OP_SLOT+addrMode)(index) => [slot],[]
static int OP_STRING
          Enabled: [],[] => OP_STRING(str) => [str],[]
static int OP_SWAP
          Enabled: [x, y],[] => OP_SWAP => [y, x],[]
static int OP_TRUE
          Enabled: [],[] => OP_TRUE => [true],[]
static int OP_TRY
          Enabled: [],[] => OP_TRY(label) => [],[handler]
[...],[...] => handler(arg) => [arg],[]
[...],[...] => handler.drop(_) => [...],[...]
static int OP_TWINE
          Enabled: [],[] => OP_TWINE(twine) => [twine],[]
static int OP_UNWIND
          Enabled: [],[] => OP_UNWIND(label) => [],[handler]
[...],[...] => handler(arg) => [rethrower(arg)],[]
[...],[...] => handler.drop(pc) => [returner(pc)],[]
static int OP_WHOLE_NUM
          Enabled: [],[] => OP_WHOLE_NUM(wholeNum) => [wholeNum],[]
 

Field Detail

OP_DUP

public static final int OP_DUP
Enabled: [x],[] => OP_DUP => [x, x],[]


OP_POP

public static final int OP_POP
Enabled: [x],[] => OP_POP => [],[]


OP_SWAP

public static final int OP_SWAP
Enabled: [x, y],[] => OP_SWAP => [y, x],[]


OP_ROT

public static final int OP_ROT
Enabled: [x, y, z],[] => OP_ROT => [y, z, x],[]


OP_RETURN

public static final int OP_RETURN
Enabled: [x],[] => OP_RETURN


OP_JUMP

public static final int OP_JUMP
Enabled: [],[] => OP_JUMP(label) => [],[]

Stacks at addr must be the same as here.

A label is represented by an integer offset from the position after this instruction to the position of the target instruction.


OP_BRANCH

public static final int OP_BRANCH
Enabled: [optEjector, flag],[] => OP_BRANCH => [],[]

Coerces flag to a boolean. If it's


OP_CALL_ONLY

public static final int OP_CALL_ONLY
Enabled: [recip, args...],[] => OP_CALL_ONLY(verb, arity) => [],[]


OP_CALL

public static final int OP_CALL
Enabled: [recip, args...],[] => OP_CALL(verb, arity) => [result],[]


OP_SEND_ONLY

public static final int OP_SEND_ONLY
Enabled: [recip, args...],[] => SEND_ONLY(verb, arity) => [],[]


OP_SEND

public static final int OP_SEND
Enabled: [recip, args...],[] => OP_SEND(verb, arity) => [result],[]


OP_EJECTOR_ONLY

public static final int OP_EJECTOR_ONLY
Enabled: [],[] => OP_EJECTOR_ONLY(label) => [ejector],[handler]
[...],[...] => ejector(_) => [],[]

Generated at least by the if and escape expressions.

Creates/pushes an ejector on the operand stack, and creates/pushes its corresponding handler onto the handler stack. The ejector, when called, if it's still enabled, will ignore its argument, pop both stacks to the height when the ejector was created/pushed, disable itself, and branch to the label.

This is a handler-introducing op, so it must be balanced by an OP_END_HANDLER which occurs at the same operand stack height, and with the created/pushed handler at the top of the handler stack. The label must be to code outside the handled region.


OP_EJECTOR

public static final int OP_EJECTOR
Enabled: [],[] => OP_EJECTOR(label) => [ejector],[handler]
[...],[...] => ejector(result) => [result],[]

Generated by the escape expression.

Creates/pushes an ejector on the operand stack, and creates/pushes its corresponding handler onto the handler stack. The ejector, when called, if it's still enabled, will pop both stacks to the height when the ejector was created/pushed, disable itself, push its argument, and branch to the label.

As with OP_EJECTOR_ONLY, this is a handler-introducing op.


OP_TRY

public static final int OP_TRY
Enabled: [],[] => OP_TRY(label) => [],[handler]
[...],[...] => handler(arg) => [arg],[]
[...],[...] => handler.drop(_) => [...],[...]

Generated by the try/catch expression.

Creates and pushes onto the handler stack a problem handler. This handler, when dropped, does nothing. This handler, when invoked, truncates the stacks to their height when the handler was created/pushed, pushes its argument onto the operand stack, and jumps to label.

As with OP_EJECTOR_ONLY, this is a handler-introducing op.


OP_UNWIND

public static final int OP_UNWIND
Enabled: [],[] => OP_UNWIND(label) => [],[handler]
[...],[...] => handler(arg) => [rethrower(arg)],[]
[...],[...] => handler.drop(pc) => [returner(pc)],[]

Generated by the try/finally expression.

Creates and pushes onto the handler stack a problem handler. This handler, when invoked, truncates the stacks to their height when the handler was created/pushed, pushes a rethrower of the arg on to the operand stack, and jumps to label. A rethrower is an ejector which will pop and rethrow its arg by invoking the top handler on the handler stack.

This handler, when dropped, pushes a returner for the current pc. A returner is an ejector that jumps to its pc.

E code can never get its hands on a rethrower or a returner. Unlike some other ejectors, these are not reified in the language.

As with OP_EJECTOR_ONLY, this is a handler-introducing op.


OP_END_HANDLER

public static final int OP_END_HANDLER
Enabled: [],[handler] => OP_END_HANDLER => [],[]

Drops the top handler on the handler stack. This is the closing bracket that balances an openning handler-introducing op.


OP_WHOLE_NUM

public static final int OP_WHOLE_NUM
Enabled: [],[] => OP_WHOLE_NUM(wholeNum) => [wholeNum],[]


OP_NEG_INT

public static final int OP_NEG_INT
Enabled: [],[] => OP_NEG_INT(wholeNum) => [-wholeNum],[]


OP_FLOAT64

public static final int OP_FLOAT64
Enabled: [],[] => OP_FLOAT64(float64) => [float64],[]


OP_CHAR

public static final int OP_CHAR
Enabled: [],[] => OP_CHAR(chr) => [chr],[]


OP_STRING

public static final int OP_STRING
Enabled: [],[] => OP_STRING(str) => [str],[]


OP_TWINE

public static final int OP_TWINE
Enabled: [],[] => OP_TWINE(twine) => [twine],[]


OP_TRUE

public static final int OP_TRUE
Enabled: [],[] => OP_TRUE => [true],[]


OP_FALSE

public static final int OP_FALSE
Enabled: [],[] => OP_FALSE => [false],[]


OP_NULL

public static final int OP_NULL
Enabled: [],[] => OP_NULL => [null],[]


OP_SCOPE

public static final int OP_SCOPE
Enabled: [],[] => OP_SCOPE => [scope],[]


OP_OBJECT

public static final int OP_OBJECT
Enabled: [ivars..., auditors...],[] => OP_OBJECT(seeBelow) => [object],[]

XXX to be written


OP_LIST_PATT

public static final int OP_LIST_PATT
Enabled:
 [optEjector, specimen],[] => OP_LIST(n)
 => [optEjector, specimen[n-1], ... optEjector, specimen[0]],[]


OP_CDR_PATT

public static final int OP_CDR_PATT
Enabled:
 [optEjector, specimen],[] => OP_CDR_PATT(n)
 => [optEjector, specimen(n,specimen.size()),
     optEjector, specimen[n-1], ... optEjector, specimen[0]],[]


OP_NOUN

public static final int OP_NOUN
Enabled: [],[] => (OP_NOUN+addrMode)(index) => [value],[]

Pushes the value of the variable. The value of the variable is what would be obtained by calling getValue() on the variable's slot.


OP_SLOT

public static final int OP_SLOT
Enabled: [],[] => (OP_SLOT+addrMode)(index) => [slot],[]

Pushes the slot holding the value of the variable.


OP_ASSIGN

public static final int OP_ASSIGN
Enabled: [rValue],[] => (OP_ASSIGN+addrMode)(index) => [],[]

Sets the value of the variable. To set the variable is to cause those effects that would be caused by calling setValue(rValue) on the variable's slot.


OP_BIND

public static final int OP_BIND
Enabled: [rValue],[] => (OP_BIND+addrMode)(index) => [],[]

Define the variable as a final variable whose permanent value is rValue. Equivalently, bind the variable to a FinalSlot holding rValue.


OP_BIND_SLOT

public static final int OP_BIND_SLOT
Enabled: [rValue],[] => (OP_BIND_SLOT+addrMode)(index) => [],[]

Define the variable as a non-final variable (a "var" variable) whose slot is rValue.


ADDR_FRAME

public static final int ADDR_FRAME
Enabled: Accesses the index'th instance variable.


ADDR_FRAME_SLOT

public static final int ADDR_FRAME_SLOT
Enabled: Accesses the value of the slot at the index'th instance variable.


ADDR_LOCAL

public static final int ADDR_LOCAL
Enabled: Accesses the index'th local variable.


ADDR_LOCAL_SLOT

public static final int ADDR_LOCAL_SLOT
Enabled: Accesses the value of the slot at the index'th local variable.


ADDR_LITERAL

public static final int ADDR_LITERAL
Enabled: Accesses the index'th literal.


ADDR_OUTER_SLOT

public static final int ADDR_OUTER_SLOT
Enabled: Accesses the value of the slot at the index'th outer variable.



comments?