ByteCodeCompiler.st
changeset 1031 a6c0c0b7d355
parent 1030 6ff51c965fd2
child 1046 8e5818442eb9
equal deleted inserted replaced
1030:6ff51c965fd2 1031:a6c0c0b7d355
   163 
   163 
   164         78          PUSH_0          push smallinteger 0 constant
   164         78          PUSH_0          push smallinteger 0 constant
   165         79          PUSH_1          push smallinteger 1 constant
   165         79          PUSH_1          push smallinteger 1 constant
   166         7A          PUSH_M1         push smallinteger -1 constant
   166         7A          PUSH_M1         push smallinteger -1 constant
   167 
   167 
   168         7B          SEND_PLUS1      send + 1 to TOS; replace TOS by result
   168         7B          SEND_PLUS1      send '+ 1' to TOS; replace TOS by result
   169         7C          SEND_MINUS1     send - 1 to TOS; replace TOS by result
   169         7C          SEND_MINUS1     send '- 1' to TOS; replace TOS by result
   170         7D          INC_MVAR        send + 1 to a method variable; store result into mvar
   170         7D          INC_MVAR        send '+ 1' to a method variable; store result into same mvar (for inlined loops)
   171         7E          DEC_MVAR        send - 1 to a method variable; store result into mvar
   171         7E          DEC_MVAR        send '- 1' to a method variable; store result into same mvar (for inlined loops)
   172         7F nn       RET_NUM         return a smallInteger from current context
   172         7F nn       RET_NUM         return a smallInteger from current context
   173     *   80          PUSH_OBVAR      push outer block variable
   173     *   80          PUSH_OBVAR      push outer block variable
   174     *   81          STORE_OBVAR     pop and store into outer block variable
   174     *   81          STORE_OBVAR     pop and store into outer block variable
   175 
   175 
   176         82          SEND_EQ         130     /* send = */
   176         82          SEND_EQ         send #= 
   177         83          SEND_PLUS       131     /* send + */
   177         83          SEND_PLUS       send #+ 
   178         84          SEND_NE         132     /* send ~= */
   178         84          SEND_NE         send #~= 
   179         85          SEND_MINUS      133     /* send - */
   179         85          SEND_MINUS      send #- 
   180         86          SEND_CLASS      134     /* send class */
   180         86          SEND_CLASS      send #class 
   181         87          SEND_AT         135     /* send at:*/
   181         87          SEND_AT         send #at:
   182         88          SEND_ATPUT      136     /* send at:put: */
   182         88          SEND_ATPUT      send #at:put: 
   183         89          SEND_BITAND     137     /* send bitAnd: */
   183         89          SEND_BITAND     send #bitAnd: 
   184         8A          SEND_BITOR      138     /* send bitOr: */
   184         8A          SEND_BITOR      send #bitOr: 
   185 
   185 
   186         8B          PUSH_2          139     /* push constant 2 */
   186         8B          PUSH_2          push constant 2
   187 
   187 
   188         8C          PUSH_BARG1      140     /* push block argument */
   188         8C          PUSH_BARG1      push block argument 1
   189         8D          PUSH_BARG2      141
   189         8D          PUSH_BARG2      
   190         8E          PUSH_BARG3      142
   190         8E          PUSH_BARG3      
   191         8F          PUSH_BARG4      143
   191         8F          PUSH_BARG4      
   192 
   192 
   193     *   90          PUSH_CONTEXT    144
   193     *   90          PUSH_CONTEXT    push thisContext
   194 
   194 
   195         91          SEND_GT         145     /* send > */
   195         91          SEND_GT         send > 
   196         92          SEND_GE         146     /* send >= */
   196         92          SEND_GE         send >= 
   197         93          SEND_LT         147     /* send < */
   197         93          SEND_LT         send < 
   198         94          SEND_LE         148     /* send <= */
   198         94          SEND_LE         send <= 
   199 
   199 
   200         95          UNUSED_149      149     /* was: send next */
   200         95          UNUSED_149      obsolete; was: send #next 
   201         96          UNUSED_150      150     /* was: send peek */
   201         96          UNUSED_150      obsolete; was: send #peek 
   202         97          SEND_VALUE      151     /* send value */
   202         97          SEND_VALUE      send #value 
   203         98          SEND_VALUE1     152     /* send value: */
   203         98          SEND_VALUE1     send #value: 
   204         99          SEND_SIZE       153     /* send size */
   204         99          SEND_SIZE       send #size 
   205         9A          UNUSED_154      154
   205         9A          UNUSED_154      
   206         9B          UNUSED_155      155
   206         9B          UNUSED_155      
   207 
   207 
   208         9C          MK0BLOCK        156     
   208         9C          MK0BLOCK        make a 0-returning block     
   209         9D          MKNILBLOCK      157
   209         9D          MKNILBLOCK      make a nil-returning block
   210 
   210 
   211         9E          UNUSED_158      158     /* was: send asInteger */
   211         9E          UNUSED_158      obsolete; was: send #asInteger */
   212         9F          UNUSED_159      159     /* was: send rounded */
   212         9F          UNUSED_159      obsolete; was: send #rounded */
   213 
   213 
   214         A0          RET_MVAR1       160     /* return method variable */
   214         A0          RET_MVAR1       return method variable 1 from current context
   215         A1          RET_MVAR2       161
   215         A1          RET_MVAR2       return method variable 2 from current context
   216         A2          RET_MVAR3       162
   216         A2          RET_MVAR3       
   217         A3          RET_MVAR4       163
   217         A3          RET_MVAR4       
   218         A4          RET_MVAR5       164
   218         A4          RET_MVAR5       
   219         A5          RET_MVAR6       165
   219         A5          RET_MVAR6       return method variable 6 from current context
   220 
   220 
   221         A6          RET_IVAR1       166     /* return instance variable */
   221         A6          RET_IVAR1       return instance variable 1 from current context
   222         A7          RET_IVAR2       167
   222         A7          RET_IVAR2       return instance variable 2 from current context
   223         A8          RET_IVAR3       168
   223         A8          RET_IVAR3       
   224         A9          RET_IVAR4       169
   224         A9          RET_IVAR4       
   225         AA          RET_IVAR5       170
   225         AA          RET_IVAR5       
   226         AB          RET_IVAR6       171
   226         AB          RET_IVAR6       
   227         AC          RET_IVAR7       172
   227         AC          RET_IVAR7       
   228         AD          RET_IVAR8       173
   228         AD          RET_IVAR8       return instance variable 8 from current context
   229 
   229 
   230         AE          RET_MARG1       174
   230         AE          RET_MARG1       return method arg 1 from current context
   231         AF          RET_MARG2       175
   231         AF          RET_MARG2       return method arg 1 from current context
   232 
   232 
   233         B0          PUSH_CIVAR      176     /* push class instance variable */
   233         B0          PUSH_CIVAR      obsolete; push class instance variable 
   234         B1          STORE_CIVAR     177     /* store top of stack in class instance variable */
   234         B1          STORE_CIVAR     obsolete; store top of stack in class instance variable 
   235 
   235 
   236         B2          SEND_VALUE2     178     /* send value:value: */
   236         B2          SEND_VALUE2     send #value:value:
   237         B3          SEND_NOT        179     
   237         B3          SEND_NOT        send #not     
   238 
   238 
   239         B4          SEND_SELF0      180     /* send a 0-arg message to self */
   239         B4          SEND_SELF0      send a 0-arg message to self 
   240         B5          SEND_SELF1      181     /* send a 1-arg message to self */
   240         B5          SEND_SELF1      send a 1-arg message to self 
   241         B6          SEND_SELF2      182     /* send a 2-arg message to self */
   241         B6          SEND_SELF2      send a 2-arg message to self 
   242         B7          SEND_SELF3      183     /* send a 3-arg message to self */
   242         B7          SEND_SELF3      send a 3-arg message to self 
   243 
   243 
   244         B8          SEND_SELF_DROP0 184     /* send a 0-arg message to self forget result */
   244         B8          SEND_SELF_DROP0 send a 0-arg message to self forget result
   245         B9          SEND_SELF_DROP1 185     /* send a 1-arg message to self forget result */
   245         B9          SEND_SELF_DROP1 send a 1-arg message to self forget result
   246         BA          SEND_SELF_DROP2 186     /* send a 2-arg message to self forget result */
   246         BA          SEND_SELF_DROP2 send a 2-arg message to self forget result
   247         BB          SEND_SELF_DROP3 187     /* send a 3-arg message to self forget result */
   247         BB          SEND_SELF_DROP3 send a 3-arg message to self forget result
   248 
   248 
   249         BC          ISNIL           188     
   249         BC          ISNIL           replace TOS by 'TOS isNil'     
   250         BD          NOTNIL          189     
   250         BD          NOTNIL          replace TOS by 'TOS notNil'     
   251 
   251 
   252 #define JMPA_FALSE      190     /* jumps to absolute offset (2 byte hi-lo) */
   252         BE uuuu     JMPA_FALSE      jumps to absolute offset (2 byte hi-lo) 
   253 #define JMPA_TRUE       191
   253         BF uuuu     JMPA_TRUE       
   254 #define JMPA_NIL        192
   254         C0 uuuu     JMPA_NIL        
   255 #define JMPA_NOTNIL     193
   255         C1 uuuu     JMPA_NOTNIL     
   256 #define JMPA            194
   256         C2 uuuu     JMPA            
   257 #define MAKE_ABLOCK     195
   257         C3          MAKE_ABLOCK     
   258 #define JMPA_ZERO       196
   258         C4 uuuu     JMPA_ZERO       
   259 #define JMPA_NOTZERO    197
   259         C5 uuuu     JMPA_NOTZERO    
   260 #define JMPA_EQ         198
   260         C6 uuuu     JMPA_EQ         
   261 #define JMPA_NOTEQ      199
   261         C7 uuuu     JMPA_NOTEQ      
   262 
   262 
   263 #define PUSH_GSPECIAL   200     /* push special global */
   263         C8 xx       PUSH_GSPECIAL   push a special global; xx specifies what:
   264 # define GSPECIAL_ARRAY                 0
   264            00        Array   (push 'Smalltalk at:#Array'; i.e. the Array class)
   265 # define GSPECIAL_STRING                1
   265            01        String  (push 'Smalltalk at:#String'; i.e. the String class)
   266 # define GSPECIAL_FLOATARRAY            2
   266            02        FloatArray
   267 # define GSPECIAL_DOUBLEARRAY           3
   267            03        DoubleArray
   268 # define GSPECIAL_POINT                 4
   268            04        Point
   269 # define GSPECIAL_SYMBOL                5
   269            05        Symbol
   270 # define GSPECIAL_SMALLTALK             6
   270            06        Smalltalk
   271 # define GSPECIAL_PROCESSOR             7
   271            07        Processor
   272 # define GSPECIAL_SMALLINTEGER          8
   272            08        SmallInteger
   273 # define GSPECIAL_CHARACTER             9
   273            09        Character
   274 # define GSPECIAL_FLOAT                 10
   274            0A        Float
   275 # define GSPECIAL_PROCESS               11
   275            0B        Process
   276 # define GSPECIAL_SET                   12
   276            0C        Set
   277 # define GSPECIAL_IDENTITYSET           13
   277            0D        IdentitySet
   278 # define GSPECIAL_DICTIONARY            14
   278            0E        Dictionary
   279 # define GSPECIAL_IDENTITYDICTIONARY    15
   279            0F        IdentityDictionary
   280 # define GSPECIAL_SEMAPHORE             16
   280            10        Semaphore
   281 # define GSPECIAL_ORDEREDCOLLECTION     17
   281            11        OrderedCollection
   282 
   282 
   283 
   283         C9 uuuu     PUSH_LLIT       push a literal (2-byte literal-number)
   284     *   PUSH_LLIT       201     /* push a literal (2-byte literal-number)*/
   284 
   285 
   285         CA nn       JMP_FALSE_L     jump if top is false (+127 .. -128) 
   286 #define JMP_FALSE_L     202     /* jump if top is false (+127 .. -128) */
   286         CB nn       JMP_TRUE_L      jump if top is true 
   287 #define JMP_TRUE_L      203     /* jump if top is true */
   287 
   288 
   288         CC          UNUSED_204      
   289 #define UNUSED_204      204
   289         CD          LSEND_MSG       send with 16 bit literal index */
   290 #define LSEND_MSG       205     /* send with 16 bit literal index */
   290         CE          LSUPERSEND_MSG  super send with 16 bit literal index */
   291 #define LSUPERSEND_MSG  206     /* send with 16 bit literal index */
   291         CF          LSEND_SELF      self-send send with 16 bit literal index */
   292 #define LSEND_SELF      207     /* send with 16 bit literal index */
   292         D0          PUSH_GT0        push 'TOS > 0'; leaves original TOS as NOS
   293 #define PUSH_GT0        208
   293 
   294 
   294         D1          UNUSED_209      
   295 #define UNUSED_209      209
   295 
   296 
   296         D2          SEND_ARRAY_NEW  use for new/basicNew; top is size (0 for Array new) 
   297 #define SEND_ARRAY_NEW  210     /* use for new/basicNew; top is size (0 for Array new) */
   297         D3          SEND_BASICNEW   top is class (receiver) 
   298 #define SEND_BASICNEW   211     /* top is class (receiver) */
   298         D4          SEND_GT0        replace TOS by result of send 'TOS > 0' 
   299 #define SEND_GT0        212     /* send > 0 */
   299         D5          SEND_NEW        top is class (receiver) 
   300 #define SEND_NEW        213     /* top is class (receiver) */
   300         D6          SEND_BASICNEWN  top is class (receiver) and arg 
   301 #define SEND_BASICNEWN  214     /* top is class (receiver) and arg */
   301         D7          SEND_NEWN       top is class (receiver) and arg
   302 #define SEND_NEWN       215     /* top is class (receiver) and arg */
   302         D8          SEND_LOGAND     send & 
   303 #define SEND_LOGAND     216     /* send & */
   303         D9          SEND_LOGOR      send | 
   304 #define SEND_LOGOR      217     /* send | */
   304 
   305 
   305         DA uuuu     PUSH_LGLOB      push global variable word index literal 
   306 #define PUSH_LGLOB      218     /* push global variable word index literal */
   306         DB uuuu     STORE_LGLOB     store global with word index literal 
   307 #define STORE_LGLOB     219     /* store global with word index literal */
   307 
   308 
   308         DC          UNUSED_220      
   309 #define UNUSED_220      220
   309         DE          UNUSED_221      
   310 #define UNUSED_221      221
   310 
   311 
   311         DF          PUSH_LIT1       push 1st literal
   312 #define PUSH_LIT1       222     /* push 1st literal */
   312         E0          PUSH_LIT2       push 2nd literal 
   313 #define PUSH_LIT2       223     /* push 2nd literal */
   313         E1          PUSH_LIT3       push literal 3 
   314 #define PUSH_LIT3       224     /* push literal 3 */
   314         E2          PUSH_LIT4       push literal 4 
   315 #define PUSH_LIT4       225     /* push literal 4 */
   315         E3          PUSH_LIT5       push literal 5 
   316 #define PUSH_LIT5       226     /* push literal 5 */
   316         E4          PUSH_LIT6       push literal 6 
   317 #define PUSH_LIT6       227     /* push literal 6 */
   317         E5          PUSH_LIT7       push literal 7 
   318 #define PUSH_LIT7       228     /* push literal 7 */
   318         E6          PUSH_LIT8       push literal 8 
   319 #define PUSH_LIT8       229     /* push literal 8 */
   319 
   320 
   320         E7          SEND_MUL        send #* 
   321 #define SEND_MUL        230     /* send * */
   321         E8 xx       SEND_SPECIAL    special send; as specified by xx:
   322 #define SEND_SPECIAL    231     /* special send */
   322            00         top           send #top
   323 # define SPECIAL_TOP    0
   323            01         bottom        send #bottom
   324 # define SPECIAL_BOTTOM 1
   324            02         left          send #left
   325 # define SPECIAL_LEFT   2
   325            03         right         send #right
   326 # define SPECIAL_RIGHT  3
   326            04         x             send #x
   327 # define SPECIAL_X      4
   327            05         y             send #y
   328 # define SPECIAL_Y      5
   328            06         width         send #width
   329 # define SPECIAL_WIDTH  6
   329            07         height        send #height
   330 # define SPECIAL_HEIGHT 7
   330            08         origin        send #origin
   331 # define SPECIAL_ORIGIN 8
   331            09         extent        send #extent
   332 # define SPECIAL_EXTENT 9
   332            0A         asInteger     send #asInteger
   333 # define SPECIAL_ASINTEGER 10
   333            0B         rounded       send #rounded
   334 # define SPECIAL_ROUNDED   11
   334            0C         next          send #next
   335 # define SPECIAL_NEXT      12
   335            0D         peek          send #peek
   336 # define SPECIAL_PEEK      13
   336 
   337 
   337         E9          PUSH_BVAR1      push block variable 1
   338 #define PUSH_BVAR1      232
   338         EA          PUSH_BVAR2      push block variable 2
   339 #define PUSH_BVAR2      233
   339         EB          PUSH_BVAR3      push block variable 3
   340 #define PUSH_BVAR3      234
   340 
   341 
   341         EC          STORE_BVAR1     store TOS in block variable 1 and drop
   342 #define STORE_BVAR1     235
   342         ED          STORE_BVAR2     store TOS in block variable 2 and drop
   343 #define STORE_BVAR2     236
   343         EE          STORE_BVAR3     store TOS in block variable 3 and drop
   344 #define STORE_BVAR3     237
   344 
   345 
   345      *  EF          BLOCK_REF       internal - check if a block is referenced by TOS
   346 #define BLOCK_REF       238
   346 
   347 
   347         F0          PUSH_LVAR       push local variable 0..numArgs-1 for args; numArgs..numArgs+nLocal-1 for mVars 
   348 #define PUSH_LVAR       239     /* push local variable 0..numArgs-1 for args; numArgs..numArgs+nLocal-1 for mVars */
   348         F1          STORE_LVAR      store local variable 0..numArgs-1 for args; numArgs..numArgs+nLocal-1 for mVars 
   349 #define STORE_LVAR      240     /* store local variable 0..numArgs-1 for args; numArgs..numArgs+nLocal-1 for mVars */
   349 
   350 
   350         F2          UNUSED_242      
   351 #define UNUSED_241      241
   351         F3          UNUSED_243      
   352 #define UNUSED_242      242
   352         F4          UNUSED_244      
   353 #define UNUSED_243      243
   353         F5          UNUSED_245      
   354 #define UNUSED_244      244
   354         F6          UNUSED_246      
   355 #define UNUSED_245      245
   355         F7          UNUSED_247      
   356 #define UNUSED_246      246
   356         F8          UNUSED_248      
   357 #define UNUSED_247      247
   357         F9          UNUSED_249      
   358 #define UNUSED_248      248
   358         FA          UNUSED_250      
   359 #define UNUSED_249      249
   359         FB          UNUSED_251      
   360 #define UNUSED_250      250
   360         FC          UNUSED_252      
   361 #define UNUSED_251      251
   361         FD          UNUSED_253      
   362 #define UNUSED_252      252
   362         FE          UNUSED_254      
   363 #define UNUSED_253      253
   363         FF          UNUSED_255      
   364 #define UNUSED_254      254
       
   365 #define UNUSED_255      255
       
   366 
   364 
   367     [author:]
   365     [author:]
   368         Claus Gittinger
   366         Claus Gittinger
   369 
   367 
   370 "
   368 "
  3645 ! !
  3643 ! !
  3646 
  3644 
  3647 !ByteCodeCompiler class methodsFor:'documentation'!
  3645 !ByteCodeCompiler class methodsFor:'documentation'!
  3648 
  3646 
  3649 version
  3647 version
  3650     ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.163 2000-02-05 13:08:43 cg Exp $'
  3648     ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.164 2000-02-05 13:35:26 cg Exp $'
  3651 ! !
  3649 ! !
  3652 ByteCodeCompiler initialize!
  3650 ByteCodeCompiler initialize!