INPUT
The input is in the form of a vector with the following elements:
0. name (string)
1. global context (vector)
2. #ret values (integer)
3. min #args (integer)
4. req #args (integer)
5. has rest (nil or 't')
6. argument names (vector of symbol)
7. regions (vector of integer, see below)
8. keyword table (hash: symbol => integer)
9. instructions (vector of symbol | vector)
10. nested funs (input vectors)
Symbols are used in the instruction vector for labels, vectors for byte
code instructions. The instructions are a symbol (all lower-case) for the
op-code, followed by the necessary source obj operands, source integer
operands and destination operands. The format of each of these types of
operands is described below:
Source Operands
The simple forms may be used as is, or may start a source operand vector.
The vector forms may only be used within a source operand vector (possibly
following a simple form). In vector form, the codes are merely run end to
end in one vector, for example: (4 plus 5 times 2) or (some_var_name vsub 2
field some_field_name).
- Simple:
- nil
- <integer>
- far
- ret
- ret_offset
- <symbol>
- num_args
- rest_len ; source integer operand only
- Vector:
- <any simple>
- quote <any object>
- module <symbol>
- global <symbol>
- rest <symbol>
- keyword <symbol> <any object>
- fun_body
- ret
- ret_offset
- local var#
- num_args
- vsub index
- hget key
- refget
- symget
- intern
- gensym
- classof
- field symbol
- lref
- rest <symbol>
- keyword <symbol> <any object>
- rest_len ; source integer operand only
- slen ; source integer operand only
- vsize ; source integer operand only
- hsize ; source integer operand only
- cont_num_values ; source integer operand only
- deref
- plus integer ; source integer operand only
- times integer ; source integer operand only
- divide integer ; source integer operand only
- remainder integer ; source integer operand only
Destination Operands
The destination can be specified from another location, or can be created
by the destination operand. If no region or wait or offset is specified in a
new destination, and the addr is one of the forms that is marked "can be used
alone", then this form may be used directly as the full destination operand
without enclosing it in a vector.
- Destination Locations
- ret ; can be used alone
- (dest <symbol> [<index>])
- (dest <src_operand> [<index>])
- New Destinations: ([region] addr [wait] [<index>])
- region:
- local
- heap
- same_as <src_operand>
- dest_region <src_operand> [<index#>]
- addr:
- discard [<#values>] ; can be used
alone
- <symbol> [<#values>] ; can be used alone
- module <symbol>
- global <symbol>
- inref <src_operand>
- <src_operand> followed by: ; can be used alone
- local <var#> [<#values>]
- vsub <src_int_operand> [<src_int_operand>]
- hset <src_operand>
- <nothing> ; symset
- field <field_name>
- wait:
- then <label> [<wait_count>]
- wait <src_operand>
- Index: