Difference between revisions of "LSO"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 2: Line 2:


It's actually a reasonably powerful instruction set in some ways, but the compiler doesn't make use of it very well. Of course, with the planned switch to [[Mono]], it's probably really not sensible to do anything with it. Besides, rumor has it that script compilation will move server-side in the near future.
It's actually a reasonably powerful instruction set in some ways, but the compiler doesn't make use of it very well. Of course, with the planned switch to [[Mono]], it's probably really not sensible to do anything with it. Besides, rumor has it that script compilation will move server-side in the near future.
=Bytecodes by Task=
==Pop==
These bytecodes remove values from the stack.
== Complete List ==
{| class="sortable" {{Prettytable}}
|-{{Hl2}}
!Name
!Value
!class="unsortable"|Description
|-
||NOOP||{{LSL Hex|0x00}}||
|-
||POP||{{LSL Hex|0x01}}||
|-
||POPS||{{LSL Hex|0x02}}||
|-
||POPL||{{LSL Hex|0x03}}||
|-
||POPV||{{LSL Hex|0x04}}||
|-
||POPQ||{{LSL Hex|0x05}}||
|-
||POPARG||{{LSL Hex|0x06}}||
|-
||POPIP||{{LSL Hex|0x07}}||
|-
||POPBP||{{LSL Hex|0x08}}||
|-
||POPSP||{{LSL Hex|0x09}}||
|-
||POPSLR||{{LSL Hex|0x0a}}||
|-
||DUP||{{LSL Hex|0x20}}||
|-
||DUPS||{{LSL Hex|0x21}}||
|-
||DUPL||{{LSL Hex|0x22}}||
|-
||DUPV||{{LSL Hex|0x23}}||
|-
||DUPQ||{{LSL Hex|0x24}}||
|-
||STORE||{{LSL Hex|0x30}}||
|-
||STORES||{{LSL Hex|0x31}}||
|-
||STOREL||{{LSL Hex|0x32}}||
|-
||STOREV||{{LSL Hex|0x33}}||
|-
||STOREQ||{{LSL Hex|0x34}}||
|-
||STOREG||{{LSL Hex|0x35}}||
|-
||STOREGS||{{LSL Hex|0x36}}||
|-
||STOREGL||{{LSL Hex|0x37}}||
|-
||STOREGV||{{LSL Hex|0x38}}||
|-
||STOREGQ||{{LSL Hex|0x39}}||
|-
||LOADP||{{LSL Hex|0x3a}}||
|-
||LOADSP||{{LSL Hex|0x3b}}||
|-
||LOADLP||{{LSL Hex|0x3c}}||
|-
||LOADVP||{{LSL Hex|0x3d}}||
|-
||LOADQP||{{LSL Hex|0x3e}}||
|-
||LOADGP||{{LSL Hex|0x3f}}||
|-
||LOADGSP||{{LSL Hex|0x40}}||
|-
||LOADGLP||{{LSL Hex|0x41}}||
|-
||LOADGVP||{{LSL Hex|0x42}}||
|-
||LOADGQP||{{LSL Hex|0x43}}||
|-
||PUSH||{{LSL Hex|0x50}}||
|-
||PUSHS||{{LSL Hex|0x51}}||
|-
||PUSHL||{{LSL Hex|0x52}}||
|-
||PUSHV||{{LSL Hex|0x53}}||
|-
||PUSHQ||{{LSL Hex|0x54}}||
|-
||PUSHG||{{LSL Hex|0x55}}||
|-
||PUSHGS||{{LSL Hex|0x56}}||
|-
||PUSHGL||{{LSL Hex|0x57}}||
|-
||PUSHGV||{{LSL Hex|0x58}}||
|-
||PUSHGQ||{{LSL Hex|0x59}}||
|-
||PUSHIP||{{LSL Hex|0x5a}}||
|-
||PUSHBP||{{LSL Hex|0x5b}}||
|-
||PUSHSP||{{LSL Hex|0x5c}}||
|-
||PUSHARGB||{{LSL Hex|0x5d}}||
|-
||PUSHARGI||{{LSL Hex|0x5e}}||
|-
||PUSHARGF||{{LSL Hex|0x5f}}||
|-
||PUSHARGS||{{LSL Hex|0x60}}||
|-
||PUSHARGV||{{LSL Hex|0x61}}||
|-
||PUSHARGQ||{{LSL Hex|0x62}}||
|-
||PUSHE||{{LSL Hex|0x63}}||
|-
||PUSHEV||{{LSL Hex|0x64}}||
|-
||PUSHEQ||{{LSL Hex|0x65}}||
|-
||PUSHARGE||{{LSL Hex|0x66}}||
|-
||ADD||{{LSL Hex|0x70}}||
|-
||SUB||{{LSL Hex|0x71}}||
|-
||MUL||{{LSL Hex|0x72}}||
|-
||DIV||{{LSL Hex|0x73}}||
|-
||MOD||{{LSL Hex|0x74}}||
|-
||EQ||{{LSL Hex|0x75}}||
|-
||NEQ||{{LSL Hex|0x76}}||
|-
||LEQ||{{LSL Hex|0x77}}||
|-
||GEQ||{{LSL Hex|0x78}}||
|-
||LESS||{{LSL Hex|0x79}}||
|-
||GREATER||{{LSL Hex|0x7a}}||
|-
||BITAND||{{LSL Hex|0x7b}}||
|-
||BITOR||{{LSL Hex|0x7c}}||
|-
||BITXOR||{{LSL Hex|0x7d}}||
|-
||BOOLAND||{{LSL Hex|0x7e}}||
|-
||BOOLOR||{{LSL Hex|0x7f}}||
|-
||NEG||{{LSL Hex|0x80}}||
|-
||BITNOT||{{LSL Hex|0x81}}||
|-
||BOOLNOT||{{LSL Hex|0x82}}||
|-
||JUMP||{{LSL Hex|0x90}}||
|-
||JUMPIF||{{LSL Hex|0x91}}||
|-
||JUMPNIF||{{LSL Hex|0x92}}||
|-
||STATE||{{LSL Hex|0x93}}||
|-
||CALL||{{LSL Hex|0x94}}||
|-
||RETURN||{{LSL Hex|0x95}}||
|-
||CAST||{{LSL Hex|0xa0}}||
|-
||STACKTOS||{{LSL Hex|0xb0}}||
|-
||STACKTOL||{{LSL Hex|0xb1}}||
|-
||PRINT||{{LSL Hex|0xc0}}||
|-
||CALLLIB||{{LSL Hex|0xd0}}||
|-
||CALLLIB_TWO_BYTE||{{LSL Hex|0xd1}}||
|-
||SHL||{{LSL Hex|0xe0}}||
|-
||SHR||{{LSL Hex|0xe1}}||
|}

Revision as of 02:30, 26 November 2007

The compiled form of LSL scripts - a mostly stack-based language with a reference-counted heap and a very odd function calling convention in which the caller allocates storage for the callee's local variables. All the gory details can be found at http://www.libsecondlife.org/wiki/LSO, including some opcodes that are implemented in the interpreter but never outputted by the compiler (such as the handy DUP family of instructions for Forth-style programming, and PUSHIP/POPIP for implementing custom function calls/function pointers, jumptable-based switch statements and the like).

It's actually a reasonably powerful instruction set in some ways, but the compiler doesn't make use of it very well. Of course, with the planned switch to Mono, it's probably really not sensible to do anything with it. Besides, rumor has it that script compilation will move server-side in the near future.

Bytecodes by Task

Pop

These bytecodes remove values from the stack.

Complete List

Name Value Description
NOOP 0x00
POP 0x01
POPS 0x02
POPL 0x03
POPV 0x04
POPQ 0x05
POPARG 0x06
POPIP 0x07
POPBP 0x08
POPSP 0x09
POPSLR 0x0a
DUP 0x20
DUPS 0x21
DUPL 0x22
DUPV 0x23
DUPQ 0x24
STORE 0x30
STORES 0x31
STOREL 0x32
STOREV 0x33
STOREQ 0x34
STOREG 0x35
STOREGS 0x36
STOREGL 0x37
STOREGV 0x38
STOREGQ 0x39
LOADP 0x3a
LOADSP 0x3b
LOADLP 0x3c
LOADVP 0x3d
LOADQP 0x3e
LOADGP 0x3f
LOADGSP 0x40
LOADGLP 0x41
LOADGVP 0x42
LOADGQP 0x43
PUSH 0x50
PUSHS 0x51
PUSHL 0x52
PUSHV 0x53
PUSHQ 0x54
PUSHG 0x55
PUSHGS 0x56
PUSHGL 0x57
PUSHGV 0x58
PUSHGQ 0x59
PUSHIP 0x5a
PUSHBP 0x5b
PUSHSP 0x5c
PUSHARGB 0x5d
PUSHARGI 0x5e
PUSHARGF 0x5f
PUSHARGS 0x60
PUSHARGV 0x61
PUSHARGQ 0x62
PUSHE 0x63
PUSHEV 0x64
PUSHEQ 0x65
PUSHARGE 0x66
ADD 0x70
SUB 0x71
MUL 0x72
DIV 0x73
MOD 0x74
EQ 0x75
NEQ 0x76
LEQ 0x77
GEQ 0x78
LESS 0x79
GREATER 0x7a
BITAND 0x7b
BITOR 0x7c
BITXOR 0x7d
BOOLAND 0x7e
BOOLOR 0x7f
NEG 0x80
BITNOT 0x81
BOOLNOT 0x82
JUMP 0x90
JUMPIF 0x91
JUMPNIF 0x92
STATE 0x93
CALL 0x94
RETURN 0x95
CAST 0xa0
STACKTOS 0xb0
STACKTOL 0xb1
PRINT 0xc0
CALLLIB 0xd0
CALLLIB_TWO_BYTE 0xd1
SHL 0xe0
SHR 0xe1