Difference between revisions of "Byte Code"

 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
__NOTOC__
 
[[Category:Runtime]]
 
[[Category:Runtime]]
 
=Introduction=
 
=Introduction=
 
Below is a description of all opcodes we current support in the Eiffel interpreter. We only display their name as defined in C/run-time/rt_interp.h. One has to use this file to avoid possible change in values of opcode which happens time to time since it is a closed format.
 
Below is a description of all opcodes we current support in the Eiffel interpreter. We only display their name as defined in C/run-time/rt_interp.h. One has to use this file to avoid possible change in values of opcode which happens time to time since it is a closed format.
 +
=Byte code reader=
 +
In C/bench you have 2 tools to read the content of the melted file:
 +
#''meltdump'': which takes as argument the melted file and will generate 2 files: '''melted.txt''' and '''bytecode.eif'''
 +
#''bytedump'': uses bytecode.eif from the current working directory and generate '''bytecode.txt'''
 +
The content of '''bytecode.txt''' is helpful to understand the code we generate and the documentation below makes it even clearer.
  
 
=Byte codes=
 
=Byte codes=
Line 183: Line 189:
  
 
===Stack transition===
 
===Stack transition===
... -> INTEGER_8 value
+
... -> value
  
 
===Arguments===
 
===Arguments===
* INTEGER_8 value: 8 bits
+
* value: 8 bits INTEGER_8
  
 
==BC_INT16==
 
==BC_INT16==
Line 193: Line 199:
  
 
===Stack transition===
 
===Stack transition===
... -> INTEGER_16 value
+
... -> value
  
 
===Arguments===
 
===Arguments===
* INTEGER_16 value: 16 bits
+
* value: 16 bits INTEGER_16
  
 
==BC_INT32==
 
==BC_INT32==
Line 203: Line 209:
  
 
===Stack transition===
 
===Stack transition===
... -> INTEGER_32 value
+
... -> value
  
 
===Arguments===
 
===Arguments===
* INTEGER_32 value: 32 bits
+
* value: 32 bits INTEGER_32
  
 
==BC_INT64==
 
==BC_INT64==
Line 213: Line 219:
  
 
===Stack transition===
 
===Stack transition===
... -> INTEGER_64 value
+
... -> value
  
 
===Arguments===
 
===Arguments===
* INTEGER_64 value: 64 bits
+
* value: 64 bits INTEGER_64
  
 
==BC_CAST_CHAR8==
 
==BC_CAST_CHAR8==
Line 230: Line 236:
  
 
===Stack transition===
 
===Stack transition===
... -> NATURAL_8 value
+
... -> value
  
 
===Arguments===
 
===Arguments===
* NATURAL_8 value: 8 bits
+
* value: 8 bits NATURAL_8
  
 
==BC_UINT16==
 
==BC_UINT16==
Line 240: Line 246:
  
 
===Stack transition===
 
===Stack transition===
... -> NATURAL_16 value
+
... -> value
  
 
===Arguments===
 
===Arguments===
* NATURAL_16 value: 16 bits
+
* value: 16 bits NATURAL_16
  
 
==BC_UINT32==
 
==BC_UINT32==
Line 250: Line 256:
  
 
===Stack transition===
 
===Stack transition===
... -> NATURAL_32 value
+
... -> value
  
 
===Arguments===
 
===Arguments===
* NATURAL_32 value: 32 bits
+
* value: 32 bits NATURAL_32
  
 
==BC_UINT64==
 
==BC_UINT64==
Line 260: Line 266:
  
 
===Stack transition===
 
===Stack transition===
... -> NATURAL_64 value
+
... -> value
  
 
===Arguments===
 
===Arguments===
* NATURAL_64 value: 64 bits
+
* value: 64 bits NATURAL_64
  
 
==BC_TUPLE==
 
==BC_TUPLE==
 
==BC_PTUPLE==
 
==BC_PTUPLE==
 
==BC_JAVA_RTYPE==
 
==BC_JAVA_EXTERNAL==
 

Latest revision as of 11:04, 31 October 2006

Introduction

Below is a description of all opcodes we current support in the Eiffel interpreter. We only display their name as defined in C/run-time/rt_interp.h. One has to use this file to avoid possible change in values of opcode which happens time to time since it is a closed format.

Byte code reader

In C/bench you have 2 tools to read the content of the melted file:

  1. meltdump: which takes as argument the melted file and will generate 2 files: melted.txt and bytecode.eif
  2. bytedump: uses bytecode.eif from the current working directory and generate bytecode.txt

The content of bytecode.txt is helpful to understand the code we generate and the documentation below makes it even clearer.

Byte codes

BC_START

Description

Entry point of a routine.

arguments

  • routine_id: 32 bits
  • body_id: 32 bits
  • result type: 32 bits
  • number of arguments: 16 bits
  • number of locals: 16 bits
  • type of each local
  • flag for argument cloning: 8 bits (If it is set (aka different of BC_NO_CLONE_ARG), read the type of arguments which need cloning).
  • routine name: null terminated CHARACTER_8 string
  • dynamic type where feature is written in: 16 bits
  • flag for rescue clause presence: 8 bits (If present, offset to the rescue clause: 32 bits).

BC_PRECOND

BC_POSTCOND

BC_DEFERRED

BC_REVERSE

BC_CHECK

BC_ASSERT

BC_NULL

BC_PRE

BC_PST

BC_CHK

BC_LINV

BC_LVAR

BC_INV

BC_END_ASSERT

BC_TAG

BC_NOTAG

BC_JMP_F

BC_JMP

BC_LOOP

BC_END_VARIANT

BC_INIT_VARIANT

BC_DEBUG

BC_RASSIGN

BC_LASSIGN

BC_ASSIGN

BC_CREATE

BC_CTYPE

BC_CARG

BC_CLIKE

BC_CCUR

BC_INSPECT

BC_RANGE

BC_INSPECT_EXCEP

BC_LREVERSE

BC_RREVERSE

BC_FEATURE

BC_METAMORPHOSE

BC_CURRENT

BC_ROTATE

BC_FEATURE_INV

BC_ATTRIBUTE

BC_ATTRIBUTE_INV

BC_EXTERN

BC_EXTERN_INV

BC_RESULT

BC_LOCAL

BC_ARG

BC_UPLUS

BC_UMINUS

BC_NOT

BC_LT

BC_GT

BC_MINUS

BC_XOR

BC_GE

BC_EQ

BC_NE

BC_STAR

BC_POWER

BC_LE

BC_DIV

BC_NHOOK

BC_AND

BC_SLASH

BC_MOD

BC_PLUS

BC_OR

BC_ADDR

BC_STRING

BC_AND_THEN

BC_OR_ELSE

BC_SPCREATE

BC_TUPLE_ACCESS

BC_JMP_T

BC_TUPLE_ASSIGN

BC_RESCUE

BC_END_RESCUE

BC_RETRY

BC_EXP_ASSIGN

BC_CLONE

BC_EXP_EXCEP

BC_VOID

BC_NONE_ASSIGN

BC_LEXP_ASSIGN

BC_REXP_ASSIGN

BC_CLONE_ARG

BC_NO_CLONE_ARG

BC_FALSE_COMPAR

BC_TRUE_COMPAR

BC_STANDARD_EQUAL

BC_BIT_STD_EQUAL

BC_HOOK

BC_BIT

BC_ARRAY

BC_RETRIEVE_OLD

BC_FLOAT

BC_OLD

BC_ADD_STRIP

BC_END_STRIP

BC_LBIT_ASSIGN

BC_RAISE_PREC

BC_GOTO_BODY

BC_NOT_REC

BC_END_PRE

BC_CAST_NATURAL

BC_CAST_INTEGER

BC_CAST_REAL_32

BC_CAST_REAL_64

BC_INV_NULL

BC_CREAT_INV

BC_END_EVAL_OLD

BC_START_EVAL_OLD

BC_OBJECT_ADDR

BC_PFEATURE

BC_PFEATURE_INV

BC_PEXTERN

BC_PEXTERN_INV

BC_PARRAY

BC_PATTRIBUTE

BC_PATTRIBUTE_INV

BC_PEXP_ASSIGN

BC_PASSIGN

BC_PREVERSE

BC_PCLIKE

BC_OBJECT_EXPR_ADDR

BC_RESERVE

BC_POP

BC_REF_TO_PTR

BC_RCREATE

BC_GEN_PARAM_CREATE

BC_CAST_CHAR32

BC_NULL_POINTER

BC_BASIC_OPERATIONS

BC_MAX

BC_MIN

BC_GENERATOR

BC_OFFSET

BC_ZERO

BC_ONE

BC_THREE_WAY_COMPARISON

BC_INT_BIT_OP

BC_INT_BIT_AND

BC_INT_BIT_OR

BC_INT_BIT_XOR

BC_INT_BIT_NOT

BC_INT_BIT_SHIFT_LEFT

BC_INT_BIT_SHIFT_RIGHT

BC_INT_BIT_TEST

BC_INT_SET_BIT

BC_INT_SET_BIT_WITH_MASK

BC_CHAR

BC_BOOL

BC_DOUBLE

BC_WCHAR

BC_INT8

Description

Load a INTEGER_8 on the stack.

Stack transition

... -> value

Arguments

  • value: 8 bits INTEGER_8

BC_INT16

Description

Load a INTEGER_16 on the stack.

Stack transition

... -> value

Arguments

  • value: 16 bits INTEGER_16

BC_INT32

Description

Load a INTEGER_32 on the stack.

Stack transition

... -> value

Arguments

  • value: 32 bits INTEGER_32

BC_INT64

Description

Load a INTEGER_64 on the stack.

Stack transition

... -> value

Arguments

  • value: 64 bits INTEGER_64

BC_CAST_CHAR8

BC_ONCE_STRING

BC_ALLOCATE_ONCE_STRINGS

BC_CCLONE

BC_UINT8

Description

Load a NATURAL_8 on the stack.

Stack transition

... -> value

Arguments

  • value: 8 bits NATURAL_8

BC_UINT16

Description

Load a NATURAL_16 on the stack.

Stack transition

... -> value

Arguments

  • value: 16 bits NATURAL_16

BC_UINT32

Description

Load a NATURAL_32 on the stack.

Stack transition

... -> value

Arguments

  • value: 32 bits NATURAL_32

BC_UINT64

Description

Load a NATURAL_64 on the stack.

Stack transition

... -> value

Arguments

  • value: 64 bits NATURAL_64

BC_TUPLE

BC_PTUPLE