ByteCodeCompiler.st
author Merge Script
Sun, 14 Feb 2016 07:00:00 +0100
branchjv
changeset 3710 e529aebad054
parent 3682 7225237d33a0
parent 3709 e9d10d99ef0d
child 3734 f4acd1ea5988
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
     1
"
4
f6fd83437415 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
45
e8331ba8ad5d *** empty log message ***
claus
parents: 39
diff changeset
     3
	      All Rights Reserved
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
     4
7ad01559b262 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
7ad01559b262 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
7ad01559b262 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
7ad01559b262 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
7ad01559b262 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
7ad01559b262 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
7ad01559b262 Initial revision
claus
parents:
diff changeset
    11
"
1046
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    12
"{ Package: 'stx:libcomp' }"
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    13
3564
7e6207c98120 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3532
diff changeset
    14
"{ NameSpace: Smalltalk }"
7e6207c98120 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3532
diff changeset
    15
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    16
Parser subclass:#ByteCodeCompiler
253
759ba0ddb672 oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
    17
	instanceVariableNames:'codeBytes codeIndex litArray stackDelta extra lineno extraLiteral
1094
745ec90c42c9 allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    18
		maxStackDepth relocList methodTempVars numTemp maxNumTemp
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
    19
		methodClass extraOP allLiterals allIdenticalLiterals
3162
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
    20
		breakpointedLines currentLineNumber'
1667
d8979b5429de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1666
diff changeset
    21
	classVariableNames:'JumpToAbsJump ShareCode ListCompiledMethods NewCodeSet
d8979b5429de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1666
diff changeset
    22
		NewPrimitives'
172
85ad12831217 give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    23
	poolDictionaries:''
85ad12831217 give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    24
	category:'System-Compiler'
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    25
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    26
372
98da4d230a8d prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
    27
!ByteCodeCompiler class methodsFor:'documentation'!
3
b63b8a6b71fb *** empty log message ***
claus
parents: 1
diff changeset
    28
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    29
byteCode
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    30
"
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    31
    TOS   - top of stack
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    32
    NOS   - next on stack
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    33
    uu    - byte-valued unsigned (0..16rFF)
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    34
    uuuu  - twoByte-valued unsigned (0..16rFFFF); msb-first
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    35
    ll    - byte-valued literal index (0..16rFF)
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    36
    nn    - byte-valued signed (-128..+127)
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    37
    nnnn  - twoByte-valued signed (16r-8000 .. 16r7FFF)
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    38
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
    39
    Notes:
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    40
        - bytecode optimized for space, not interpreter speed,
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    41
          since JITTER is assumed to be present and compensate for decoding
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    42
          overhead.
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    43
        - number assignments due to backward compatible extensions of the
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    44
          bytecode set - reassignment & cleanup would be nice.
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    45
        - codes marked with (*) make the minimal set; all others duplicate
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    46
          the functionality of a minimalSet code, but provides dense encoding
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    47
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    48
    definition of ST/X byteCode:
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    49
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    50
    *   00          RET_TOP         return TOS from current context
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    51
        01          RET_NIL         return nil from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    52
        02          RET_TRUE        return true from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    53
        03          RET_FALSE       return false from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    54
        04          RET_0           return 0 (zero) from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    55
        05          RET_SELF        return the current receiver from current context
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    56
    *   06          DUP_OVER        push NOS (used with inlined loops)
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    57
    *   07          HOME_RET_TOP    return TOS from home context (method return from block)
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    58
        08 uu       LINENO          line number information dummy
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    59
    *   09 uuuu     LINENO16        line number information dummy
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    60
        0A          PUSH_NIL        push nil onto stack
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    61
        0B          PUSH_TRUE       push true onto stack
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    62
        0C          PUSH_FALSE      push false onto stack
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    63
        0D          SEND_SELF       self-send
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    64
    *   0E ll       PUSH_LIT        push a literal
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    65
        0F          PUSH_SELF       push the current receiver onto stack
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    66
        10 nn       PUSH_NUM        push a byte-valued smallInteger onto stack
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    67
        11 nnnn     PUSH_NUM16      push a twoByte-valued smallInteger onto stack
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    68
    *   12          DROP            pop & forget
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
    69
    *   13          SEND            send
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
    70
    *   14          SUPER_SEND      super-send (actually: directed send)
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    71
        15          SEND0           send 0-arg message
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    72
        16          SEND1           send 1-arg message
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    73
        17          SEND2           send 2-arg message
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    74
        18          SEND3           send 3-arg message
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    75
        19          SEND_DROP       send & forget result
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    76
        1A          SEND0_DROP      send 0-arg message & forget result
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    77
        1B          SEND1_DROP      send 1-arg message & forget result
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    78
        1C          SEND2_DROP      send 2-arg message & forget result
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    79
        1D          SEND3_DROP      send 3-arg message & forget result
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    80
    *   1E          PUSH_MARG       push method arg
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    81
    *   1F          PUSH_MVAR       push method variable
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    82
    *   20          PUSH_BARG       push block arg
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    83
    *   21          PUSH_BVAR       push block variable
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    84
    *   22          PUSH_IVAR       push instance variable
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    85
        23          PUSH_CVAR       -- obsolete -- no longer used.
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    86
    *   24          PUSH_GLOB       push global
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    87
    *   25          STORE_MVAR      pop and store into method variable
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    88
    *   26          STORE_BVAR      pop and store into block variable
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    89
    *   27          STORE_IVAR      pop and store into instance variable
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    90
        28          STORE_CVAR      -- obsolete -- no longer used.
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    91
    *   29          STORE_GLOB      pop and store into global
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    92
    *   2A          PUSH_OBARG      push outer block arg (n levels)
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    93
        2B          PUSH_OBARG1     push outer block arg (1 level)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    94
        2C          PUSH_OBARG2     push outer block arg (2 levels)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    95
        2D          EQEQ            == -> pop a,b; push a==b
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    96
        2E          NENE            ~~ -> pop a,b; push a~~b
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    97
    *   2F          DUP             duplicate TOS
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    98
        30          EQEQ0           ==0 -> pop a; push a==0
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
    99
        31          NENE0           ~~0 -> pop a; push a~~0
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   100
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   101
        32          JMP_FALSE       pop; branch if false
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   102
        33          JMP_TRUE        pop; branch if true
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   103
        34          JMP_NIL         pop; branch if nil
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   104
        35          JMP_NOTNIL      pop; branch if not nil
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   105
        36          JMP             branch always
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   106
        37          MAKE_BLOCK      make a block
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   107
        38          JMP_ZERO        pop; branch if ==0
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   108
        39          JMP_NOTZERO     pop; branch if ~~0
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   109
        3A          JMP_EQEQ        pop a,b; branch if a==b
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   110
        3B          JMP_NENE        pop a,b; branch if a~~b
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   111
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   112
        3C          JMPL_FALSE      like above, extended branch delta, (add +128/-128 to offs)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   113
        ...          ...
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   114
        45          JMPL_NENE       like above, extended branch delta, (add +128/-128 to offs)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   115
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   116
        46          JMPVL_FALSE     like above, extended branch delta, (add +256/-256 to offs)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   117
        ...          ...
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   118
        4F          JMPVL_NENE      like above, extended branch delta, (add +256/-256 to offs)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   119
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   120
        50          PUSH_MVAR1      push method variable 1 (first variable)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   121
        51          PUSH_MVAR2      push method variable 2
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   122
        52          PUSH_MVAR3      push method variable 3
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   123
        53          PUSH_MVAR4      push method variable 4
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   124
        54          PUSH_MVAR5      push method variable 5
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   125
        55          PUSH_MVAR6      push method variable 6
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   126
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   127
        56          PUSH_MARG1      push method arg 1
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   128
        57          PUSH_MARG2      push method arg 2
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   129
        58          PUSH_MARG3      push method arg 3
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   130
        59          PUSH_MARG4      push method arg 4
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   131
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   132
        5A          PUSH_IVAR1      push inst variable 1 (first variable)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   133
        5B          PUSH_IVAR2      push inst variable 2
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   134
        5C          PUSH_IVAR3      push inst variable 3
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   135
        5D          PUSH_IVAR4      push inst variable 4
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   136
        5E          PUSH_IVAR5      push inst variable 5
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   137
        5F          PUSH_IVAR6      push inst variable 6
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   138
        60          PUSH_IVAR7      push inst variable 7
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   139
        61          PUSH_IVAR8      push inst variable 8
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   140
        62          PUSH_IVAR9      push inst variable 9
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   141
        63          PUSH_IVAR10     push inst variable 10
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   142
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   143
        64          STORE_MVAR1     pop and store into method variable 1 (first variable)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   144
        65          STORE_MVAR2     pop and store into method variable 2
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   145
        66          STORE_MVAR3     pop and store into method variable 3
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   146
        67          STORE_MVAR4     pop and store into method variable 4
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   147
        68          STORE_MVAR5     pop and store into method variable 5
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   148
        69          STORE_MVAR6     pop and store into method variable 6
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   149
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   150
        6A          unused
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   151
        6B          unused
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   152
        6C          unused
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   153
        6D          unused
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   154
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   155
        6E          STORE_IVAR1     pop and store into inst variable 1 (first variable)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   156
        6F          STORE_IVAR2     pop and store into inst variable 2
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   157
        70          STORE_IVAR3     pop and store into inst variable 3
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   158
        71          STORE_IVAR4     pop and store into inst variable 4
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   159
        72          STORE_IVAR5     pop and store into inst variable 5
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   160
        73          STORE_IVAR6     pop and store into inst variable 6
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   161
        74          STORE_IVAR7     pop and store into inst variable 7
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   162
        75          STORE_IVAR8     pop and store into inst variable 8
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   163
        76          STORE_IVAR9     pop and store into inst variable 9
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   164
        77          STORE_IVAR10    pop and store into inst variable 10
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   165
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   166
        78          PUSH_0          push smallinteger 0 constant
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   167
        79          PUSH_1          push smallinteger 1 constant
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   168
        7A          PUSH_M1         push smallinteger -1 constant
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   169
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   170
        7B          SEND_PLUS1      send '+ 1' to TOS; replace TOS by result
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   171
        7C          SEND_MINUS1     send '- 1' to TOS; replace TOS by result
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   172
        7D          INC_MVAR        send '+ 1' to a method variable; store result into same mvar (for inlined loops)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   173
        7E          DEC_MVAR        send '- 1' to a method variable; store result into same mvar (for inlined loops)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   174
        7F nn       RET_NUM         return a smallInteger from current context
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   175
    *   80          PUSH_OBVAR      push outer block variable
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   176
    *   81          STORE_OBVAR     pop and store into outer block variable
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   177
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   178
        82          SEND_EQ         send #=
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   179
        83          SEND_PLUS       send #+
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   180
        84          SEND_NE         send #~=
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   181
        85          SEND_MINUS      send #-
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   182
        86          SEND_CLASS      send #class
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   183
        87          SEND_AT         send #at:
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   184
        88          SEND_ATPUT      send #at:put:
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   185
        89          SEND_BITAND     send #bitAnd:
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   186
        8A          SEND_BITOR      send #bitOr:
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   187
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   188
        8B          PUSH_2          push constant 2
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   189
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   190
        8C          PUSH_BARG1      push block argument 1
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   191
        8D          PUSH_BARG2
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   192
        8E          PUSH_BARG3
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   193
        8F          PUSH_BARG4
1031
a6c0c0b7d355 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   194
a6c0c0b7d355 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   195
    *   90          PUSH_CONTEXT    push thisContext
a6c0c0b7d355 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   196
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   197
        91          SEND_GT         send >
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   198
        92          SEND_GE         send >=
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   199
        93          SEND_LT         send <
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   200
        94          SEND_LE         send <=
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   201
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   202
        95          UNUSED_149      obsolete; was: send #next
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   203
        96          UNUSED_150      obsolete; was: send #peek
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   204
        97          SEND_VALUE      send #value
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   205
        98          SEND_VALUE1     send #value:
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   206
        99          SEND_SIZE       send #size
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   207
        9A          UNUSED_154
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   208
        9B          UNUSED_155
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   209
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   210
        9C          MK0BLOCK        make a 0-returning block
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   211
        9D          MKNILBLOCK      make a nil-returning block
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   212
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   213
        9E          UNUSED_158      obsolete; was: send #asInteger */
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   214
        9F          UNUSED_159      obsolete; was: send #rounded */
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   215
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   216
        A0          RET_MVAR1       return method variable 1 from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   217
        A1          RET_MVAR2       return method variable 2 from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   218
        A2          RET_MVAR3
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   219
        A3          RET_MVAR4
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   220
        A4          RET_MVAR5
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   221
        A5          RET_MVAR6       return method variable 6 from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   222
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   223
        A6          RET_IVAR1       return instance variable 1 from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   224
        A7          RET_IVAR2       return instance variable 2 from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   225
        A8          RET_IVAR3
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   226
        A9          RET_IVAR4
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   227
        AA          RET_IVAR5
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   228
        AB          RET_IVAR6
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   229
        AC          RET_IVAR7
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   230
        AD          RET_IVAR8       return instance variable 8 from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   231
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   232
        AE          RET_MARG1       return method arg 1 from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   233
        AF          RET_MARG2       return method arg 1 from current context
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   234
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   235
        B0          PUSH_CIVAR      obsolete; push class instance variable
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   236
        B1          STORE_CIVAR     obsolete; store top of stack in class instance variable
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   237
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   238
        B2          SEND_VALUE2     send #value:value:
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   239
        B3          SEND_NOT        send #not
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   240
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   241
        B4          SEND_SELF0      send a 0-arg message to self
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   242
        B5          SEND_SELF1      send a 1-arg message to self
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   243
        B6          SEND_SELF2      send a 2-arg message to self
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   244
        B7          SEND_SELF3      send a 3-arg message to self
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   245
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   246
        B8          SEND_SELF_DROP0 send a 0-arg message to self forget result
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   247
        B9          SEND_SELF_DROP1 send a 1-arg message to self forget result
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   248
        BA          SEND_SELF_DROP2 send a 2-arg message to self forget result
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   249
        BB          SEND_SELF_DROP3 send a 3-arg message to self forget result
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   250
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   251
        BC          ISNIL           replace TOS by 'TOS isNil'
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   252
        BD          NOTNIL          replace TOS by 'TOS notNil'
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   253
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   254
        BE uuuu     JMPA_FALSE      jumps to absolute offset (2 byte hi-lo)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   255
        BF uuuu     JMPA_TRUE
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   256
        C0 uuuu     JMPA_NIL
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   257
        C1 uuuu     JMPA_NOTNIL
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   258
        C2 uuuu     JMPA
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   259
        C3          MAKE_ABLOCK
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   260
        C4 uuuu     JMPA_ZERO
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   261
        C5 uuuu     JMPA_NOTZERO
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   262
        C6 uuuu     JMPA_EQ
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   263
        C7 uuuu     JMPA_NOTEQ
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   264
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   265
        C8 xx       PUSH_GSPECIAL   push a special global; xx specifies what:
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   266
           00        Array   (push 'Smalltalk at:#Array'; i.e. the Array class)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   267
           01        String  (push 'Smalltalk at:#String'; i.e. the String class)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   268
           02        FloatArray
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   269
           03        DoubleArray
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   270
           04        Point
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   271
           05        Symbol
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   272
           06        Smalltalk
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   273
           07        Processor
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   274
           08        SmallInteger
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   275
           09        Character
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   276
           0A        Float
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   277
           0B        Process
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   278
           0C        Set
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   279
           0D        IdentitySet
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   280
           0E        Dictionary
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   281
           0F        IdentityDictionary
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   282
           10        Semaphore
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   283
           11        OrderedCollection
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   284
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   285
        C9 uuuu     PUSH_LLIT       push a literal (2-byte literal-number)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   286
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   287
        CA nn       JMP_FALSE_L     jump if top is false (+127 .. -128)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   288
        CB nn       JMP_TRUE_L      jump if top is true
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   289
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   290
        CC          UNUSED_204
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   291
        CD          LSEND_MSG       send with 16 bit literal index */
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   292
        CE          LSUPERSEND_MSG  super send with 16 bit literal index */
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   293
        CF          LSEND_SELF      self-send send with 16 bit literal index */
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   294
        D0          PUSH_GT0        push 'TOS > 0'; leaves original TOS as NOS
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   295
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   296
        D1          UNUSED_209
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   297
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   298
        D2          SEND_ARRAY_NEW  use for new/basicNew; top is size (0 for Array new)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   299
        D3          SEND_BASICNEW   top is class (receiver)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   300
        D4          SEND_GT0        replace TOS by result of send 'TOS > 0'
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   301
        D5          SEND_NEW        top is class (receiver)
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   302
        D6          SEND_BASICNEWN  top is class (receiver) and arg
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   303
        D7          SEND_NEWN       top is class (receiver) and arg
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   304
        D8          SEND_LOGAND     send &
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   305
        D9          SEND_LOGOR      send |
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   306
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   307
        DA uuuu     PUSH_LGLOB      push global variable word index literal
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   308
        DB uuuu     STORE_LGLOB     store global with word index literal
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   309
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   310
        DC          UNUSED_220
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   311
        DE          UNUSED_221
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   312
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   313
        DF          PUSH_LIT1       push 1st literal
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   314
        E0          PUSH_LIT2       push 2nd literal
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   315
        E1          PUSH_LIT3       push literal 3
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   316
        E2          PUSH_LIT4       push literal 4
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   317
        E3          PUSH_LIT5       push literal 5
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   318
        E4          PUSH_LIT6       push literal 6
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   319
        E5          PUSH_LIT7       push literal 7
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   320
        E6          PUSH_LIT8       push literal 8
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   321
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   322
        E7          SEND_MUL        send #*
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   323
        E8 xx       SEND_SPECIAL    special send; as specified by xx:
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   324
           00         top           send #top
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   325
           01         bottom        send #bottom
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   326
           02         left          send #left
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   327
           03         right         send #right
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   328
           04         x             send #x
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   329
           05         y             send #y
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   330
           06         width         send #width
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   331
           07         height        send #height
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   332
           08         origin        send #origin
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   333
           09         extent        send #extent
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   334
           0A         asInteger     send #asInteger
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   335
           0B         rounded       send #rounded
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   336
           0C         next          send #next
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   337
           0D         peek          send #peek
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   338
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   339
        E9          PUSH_BVAR1      push block variable 1
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   340
        EA          PUSH_BVAR2      push block variable 2
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   341
        EB          PUSH_BVAR3      push block variable 3
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   342
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   343
        EC          STORE_BVAR1     store TOS in block variable 1 and drop
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   344
        ED          STORE_BVAR2     store TOS in block variable 2 and drop
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   345
        EE          STORE_BVAR3     store TOS in block variable 3 and drop
1031
a6c0c0b7d355 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   346
a6c0c0b7d355 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   347
     *  EF          BLOCK_REF       internal - check if a block is referenced by TOS
a6c0c0b7d355 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   348
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   349
        F0          PUSH_LVAR       push local variable 0..numArgs-1 for args; numArgs..numArgs+nLocal-1 for mVars
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   350
        F1          STORE_LVAR      store local variable 0..numArgs-1 for args; numArgs..numArgs+nLocal-1 for mVars
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   351
        F2          STORE_OUTBLOCK_LVAR store local variable in outer context 0..numArgs-1 for args; numArgs..numArgs+nLocal-1 for bVars
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   352
        F3          SWAP            swap TOS with NOS
3162
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
   353
3645
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
   354
        F4          SOURCEPOS8 uu   source position information (offset in source, dummy) 
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
   355
        F5          SOURCEPOS16 uuuu  source position information (offset in source, dummy) 
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
   356
        F6          SOURCEPOS32 uuuuuuuu source position information (offset in source, dummy) 
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   357
        F7          UNUSED_247
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   358
        F8          UNUSED_248
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   359
        F9          UNUSED_249
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   360
        FA          UNUSED_250
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   361
        FB          UNUSED_251
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   362
        FC          UNUSED_252
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   363
        FD          UNUSED_253
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   364
        FE          UNUSED_254
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   365
        FF          UNUSED_255
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   366
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   367
    [author:]
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
   368
        Claus Gittinger
1030
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   369
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   370
"
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   371
!
6ff51c965fd2 byteCodes commented
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   372
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   373
copyright
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   374
"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   375
 COPYRIGHT (c) 1989 by Claus Gittinger
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   376
	      All Rights Reserved
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   377
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   378
 This software is furnished under a license and may be used
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   379
 only in accordance with the terms of that license and with the
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   380
 inclusion of the above copyright notice.   This software may not
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   381
 be provided or otherwise made available to, or used by, any
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   382
 other person.  No title to or ownership of the software is
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   383
 hereby transferred.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   384
"
135
aa4f7b8f121e uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   385
!
20
f8dd8ba75205 *** empty log message ***
claus
parents: 19
diff changeset
   386
3
b63b8a6b71fb *** empty log message ***
claus
parents: 1
diff changeset
   387
documentation
b63b8a6b71fb *** empty log message ***
claus
parents: 1
diff changeset
   388
"
19
84a1ddf215a5 *** empty log message ***
claus
parents: 15
diff changeset
   389
    This class performs compilation into ByteCodes.
84a1ddf215a5 *** empty log message ***
claus
parents: 15
diff changeset
   390
    First, parsing is done using superclass methods,
84a1ddf215a5 *** empty log message ***
claus
parents: 15
diff changeset
   391
    then the parse-tree is converted into an array of symbolic codes
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   392
    and a relocation table;
19
84a1ddf215a5 *** empty log message ***
claus
parents: 15
diff changeset
   393
    these two are finally combined into a byteArray of the codes.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   394
19
84a1ddf215a5 *** empty log message ***
claus
parents: 15
diff changeset
   395
    (the intermediate step through symbolic codes is for debugging
556
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
   396
     only - it may vanish in future releases)
19
84a1ddf215a5 *** empty log message ***
claus
parents: 15
diff changeset
   397
84a1ddf215a5 *** empty log message ***
claus
parents: 15
diff changeset
   398
    There are many dependencies to the run-time-system (especially the
84a1ddf215a5 *** empty log message ***
claus
parents: 15
diff changeset
   399
    interpreter) in here - be careful when playing around ...
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   400
259
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   401
    [Instance variables:]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   402
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   403
	codeBytes       <ByteArry>              bytecodes
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   404
	codeIndex       <SmallInteger>          next index to put into code array
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   405
	litArray        <OrderedCollection>     literals
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   406
	stackDelta      <SmallInteger>          return value of byteCodeFor:
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   407
	extra           <Symbol>                return value of byteCodeFor:
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   408
	lineno          <Boolean>               return value of byteCodeFor:
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   409
	extraLiteral    <Symbol>                return value of byteCodeFor:
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   410
	maxStackDepth   <SmallInteger>          stack need of method
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   411
	relocList       <Array>                 used temporary for relocation
19
84a1ddf215a5 *** empty log message ***
claus
parents: 15
diff changeset
   412
259
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   413
    [Class variables:]
19
84a1ddf215a5 *** empty log message ***
claus
parents: 15
diff changeset
   414
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   415
	JumpToAbsJump   <Dictionary>            internal table to map opcodes
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   416
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   417
	STCCompilationDefines                   passed to stc as command line arguments
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   418
	STCCompilationIncludes
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   419
	STCCompilationOptions
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   420
			<String>
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   421
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   422
	STCCompilation  <Symbol>                #always, #primitiveOnly or #never
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   423
						controls when stc compilation is wanted
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   424
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   425
	ShareCode       <Boolean>               reuse byteArrays for common (simple) code sequences
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   426
						This is normally a 'good' optimization,
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   427
						except if you plan to modify the byteCodes.
263
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   428
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   429
    [author:]
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   430
	Claus Gittinger
263
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   431
3
b63b8a6b71fb *** empty log message ***
claus
parents: 1
diff changeset
   432
"
3681
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   433
!
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   434
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   435
examples
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   436
"
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   437
    a GNU-Smalltalk method:                                                                    
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   438
                                                                        [exBegin]
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   439
    Compiler 
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   440
        compile:'bla
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   441
    <category: ''tests''>
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   442
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   443
    ^ 123
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   444
'
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   445
        forClass: Object
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   446
                                                                        [exEnd]
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
   447
"
98
claus
parents: 97
diff changeset
   448
! !
claus
parents: 97
diff changeset
   449
372
98da4d230a8d prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   450
!ByteCodeCompiler class methodsFor:'initialization'!
209
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   451
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   452
initialize
1050
c6306361ec19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1049
diff changeset
   453
    Smalltalk vmMajorVersionNr >= 5 ifTrue:[
3393
8fbe6ede03c6 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3284
diff changeset
   454
        NewCodeSet := true.
8fbe6ede03c6 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3284
diff changeset
   455
        NewPrimitives := true.
1050
c6306361ec19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1049
diff changeset
   456
    ] ifFalse:[
3393
8fbe6ede03c6 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3284
diff changeset
   457
        NewCodeSet := false.
8fbe6ede03c6 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3284
diff changeset
   458
        NewPrimitives := false.
1050
c6306361ec19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1049
diff changeset
   459
    ].
209
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   460
    ShareCode := true.
603
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   461
    ListCompiledMethods := false.
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   462
1219
e5c891489441 support compilation restart (after a fix)
Claus Gittinger <cg@exept.de>
parents: 1216
diff changeset
   463
    "Modified: / 15.11.2001 / 17:20:51 / cg"
1046
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   464
!
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   465
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   466
newCodeSet
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   467
    ^ NewCodeSet
1046
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   468
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   469
!
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   470
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   471
newCodeSet:aBoolean
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   472
    NewCodeSet := aBoolean.
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   473
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   474
    "
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   475
     ByteCodeCompiler newCodeSet:true
8e5818442eb9 newCode (for rel5)
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   476
    "
1049
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   477
!
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   478
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   479
newPrimitives
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   480
    ^ NewPrimitives
1049
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   481
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   482
!
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   483
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   484
newPrimitives:aBoolean
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   485
    NewPrimitives := aBoolean.
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   486
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   487
    "
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   488
     ByteCodeCompiler newPrimitives:true
0b69b110f150 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
   489
    "
209
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   490
! !
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
   491
3428
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   492
!ByteCodeCompiler class methodsFor:'instance creation'!
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   493
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   494
new
3436
874d31b00f8a Comment in ByteCodeCompiler>>#new
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3428
diff changeset
   495
874d31b00f8a Comment in ByteCodeCompiler>>#new
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3428
diff changeset
   496
    "/ Pretty ugly hack. A caller to compiler may provide a set of breakpoints
874d31b00f8a Comment in ByteCodeCompiler>>#new
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3428
diff changeset
   497
    "/ that has to be injected to the code. However, since breakpoint injection
874d31b00f8a Comment in ByteCodeCompiler>>#new
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3428
diff changeset
   498
    "/ is actually done by a subclass or me, so we have to return this subclass here.
874d31b00f8a Comment in ByteCodeCompiler>>#new
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3428
diff changeset
   499
    "/ This subclass-to-tranform API is bit unfortunate.
3428
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   500
    ^ self ~~ ByteCodeCompiler ifTrue:[ 
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   501
        super new.
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   502
    ] ifFalse:[ 
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   503
        | breakpoints |
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   504
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   505
        breakpoints := BreakpointQuery query.
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   506
        breakpoints notEmptyOrNil ifTrue:[ 
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   507
            ByteCodeCompilerWithBreakpointSupport new
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   508
                breakpoints: breakpoints;
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   509
                yourself.
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   510
        ] ifFalse:[ 
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   511
            super new.
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   512
        ].
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   513
    ].
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   514
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   515
    "Created: / 08-05-2014 / 11:01:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   516
! !
eaf3ac065bf9 Added breakpoint support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3416
diff changeset
   517
372
98da4d230a8d prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   518
!ByteCodeCompiler class methodsFor:'compiling methods'!
98
claus
parents: 97
diff changeset
   519
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   520
compile:methodText forClass:classToCompileFor
890
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   521
    "compile a source-string for a method in classToCompileFor.
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   522
     Returns the new method, #Error or nil."
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   523
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   524
    ^ self
3281
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   525
        compile:methodText
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   526
        forClass:classToCompileFor
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   527
        inCategory:(self asYetUncategorizedMethodCategory)
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   528
        notifying:nil
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   529
        install:true
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   530
        skipIfSame:false
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   531
        silent:false
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   532
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   533
7ad01559b262 Initial revision
claus
parents:
diff changeset
   534
compile:aString forClass:aClass inCategory:cat
7ad01559b262 Initial revision
claus
parents:
diff changeset
   535
    "compile a source-string for a method in classToCompileFor.
890
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   536
     The method will get cat as category.
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   537
     Returns the new method, #Error or nil."
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   538
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   539
    ^ self
2735
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   540
        compile:aString
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   541
        forClass:aClass
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   542
        inCategory:cat
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   543
        notifying:nil
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   544
        install:true
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   545
        skipIfSame:false
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   546
        silent:false
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   547
        foldConstants:true
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   548
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   549
    "Modified: / 30-09-2011 / 12:44:23 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   550
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   551
84
claus
parents: 78
diff changeset
   552
compile:aString forClass:aClass inCategory:cat notifying:requestor
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   553
    "compile a source-string for a method in classToCompileFor.
84
claus
parents: 78
diff changeset
   554
     errors are forwarded to requestor.
890
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   555
     The method will get cat as category.
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   556
     Returns the new method, #Error or nil."
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   557
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   558
    ^ self
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   559
	compile:aString
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   560
	forClass:aClass
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   561
	inCategory:cat
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   562
	notifying:requestor
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   563
	install:true
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   564
	skipIfSame:false
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   565
	silent:false
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   566
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   567
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   568
compile:aString forClass:aClass inCategory:cat notifying:requestor install:install
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   569
    "compile a source-string for a method in classToCompileFor.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   570
     The install-argument controls if the method is to be installed into the
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   571
     classes method-dictionary, or just to be compiled and a method object to be returned.
890
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   572
     Errors are forwarded to requestor. The method will get cat as category.
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   573
     Returns the new method, #Error or nil."
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   574
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   575
    ^ self
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   576
        compile:aString
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   577
        forClass:aClass
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   578
        inCategory:cat
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   579
        notifying:requestor
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   580
        install:install
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   581
        skipIfSame:false
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   582
        silent:false
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   583
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   584
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   585
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   586
compile:aString forClass:aClass inCategory:cat notifying:requestor
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   587
		 install:install skipIfSame:skipIfSame
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   588
    "compile a source-string for a method in classToCompileFor.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   589
     The install-argument controls if the method is to be installed into the
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   590
     classes method-dictionary, or just to be compiled and a method object to be returned.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   591
     Errors are forwarded to requestor. The method will get cat as category.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   592
     If skipIsSame is true, and the source is the same as an existing
890
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   593
     methods source, this is a noop (for fast fileIn).
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   594
     Returns the new method, #Error or nil."
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   595
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   596
    ^ self
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   597
	compile:aString
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   598
	forClass:aClass
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   599
	inCategory:cat
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   600
	notifying:requestor
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   601
	install:install
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   602
	skipIfSame:skipIfSame
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   603
	silent:false
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   604
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   605
84
claus
parents: 78
diff changeset
   606
compile:aString forClass:aClass inCategory:cat notifying:requestor
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   607
                 install:install skipIfSame:skipIfSame silent:silent
890
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   608
    "compile a source-string for a method in aClass.
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   609
     errors are forwarded to requestor.
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   610
     The method will get cat as category.
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   611
     if install is true, the method is installed in the class.
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   612
     if skipIfSame, the method is not installed if there is no change
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   613
     (used when filing in).
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   614
     if silent is true, no warnings are output.
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   615
     Returns the new method, #Error or nil."
230
54e13c76f143 allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents: 217
diff changeset
   616
54e13c76f143 allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents: 217
diff changeset
   617
    ^ self
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   618
        compile:aString
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   619
        forClass:aClass
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   620
        inCategory:cat
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   621
        notifying:requestor
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   622
        install:install
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   623
        skipIfSame:skipIfSame
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   624
        silent:silent
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   625
        foldConstants:true
230
54e13c76f143 allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents: 217
diff changeset
   626
!
54e13c76f143 allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents: 217
diff changeset
   627
1221
2768cbe3be2b finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 1219
diff changeset
   628
compile:aStringArg forClass:aClassArg inCategory:cat notifying:requestor
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   629
                 install:install skipIfSame:skipIfSame silent:silent foldConstants:fold
20
f8dd8ba75205 *** empty log message ***
claus
parents: 19
diff changeset
   630
f8dd8ba75205 *** empty log message ***
claus
parents: 19
diff changeset
   631
    "the basic workhorse method for compiling:
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   632
     compile a source-string for a method in classToCompileFor.
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   633
     errors are forwarded to requestor
890
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   634
     (report on Transcript and return #Error, if requestor is nil).
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   635
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   636
     The new method will get cat as category.
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   637
     If install is true, the method will go into the classes method-table,
20
f8dd8ba75205 *** empty log message ***
claus
parents: 19
diff changeset
   638
     otherwise the method is simply returned (for anonymous methods).
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   639
     If skipIsSame is true, and the source is the same as an existing
20
f8dd8ba75205 *** empty log message ***
claus
parents: 19
diff changeset
   640
     methods source, this is a noop (for fast fileIn).
890
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   641
     The argument, silent controls if errors are to be reported.
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   642
     Returns the method, #Error or nil."
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   643
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
   644
    ^ self new
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   645
        compile:aStringArg 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   646
        forClass:aClassArg 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   647
        inCategory:cat 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   648
        notifying:requestor
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   649
        install:install 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   650
        skipIfSame:skipIfSame 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   651
        silent:silent 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   652
        foldConstants:fold
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   653
!
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   654
1466
c05b6aa03a47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
   655
compile:methodText forClass:classToCompileFor install:doInstall
c05b6aa03a47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
   656
    "compile a source-string for a method in classToCompileFor.
c05b6aa03a47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
   657
     The install-argument controls if the method is to be installed into the
c05b6aa03a47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
   658
     classes method-dictionary, or just to be compiled and a method object to be returned.
c05b6aa03a47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
   659
     Returns the new method, #Error or nil."
c05b6aa03a47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
   660
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   661
    ^ self
3281
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   662
        compile:methodText
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   663
        forClass:classToCompileFor
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   664
        inCategory:(self defaultMethodCategory)
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   665
        notifying:nil
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   666
        install:doInstall
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   667
        skipIfSame:false
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   668
        silent:false
1466
c05b6aa03a47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
   669
!
c05b6aa03a47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
   670
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   671
compile:methodText forClass:classToCompileFor notifying:requestor
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   672
    "compile a source-string for a method in classToCompileFor.
890
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   673
     Errors are forwarded to requestor.
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   674
     Returns the new method, #Error or nil."
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   675
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   676
    ^ self
3281
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   677
        compile:methodText
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   678
        forClass:classToCompileFor
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   679
        inCategory:(self defaultMethodCategory)
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   680
        notifying:requestor
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   681
        install:true
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   682
        skipIfSame:false
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   683
        silent:false
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   684
!
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   685
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   686
compile:textOrStream in:aClass notifying:requestor ifFail:exceptionBlock
890
bc5c9b3bf477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   687
    "name alias for ST-80 compatibility.
1201
d38dbc8f2961 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   688
     Returns the new method, or the value from exceptionBlock."
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   689
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   690
    ^ self new 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   691
        compile:textOrStream 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   692
        in:aClass 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   693
        notifying:requestor 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
   694
        ifFail:exceptionBlock
1549
dd2913f2fbb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   695
!
dd2913f2fbb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   696
2428
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   697
compile:textOrStream in:aClass notifying:requestor install:install ifFail:exceptionBlock
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   698
    "name alias for ST-80 compatibility.
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   699
     Returns the new method, or the value from exceptionBlock."
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   700
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   701
    ^ self new 
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   702
        compile:textOrStream 
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   703
        in:aClass 
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   704
        notifying:requestor
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   705
        install:install
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   706
        ifFail:exceptionBlock
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   707
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   708
    "Created: / 15-10-2010 / 10:39:27 / cg"
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   709
!
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   710
1549
dd2913f2fbb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   711
stcCompileMethod:aMethod
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   712
    ParserFlags
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   713
	withSTCCompilation:#always
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   714
	do:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   715
	    self
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   716
		compile:(aMethod source)
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   717
		forClass:(aMethod mclass)
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   718
		inCategory:(aMethod category)
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   719
	].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   720
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
   721
372
98da4d230a8d prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   722
!ByteCodeCompiler class methodsFor:'constants'!
15
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   723
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   724
byteCodeFor:aSymbol
246
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   725
    "returns the numeric code for some symbolic bytecodes."
15
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   726
25
865d6cfaf90d changed bytecodes
claus
parents: 20
diff changeset
   727
    (aSymbol == #retNil) ifTrue:[^ 1].
865d6cfaf90d changed bytecodes
claus
parents: 20
diff changeset
   728
    (aSymbol == #retTrue) ifTrue:[^ 2].
865d6cfaf90d changed bytecodes
claus
parents: 20
diff changeset
   729
    (aSymbol == #retFalse) ifTrue:[^ 3].
865d6cfaf90d changed bytecodes
claus
parents: 20
diff changeset
   730
    (aSymbol == #ret0) ifTrue:[^ 4].
1402
2cf2b7e79168 Fix typos
Stefan Vogel <sv@exept.de>
parents: 1378
diff changeset
   731
    (aSymbol == #retSelf) ifTrue:[^5].
1300
be5542fc877e more bytecodes in #byteCodeFor class method
Stefan Vogel <sv@exept.de>
parents: 1280
diff changeset
   732
    (aSymbol == #retNum) ifTrue:[^ 127].
25
865d6cfaf90d changed bytecodes
claus
parents: 20
diff changeset
   733
    (aSymbol == #retTop) ifTrue:[^ 0].
865d6cfaf90d changed bytecodes
claus
parents: 20
diff changeset
   734
1300
be5542fc877e more bytecodes in #byteCodeFor class method
Stefan Vogel <sv@exept.de>
parents: 1280
diff changeset
   735
    (aSymbol == #mk0Block) ifTrue:[^ 156].
be5542fc877e more bytecodes in #byteCodeFor class method
Stefan Vogel <sv@exept.de>
parents: 1280
diff changeset
   736
    (aSymbol == #mkNilBlock) ifTrue:[^ 157].
be5542fc877e more bytecodes in #byteCodeFor class method
Stefan Vogel <sv@exept.de>
parents: 1280
diff changeset
   737
15
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   738
    (aSymbol == #push0) ifTrue:[^120].
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   739
    (aSymbol == #push1) ifTrue:[^121].
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   740
    (aSymbol == #push2) ifTrue:[^139].
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   741
    (aSymbol == #pushMinus1) ifTrue:[^122].
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   742
    (aSymbol == #pushNil) ifTrue:[^ 10].
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   743
    (aSymbol == #pushTrue) ifTrue:[^ 11].
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   744
    (aSymbol == #pushFalse) ifTrue:[^ 12].
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   745
    (aSymbol == #pushSelf) ifTrue:[^ 15].
1402
2cf2b7e79168 Fix typos
Stefan Vogel <sv@exept.de>
parents: 1378
diff changeset
   746
    self error:'unknown instruction'.
15
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   747
! !
992c3d87edbf *** empty log message ***
claus
parents: 13
diff changeset
   748
1324
fb29e5557fd6 default method category
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   749
!ByteCodeCompiler class methodsFor:'defaults'!
fb29e5557fd6 default method category
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   750
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   751
allowExtensionsToPrivateClasses
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   752
    ^ ParserFlags allowExtensionsToPrivateClasses
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   753
!
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   754
3281
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   755
asYetUncategorizedMethodCategory
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   756
    ^ '* As yet uncategorized *'
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   757
!
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
   758
1324
fb29e5557fd6 default method category
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   759
defaultMethodCategory
fb29e5557fd6 default method category
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   760
    "/ ^ '** As yet uncategorized **'.
fb29e5557fd6 default method category
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   761
    ^ '* uncategorized *'
fb29e5557fd6 default method category
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   762
! !
fb29e5557fd6 default method category
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   763
1414
613ec963af7c method category rename
Claus Gittinger <cg@exept.de>
parents: 1402
diff changeset
   764
!ByteCodeCompiler class methodsFor:'private-utilities'!
1280
73fa8c2f6b1c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   765
73fa8c2f6b1c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   766
stringWithSimpleCRs:aString
73fa8c2f6b1c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   767
    |src dst ch|
73fa8c2f6b1c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   768
1496
7f31982d2933 replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   769
    dst := String writeStream.
1280
73fa8c2f6b1c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   770
    src := aString readStream.
73fa8c2f6b1c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   771
    [src atEnd] whileFalse:[
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   772
	ch := src next.
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   773
	ch = Character return ifTrue:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   774
	    src peek == Character linefeed ifTrue:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   775
		src next.
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   776
	    ].
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   777
	    ch := Character cr.
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   778
	].
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   779
	dst nextPut:ch
1280
73fa8c2f6b1c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   780
    ].
73fa8c2f6b1c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   781
    ^ dst contents
73fa8c2f6b1c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   782
! !
73fa8c2f6b1c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   783
372
98da4d230a8d prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   784
!ByteCodeCompiler class methodsFor:'stc compilation defaults'!
54
86c5b39c2eca *** empty log message ***
claus
parents: 49
diff changeset
   785
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   786
canCreateMachineCode
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   787
    "return true, if compilation to machine code is supported.
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   788
     Currently, all SYSV4, Linux and WinNT/XP systems do so;
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   789
     REAL/IX and HPUX9.x do not
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   790
	(due to the need for dynamic loading of object files, which is not supported by those).
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   791
     MIPS ULTRIX is almost finished, but not yet released.
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   792
     (late note - we no longer care for REAL/IX, HPUX9.x and MIPS ULTRIX)"
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   793
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   794
    ^ ObjectFileLoader notNil and:[ ObjectFileLoader canLoadObjectFiles ].
124
claus
parents: 120
diff changeset
   795
claus
parents: 120
diff changeset
   796
    "
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   797
     Compiler canCreateMachineCode
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   798
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   799
769
cabe7bdb46ec changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
   800
    "Modified: / 13.9.1995 / 15:15:11 / claus"
cabe7bdb46ec changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
   801
    "Modified: / 3.9.1998 / 15:56:07 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   802
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   803
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   804
ccCompilationOptions
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   805
    "return the options used with cc compilation"
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   806
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   807
    ^ ParserFlags ccCompilationOptions
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   808
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   809
    "
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   810
     Compiler ccCompilationOptions
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   811
    "
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   812
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   813
    "Modified: 5.11.1996 / 17:38:56 / cg"
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   814
!
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   815
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   816
ccCompilationOptions:aString
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   817
    "define the compilation options
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   818
     to be used when compiling to machine code.
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   819
     These are passed to cc. Can be set from your private.rc file."
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   820
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   821
    ParserFlags ccCompilationOptions:aString
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   822
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   823
    "
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   824
     Compiler ccCompilationOptions:'-O'
742
73b6a9c187f3 ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
   825
     Compiler ccCompilationOptions:'-O -fPIC'
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   826
     Compiler ccCompilationOptions
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   827
    "
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   828
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   829
    "Created: 5.11.1996 / 17:37:05 / cg"
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   830
    "Modified: 5.11.1996 / 17:38:32 / cg"
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   831
!
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   832
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   833
ccPath
768
07fcee0355e3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
   834
    "return the path to (name of) the cc command for incremental method compilation"
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   835
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   836
    ^ ParserFlags ccPath
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   837
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   838
    "
772
bd6fcf9e44e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 769
diff changeset
   839
     CC := nil
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   840
     Compiler ccPath
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   841
     Compiler ccPath:'gcc'
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   842
    "
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   843
769
cabe7bdb46ec changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
   844
    "Modified: / 13.9.1995 / 15:15:04 / claus"
cabe7bdb46ec changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
   845
    "Created: / 5.11.1996 / 17:35:40 / cg"
772
bd6fcf9e44e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 769
diff changeset
   846
    "Modified: / 4.9.1998 / 15:48:40 / cg"
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   847
!
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   848
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   849
ccPath:aPathOrCommandName
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   850
    "set the path to the cc command for incremental method compilation"
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   851
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   852
    ParserFlags ccPath:aPathOrCommandName
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   853
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   854
    "
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   855
     Compiler ccPath
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   856
     Compiler ccPath:'gcc'
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   857
     Compiler ccPath:'bcc32'
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   858
    "
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   859
773
1e2375488d3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 772
diff changeset
   860
    "Modified: / 13.9.1995 / 15:15:04 / claus"
1e2375488d3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 772
diff changeset
   861
    "Created: / 5.11.1996 / 17:38:11 / cg"
1e2375488d3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 772
diff changeset
   862
    "Modified: / 23.8.1998 / 13:58:57 / cg"
411
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   863
!
d4ca24ab1f4c more control over cc command;
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   864
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   865
stcCompilation
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   866
    "return the flag which controls compilation to machine code.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   867
     If #always, methods are always compiled to machine code (which takes
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   868
     longer, but provides faster code). If #none, methods are never compiled
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   869
     to machine code, instead for non-primitive ones, compilation is to bytecode
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   870
     and for primitive ones, a trapping stub is generated.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   871
     Anything else lets the compiler compile to bytecode,
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   872
     except for methods containing primitive code.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   873
     This can be set from your private.rc file or from a workspace
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   874
     for selective compilation to machine code."
124
claus
parents: 120
diff changeset
   875
1661
6b500fab2c0b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   876
    ^ ParserFlags stcCompilation
54
86c5b39c2eca *** empty log message ***
claus
parents: 49
diff changeset
   877
86c5b39c2eca *** empty log message ***
claus
parents: 49
diff changeset
   878
    "
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   879
     Compiler stcCompilation
124
claus
parents: 120
diff changeset
   880
    "
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   881
!
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   882
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   883
stcCompilation:how
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   884
    "set the flag which controls compilation to machine code.
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   885
     If #always, methods are always compiled to machine code (which takes
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   886
     longer, but provides faster code). If #none, methods are never compiled
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   887
     to machine code, instead for non-primitive ones, compilation is to bytecode
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   888
     and for primitive ones, a trapping stub is generated.
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   889
     Anything else lets the compiler compile to bytecode,
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   890
     except for methods containing primitive code.
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   891
     This can be set from your private.rc file or from a workspace
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   892
     for selective compilation to machine code."
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   893
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   894
    |ret|
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   895
1661
6b500fab2c0b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   896
    ret := ParserFlags stcCompilation.
6b500fab2c0b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   897
    ParserFlags stcCompilation:how.
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   898
    ^ ret
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   899
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   900
    "
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   901
     Compiler stcCompilation:#always
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   902
     Compiler stcCompilation:#never
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   903
     Compiler stcCompilation:#default
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   904
    "
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   905
!
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   906
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   907
stcCompilationDefines
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   908
    "return the defines used with stc compilation"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   909
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   910
    ^ ParserFlags stcCompilationDefines
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   911
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   912
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   913
stcCompilationDefines:aString
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   914
    "define the flags (for example, additional -D defines)
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   915
     to be used when compiling to machine code.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   916
     These are passed to stc. Can be set from your private.rc file."
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   917
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   918
    ParserFlags stcCompilationDefines:aString
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   919
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   920
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   921
     Compiler stcCompilationDefines:'-DVGL -DDEBUG'
773
1e2375488d3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 772
diff changeset
   922
     Compiler stcCompilationDefines:'-DWIN32'
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   923
    "
773
1e2375488d3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 772
diff changeset
   924
1e2375488d3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 772
diff changeset
   925
    "Modified: / 23.8.1998 / 14:00:40 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   926
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   927
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   928
stcCompilationIncludes
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   929
    "return the includes used with stc compilation"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   930
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   931
    ^ ParserFlags stcCompilationIncludes
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   932
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   933
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   934
stcCompilationIncludes:aString
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   935
    "define the include directories via additional -I flags.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   936
     These are passed to stc. Can be set in your private.rc file"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   937
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   938
    ParserFlags stcCompilationIncludes:aString
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   939
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   940
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   941
     Compiler stcCompilationIncludes:'-I/usr/local/include -I../../include'
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   942
     Compiler stcCompilationIncludes:(Compiler stcCompilationIncludes , ' -I../../libxt')
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   943
    "
586
e9ef451f36d0 automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   944
e9ef451f36d0 automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   945
    "Modified: 18.7.1997 / 18:04:25 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   946
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   947
124
claus
parents: 120
diff changeset
   948
stcCompilationOptions
claus
parents: 120
diff changeset
   949
    "return the options used with stc compilation"
claus
parents: 120
diff changeset
   950
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   951
    ^ ParserFlags stcCompilationOptions
124
claus
parents: 120
diff changeset
   952
!
claus
parents: 120
diff changeset
   953
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   954
stcCompilationOptions:aString
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   955
    "define the compilation options
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   956
     to be used when compiling to machine code.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   957
     These are passed to stc. Can be set from your private.rc file."
101
claus
parents: 98
diff changeset
   958
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   959
    ParserFlags stcCompilationOptions:aString
101
claus
parents: 98
diff changeset
   960
claus
parents: 98
diff changeset
   961
    "
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   962
     Compiler stcCompilationOptions:'+optinline'
101
claus
parents: 98
diff changeset
   963
    "
claus
parents: 98
diff changeset
   964
!
claus
parents: 98
diff changeset
   965
301
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   966
stcModulePath
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   967
    "return the path, where temporary modules are created"
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   968
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   969
    ^ ParserFlags stcModulePath
301
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   970
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   971
    "Created: 12.7.1996 / 12:15:26 / cg"
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   972
!
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   973
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   974
stcModulePath:aPath
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   975
    "set the path to the directory, where temporary modules are created"
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   976
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   977
    ParserFlags stcModulePath:aPath
301
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   978
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   979
    "Created: 12.7.1996 / 12:15:49 / cg"
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   980
!
5c0add6f00e2 create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents: 298
diff changeset
   981
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   982
stcPath
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   983
    "return the path to the stc command, or nil if not found."
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   984
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   985
    ^ ParserFlags stcPath
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   986
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   987
    "
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   988
     Compiler stcPath
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   989
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   990
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   991
    "Modified: 13.9.1995 / 14:37:26 / claus"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   992
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
   993
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
   994
stcPath:aPath
695
90e875507838 allow change of the stc path
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   995
    "set the path to the stc command - useful if private stc is wanted"
90e875507838 allow change of the stc path
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   996
1666
750da2bec865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1661
diff changeset
   997
    ParserFlags stcPath:aPath
695
90e875507838 allow change of the stc path
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   998
90e875507838 allow change of the stc path
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   999
    "
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1000
     Compiler stcPath:'../../stc/stc'
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1001
     Compiler stcPath:'..\stc\stc'
695
90e875507838 allow change of the stc path
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
  1002
    "
90e875507838 allow change of the stc path
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
  1003
773
1e2375488d3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 772
diff changeset
  1004
    "Modified: / 13.9.1995 / 14:37:26 / claus"
1e2375488d3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 772
diff changeset
  1005
    "Modified: / 23.8.1998 / 13:59:24 / cg"
695
90e875507838 allow change of the stc path
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
  1006
!
90e875507838 allow change of the stc path
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
  1007
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1008
stcPathOf:command
120
claus
parents: 118
diff changeset
  1009
    "return the path to an stc command, or nil if not found."
101
claus
parents: 98
diff changeset
  1010
623
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1011
    |f d reqdSuffix cmd|
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1012
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1013
    "/
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1014
    "/ care for executable suffix
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1015
    "/
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1016
    cmd := command.
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1017
    OperatingSystem isMSDOSlike ifTrue:[
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1018
	reqdSuffix := 'exe'
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1019
    ] ifFalse:[
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1020
	OperatingSystem isVMSlike ifTrue:[
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1021
	    reqdSuffix := 'EXE'
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1022
	].
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1023
    ].
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1024
    reqdSuffix notNil ifTrue:[
658
fff35b3c95e2 stcPathOf: fixed
Claus Gittinger <cg@exept.de>
parents: 649
diff changeset
  1025
	(f := cmd asFilename) suffix isEmpty ifTrue:[
fff35b3c95e2 stcPathOf: fixed
Claus Gittinger <cg@exept.de>
parents: 649
diff changeset
  1026
	    cmd := (f withSuffix:reqdSuffix) name
623
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1027
	]
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1028
    ].
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1029
    "/
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1030
    "/ for our convenience, also check in current
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1031
    "/ and parent directories; even if PATH does not
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1032
    "/ include them ...
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1033
    "/
658
fff35b3c95e2 stcPathOf: fixed
Claus Gittinger <cg@exept.de>
parents: 649
diff changeset
  1034
    "/ look in current ...
623
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1035
    d := Filename currentDirectory.
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1036
    (f := d construct:cmd) isExecutable ifTrue:[
101
claus
parents: 98
diff changeset
  1037
	^ f pathName
claus
parents: 98
diff changeset
  1038
    ].
658
fff35b3c95e2 stcPathOf: fixed
Claus Gittinger <cg@exept.de>
parents: 649
diff changeset
  1039
    "/ look in ../stc ...
623
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1040
    d := d construct:'..'.
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1041
    (f := (d construct:'stc') construct:cmd) isExecutable ifTrue:[
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1042
	^ f pathName
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1043
    ].
658
fff35b3c95e2 stcPathOf: fixed
Claus Gittinger <cg@exept.de>
parents: 649
diff changeset
  1044
    "/ look in ../../stc ...
623
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1045
    d := d construct:'..'.
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1046
    (f := (d construct:'stc') construct:cmd) isExecutable ifTrue:[
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1047
	^ f pathName
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1048
    ].
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1049
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1050
    "/
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1051
    "/ ok, stc must be installed in some directory along the PATH
6dd4e417ddb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1052
    "/
126
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
  1053
    ^ OperatingSystem pathOfCommand:command
97
claus
parents: 96
diff changeset
  1054
claus
parents: 96
diff changeset
  1055
    "
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1056
     Compiler stcPathOf:'stc'
120
claus
parents: 118
diff changeset
  1057
    "
claus
parents: 118
diff changeset
  1058
claus
parents: 118
diff changeset
  1059
    "Created: 13.9.1995 / 14:37:16 / claus"
54
86c5b39c2eca *** empty log message ***
claus
parents: 49
diff changeset
  1060
! !
86c5b39c2eca *** empty log message ***
claus
parents: 49
diff changeset
  1061
1417
7e97dd2df5ca method category rename
Claus Gittinger <cg@exept.de>
parents: 1414
diff changeset
  1062
!ByteCodeCompiler methodsFor:'Compatibility-ST80'!
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
  1063
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
  1064
compile:textOrStream in:aClass notifying:requestor ifFail:exceptionBlock
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
  1065
    "name alias for ST-80 compatibility"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1066
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1067
    ^ self
3281
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  1068
           compile:textOrStream
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  1069
           forClass:aClass
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  1070
           inCategory:(self class defaultMethodCategory)
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  1071
           notifying:requestor
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  1072
           install:true
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  1073
           skipIfSame:false
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  1074
           silent:false
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  1075
           foldConstants:true
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  1076
           ifFail:exceptionBlock.
2428
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1077
!
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1078
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1079
compile:textOrStream in:aClass notifying:requestor install:install ifFail:exceptionBlock
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1080
    "name alias for ST-80 compatibility"
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1081
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1082
    ^ self
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1083
           compile:textOrStream
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1084
           forClass:aClass
3281
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  1085
           inCategory:(self class defaultMethodCategory)
2428
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1086
           notifying:requestor
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1087
           install:install
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1088
           skipIfSame:false
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1089
           silent:false
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1090
           foldConstants:true
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1091
           ifFail:exceptionBlock.
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1092
3e8b7caa22cb added: #compile:in:notifying:install:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1093
    "Created: / 15-10-2010 / 10:39:42 / cg"
2474
c2fb6e429e46 added: #from:class:context:notifying:
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1094
!
c2fb6e429e46 added: #from:class:context:notifying:
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1095
c2fb6e429e46 added: #from:class:context:notifying:
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1096
from:aStream class:aClass context:ctx notifying:aRequestor
c2fb6e429e46 added: #from:class:context:notifying:
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1097
    classToCompileFor := aClass.
c2fb6e429e46 added: #from:class:context:notifying:
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1098
    self source:aStream.
c2fb6e429e46 added: #from:class:context:notifying:
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1099
c2fb6e429e46 added: #from:class:context:notifying:
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1100
    self setClassToCompileFor:aClass.
c2fb6e429e46 added: #from:class:context:notifying:
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1101
    self notifying:aRequestor.
c2fb6e429e46 added: #from:class:context:notifying:
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1102
c2fb6e429e46 added: #from:class:context:notifying:
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1103
    "Created: / 30-01-2011 / 03:38:00 / cg"
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
  1104
! !
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1105
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
  1106
!ByteCodeCompiler methodsFor:'accessing'!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1107
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1108
code
3
b63b8a6b71fb *** empty log message ***
claus
parents: 1
diff changeset
  1109
    "return the bytecode array - only valid after code-generation"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1110
49
02660b790c3e *** empty log message ***
claus
parents: 46
diff changeset
  1111
    ^ codeBytes
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1112
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1113
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1114
literalArray
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1115
    "return the literal array - only valid after parsing"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1116
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1117
    ^ litArray
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1118
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1119
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1120
maxStackDepth
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1121
    "return the stack-need of the method - only valid after code-generation"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1122
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1123
    ^ maxStackDepth
1094
745ec90c42c9 allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
  1124
!
745ec90c42c9 allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
  1125
745ec90c42c9 allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
  1126
methodClass
745ec90c42c9 allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
  1127
    ^ methodClass ? Method
745ec90c42c9 allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
  1128
!
745ec90c42c9 allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
  1129
745ec90c42c9 allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
  1130
methodClass:aClass
745ec90c42c9 allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
  1131
    methodClass := aClass
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1132
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1133
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1134
!ByteCodeCompiler methodsFor:'code generation'!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1135
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1136
byteCodeFor:aSymbol
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1137
    "given a symbolic instruction, return the corresponding bytecode.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1138
     as a side-effect, leave number of bytes pushed/popped by this instr.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1139
     in stackDelta, and, if the instruction needs extra arguments, leave
246
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1140
     this info in extra. Also lineno is set to true, if this code has line
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1141
     information and extraLiteral is set if any hidden send is performed by it."
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1142
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1143
    "standard bytecodes"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1144
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1145
    (aSymbol == #pushNil) ifTrue:[stackDelta := 1. ^ 10].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1146
    (aSymbol == #pushTrue) ifTrue:[stackDelta := 1. ^ 11].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1147
    (aSymbol == #pushFalse) ifTrue:[stackDelta := 1. ^ 12].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1148
    (aSymbol == #pushLit) ifTrue:[stackDelta := 1. extra := #lit. ^ 14].
105
claus
parents: 104
diff changeset
  1149
    (aSymbol == #pushLitS) ifTrue:[stackDelta := 1. extra := #index. ^ 14].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1150
    (aSymbol == #pushSelf) ifTrue:[stackDelta := 1. ^ 15].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1151
    (aSymbol == #pushNum) ifTrue:[stackDelta := 1. extra := #number. ^ 16].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1152
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1153
    (aSymbol == #pushMethodArg) ifTrue:[stackDelta := 1. extra := #index. ^ 30].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1154
    (aSymbol == #pushMethodVar) ifTrue:[stackDelta := 1. extra := #index. ^ 31].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1155
    (aSymbol == #pushBlockArg) ifTrue:[stackDelta := 1. extra := #index. ^ 32].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1156
    (aSymbol == #pushBlockVar) ifTrue:[stackDelta := 1. extra := #index. ^ 33].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1157
    (aSymbol == #pushInstVar) ifTrue:[stackDelta := 1. extra := #index. ^ 34].
1
77da9f5728e5 *** empty log message ***
claus
parents: 0
diff changeset
  1158
    (aSymbol == #pushOuterBlockArg) ifTrue:[stackDelta := 1. extra := #indexLevel. ^ 42].
77da9f5728e5 *** empty log message ***
claus
parents: 0
diff changeset
  1159
    (aSymbol == #pushOuterBlockVar) ifTrue:[stackDelta := 1. extra := #indexLevel. ^ 128].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1160
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1161
    (aSymbol == #retTop) ifTrue:[stackDelta := -1. ^ 0].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1162
    (aSymbol == #retSelf) ifTrue:[^5].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1163
246
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1164
    (aSymbol == #==) ifTrue:[stackDelta := -1. extraLiteral := aSymbol. ^ 45].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1165
    (aSymbol == #~~) ifTrue:[stackDelta := -1. extraLiteral := aSymbol. ^ 46].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1166
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1167
    (aSymbol == #falseJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 50].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1168
    (aSymbol == #trueJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 51].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1169
    (aSymbol == #nilJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 52].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1170
    (aSymbol == #notNilJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 53].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1171
    (aSymbol == #jump) ifTrue:[extra := #offset. ^ 54].
1
77da9f5728e5 *** empty log message ***
claus
parents: 0
diff changeset
  1172
    (aSymbol == #makeBlock) ifTrue:[stackDelta := 1. extra := #offsetNvarNarg. ^ 55].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1173
    (aSymbol == #zeroJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 56].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1174
    (aSymbol == #notZeroJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 57].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1175
    (aSymbol == #eqJump) ifTrue:[stackDelta := -2. extra := #offset. ^ 58].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1176
    (aSymbol == #notEqJump) ifTrue:[stackDelta := -2. extra := #offset. ^ 59].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1177
54
86c5b39c2eca *** empty log message ***
claus
parents: 49
diff changeset
  1178
    (aSymbol == #lineno) ifTrue:[lineno := true. ^ 8].
372
98da4d230a8d prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
  1179
    (aSymbol == #lineno16) ifTrue:[lineno := true. ^ 9].
54
86c5b39c2eca *** empty log message ***
claus
parents: 49
diff changeset
  1180
3645
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  1181
    (aSymbol == #sourcepos8)  ifTrue:[extra := #index.      ^ 244].
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  1182
    (aSymbol == #sourcepos16) ifTrue:[extra := #unsigned16. ^ 245].
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  1183
    (aSymbol == #sourcepos32) ifTrue:[extra := #unsigned32. ^ 246].
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  1184
106
claus
parents: 105
diff changeset
  1185
    (aSymbol == #send) ifTrue:[lineno := true. extra := #special. ^ 19].
claus
parents: 105
diff changeset
  1186
    (aSymbol == #superSend) ifTrue:[lineno := true. extra := #special. ^ 20].
117
claus
parents: 111
diff changeset
  1187
    (aSymbol == #sendSelf) ifTrue:[lineno := true. extra := #special. ^ 13].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1188
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1189
    (aSymbol == #drop) ifTrue:[stackDelta := -1. ^ 18].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1190
    (aSymbol == #dup) ifTrue:[stackDelta := 1. ^ 47].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1191
117
claus
parents: 111
diff changeset
  1192
    (aSymbol == #storeMethodVar) ifTrue:[extra := #index. stackDelta := -1. ^ 37].
claus
parents: 111
diff changeset
  1193
    (aSymbol == #storeBlockVar) ifTrue:[extra := #index. stackDelta := -1. ^ 38].
claus
parents: 111
diff changeset
  1194
    (aSymbol == #storeInstVar) ifTrue:[extra := #index. stackDelta := -1. ^ 39].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1195
117
claus
parents: 111
diff changeset
  1196
    (aSymbol == #pushClassVarS) ifTrue:[stackDelta := 1. extra := #speciallitS. ^ 35].
356
bb3beb18de1f 6empty slots in GLOBL/CLASSVAR bytecodes removed
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  1197
    (aSymbol == #pushGlobalS) ifTrue:[stackDelta := 1. extra := #speciallitS. ^ 36].
117
claus
parents: 111
diff changeset
  1198
claus
parents: 111
diff changeset
  1199
    (aSymbol == #storeClassVarS) ifTrue:[extra := #speciallitS.stackDelta := -1. ^ 40].
356
bb3beb18de1f 6empty slots in GLOBL/CLASSVAR bytecodes removed
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  1200
    (aSymbol == #storeGlobalS) ifTrue:[extra := #speciallitS. stackDelta := -1. ^ 41].
247
fbb6e3b5764c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
  1201
    (aSymbol == #pushSpecialGlobal) ifTrue:[stackDelta := 1. extra := #index. ^ 200].
117
claus
parents: 111
diff changeset
  1202
1
77da9f5728e5 *** empty log message ***
claus
parents: 0
diff changeset
  1203
    (aSymbol == #storeOuterBlockVar) ifTrue:[stackDelta := -1. extra := #indexLevel. ^ 129].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1204
117
claus
parents: 111
diff changeset
  1205
    (aSymbol == #pushClassInstVar) ifTrue:[stackDelta := 1. extra := #index. ^ 176].
claus
parents: 111
diff changeset
  1206
    (aSymbol == #storeClassInstVar) ifTrue:[extra := #index.stackDelta := -1. ^ 177].
105
claus
parents: 104
diff changeset
  1207
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1208
    "optimized bytecodes"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1209
1822
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1210
    (aSymbol == #pushMethodVar1) ifTrue:[stackDelta := 1. ^80].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1211
    (aSymbol == #pushMethodVar2) ifTrue:[stackDelta := 1. ^81].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1212
    (aSymbol == #pushMethodVar3) ifTrue:[stackDelta := 1. ^82].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1213
    (aSymbol == #pushMethodVar4) ifTrue:[stackDelta := 1. ^83].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1214
    (aSymbol == #pushMethodVar5) ifTrue:[stackDelta := 1. ^84].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1215
    (aSymbol == #pushMethodVar6) ifTrue:[stackDelta := 1. ^85].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1216
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1217
    (aSymbol == #pushMethodArg1) ifTrue:[stackDelta := 1. ^86].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1218
    (aSymbol == #pushMethodArg2) ifTrue:[stackDelta := 1. ^87].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1219
    (aSymbol == #pushMethodArg3) ifTrue:[stackDelta := 1. ^88].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1220
    (aSymbol == #pushMethodArg4) ifTrue:[stackDelta := 1. ^89].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1221
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1222
    (aSymbol == #retNil) ifTrue:[^ 1].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1223
    (aSymbol == #retTrue) ifTrue:[^ 2].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1224
    (aSymbol == #retFalse) ifTrue:[^ 3].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1225
    (aSymbol == #ret0) ifTrue:[^ 4].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1226
    (aSymbol == #retNum) ifTrue:[extra := #number. ^ 127].
25
865d6cfaf90d changed bytecodes
claus
parents: 20
diff changeset
  1227
    (aSymbol == #homeRetTop) ifTrue:[^ 7].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1228
46
a8c1e932ed6a 16bit literal offsets
claus
parents: 45
diff changeset
  1229
    (aSymbol == #pushNum16) ifTrue:[stackDelta := 1. extra := #number16. ^ 17].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1230
    (aSymbol == #push0) ifTrue:[stackDelta := 1. ^120].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1231
    (aSymbol == #push1) ifTrue:[stackDelta := 1. ^121].
3
b63b8a6b71fb *** empty log message ***
claus
parents: 1
diff changeset
  1232
    (aSymbol == #push2) ifTrue:[stackDelta := 1. ^139].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1233
    (aSymbol == #pushMinus1) ifTrue:[stackDelta := 1. ^122].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1234
106
claus
parents: 105
diff changeset
  1235
    (aSymbol == #send0) ifTrue:[lineno := true. extra := #index. ^21].
claus
parents: 105
diff changeset
  1236
    (aSymbol == #send1) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^22].
claus
parents: 105
diff changeset
  1237
    (aSymbol == #send2) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^23].
claus
parents: 105
diff changeset
  1238
    (aSymbol == #send3) ifTrue:[lineno := true. extra := #index. stackDelta := -3. ^24].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1239
106
claus
parents: 105
diff changeset
  1240
    (aSymbol == #sendSelf0) ifTrue:[lineno := true. extra := #index. stackDelta := 1. ^180].
claus
parents: 105
diff changeset
  1241
    (aSymbol == #sendSelf1) ifTrue:[lineno := true. extra := #index. ^181].
claus
parents: 105
diff changeset
  1242
    (aSymbol == #sendSelf2) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^182].
claus
parents: 105
diff changeset
  1243
    (aSymbol == #sendSelf3) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^183].
claus
parents: 105
diff changeset
  1244
    (aSymbol == #sendSelfDrop0) ifTrue:[lineno := true. extra := #index. ^184].
claus
parents: 105
diff changeset
  1245
    (aSymbol == #sendSelfDrop1) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^185].
claus
parents: 105
diff changeset
  1246
    (aSymbol == #sendSelfDrop2) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^186].
claus
parents: 105
diff changeset
  1247
    (aSymbol == #sendSelfDrop3) ifTrue:[lineno := true. extra := #index. stackDelta := -3. ^187].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1248
106
claus
parents: 105
diff changeset
  1249
    (aSymbol == #sendDrop) ifTrue:[lineno := true. extra := #special. ^25].
claus
parents: 105
diff changeset
  1250
    (aSymbol == #sendDrop0) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^26].
claus
parents: 105
diff changeset
  1251
    (aSymbol == #sendDrop1) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^27].
claus
parents: 105
diff changeset
  1252
    (aSymbol == #sendDrop2) ifTrue:[lineno := true. extra := #index. stackDelta := -3. ^28].
claus
parents: 105
diff changeset
  1253
    (aSymbol == #sendDrop3) ifTrue:[lineno := true. extra := #index. stackDelta := -4. ^29].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1254
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1255
    (aSymbol == #pushInstVar1) ifTrue:[stackDelta := 1. ^90].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1256
    (aSymbol == #pushInstVar2) ifTrue:[stackDelta := 1. ^91].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1257
    (aSymbol == #pushInstVar3) ifTrue:[stackDelta := 1. ^92].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1258
    (aSymbol == #pushInstVar4) ifTrue:[stackDelta := 1. ^93].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1259
    (aSymbol == #pushInstVar5) ifTrue:[stackDelta := 1. ^94].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1260
    (aSymbol == #pushInstVar6) ifTrue:[stackDelta := 1. ^95].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1261
    (aSymbol == #pushInstVar7) ifTrue:[stackDelta := 1. ^96].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1262
    (aSymbol == #pushInstVar8) ifTrue:[stackDelta := 1. ^97].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1263
    (aSymbol == #pushInstVar9) ifTrue:[stackDelta := 1. ^98].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1264
    (aSymbol == #pushInstVar10) ifTrue:[stackDelta := 1. ^99].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1265
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1266
    (aSymbol == #storeMethodVar1) ifTrue:[stackDelta := -1. ^100].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1267
    (aSymbol == #storeMethodVar2) ifTrue:[stackDelta := -1. ^101].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1268
    (aSymbol == #storeMethodVar3) ifTrue:[stackDelta := -1. ^102].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1269
    (aSymbol == #storeMethodVar4) ifTrue:[stackDelta := -1. ^103].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1270
    (aSymbol == #storeMethodVar5) ifTrue:[stackDelta := -1. ^104].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1271
    (aSymbol == #storeMethodVar6) ifTrue:[stackDelta := -1. ^105].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1272
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1273
    (aSymbol == #storeInstVar1) ifTrue:[stackDelta := -1. ^110].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1274
    (aSymbol == #storeInstVar2) ifTrue:[stackDelta := -1. ^111].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1275
    (aSymbol == #storeInstVar3) ifTrue:[stackDelta := -1. ^112].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1276
    (aSymbol == #storeInstVar4) ifTrue:[stackDelta := -1. ^113].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1277
    (aSymbol == #storeInstVar5) ifTrue:[stackDelta := -1. ^114].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1278
    (aSymbol == #storeInstVar6) ifTrue:[stackDelta := -1. ^115].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1279
    (aSymbol == #storeInstVar7) ifTrue:[stackDelta := -1. ^116].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1280
    (aSymbol == #storeInstVar8) ifTrue:[stackDelta := -1. ^117].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1281
    (aSymbol == #storeInstVar9) ifTrue:[stackDelta := -1. ^118].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1282
    (aSymbol == #storeInstVar10) ifTrue:[stackDelta := -1. ^119].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1283
103
claus
parents: 102
diff changeset
  1284
    (aSymbol == #pushLit1) ifTrue:[stackDelta := 1. ^ 222].
claus
parents: 102
diff changeset
  1285
    (aSymbol == #pushLit2) ifTrue:[stackDelta := 1. ^ 223].
claus
parents: 102
diff changeset
  1286
    (aSymbol == #pushLit3) ifTrue:[stackDelta := 1. ^ 224].
claus
parents: 102
diff changeset
  1287
    (aSymbol == #pushLit4) ifTrue:[stackDelta := 1. ^ 225].
claus
parents: 102
diff changeset
  1288
    (aSymbol == #pushLit5) ifTrue:[stackDelta := 1. ^ 226].
claus
parents: 102
diff changeset
  1289
    (aSymbol == #pushLit6) ifTrue:[stackDelta := 1. ^ 227].
claus
parents: 102
diff changeset
  1290
    (aSymbol == #pushLit7) ifTrue:[stackDelta := 1. ^ 228].
claus
parents: 102
diff changeset
  1291
    (aSymbol == #pushLit8) ifTrue:[stackDelta := 1. ^ 229].
claus
parents: 102
diff changeset
  1292
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1293
    (aSymbol == #retMethodVar1) ifTrue:[^160].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1294
    (aSymbol == #retMethodVar2) ifTrue:[^161].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1295
    (aSymbol == #retMethodVar3) ifTrue:[^162].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1296
    (aSymbol == #retMethodVar4) ifTrue:[^163].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1297
    (aSymbol == #retMethodVar5) ifTrue:[^164].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1298
    (aSymbol == #retMethodVar6) ifTrue:[^165].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1299
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1300
    (aSymbol == #retInstVar1) ifTrue:[^166].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1301
    (aSymbol == #retInstVar2) ifTrue:[^167].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1302
    (aSymbol == #retInstVar3) ifTrue:[^168].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1303
    (aSymbol == #retInstVar4) ifTrue:[^169].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1304
    (aSymbol == #retInstVar5) ifTrue:[^170].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1305
    (aSymbol == #retInstVar6) ifTrue:[^171].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1306
    (aSymbol == #retInstVar7) ifTrue:[^172].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1307
    (aSymbol == #retInstVar8) ifTrue:[^173].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1308
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1309
    (aSymbol == #retMethodArg1) ifTrue:[^174].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1310
    (aSymbol == #retMethodArg2) ifTrue:[^175].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1311
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1312
    (aSymbol == #pushBlockArg1) ifTrue:[stackDelta := 1. ^140].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1313
    (aSymbol == #pushBlockArg2) ifTrue:[stackDelta := 1. ^141].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1314
    (aSymbol == #pushBlockArg3) ifTrue:[stackDelta := 1. ^142].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1315
    (aSymbol == #pushBlockArg4) ifTrue:[stackDelta := 1. ^143].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1316
1
77da9f5728e5 *** empty log message ***
claus
parents: 0
diff changeset
  1317
    (aSymbol == #pushOuter1BlockArg) ifTrue:[stackDelta := 1. extra := #index. ^ 43].
77da9f5728e5 *** empty log message ***
claus
parents: 0
diff changeset
  1318
    (aSymbol == #pushOuter2BlockArg) ifTrue:[stackDelta := 1. extra := #index. ^ 44].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1319
246
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1320
    (aSymbol == #=) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^130].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1321
    (aSymbol == #+) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^131].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1322
    (aSymbol == #~=) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^132].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1323
    (aSymbol == #-) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^133].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1324
    (aSymbol == #*) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^230].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1325
    (aSymbol == #class) ifTrue:[extraLiteral := aSymbol. ^134].
400
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1326
"/    (aSymbol == #x) ifTrue:[lineno := true. extraLiteral := aSymbol. ^106].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1327
"/    (aSymbol == #y) ifTrue:[lineno := true. extraLiteral := aSymbol. ^107].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1328
"/    (aSymbol == #width) ifTrue:[lineno := true. extraLiteral := aSymbol. ^108].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1329
"/    (aSymbol == #height) ifTrue:[lineno := true. extraLiteral := aSymbol. ^109].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1330
"/    (aSymbol == #origin) ifTrue:[lineno := true. extraLiteral := aSymbol. ^154].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1331
"/    (aSymbol == #extent) ifTrue:[lineno := true. extraLiteral := aSymbol. ^155].
246
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1332
    (aSymbol == #at:) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^135].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1333
    (aSymbol == #at:put:)ifTrue:[lineno := true. stackDelta := -2. extraLiteral := aSymbol. ^136].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1334
    (aSymbol == #bitAnd:) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^137].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1335
    (aSymbol == #bitOr:) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^138].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1336
    (aSymbol == #plus1) ifTrue:[lineno := true. extraLiteral := #+. ^123].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1337
    (aSymbol == #minus1) ifTrue:[lineno := true. extraLiteral := #-. ^124].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1338
246
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1339
    (aSymbol == #incMethodVar) ifTrue:[lineno := true. extraLiteral := #+. extra := #index. ^125].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1340
    (aSymbol == #decMethodVar) ifTrue:[lineno := true. extraLiteral := #-. extra := #index. ^126].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1341
246
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1342
    (aSymbol == #eq0) ifTrue:[extraLiteral := #==. ^48].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1343
    (aSymbol == #ne0) ifTrue:[extraLiteral := #~~. ^49].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1344
246
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1345
    (aSymbol == #>) ifTrue:[lineno := true. extraLiteral := aSymbol. stackDelta := -1. ^ 145].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1346
    (aSymbol == #>=) ifTrue:[lineno := true. extraLiteral := aSymbol. stackDelta := -1. ^ 146].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1347
    (aSymbol == #<) ifTrue:[lineno := true. extraLiteral := aSymbol. stackDelta := -1. ^ 147].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1348
    (aSymbol == #<=) ifTrue:[lineno := true. extraLiteral := aSymbol. stackDelta := -1. ^ 148].
400
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1349
"/    (aSymbol == #next) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 149].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1350
"/    (aSymbol == #peek) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 150].
246
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1351
    (aSymbol == #value) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 151].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1352
    (aSymbol == #value:) ifTrue:[lineno := true. extraLiteral := aSymbol.  stackDelta := -1. ^ 152].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1353
    (aSymbol == #value:value:) ifTrue:[lineno := true. extraLiteral := aSymbol.  stackDelta := -2. ^ 178].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1354
    (aSymbol == #size) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 153].
400
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1355
"/    (aSymbol == #asInteger) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 158].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1356
"/    (aSymbol == #rounded) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 159].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1357
    (aSymbol == #mk0Block) ifTrue:[^ 156].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1358
    (aSymbol == #mkNilBlock) ifTrue:[^ 157].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1359
246
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1360
    (aSymbol == #gt0) ifTrue:[lineno := true. extraLiteral := #>. ^ 212].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1361
    (aSymbol == #pushgt0) ifTrue:[lineno := true. stackDelta := 1. extraLiteral := #>. ^ 208].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1362
    (aSymbol == #basicNew) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 211].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1363
    (aSymbol == #new) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 213].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1364
    (aSymbol == #basicNew:) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 214].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1365
    (aSymbol == #new:) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 215].
103
claus
parents: 102
diff changeset
  1366
217
eba0ee7232aa new opcodes
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1367
    (aSymbol == #pushBlockVar1) ifTrue:[stackDelta := 1. ^ 232].
eba0ee7232aa new opcodes
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1368
    (aSymbol == #pushBlockVar2) ifTrue:[stackDelta := 1. ^ 233].
eba0ee7232aa new opcodes
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1369
    (aSymbol == #pushBlockVar3) ifTrue:[stackDelta := 1. ^ 234].
eba0ee7232aa new opcodes
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1370
    (aSymbol == #storeBlockVar1) ifTrue:[stackDelta := -1. ^ 235].
eba0ee7232aa new opcodes
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1371
    (aSymbol == #storeBlockVar2) ifTrue:[stackDelta := -1. ^ 236].
eba0ee7232aa new opcodes
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1372
    (aSymbol == #storeBlockVar3) ifTrue:[stackDelta := -1. ^ 237].
eba0ee7232aa new opcodes
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1373
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1374
    (aSymbol == #falseJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 190].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1375
    (aSymbol == #trueJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 191].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1376
    (aSymbol == #nilJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 192].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1377
    (aSymbol == #notNilJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 193].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1378
    (aSymbol == #jumpabs) ifTrue:[extra := #absoffset. ^ 194].
1
77da9f5728e5 *** empty log message ***
claus
parents: 0
diff changeset
  1379
    (aSymbol == #makeBlockabs) ifTrue:[stackDelta := 1. extra := #absoffsetNvarNarg. ^ 195].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1380
    (aSymbol == #zeroJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 196].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1381
    (aSymbol == #notZeroJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 197].
1
77da9f5728e5 *** empty log message ***
claus
parents: 0
diff changeset
  1382
    (aSymbol == #eqJumpabs) ifTrue:[stackDelta := -2. extra := #absoffset. ^ 198].
77da9f5728e5 *** empty log message ***
claus
parents: 0
diff changeset
  1383
    (aSymbol == #notEqJumpabs) ifTrue:[stackDelta := -2. extra := #absoffset. ^ 199].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1384
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1385
    (aSymbol == #pushThisContext) ifTrue:[stackDelta := 1. ^ 144].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1386
1466
c05b6aa03a47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  1387
    (aSymbol == #isNil) ifTrue:["extraLiteral := aSymbol. -- could be synthetic" ^ 188].
c05b6aa03a47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  1388
    (aSymbol == #notNil) ifTrue:["extraLiteral := aSymbol. -- could be synthetic" ^ 189].
425
b046a32edb08 remember &, | and not in literal array
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1389
    (aSymbol == #not) ifTrue:[extraLiteral := aSymbol. lineno := true. ^ 179].
b046a32edb08 remember &, | and not in literal array
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1390
    (aSymbol == #&) ifTrue:[extraLiteral := aSymbol. lineno := true. ^ 216].
b046a32edb08 remember &, | and not in literal array
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1391
    (aSymbol == #|) ifTrue:[extraLiteral := aSymbol. lineno := true. ^ 217].
76
55d64cb1ffea *** empty log message ***
claus
parents: 54
diff changeset
  1392
117
claus
parents: 111
diff changeset
  1393
    (aSymbol == #pushClassVarL) ifTrue:[stackDelta := 1. extra := #speciallitL. ^ 218].
claus
parents: 111
diff changeset
  1394
    (aSymbol == #pushGlobalL) ifTrue:[stackDelta := 1. extra := #speciallitL. ^ 218].
claus
parents: 111
diff changeset
  1395
    (aSymbol == #storeClassVarL) ifTrue:[extra := #speciallitL.stackDelta := -1. ^ 219].
claus
parents: 111
diff changeset
  1396
    (aSymbol == #storeGlobalL) ifTrue:[extra := #speciallitL. stackDelta := -1. ^ 219].
claus
parents: 111
diff changeset
  1397
    (aSymbol == #pushLitL) ifTrue:[stackDelta := 1. extra := #unsigned16. ^ 201].
claus
parents: 111
diff changeset
  1398
claus
parents: 111
diff changeset
  1399
    (aSymbol == #sendL) ifTrue:[lineno := true. extra := #specialL. ^ 205].
claus
parents: 111
diff changeset
  1400
    (aSymbol == #sendSelfL) ifTrue:[lineno := true. extra := #specialL. ^ 207].
claus
parents: 111
diff changeset
  1401
    (aSymbol == #sendDropL) ifTrue:[lineno := true. extra := #specialL. ^ 204].
claus
parents: 111
diff changeset
  1402
    (aSymbol == #superSendL) ifTrue:[lineno := true. extra := #specialL. ^ 206].
106
claus
parents: 105
diff changeset
  1403
246
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1404
    (aSymbol == #top) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1405
    (aSymbol == #bottom) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1406
    (aSymbol == #left) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
abf09d4821fe new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  1407
    (aSymbol == #right) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
199
1b3b350a3f59 moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
  1408
400
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1409
    (aSymbol == #x) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1410
    (aSymbol == #y) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1411
    (aSymbol == #width) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1412
    (aSymbol == #height) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1413
    (aSymbol == #origin) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1414
    (aSymbol == #extent) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1415
    (aSymbol == #next) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1416
    (aSymbol == #peek) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1417
    (aSymbol == #asInteger) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1418
    (aSymbol == #rounded) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231].
e5cfc008be47 bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  1419
217
eba0ee7232aa new opcodes
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1420
    (aSymbol == #blockRef) ifTrue:[stackDelta := 0. ^ 238].
549
e403281da682 added #over code
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1421
    (aSymbol == #over) ifTrue:[stackDelta := 1. ^ 6].
1799
121a51d444a6 more long ops
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  1422
121a51d444a6 more long ops
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  1423
    (aSymbol == #sendVL) ifTrue:[lineno := true. extra := #specialVL. extraOP := 0. ^ 204].
121a51d444a6 more long ops
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  1424
    (aSymbol == #superSendVL) ifTrue:[lineno := true. extra := #specialVL. extraOP := 1. ^ 204].
1792
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  1425
    (aSymbol == #pushLitVL) ifTrue:[stackDelta := 1. extra := #unsigned32. extraOP := 2. ^ 204].
1799
121a51d444a6 more long ops
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  1426
    (aSymbol == #pushGlobalVL) ifTrue:[stackDelta := 1. extra := #speciallitVL. extraOP := 3. ^ 204].
121a51d444a6 more long ops
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  1427
    (aSymbol == #storeGlobalVL) ifTrue:[stackDelta := -1. extra := #speciallitVL. extraOP := 4. ^ 204].
217
eba0ee7232aa new opcodes
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1428
2756
4b1b41756f13 comment/format in: #byteCodeFor:
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  1429
    "/ the next 2 are to be obsoleted soon (renamed as MethodLocal)
1822
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1430
    (aSymbol == #pushLocal) ifTrue:[ stackDelta := 1. extra := #index. ^ 239].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1431
    (aSymbol == #storeLocal) ifTrue:[ stackDelta := -1. extra := #index. ^ 240].
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1432
2752
8ad917ec2b3a changed: #byteCodeFor:
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  1433
    (aSymbol == #pushMethodLocal) ifTrue:[ stackDelta := 1. extra := #index. ^ 239].
8ad917ec2b3a changed: #byteCodeFor:
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  1434
    (aSymbol == #storeMethodLocal) ifTrue:[ stackDelta := -1. extra := #index. ^ 240].
8ad917ec2b3a changed: #byteCodeFor:
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  1435
    (aSymbol == #storeBlockLocal) ifTrue:[ stackDelta := -1. extra := #index. ^ 241].
8ad917ec2b3a changed: #byteCodeFor:
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  1436
    (aSymbol == #storeOuterBlockLocal) ifTrue:[ stackDelta := -1. extra := #indexLevel. ^ 242].
3169
909acdf40ba0 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3162
diff changeset
  1437
    (aSymbol == #swap) ifTrue:[stackDelta := 0. ^ 243].
2752
8ad917ec2b3a changed: #byteCodeFor:
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  1438
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  1439
    self codeGeneratorError:'invalid code symbol'.
117
claus
parents: 111
diff changeset
  1440
1822
f9db06526cdd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1815
diff changeset
  1441
    "Modified: / 03-09-1995 / 12:58:47 / claus"
2752
8ad917ec2b3a changed: #byteCodeFor:
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
  1442
    "Modified: / 25-10-2011 / 21:56:43 / cg"
2756
4b1b41756f13 comment/format in: #byteCodeFor:
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  1443
    "Modified (comment): / 31-10-2011 / 11:34:37 / cg"
3645
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  1444
    "Modified (format): / 31-05-2015 / 03:55:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
  1445
!
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
  1446
209
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
  1447
checkForCommonCode:symbolicCodeArray
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
  1448
    "hook to return the code for common code sequences.
212
ff39051e219f more constant folding options
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1449
     This reduces the in-memory number of byteArrays somewhat.
ff39051e219f more constant folding options
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1450
1095
8963fe0f984f comment
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  1451
     Not yet fully implemented - just an idea ... there is certainly more to do here
212
ff39051e219f more constant folding options
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1452
     (does it make sense to scan all methods, collect code in a set and unify things
ff39051e219f more constant folding options
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1453
      automatically in the background - or upon request ?)"
199
1b3b350a3f59 moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
  1454
209
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
  1455
    |sz insn1|
199
1b3b350a3f59 moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
  1456
209
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
  1457
    (sz := symbolicCodeArray size) == 2 ifTrue:[
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1458
	"/
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1459
	"/ a very common sequence: return the first literal
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1460
	"/
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1461
	(insn1 := symbolicCodeArray at:1) == #pushLit1 ifTrue:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1462
	    (symbolicCodeArray at:2) == #retTop ifTrue:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1463
		^ #[222 0]
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1464
	    ]
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1465
	]
209
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
  1466
    ].
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
  1467
    sz == 1 ifTrue:[
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1468
	"/
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1469
	"/ other common sequences: return the receiver, nil, true or false
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1470
	"/
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1471
	(insn1 := symbolicCodeArray at:1) == #retSelf ifTrue:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1472
	    ^ #[5]
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1473
	].
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1474
	insn1 == #retNil ifTrue:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1475
	    ^ #[1]
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1476
	].
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1477
	insn1 == #retTrue ifTrue:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1478
	    ^ #[2]
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1479
	].
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1480
	insn1 == #retFalse ifTrue:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1481
	    ^ #[3]
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1482
	].
209
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
  1483
    ].
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
  1484
    ^ nil
199
1b3b350a3f59 moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
  1485
!
1b3b350a3f59 moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
  1486
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1487
checkForPrimitiveCode:nr
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1488
    "return the code for an ST-80 primitive method.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1489
     Since many primitives available on ST-80 should also be available
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1490
     somewhere in ST/X, this may work for many primitive numbers.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1491
     However, more information is needed and more things to be added below.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1492
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1493
     This was added to allow emulation of (some) ST-80
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1494
     primitives (to fileIn RemoteInvocation & Monitor41 packages)"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1495
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1496
    |cls sel|
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1497
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1498
    (nr == 75)  ifTrue:[ cls := Object. sel := #identityHash ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1499
    (nr == 110) ifTrue:[ cls := Object. sel := #==           ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1500
    (nr == 111) ifTrue:[ cls := Object. sel := #class        ].
1228
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1501
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1502
    "
1228
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1503
     should add more here, to be able to fileIn ST-80 and Squeak methods
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  1504
     containing primitive calls (who gives me the numbers ... ?)
512
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1505
     mhmh - got some ..."
1228
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1506
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1507
     "/ ST80 and Squeak common:
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1508
     "/            18 Number @
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1509
     "/            41 Float +
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1510
     "/            42 Float -
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1511
     "/            49 Float *
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1512
     "/            50 Float /
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1513
     "/            52 Float fractionPart
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1514
     "/            54 Float timesTwoPower:
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1515
907
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1516
     "/ ST80:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1517
     "/
1228
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1518
     "/            18 Number @
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1519
     "/            21 LargePositiveInteger +
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1520
     "/            22 LargePositiveInteger -
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1521
     "/            29 LargePositiveInteger *
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1522
     "/            30 LargePositiveInteger /
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1523
     "/            31 LargePositiveInteger \\
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1524
     "/            32 LargePositiveInteger //
1228
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1525
     "/            34 LargePositiveInteger bitAnd:
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1526
     "/            35 LargePositiveInteger bitOr:
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1527
     "/            36 LargePositiveInteger bitXor:
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1528
     "/            37 LargePositiveInteger bitShift:
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1529
     "/            40 SmallInteger asFloat
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1530
     "/            41 Float +
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1531
     "/            42 Float -
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1532
     "/            49 Float *
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  1533
     "/            50 Float /
1228
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1534
     "/            52 Float fractionPart
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1535
     "/            54 Float timesTwoPower:
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1536
     "/            70 Behavior basicNew
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1537
     "/            71 Behavior basicNew:
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1538
     "/            89 Behavior flushVMmethodCache
5ee632d481f2 comment
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1539
     "/            91 InputState primCursorLocPut:
512
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1540
     "/           105 ByteArray replaceElementsFrom:to:withByteArray:startingAt:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1541
     "/           223 ByteString =
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1542
     "/           306 ObjectMemory class sizesAtStartup
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1543
     "/           307 ObjectMemory class defaultSizesAtStartup
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1544
     "/           309 ObjectMemory class defaultThresholds
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1545
     "/           326 ObjectMemory class getMemoryUsageAndZeroFragmentationStatisticsIf:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1546
     "/           395 ExternalInterface ???
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1547
     "/           400 FormBitmap class newWidth:height:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1548
     "/           414 TwoByteString replaceElementsFrom:to:withTwoByteString:startingAt:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1549
     "/           415 TwoByteString =
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1550
     "/           417 String trueCompare:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1551
     "/           418 ByteString nextIndexOf:from:to:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1552
     "/           419 ByteString prevIndexOf:from:to:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1553
     "/           422 WeakArray indexOf:replaceWith:startingAt:stoppingAt:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1554
     "/           522 Behavior flushVMmethodCacheEntriesFor:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1555
     "/           524 Context nFromVPC:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1556
     "/           525 Context vFromNPC:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1557
     "/           532 Object shallowCopy
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1558
     "/           536 Behavior atomicAllInstances
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1559
     "/           537 Object allOwners
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1560
     "/           538 ObjectMemory class allObjects
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1561
     "/           546 UninterpretedBytes longAt:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1562
     "/           548 UninterpretedBytes floatAt:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1563
     "/           550 UninterpretedBytes longFloatAt:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1564
     "/           544 UninterpretedBytes unsignedLongAt:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1565
     "/           559 ByteArray replaceBytesFrom:to:with:startingAt:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1566
     "/           560 Double class fromNumber:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1567
     "/           561 Double +
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1568
     "/           562 Double -
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1569
     "/           569 Double *
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1570
     "/           570 Double /
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1571
     "/           572 Double fractionPart
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1572
     "/           574 Double timesTwoPower:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1573
     "/           576 Double sin
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1574
     "/           577 Double cos
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1575
     "/           578 Double tan
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1576
     "/           579 Double arcSin
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1577
     "/           580 Double arcCos
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1578
     "/           581 Double arcTan
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1579
     "/           582 Double sqrt
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1580
     "/           583 Double ln
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1581
     "/           584 Double exp
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1582
     "/           585 Double raisedTo:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1583
     "/           587 Double floorLog10
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1584
     "/           588 Double asFloat
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1585
     "/           591 Float cos
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1586
     "/           592 Float arcSin
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1587
     "/           593 Float arcCos
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1588
     "/           600 Float sin
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1589
     "/           601 Float tan
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1590
     "/           602 Float arcTan
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1591
     "/           603 Float sqrt
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1592
     "/           604 Float ln
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1593
     "/           605 Float exp
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1594
     "/           606 Float raisedTo:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1595
     "/           609 Float floorLog10
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1596
     "/           610 Filename getDatesErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1597
     "/           614 DosFilename class getVolumes
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1598
     "/           615 UnixFilename primSetProtection:errInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1599
     "/           616 UnixFilename class primSetCreationMask:errInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1600
     "/           617 UnixFilename primGetProtectionErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1601
     "/           620 Filename listDirectoryErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1602
     "/           621 Filename deleteErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1603
     "/           622 Filename isDirectoryErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1604
     "/           623 Filename renameTo:errInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1605
     "/           624 Filename makeDirectoryErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1606
     "/           625 Filename class defaultDirectoryErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1607
     "/           626 Filename fileSizeErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1608
     "/           627 Filename isWritableErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1609
     "/           628 Filename setWritable:errInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1610
     "/           629 Filename existsErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1611
     "/           630 SocketAccessor setOptionsLevel:name:value:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1612
     "/           631 SocketAccessor getOptionsLevel:name:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1613
     "/           632 SocketAccessor primGetName
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1614
     "/           633 SocketAccessor primGetPeer
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1615
     "/           634 SocketAccessor atMark
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1616
     "/           637 UnixTtyAccessor primGetOptions
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1617
     "/           638 UnixTtyAccessor setOptions:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1618
     "/           639 UnixRealTtyAccessor modemBits:mask:sendBreak:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1619
     "/           640 IPSocketAddress class primHostAddressByName:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1620
     "/           641 IPSocketAddress class netAddressByName:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1621
     "/           642 IPSocketAddress class protocolNumberByName:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1622
     "/           643 IPSocketAddress class servicePortByName:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1623
     "/           645 IPSocketAddress class primHostNameByAddress:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1624
     "/           646 IPSocketAddress class netNameByAddress:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1625
     "/           647 IPSocketAddress class protocolNameByNumber:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1626
     "/           648 IPSocketAddress class serviceNameByPort:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1627
     "/           649 SocketAccessor class getHostname
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1628
     "/           650 Filename primOpenFileNamed:direction:creation:errorInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1629
     "/           651 IOAccessor primClose
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1630
     "/           652 UnixPipeAccessor class primPipeErrorInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1631
     "/           653 UnixPseudoTtyAccessor class primPtyErrorInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1632
     "/           654 SocketAccessor class primPairErrorInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1633
     "/           655 UnixRealTtyAccessor class primOpen:errInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1634
     "/           660 IOAccessor primReadInto:startingAt:for:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1635
     "/           661 IOAccessor primWriteFrom:startingAt:for:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1636
     "/           662 IOAccessor primSeekTo:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1637
     "/           664 IOAccessor truncateTo:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1638
     "/           665 DosDiskFileAccessor commit
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1639
     "/           666 IOAccessor primGetSize
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1640
     "/           667 MacDiskFileAccessor lock:for:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1641
     "/           669 UnixIOAccessor bytesForRead
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1642
     "/           670 SocketAccessor class primFamily:type:protocol:errInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1643
     "/           671 SocketAccessor primAccept
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1644
     "/           672 SocketAccessor bindTo:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1645
     "/           673 SocketAccessor listenFor:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1646
     "/           674 SocketAccessor primConnectTo:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1647
     "/           675 SocketAccessor primReceiveFrom:buffer:start:for:flags:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1648
     "/           676 SocketAccessor sendTo:buffer:start:for:flags:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1649
     "/           677 SocketAccessor shutdown:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1650
     "/           681 UnixProcess class primFork:arguments:environment:descriptors:errorTo:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1651
     "/           682 UnixProcess class reapOne
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1652
     "/           683 UnixProcess kill:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1653
     "/           690 CEnvironment class primEnvironment
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1654
     "/           697 OSErrorHolder class errorDescriptionFor:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1655
     "/           697 ErrorHolder class errorDescriptionFor:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1656
     "/           698 SocketAccessor class primInit:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1657
     "/           700 ParagraphEditor class getExternalSelectionOrNil:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1658
     "/           701 ParagraphEditor class putExternalSelection:with:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1659
     "/           705 Screen ringBell
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1660
     "/           706 Cursor class primOpenImage:mask:hotSpotX:hotSpotY:background:foreground:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1661
     "/           707 Cursor primBeCursor
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1662
     "/           708 Cursor primFreeCursor
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1663
     "/           772 SoundManager enumerateSoundsFrom:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1664
     "/           773 SoundManager playSoundFrom:sound:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1665
     "/           774 SoundManager simpleBeep:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1666
     "/           775 Pixmap primFromClipboard
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1667
     "/           776 Pixmap toClipboard
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1668
     "/           808 Context findNextMarkedUpTo:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1669
     "/           809 Context terminateTo:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1670
     "/           710 DosTtyAccessor class primOpen:errInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1671
     "/           711 DosTtyAccessor primClose
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1672
     "/           712 DosTtyAccessor primReadInto:startingAt:for:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1673
     "/           713 DosTtyAccessor primWriteFrom:startingAt:for:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1674
     "/           714 DosTtyAccessor primGetOptions
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1675
     "/           715 DosTtyAccessor primSetOptions:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1676
     "/           716 DosTtyAccessor setSem:forWrite:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1677
     "/           717 DosTtyAccessor modemBits:mask:sendBreak:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1678
     "/           750 MacFilename class getVolumes
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1679
     "/           752 MacFilename primSetCreator:type:errInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1680
     "/           754 MacIOAccessor class getAccessories
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1681
     "/           755 MacIOAccessor class runAccessory:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1682
     "/           756 MacOSFilename class getFileTypes:errInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1683
     "/           757 MacOSFilename putFileWithPrompt:errInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1684
     "/           758 MacOSFilename getFileInfoErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1685
     "/           759 MacOSFilename stringFromVRefErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1686
     "/           761 MacOSFilename class getStartupFilesErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1687
     "/           770 DosFilename printPSFileErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1688
     "/           771 DosFilename printTextFileErrInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1689
     "/           780 MacTtyAccessor class primOpen:errInto:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1690
     "/           781 MacTtyAccessor primClose
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1691
     "/           782 MacTtyAccessor primReadInto:startingAt:for:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1692
     "/           783 MacTtyAccessor primWriteFrom:startingAt:for:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1693
     "/           786 MacTtyAccessor primGetOptions
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1694
     "/           787 MacTtyAccessor setOptions:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1695
     "/           788 MacTtyAccessor primBreak:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1696
     "/           790 MacTtyAccessor primGetStatus
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1697
     "/           792 MacTtyAccessor setSem:forWrite:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1698
     "/           793 MacTtyAccessor primAssertDTR:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1699
     "/           794 MacTtyAccessor primGetSize
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1700
     "/           933 ByteArray copyBitsClippedStride:...
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1701
     "/           934 ByteArray tileBits32By32Stride:...
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1702
     "/           935 Screen dragShape:...
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1703
     "/           936 Screen resizeRectangle...
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1704
     "/           937 Screen displayShape:...
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1705
     "/           938 Window resizeFromUserWithMinimum:maximum:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1706
     "/           940 Window primClose
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1707
     "/           942 Window getDimensions
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1708
     "/           943 Window moveTo:resize:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1709
     "/           944 Window primMap
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1710
     "/           945 Window class primNewAt:extent:min:max:windowType:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1711
     "/           946 Screen flush
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1712
     "/           947 Screen getScreenDimensions
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1713
     "/           948 Window unmap
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1714
     "/           950 Screen sync
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1715
     "/           951 Window setIconMask:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1716
     "/           952 Window label:iconLabel:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1717
     "/           953 Window raise
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1718
     "/           954 Window lower
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1719
     "/           955 Screen queryStackingOrder
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1720
     "/           956 TextMeasurer primScanCharactersFrom:...
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1721
     "/           957 GraphicsContext displayMappedString:from:to:at:withMap:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1722
     "/           959 Window setBackgroundPixel:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1723
     "/           960 Screen class primOpen:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1724
     "/           965 UnmappableSurface contentsOfAreaOriginX:y:width:height:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1725
     "/           966 Window contentsOfAreaOriginX:y:width:height:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1726
     "/           967 Screen contentsOfAreaOriginX:y:width:height:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1727
     "/           970 Mask class primExtent:depth:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1728
     "/           971 Mask privateClose
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1729
     "/           976 GraphicsContext displayCharacterOfIndex:at:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1730
     "/           978 DeviceFont class listFonts
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1731
     "/           979 DeviceFont primLoadFont
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1732
     "/           980 DeviceFont primUnLoadFont
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1733
     "/           985 GraphicsContext displayLineFrom:to:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1734
     "/           986 GraphicsContext displayPolyline:at:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1735
     "/           987 GraphicsContext displayPolygon:at:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1736
     "/           988 GraphicsContext primDisplayRectangleOrigin:extent:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1737
     "/           989 GraphicsContext primDisplayRectangularBorderOrigin:extent:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1738
     "/           990 GraphicsContext primDisplayArcBBoxOrigin:extent:startAngle:sweepAngle:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1739
     "/           991 GraphicsContext primDisplayWedgeBBoxOrigin:extent:startAngle:sweepAngle:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1740
     "/           992 GraphicsContext displayMask:at:"
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1741
     "/           993 GraphicsContext displayUninterpretedImageBits:at:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1742
     "/           994 GraphicsContext primCopyRectangularAreaExtent:from:sourceOffset:destinationOffset:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1743
     "/           995 GraphicsContext primCopyMaskedArea:from:sourceOffset:destinationOffset:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1744
     "/           996 Screen deviceColormap
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1745
     "/           998 GraphicsContext displayUninterpretedMonoImageBits:foreground:background:at:
fed48886aff9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1746
907
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1747
     "/ Squeak:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1748
     "/
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1749
     "/             1 +
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1750
     "/             2 -
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1751
     "/             3 <
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1752
     "/             4 >
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1753
     "/             5 <=
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1754
     "/             6 >=
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1755
     "/             7 =
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1756
     "/             8 ~=
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1757
     "/             9 *
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1758
     "/            10 /
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1759
     "/            11 mod:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1760
     "/            12 div:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1761
     "/            13 quo:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1762
     "/            14 bitAnd:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1763
     "/            15 bitOr:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1764
     "/            16 bitXor:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1765
     "/            17 bitShift:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1766
     "/            18 @
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1767
     "/            19
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1768
     "/            ...
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1769
     "/            39 fail - reserved/unimplemented
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1770
     "/            40 asFloat
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1771
     "/            41 Float +
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1772
     "/            42 Float -
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1773
     "/            43 Float <
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1774
     "/            44 Float >
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1775
     "/            45 Float <=
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1776
     "/            46 Float >=
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1777
     "/            47 Float =
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1778
     "/            48 Float ~=
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1779
     "/            49 Float *
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1780
     "/            50 Float /
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1781
     "/            51 Float truncated
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1782
     "/            52 Float fractionalPart
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1783
     "/            53 Float exponent
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1784
     "/            54 Float timeTwoPower
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1785
     "/            55 Float sqrt
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1786
     "/            56 Float sine
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1787
     "/            57 Float arcTan
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1788
     "/            58 Float logN
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1789
     "/            59 Float exp
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1790
     "/            60 at:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1791
     "/            61 at:put:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1792
     "/            62 size
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1793
     "/            63 stringAt:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1794
     "/            64 stringAt:put:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1795
     "/            65 next
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1796
     "/            66 nextPut:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1797
     "/            67 atEnd
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1798
     "/            68 objectAt:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1799
     "/            69 objectAt:put:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1800
     "/            70 new
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1801
     "/            71 new:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1802
     "/            72 becomeOneWay
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1803
     "/            73 instVarAt:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1804
     "/            74 instVarAtPut:
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1805
     "/            75 asOop
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1806
     "/            76 storeStackP
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1807
     "/            77 someInstance
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1808
     "/            78 nextInstance
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1809
     "/            79 newMethod
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1810
     "/            80 blockCopy
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1811
     "/            81 value
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1812
     "/            82 valueWithArgs
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1813
     "/            83 perform
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1814
     "/            84 performWithArgs
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1815
     "/            85 signal
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1816
     "/            86 wait
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1817
     "/            87 resume
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1818
     "/            88 suspend
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1819
     "/            89 flushCache
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1820
     "/            90 mousePoint
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1821
     "/            91 fail/unimplemented/reserved
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1822
     "/            92 fail/unimplemented/reserved
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1823
     "/            93 inputSemaphore
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1824
     "/            94 fail/unimplemented/reserved
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1825
     "/            95 inputWord
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1826
     "/            96 copyBits
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1827
     "/            97 snapShot
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1828
     "/            98 fail/unimplemented/reserved
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1829
     "/            99 fail/unimplemented/reserved
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1830
     "/           100 fail/unimplemented/reserved
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1831
     "/           101 beCursor
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1832
     "/           102 beDisplay
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1833
     "/           103 scanCharacters
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1834
     "/           104 drawLoop
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1835
     "/           105 stringReplace
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1836
     "/           106 screenSize
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1837
     "/           107 mouseButtons
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1838
     "/           108 kbdNext
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1839
     "/           109 kbdPeek
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1840
     "/           110 equivalent
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1841
     "/           111 class
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1842
     "/           112 bytesLeft
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1843
     "/           113 quit
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1844
     "/           114 exitToDebugger
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1845
     "/           115 fail/unimplemented/reserved
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1846
     "/           116 flushCacheByMethod
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1847
     "/           117 externalCall
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1848
     "/           118 doPrimitiveWithArg
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1849
     "/           119 flushCacheSelective
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1850
     "/           120 fail/unimplemented/reserved
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1851
     "/           121 imageName
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1852
     "/           122 noop
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1853
     "/           123 fail/unimplemented/reserved
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1854
     "/           124 lowSpaceSemaphore
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1855
     "/           125 signalAtBytesLeft
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1856
     "/           126 deferDisplayUpdate
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1857
     "/           127 showDisplayRect
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1858
     "/           128 arrayBecome
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1859
     "/           129 specialObjectsOop
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1860
     "/           130 fullGC
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1861
     "/           131 incrementalGC
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1862
     "/           132 objectPointsTo
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1863
     "/           133 setInterruptKey
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1864
     "/           134 interruptSemaphore
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1865
     "/           135 millisecondClock
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1866
     "/           136 signalAtMilliseconds
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1867
     "/           137 secondsClock
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1868
     "/           138 someObject
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1869
     "/           139 nextObject
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1870
     "/           140 beep
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1871
     "/           141 clipboardText
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1872
     "/           142 vmPath
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1873
     "/           143 shortAt
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1874
     "/           144 shortAtPut
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1875
     "/           145 constantFill
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1876
     "/           146 readJoystick
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1877
     "/           147 warpBits
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1878
     "/           148 clone
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1879
     "/           149 getAttribute
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1880
     "/           150 fileAtEnd
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1881
     "/           151 fileClose
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1882
     "/           152 fileGetPosition
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1883
     "/           153 fileOpen
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1884
     "/           154 fileRead
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1885
     "/           155 fileSetPosition
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1886
     "/           156 fileDelete
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1887
     "/           157 fileSize
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1888
     "/           158 fileWrite
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1889
     "/           159 fileRename
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1890
     "/           160 directoryCreate
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1891
     "/           161 directoryDelimiter
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1892
     "/           162 directoryLookup
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1893
     "/           163 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1894
     "/           164 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1895
     "/           165 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1896
     "/           166 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1897
     "/           167 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1898
     "/           168 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1899
     "/           169 directorySetMacType
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1900
     "/           170 soundStart
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1901
     "/           171 soundStartWithSemaphore
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1902
     "/           172 soundStop
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1903
     "/           173 soundAvailableSpace
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1904
     "/           174 soundPlaySamples
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1905
     "/           175 soundPlaySilence
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1906
     "/           176 waveTableSoundmixSampleCountIntoStarrtingAtpan
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1907
     "/           177 fmSoundmixSampleCountintostartingAtpan
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1908
     "/           178 pluckedSoundmixSampleCountintostartingAtpan
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1909
     "/           179 sampledSoundmixSampleCountintostartingAtpan
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1910
     "/           180 fmSoundmixSampleCountintostartingAtleftVolrightVol
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1911
     "/           181 pluckedSoundmixSampleCountintostartingAtleftVolrightVol
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1912
     "/           182 sampledSoundmixSampleCountintostartingAtleftVolrightVol
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1913
     "/           183 reverbSoundapplyReverbTostartingAtcount
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1914
     "/           184 loopedSampledSoundmixSampleCountintostartingAtleftVolrightVol
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1915
     "/           185 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1916
     "/           186 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1917
     "/           187 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1918
     "/           188 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1919
     "/           189 soundInsertSamples
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1920
     "/           190 soundStartRecording
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1921
     "/           191 soundStopRecording
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1922
     "/           192 soundGetRecordingSampleRate
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1923
     "/           193 soundRecordSamples
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1924
     "/           194 soundSetRecordLevel
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1925
     "/           195 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1926
     "/           196 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1927
     "/           197 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1928
     "/           198 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1929
     "/           199 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1930
     "/           200 initializeNetwork
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1931
     "/           201 resolverStartNameLookup
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1932
     "/           202 resolverNameLookupResult
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1933
     "/           203 resolverStartAddressLookup
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1934
     "/           204 resolverAddressLookupResult
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1935
     "/           205 resolverAbortLookup
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1936
     "/           206 resolverLocalAddress
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1937
     "/           207 resolverStatus
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1938
     "/           208 resolverError
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1939
     "/           209 socketCreate
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1940
     "/           210 socketDestroy
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1941
     "/           211 socketConnectionStatus
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1942
     "/           212 socketError
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1943
     "/           213 socketLocalAddress
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1944
     "/           214 socketLocalPort
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1945
     "/           215 socketRemoteAddress
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1946
     "/           216 socketRemotePort
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1947
     "/           217 socketConnectToPort
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1948
     "/           218 socketListenOnPort
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1949
     "/           219 socketCloseConnection
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1950
     "/           220 socketAbortConnection
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1951
     "/           221 socketReceiveDataBufCount
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1952
     "/           222 socketReceiveDataAvailable
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1953
     "/           223 socketSendDataBufCount
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1954
     "/           224 socketSendDone
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1955
     "/           225 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1956
     "/           226 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1957
     "/           227 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1958
     "/           228 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1959
     "/           229 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1960
     "/           230 relinquishProcessor
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1961
     "/           231 forceDisplayUpdate
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1962
     "/           232 formPrint
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1963
     "/           233 setFullScreen
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1964
     "/           234 bitmapdecompressfromByteArrayat
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1965
     "/           235 stringcomparewithcollated
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1966
     "/           236 sampledSoundconvert8bitSignedFromto16Bit
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1967
     "/           237 bitmapcompresstoByteArray
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1968
     "/           238 serialPortOpen
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1969
     "/           239 serialPortClose
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1970
     "/           240 serialPortWrite
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1971
     "/           241 serialPortRead
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1972
     "/           242 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1973
     "/           243 stringtranslatefromtotable
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1974
     "/           244 stringfindFirstInStringinSetstartingAt
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1975
     "/           245 stringindexOfAsciiinStringstartingAt
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1976
     "/           246 stringfindSubstringinstartingAtmatchTable
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1977
     "/           247 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1978
     "/           248 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1979
     "/           249 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1980
     "/           250 clearProfile
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1981
     "/           251 dumpProfile
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1982
     "/           252 startProfiling
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1983
     "/           253 stopProfiling
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1984
     "/           254 vmParameter
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1985
     "/           255 instVarsPutFromStack
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1986
     "/           256 pushSelf
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1987
     "/           257 pushTrue
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1988
     "/           258 pushFalse
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1989
     "/           259 pushNil
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1990
     "/           260 pushMinusOne
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1991
     "/           261 pushZero
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1992
     "/           262 pushOne
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1993
     "/           263 pushTwo
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1994
     "/           264 loadInstVar
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1995
     "/           ..  loadInstVar
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1996
     "/           519 loadInstVar
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1997
     "/           520 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1998
     "/           521 MIDIClosePort
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1999
     "/           522 MIDIGetClock
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2000
     "/           523 MIDIGetPortCount
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2001
     "/           524 MIDIGetPortDirectionality
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2002
     "/           525 MIDIGetPortName
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2003
     "/           526 MIDIOpenPort
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2004
     "/           527 MIDIParameterGetOrSet
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2005
     "/           528 MIDIRead
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2006
     "/           529 MIDIWrite
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2007
     "/           530 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2008
     "/           ..  fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2009
     "/           539 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2010
     "/           540 asyncFileClose
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2011
     "/           541 asyncFileOpen
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2012
     "/           542 asyncFileReadResult
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2013
     "/           543 asyncFileReadStart
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2014
     "/           544 asyncFileWriteResult
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2015
     "/           545 asyncFileWriteStart
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2016
     "/           546 fail
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2017
     "/           ..
907
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2018
     "/           700 fail
683b46536bc6 comment
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2019
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2020
    cls notNil ifTrue:[
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2021
	^ (cls compiledMethodAt:sel) code
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2022
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2023
    ^ nil
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2024
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2025
3162
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2026
codeLineNumber:nr on:codeStream
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2027
    "generate lineNumber information"
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2028
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2029
    "/ caveat: (currently) there is no separate lineNumber or symbol table;
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2030
    "/ the line numbers are coded right into the instruction stream.
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2031
    "/ This might change in the future.
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2032
    "/ (It is not a problem speed wise: the Jitter just skips them.)
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2033
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2034
    (currentLineNumber = nr or:[nr <= 0]) ifTrue:[
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2035
        ^ self
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2036
    ].
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2037
3186
2c1b6673c461 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3178
diff changeset
  2038
    "don't need line number information, if still on same line"
3162
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2039
    currentLineNumber := nr.
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2040
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2041
    nr <= 255 ifTrue:[
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2042
        codeStream 
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2043
            nextPut:#lineno;
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2044
            nextPut:nr.
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2045
    ] ifFalse:[
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2046
        nr <= 16rFFFF ifTrue:[
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2047
            codeStream 
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2048
                nextPut:#lineno16;
3709
e9d10d99ef0d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3681
diff changeset
  2049
                nextPutInt16:nr MSB:true.
3162
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2050
        ]
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2051
    ].
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2052
!
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2053
3645
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2054
codeSourcePosition:nr on:codeStream
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2055
    "generate source position information"
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2056
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2057
    "/ caveat: (currently) there is no separate line number, position or symbol table;
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2058
    "/ the source positions are coded right into the instruction stream.
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2059
    "/ This might change in the future.
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2060
    "/ (It is not a problem speed wise: the Jitter just skips them.)
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2061
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2062
    nr <= 255 ifTrue:[
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2063
        codeStream 
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2064
            nextPut:#sourcepos8;
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2065
            nextPut:nr.
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2066
    ] ifFalse:[
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2067
        nr <= 16rFFFF ifTrue:[
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2068
            codeStream 
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2069
                nextPut:#sourcepos16;
3667
7884cf07e2c4 Fix in generating SOURCEPOS16/32 pseudo-insns.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3663
diff changeset
  2070
                nextPut:nr;
7884cf07e2c4 Fix in generating SOURCEPOS16/32 pseudo-insns.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3663
diff changeset
  2071
                nextPut:nil.
7884cf07e2c4 Fix in generating SOURCEPOS16/32 pseudo-insns.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3663
diff changeset
  2072
3645
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2073
        ] ifFalse:[ 
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2074
            nr <= 16rFFFFFFFF ifTrue:[ 
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2075
                codeStream 
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2076
                    nextPut:#sourcepos32;
3667
7884cf07e2c4 Fix in generating SOURCEPOS16/32 pseudo-insns.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3663
diff changeset
  2077
                    nextPut:nr;
7884cf07e2c4 Fix in generating SOURCEPOS16/32 pseudo-insns.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3663
diff changeset
  2078
                    nextPut:nil;
7884cf07e2c4 Fix in generating SOURCEPOS16/32 pseudo-insns.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3663
diff changeset
  2079
                    nextPut:nil;
7884cf07e2c4 Fix in generating SOURCEPOS16/32 pseudo-insns.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3663
diff changeset
  2080
                    nextPut:nil.
3645
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2081
            ].
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2082
        ].
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2083
    ].
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2084
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2085
    "Created: / 31-05-2015 / 03:43:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2086
!
695fc26d7207 Block source position support [1/2]: generate SOURCEPOS pseudoinstruction before each MAKE_BLOCK insn
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3641
diff changeset
  2087
277
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2088
createMethod
429
ffc4e2ab5581 cleanup
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  2089
    |newMethod|
277
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2090
1094
745ec90c42c9 allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
  2091
    newMethod := self methodClass new:(litArray size).
292
163651658aee Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 287
diff changeset
  2092
    litArray notNil ifTrue:[
2502
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2093
        "/ fixup CheapBlocks method-field in literal array,
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2094
        litArray do:[:aLiteral |
3416
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2095
            (aLiteral isBlock and:[aLiteral isCheapBlock]) ifTrue:[
2502
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2096
                aLiteral setMethod:newMethod.
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2097
            ]
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2098
        ].
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2099
        newMethod literals:litArray
277
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2100
    ].
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2101
594
11ae33ac9b34 finally replaced all sends of #numberOfMethodVars with #numerOfVars
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2102
    newMethod numberOfVars:(self numberOfMethodVars + (maxNumTemp ? 0)).
3648
a7e535c13f00 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3641
diff changeset
  2103
    newMethod numberOfArgs:(self numberOfMethodArgs).
277
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2104
    newMethod stackSize:(self maxStackDepth).
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2105
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2106
    primitiveResource notNil ifTrue:[
2502
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2107
        newMethod setResourceFlag
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2108
    ].
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2109
2623
a006a3ecfda8 changed: #createMethod
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
  2110
    annotations notEmptyOrNil ifTrue:[
3569
d2ca8339f9f7 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3566
diff changeset
  2111
        newMethod annotations: (self annotations copy).
2759
869b00393e4c changed: #createMethod
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  2112
        (Smalltalk at: #NamespaceAwareLookup) notNil ifTrue:[
3569
d2ca8339f9f7 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3566
diff changeset
  2113
            (annotations contains: [:annotation| (annotation key) == #namespace:])
2502
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2114
                ifTrue:[newMethod lookupObject:NamespaceAwareLookup instance]
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2115
        ]
277
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2116
    ].
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2117
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2118
    ^ newMethod
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2119
2502
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2120
    "Created: / 18-05-1996 / 16:33:17 / cg"
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2121
    "Modified: / 24-06-1996 / 12:32:50 / stefan"
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  2122
    "Modified: / 10-07-2010 / 21:40:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2759
869b00393e4c changed: #createMethod
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  2123
    "Modified: / 29-11-2011 / 11:22:15 / cg"
277
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2124
!
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2125
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2126
genByteCodeFrom:symbolicCodeArray
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2127
    "convert symbolicCode into bytecodes"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2128
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2129
    |symIndex    "{Class: SmallInteger }"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2130
     codeSize    "{Class: SmallInteger }"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2131
     symCodeSize "{Class: SmallInteger }"
429
ffc4e2ab5581 cleanup
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  2132
     index nextSym addr
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2133
     codeSymbol nargs needRetry
429
ffc4e2ab5581 cleanup
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  2134
     stackDepth relocInfo level nvars round|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2135
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2136
    symbolicCodeArray isNil ifTrue:[^ self].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2137
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2138
    round := 0.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2139
    needRetry := true.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2140
    symCodeSize := symbolicCodeArray size.
192
5f5ecdcffc67 share common byteCodes - just an idea and more is needed for most compact code
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  2141
    ShareCode ifTrue:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2142
        codeBytes := self checkForCommonCode:symbolicCodeArray.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2143
        codeBytes notNil ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2144
            ^ self
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2145
        ].
192
5f5ecdcffc67 share common byteCodes - just an idea and more is needed for most compact code
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  2146
    ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2147
    codeSize := symCodeSize.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2148
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2149
    [needRetry] whileTrue:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2150
        stackDepth := 0.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2151
        maxStackDepth := 0.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2152
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2153
        codeBytes := ByteArray uninitializedNew:codeSize.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2154
        relocInfo := Array basicNew:(codeSize + 1).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2155
        symIndex := 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2156
        codeIndex := 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2157
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2158
        needRetry := false.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2159
        round := round + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2160
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2161
        [symIndex <= symCodeSize] whileTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2162
            relocInfo at:symIndex put:codeIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2163
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2164
            codeSymbol := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2165
            symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2166
            stackDelta := 0.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2167
            extra := extraLiteral := extraOP := nil.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2168
            lineno := false.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2169
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2170
            self appendByteCodeFor:codeSymbol.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2171
            extraOP notNil ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2172
                self appendByte:extraOP.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2173
                symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2174
            ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2175
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2176
            extraLiteral notNil ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2177
                self addLiteral:extraLiteral
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2178
            ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2179
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2180
            lineno ifTrue:[
3162
d7d32920c1b4 Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents: 3161
diff changeset
  2181
                "the instruction requires a line number byte"
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2182
                self appendByte:((symbolicCodeArray at:symIndex) min:255).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2183
                symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2184
                codeSymbol == #lineno16 ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2185
                    self appendByte:((symbolicCodeArray at:symIndex) min:255).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2186
                    symIndex := symIndex + 1
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2187
                ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2188
            ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2189
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2190
            extra notNil ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2191
                nextSym := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2192
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2193
                (extra == #number) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2194
                    index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2195
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2196
                    self appendSignedByte:index
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2197
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2198
                ] ifFalse:[ (extra == #number16) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2199
                    index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2200
                    symIndex := symIndex + 2.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2201
                    self appendSignedWord:index
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2202
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2203
                ] ifFalse:[ (extra == #unsigned16) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2204
                    index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2205
                    symIndex := symIndex + 2.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2206
                    self appendWord:index
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2207
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2208
                ] ifFalse:[ (extra == #unsigned32) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2209
                    index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2210
                    symIndex := symIndex + 4.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2211
                    self appendLongWord:index
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2212
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2213
                ] ifFalse:[ (extra == #index) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2214
                    index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2215
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2216
                    self appendByte:index
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2217
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2218
                ] ifFalse:[ (extra == #lit) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2219
                    index := self addLiteral:nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2220
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2221
                    self appendByte:index
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2222
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2223
                ] ifFalse:[ (extra == #speciallit) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2224
                    index := self addLiteral:nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2225
                    index > 255 ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2226
                        self codeGeneratorError:'too many globals (' ,
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2227
                                        (symbolicCodeArray at:symIndex) ,
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2228
                                        ' index=' , index printString ,
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2229
                                        ') in method - please simplify'.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2230
                        ^ #Error
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2231
                    ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2232
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2233
                    self appendByte:index.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2234
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2235
                ] ifFalse:[ (extra == #speciallitS) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2236
                    index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2237
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2238
                    self appendByte:index.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2239
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2240
                ] ifFalse:[ (extra == #speciallitL) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2241
                    index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2242
                    symIndex := symIndex + 2.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2243
                    self appendWord:index.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2244
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2245
                ] ifFalse:[ (extra == #offset) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2246
                    relocInfo at:symIndex put:codeIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2247
                    self addReloc:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2248
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2249
                    self appendByte:0
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2250
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2251
                ] ifFalse:[ (extra == #indexLevel) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2252
                    index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2253
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2254
                    self appendByte:index.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2255
                    level := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2256
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2257
                    self appendByte:level
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2258
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2259
                ] ifFalse:[ (extra == #offsetNvarNarg) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2260
                    relocInfo at:symIndex put:codeIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2261
                    self addReloc:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2262
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2263
                    self appendEmptyByte.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2264
                    nvars := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2265
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2266
                    self appendByte:nvars.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2267
                    level := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2268
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2269
                    self appendByte:level
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2270
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2271
                ] ifFalse:[ (extra == #absoffset) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2272
                    relocInfo at:symIndex put:codeIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2273
                    self addReloc:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2274
                    addr := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2275
                    symIndex := symIndex + 1.
3412
4d45e15e0de8 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  2276
                    self appendWord:addr.
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2277
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2278
                ] ifFalse:[ (extra == #absoffsetNvarNarg) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2279
                    relocInfo at:symIndex put:codeIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2280
                    self addReloc:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2281
                    addr := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2282
                    symIndex := symIndex + 1.
3412
4d45e15e0de8 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  2283
                    self appendWord:addr.
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2284
                    nvars := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2285
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2286
                    self appendByte:nvars.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2287
                    level := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2288
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2289
                    self appendByte:level
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2290
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2291
                ] ifFalse:[ (extra == #special) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2292
                    ((codeSymbol == #send)
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2293
                     or:[codeSymbol == #sendSelf
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2294
                     or:[codeSymbol == #superSend]]) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2295
                        index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2296
                        symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2297
                        nargs := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2298
                        symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2299
                        self appendByte:nargs.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2300
                        self appendByte:index.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2301
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2302
                        (codeSymbol == #superSend) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2303
                            index := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2304
                            symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2305
                            self appendByte:index
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2306
                        ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2307
                        stackDelta := nargs negated.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2308
                        codeSymbol == #sendSelf ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2309
                            stackDelta := stackDelta + 1
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2310
                        ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2311
                    ] ifFalse:[ (codeSymbol == #sendDrop) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2312
                        index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2313
                        symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2314
                        nargs := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2315
                        symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2316
                        self appendByte:nargs.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2317
                        self appendByte:index.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2318
                        stackDelta := (nargs + 1) negated
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2319
                    ]]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2320
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2321
                ] ifFalse:[ (extra == #specialL) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2322
                    ((codeSymbol == #sendL)
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2323
                     or:[codeSymbol == #sendDropL
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2324
                     or:[codeSymbol == #sendSelfL
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2325
                     or:[codeSymbol == #superSendL]]]) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2326
                        index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2327
                        symIndex := symIndex + 2.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2328
                        nargs := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2329
                        symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2330
                        self appendByte:nargs.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2331
                        self appendWord:index.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2332
                        (codeSymbol == #superSendL) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2333
                            index := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2334
                            symIndex := symIndex + 2.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2335
                            self appendWord:index.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2336
                        ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2337
                        stackDelta := nargs negated.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2338
                        codeSymbol == #sendSelfL ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2339
                            stackDelta := stackDelta + 1
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2340
                        ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2341
                    ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2342
                ] ifFalse:[ (extra == #specialSend) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2343
                    index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2344
                    symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2345
                    self appendByte:index.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2346
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2347
                ] ifFalse:[ (extra == #specialVL) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2348
                    ((codeSymbol == #sendVL)
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2349
                     or:[codeSymbol == #superSendVL]) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2350
                        index := nextSym.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2351
                        symIndex := symIndex + 4.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2352
                        nargs := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2353
                        symIndex := symIndex + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2354
                        self appendByte:nargs.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2355
                        self appendLongWord:index.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2356
                        (codeSymbol == #superSendVL) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2357
                            index := symbolicCodeArray at:symIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2358
                            symIndex := symIndex + 4.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2359
                            self appendLongWord:index.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2360
                        ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2361
                        stackDelta := nargs negated.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2362
                    ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2363
                ] ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2364
                    "/ self halt:'internal error'
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2365
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2366
                ]]]]]]]]]]]]]]]]]]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2367
            ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2368
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2369
            stackDepth := stackDepth + stackDelta.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2370
            (stackDepth > maxStackDepth) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2371
                maxStackDepth := stackDepth
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2372
            ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2373
        ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2374
        relocInfo at:symIndex put:codeIndex.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2375
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2376
        needRetry ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2377
            "
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2378
             now relocate - returns true if ok, false if we have to do it again
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2379
             (when short jumps have been changed to long jumps)
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2380
            "
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2381
            relocList notNil ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2382
                needRetry := (self relocateWith:symbolicCodeArray relocInfo:relocInfo) not.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2383
                "
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2384
                 if returned with false, a relative jump was made into
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2385
                 an absolute jump - need to start over with one more byte space
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2386
                "
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2387
                needRetry ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2388
                    relocList := nil.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2389
                    codeSize := codeSize + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2390
                ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2391
            ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2392
        ] ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2393
            'Compiler [info]: compiling again ...' infoPrintCR.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2394
        ]
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
  2395
    ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2396
    "code printNL."
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2397
    ^ errorFlag
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2398
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2399
    "Modified: 3.9.1995 / 12:59:43 / claus"
475
5bce2cf3dadc new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  2400
    "Modified: 10.1.1997 / 15:17:51 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2401
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2402
937
21ca5ab983b7 support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  2403
genSpecialStatement:selector on:codeStream
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2404
    "/ generate: thisContext selector (to force a context).
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2405
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2406
    (StatementNode
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2407
	expression:(UnaryNode receiver:(VariableNode type:#ThisContext context:contextToEvaluateIn)
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2408
			      selector:selector))
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2409
	    codeForSideEffectOn:codeStream inBlock:nil for:self.
937
21ca5ab983b7 support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  2410
!
21ca5ab983b7 support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  2411
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2412
genSymbolicCode
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2413
    "traverse the parse-tree producing symbolicCode - return the codeArray"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2414
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2415
    |codeStream code thisStatement lastStatement|
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2416
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2417
    litArray := nil.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2418
    codeStream := WriteStream on:(OrderedCollection new:100).
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2419
937
21ca5ab983b7 support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  2420
    primitiveContextInfo notNil ifTrue:[
3416
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2421
        (primitiveContextInfo includes:('exception:' -> #unwind)) ifTrue:[
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2422
            self genSpecialStatement:#markForUnwind on:codeStream
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2423
        ].
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2424
        (primitiveContextInfo includes:('exception:' -> #handle)) ifTrue:[
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2425
            self genSpecialStatement:#markForHandle on:codeStream
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2426
        ].
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2427
        (primitiveContextInfo includes:('exception:' -> #raise)) ifTrue:[
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2428
            self genSpecialStatement:#markForRaise on:codeStream
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2429
        ].
937
21ca5ab983b7 support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  2430
    ].
21ca5ab983b7 support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  2431
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2432
    self startCodeGenerationHookOn:codeStream.
1312
3393e713d8e8 preps for special variables
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2433
    self generateVariables:methodVars on:codeStream.
3393e713d8e8 preps for special variables
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2434
3416
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2435
    (tree notNil and:[tree isMethodNode]) ifTrue:[
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2436
        "kludge for VW compat."
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2437
        tree codeForSideEffectOn:codeStream inBlock:nil for:self.
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2438
        lastStatement := tree statements last.
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  2439
    ] ifFalse:[
3416
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2440
        thisStatement := tree.
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2441
        [thisStatement notNil] whileTrue:[
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2442
            lastStatement := thisStatement.
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2443
            thisStatement codeForSideEffectOn:codeStream inBlock:nil for:self.
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2444
            thisStatement := thisStatement nextStatement
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2445
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2446
    ].
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2447
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2448
    (lastStatement isNil or:[lastStatement isReturnNode not])
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2449
    ifTrue:[
3416
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2450
        "not a return - add retSelf"
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2451
        "
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2452
         if the last statement was a send for side-effect,
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2453
         replace the previous drop by a retSelf.
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2454
         In this case we have to keep an extra retSelf bacause
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2455
         it could be a jump target.
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2456
        "
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2457
        (lastStatement notNil
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2458
         and:[(code := codeStream contents) notNil
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2459
         and:[code size > 0
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2460
         and:[code last == #drop]]]) ifTrue:[
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2461
            codeStream backStep.
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2462
            codeStream nextPut:#retSelf
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2463
        ].
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2464
        codeStream nextPut:#retSelf
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2465
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2466
    ^ codeStream contents
328
c63c54ff95d3 Optimize double #retSelf.
Stefan Vogel <sv@exept.de>
parents: 325
diff changeset
  2467
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  2468
    "Modified: / 15-08-1996 / 17:35:02 / stefan"
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  2469
    "Modified: / 06-08-2006 / 15:03:14 / cg"
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
  2470
!
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
  2471
1312
3393e713d8e8 preps for special variables
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2472
generateVariables:varCollection on:codeStream
3393e713d8e8 preps for special variables
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2473
    varCollection isNil ifTrue:[^ self].
3393e713d8e8 preps for special variables
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2474
3393e713d8e8 preps for special variables
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2475
    varCollection do:[:eachVar |
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2476
	eachVar type notNil ifTrue:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2477
	    "/ generate code to set it up.
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2478
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2479
	    (AssignmentNode
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2480
		variable:(self nodeForMethodVariable:eachVar name)
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2481
		expression:(eachVar expressionForSetup))
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2482
		    codeForSideEffectOn:codeStream inBlock:nil for:self.
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2483
	]
1312
3393e713d8e8 preps for special variables
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2484
    ]
3393e713d8e8 preps for special variables
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2485
!
3393e713d8e8 preps for special variables
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2486
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2487
relocateWith:symbolicCodeArray relocInfo:relocInfo
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2488
    "helper for genByteCodeFrom - relocate code using relocInfo.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2489
     if relocation fails badly (due to long relative jumps) patch
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2490
     symbolicCode to use absolute jumps instead and return false
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2491
     (genByteCodeFrom will then try again). Otherwise return true.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2492
     Also, on the fly, jumps to jumps and jumps to return are handled."
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2493
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2494
    |delta       "{Class: SmallInteger }"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2495
     codePos     "{Class: SmallInteger }"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2496
     opCodePos   "{Class: SmallInteger }"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2497
     codeOffset  "{Class: SmallInteger }"
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2498
     symOffset
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2499
     opcode      "{Class: SmallInteger }"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2500
     dstOpcode jumpTarget
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2501
     jumpCode deleteSet|
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2502
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2503
    deleteSet := OrderedCollection new.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2504
    relocList do:[:sIndex |
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2505
        "have to relocate symCode at sIndex ..."
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2506
        symOffset := symbolicCodeArray at:sIndex.   "the target in the symbolic code"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2507
        codePos := relocInfo at:sIndex.             "position of the offet in byte code"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2508
        codeOffset := relocInfo at:symOffset.       "position of the target in byte code"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2509
        delta := codeOffset - codePos - 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2510
        opCodePos := codePos - 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2511
        opcode := codeBytes at:opCodePos.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2512
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2513
        (opcode between:190 and:199) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2514
            "an absolute jump/makeBlock"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2515
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2516
            codeBytes at:codePos put:(codeOffset bitAnd:16rFF).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2517
            codeBytes at:(codePos + 1) put:(codeOffset bitShift:-8)
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2518
        ] ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2519
            "get jump-code from long and vlong codes"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2520
            (opcode between:50 and:59) ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2521
                (opcode between:60 and:69) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2522
                    opcode := opcode - 10
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2523
                ] ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2524
                    (opcode between:70 and:79) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2525
                        opcode := opcode - 20
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2526
                    ] ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2527
                        self codeGeneratorError:'invalid code to relocate'
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2528
                    ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2529
                ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2530
            ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2531
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2532
            "optimize jump to return and jump to jump"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2533
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2534
            (opcode == 54) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2535
                "a jump"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2536
                dstOpcode := symbolicCodeArray at:symOffset.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2537
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2538
                (#(retSelf retTop retNil retTrue retFalse ret0 "blockRetTop") includes:dstOpcode) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2539
                    "a jump to a return - put in the return instead jump"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2540
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2541
                    symbolicCodeArray at:(sIndex - 1) put:dstOpcode.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2542
                    symbolicCodeArray at:sIndex put:dstOpcode.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2543
                    codeBytes at:opCodePos put:(self byteCodeFor:dstOpcode).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2544
                    delta := 0.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2545
                    deleteSet add:sIndex.
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2546
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2547
"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2548
'jump to return at: ' print. (sIndex - 1) printNL.
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2549
"
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2550
                ] ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2551
                    (dstOpcode == #jump) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2552
                        "jump to jump to be done soon"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2553
                        jumpTarget := symbolicCodeArray at:(symOffset + 1).
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2554
"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2555
'jump to jump at: ' print. (sIndex - 1) print.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2556
'  newTarget:' print. jumpTarget printNL.
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2557
"
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2558
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2559
                        symbolicCodeArray at:sIndex put:jumpTarget.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2560
                        symOffset := jumpTarget.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2561
                        codeOffset := relocInfo at:symOffset.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2562
                        delta := codeOffset - codePos - 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2563
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2564
                        "continue with new delta"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2565
                    ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2566
                ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2567
            ].
3416
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2568
            (#[50 51 52 53 56 57 58 59] includes:opcode) ifTrue:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2569
                "a conditional jump"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2570
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2571
                dstOpcode := symbolicCodeArray at:symOffset.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2572
                (dstOpcode == #jump) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2573
                    "conditional jump to unconditional jump"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2574
                    jumpTarget := symbolicCodeArray at:(symOffset + 1).
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2575
"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2576
'cond jump to jump at: ' print. (sIndex - 1) print.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2577
'  newTarget:' print. jumpTarget printNL.
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2578
"
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2579
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2580
                    symbolicCodeArray at:sIndex put:jumpTarget.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2581
                    symOffset := jumpTarget.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2582
                    codeOffset := relocInfo at:symOffset.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2583
                    delta := codeOffset - codePos - 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2584
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2585
                    "continue with new delta"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2586
                ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2587
            ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2588
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2589
            (delta >= 0) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2590
                (delta > 127) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2591
                    (opcode between:50 and:59) ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2592
                        self codeGeneratorError:'invalid code to relocate'
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2593
                    ] ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2594
                        (delta > 255) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2595
                            "change jmp into vljmp ..."
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2596
                            codeBytes at:opCodePos put:(opcode + 20).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2597
                            delta := delta - 256
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2598
                        ] ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2599
                            "change jmp into ljmp ..."
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2600
                            codeBytes at:opCodePos put:(opcode + 10).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2601
                            delta := delta - 128
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2602
                        ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2603
                        (delta > 127) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2604
                            "change symbolic into a jump absolute and fail"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2605
                            jumpCode := symbolicCodeArray at:(sIndex - 1).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2606
                            symbolicCodeArray at:(sIndex - 1) put:(self absJumpFromJump:jumpCode).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2607
                            symbolicCodeArray at:sIndex put:symOffset.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2608
"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2609
'change short into abs jump' printNL.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2610
"
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2611
                            deleteSet do:[:d | relocList remove:d].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2612
                            ^ false
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2613
                        ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2614
                    ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2615
                ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2616
                codeBytes at:codePos put:delta
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2617
            ] ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2618
                (delta < -128) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2619
                    (opcode between:50 and:59) ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2620
                        self codeGeneratorError:'invalid code to relocate'
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2621
                    ] ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2622
                        (delta < -256) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2623
                            "change jmp into vljmp ..."
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2624
                            codeBytes at:opCodePos put:(opcode + 20).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2625
                            delta := delta + 256
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2626
                        ] ifFalse:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2627
                            "change jmp into ljmp ..."
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2628
                            codeBytes at:opCodePos put:(opcode + 10).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2629
                            delta := delta + 128
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2630
                        ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2631
                        (delta < -128) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2632
                            "change symbolic into a jump absolute and fail"
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2633
                            jumpCode := symbolicCodeArray at:(sIndex - 1).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2634
                            symbolicCodeArray at:(sIndex - 1) put:(self absJumpFromJump:jumpCode).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2635
                            symbolicCodeArray at:sIndex put:symOffset.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2636
"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2637
'change short into abs jump' printNL.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2638
"
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2639
                            deleteSet do:[:d | relocList remove:d].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2640
                            ^ false
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2641
                        ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2642
                    ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2643
                ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2644
                codeBytes at:codePos put:(256 + delta)
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2645
            ]
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2646
        ]
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2647
    ].
3451
3bf71ab30730 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3436
diff changeset
  2648
    self errorFlag ifTrue:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2649
        self codeGeneratorError:'relocation range error'
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2650
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 137
diff changeset
  2651
    ^ true
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2652
! !
49
02660b790c3e *** empty log message ***
claus
parents: 46
diff changeset
  2653
556
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2654
!ByteCodeCompiler methodsFor:'code generation helpers'!
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2655
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2656
absJumpFromJump:code
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2657
    "given a jump-symbolic code, return corresponding absolute jump"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2658
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2659
    JumpToAbsJump isNil ifTrue:[
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2660
	JumpToAbsJump := IdentityDictionary new.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2661
	JumpToAbsJump at:#jump put:#jumpabs.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2662
	JumpToAbsJump at:#trueJump put:#trueJumpabs.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2663
	JumpToAbsJump at:#falseJump put:#falseJumpabs.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2664
	JumpToAbsJump at:#nilJump put:#nilJumpabs.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2665
	JumpToAbsJump at:#notNilJump put:#notNilJumpabs.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2666
	JumpToAbsJump at:#eqJump put:#eqJumpabs.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2667
	JumpToAbsJump at:#notEqJump put:#notEqJumpabs.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2668
	JumpToAbsJump at:#zeroJump put:#zeroJumpabs.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2669
	JumpToAbsJump at:#notZeroJump put:#notZeroJumpabs.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2670
	JumpToAbsJump at:#makeBlock put:#makeBlockabs.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2671
    ].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2672
    ^ JumpToAbsJump at:code
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2673
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2674
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2675
addLiteral:anObject
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2676
    "add a literal to the literalArray - watch for and eliminate
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2677
     duplicates. return the index of the literal in the Array"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2678
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2679
    |index oldLit class sharable sharableValue|
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2680
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2681
    litArray isNil ifTrue:[
2337
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2682
        litArray := OrderedCollection with:anObject.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2683
        ^ 1
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2684
    ].
1798
9491f62eac86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  2685
1810
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2686
    sharable := sharableValue := false.
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2687
    class := anObject class.
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2688
    class == Symbol
2337
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2689
        ifTrue:[ sharable := true ]
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2690
        ifFalse:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2691
            ((class == String) or:[class == Array or:[class == ByteArray]]) ifTrue:[
3416
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  2692
                anObject isEmpty ifTrue:[
2337
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2693
                    sharable := true
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2694
                ]
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2695
            ] ifFalse:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2696
                ((class == Float) or:[class == Fraction or:[class == LargeInteger]]) ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2697
                    sharableValue := true
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2698
                ]
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2699
            ]
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2700
        ].
1810
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2701
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2702
    (sharable not and:[sharableValue not]) ifTrue:[
2337
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2703
        litArray add:anObject.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2704
        index := litArray size.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2705
        ^ index.
1810
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2706
    ].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2707
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2708
    "/ searching a dictionary is *much* faster; the code below starts to
1798
9491f62eac86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  2709
    "/ keep track of literals whenever we have collected more than a threshold
9491f62eac86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  2710
    allLiterals notNil ifTrue:[
2337
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2711
        sharable ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2712
            index := allLiterals at:anObject ifAbsent:nil.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2713
            index isNil ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2714
                litArray add:anObject.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2715
                index := litArray size.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2716
                allLiterals at:anObject put:index.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2717
                ^ index.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2718
            ].
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2719
            (litArray at:index) class ~~ anObject class ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2720
                index := nil.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2721
            ].
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2722
        ].
1798
9491f62eac86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  2723
    ].
1810
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2724
    index isNil ifTrue:[
2337
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2725
        index := litArray identityIndexOf:anObject.
1810
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2726
    ].
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2727
    (index == 0) ifTrue:[
2337
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2728
        "
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2729
         reuse constants if same value and same class
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2730
        "
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2731
        ((class == Float)
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2732
        or:[class == Fraction
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2733
        or:[class == LargeInteger
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2734
        "or:[class == String] --only if literalString option has been added---" ]]) ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2735
            index := litArray indexOf:anObject.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2736
            index ~~ 0 ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2737
                oldLit := litArray at:index.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2738
                oldLit class == class ifFalse:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2739
                    index := 0.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2740
                ] ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2741
                    "/ dont mess up negative with positive zeros
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2742
                    anObject = 0.0 ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2743
                        anObject isNegativeZero ~~ oldLit isNegativeZero ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2744
                            index := 0
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2745
                        ]
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2746
                    ]
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2747
                ].
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2748
            ].
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2749
        ].
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2750
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2751
        "
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2752
         reuse empty collection literals
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2753
        "
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2754
        ((class == String) or:[class == Array or:[class == ByteArray]]) ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2755
            anObject size == 0 ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2756
                index := litArray indexOf:anObject.
2338
ee3c4b35ad49 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2337
diff changeset
  2757
                index ~~ 0 ifTrue:[
ee3c4b35ad49 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2337
diff changeset
  2758
                    oldLit := litArray at:index.
ee3c4b35ad49 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2337
diff changeset
  2759
                    oldLit class == class ifFalse:[
ee3c4b35ad49 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2337
diff changeset
  2760
                        index := 0.
ee3c4b35ad49 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2337
diff changeset
  2761
                    ]
2337
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2762
                ]
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2763
            ]
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2764
        ].
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2765
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2766
        (index == 0) ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2767
            litArray add:anObject.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2768
            index := litArray size.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2769
            index > 30 ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2770
                allLiterals isNil ifTrue:[
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2771
                    allLiterals := Dictionary new.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2772
                    litArray keysAndValuesDo:[:idx :lit | allLiterals at:lit put:idx].
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2773
                ].
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2774
                allLiterals at:anObject put:index.
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2775
            ].
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  2776
        ].
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2777
    ].
1798
9491f62eac86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  2778
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2779
    ^ index
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2780
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2781
    "Modified: / 12.11.1997 / 18:49:43 / cg"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2782
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2783
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2784
addReloc:symIndex
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2785
    "remember to relocate offset at symIndex later ..."
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2786
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2787
    relocList isNil ifTrue:[
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2788
	relocList := OrderedCollection new.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2789
    ].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2790
    relocList add:symIndex
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2791
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2792
556
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2793
addTempVar
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2794
    "add a temporary variable; return its position (1-based).
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2795
     Used when a block with args/locals is inlined."
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2796
558
e7ecd861b86f preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  2797
    numTemp isNil ifTrue:[numTemp := maxNumTemp := 0].
e7ecd861b86f preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  2798
    numTemp := numTemp + 1.
e7ecd861b86f preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  2799
    maxNumTemp := maxNumTemp max:numTemp.
560
9311c79529d4 inline blocks withs args/vars
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  2800
    ^ numTemp + methodVars size
9311c79529d4 inline blocks withs args/vars
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  2801
9311c79529d4 inline blocks withs args/vars
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  2802
    "Modified: 26.6.1997 / 10:22:23 / cg"
556
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2803
!
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2804
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2805
appendByte:aByte
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2806
    "append a byte to the code-Array, checking for byte-range (debug-only)"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2807
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2808
    |idx "{Class: SmallInteger }"|
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2809
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2810
    idx := codeIndex.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2811
    (aByte between:0 and:255) ifTrue:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2812
        codeBytes at:idx put:aByte.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2813
        codeIndex := idx + 1
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2814
    ] ifFalse:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2815
        self codeGeneratorError:'byte range error'.
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2816
    ]
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2817
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2818
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2819
appendByteCodeFor:codeSymbol
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2820
    "append the byteCode for an instructionSymbol to the code-Array"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2821
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2822
    |idx "{Class: SmallInteger }"|
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2823
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2824
    idx := codeIndex.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2825
    codeBytes at:idx put:(self byteCodeFor:codeSymbol).
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2826
    codeIndex := idx + 1
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2827
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2828
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2829
appendEmptyByte
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2830
    "append an empty byte to the code-Array"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2831
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2832
    |idx "{Class: SmallInteger }"|
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2833
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2834
    idx := codeIndex.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2835
    codeBytes at:idx put:0.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2836
    codeIndex := idx + 1
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2837
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2838
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2839
appendEmptyLong
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2840
    "append an empty long (4 bytes) to the code-Array"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2841
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2842
    |idx "{Class: SmallInteger }"|
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2843
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2844
    idx := codeIndex.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2845
    codeBytes at:idx put:0.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2846
    codeBytes at:idx+1 put:0.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2847
    codeBytes at:idx+2 put:0.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2848
    codeBytes at:idx+3 put:0.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2849
    codeIndex := idx + 4
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2850
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2851
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2852
appendEmptyShort
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2853
    "append an empty short (2 bytes) to the code-Array"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2854
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2855
    |idx "{Class: SmallInteger }"|
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2856
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2857
    idx := codeIndex.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2858
    codeBytes at:idx put:0.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2859
    codeBytes at:idx+1 put:0.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2860
    codeIndex := idx + 2
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2861
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2862
1792
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  2863
appendLongWord:aWord
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2864
    "append an unsigned long word (low-high) to the code-Array,
1792
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  2865
     checking for long word-range (debug-only)"
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  2866
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  2867
    |idx "{Class: SmallInteger }"|
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  2868
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  2869
    idx := codeIndex.
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  2870
    (aWord between:0 and:16rFFFFFFFF) ifTrue:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2871
        codeBytes at:idx put:(aWord bitAnd:16rFF).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2872
        idx := idx + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2873
        codeBytes at:idx put:((aWord bitShift:-8) bitAnd:16rFF).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2874
        idx := idx + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2875
        codeBytes at:idx put:((aWord bitShift:-16) bitAnd:16rFF).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2876
        idx := idx + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2877
        codeBytes at:idx put:((aWord bitShift:-24) bitAnd:16rFF).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2878
        codeIndex := idx + 1
1792
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  2879
    ] ifFalse:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2880
        self codeGeneratorError:'long word range error'.
1792
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  2881
    ]
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  2882
!
87315c3bd290 preps for vl literals
Claus Gittinger <cg@exept.de>
parents: 1790
diff changeset
  2883
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2884
appendSignedByte:aByte
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2885
    "append a signedbyte (as in jump-offsets) to the code-Array,
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2886
     check range and report an error if invalid"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2887
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2888
    |b   "{Class: SmallInteger }"
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2889
     idx "{Class: SmallInteger }"|
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2890
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2891
    idx := codeIndex.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2892
    b := aByte.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2893
    (b >= 0) ifTrue:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2894
        (b > 127) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2895
            self codeGeneratorError:'jump-range error'.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2896
        ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2897
        codeBytes at:idx put:b
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2898
    ] ifFalse:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2899
        (b < -128) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2900
            self codeGeneratorError:'jump-range error'.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2901
        ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2902
        b := 256 + b
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2903
    ].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2904
    codeBytes at:idx put:b.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2905
    codeIndex := idx + 1
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2906
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2907
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2908
appendSignedWord:aWord
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2909
    "append a signed word to the code-Array,
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2910
     check range and report an error if invalid"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2911
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2912
    |w   "{Class: SmallInteger }"|
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2913
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2914
    w := aWord.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2915
    (w >= 0) ifTrue:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2916
        (w > 16r7FFFF) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2917
            self codeGeneratorError:'word-range error'.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2918
        ].
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2919
    ] ifFalse:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2920
        (w < 16r-8000) ifTrue:[
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2921
            self codeGeneratorError:'word-range error'.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2922
        ].
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2923
        w := (16r10000 + w).
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2924
    ].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2925
    self appendWord:w
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2926
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2927
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2928
appendWord:aWord
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  2929
    "append an unsigned word (low-high) to the code-Array,
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2930
     checking for word-range (debug-only)"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2931
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2932
    |idx "{Class: SmallInteger }"|
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2933
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2934
    idx := codeIndex.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2935
    (aWord between:0 and:16rFFFF) ifTrue:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2936
        codeBytes at:idx put:(aWord bitAnd:16rFF).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2937
        idx := idx + 1.
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2938
        codeBytes at:idx put:(aWord bitShift:-8).
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2939
        codeIndex := idx + 1
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2940
    ] ifFalse:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  2941
        self codeGeneratorError:'word range error'.
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2942
    ]
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2943
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2944
1999
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2945
nameSpaceSelectorFor:aSymbol
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2946
    "Caring for the current namespace, return the real selector used for a send."
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2947
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2948
    |ns usedSym|
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2949
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2950
    usedSym := aSymbol.
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2951
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2952
    Smalltalk hasSelectorNameSpaces ifTrue:[
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2953
        ns := self currentNameSpace.
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2954
        (ns notNil and:[ns ~~ Smalltalk]) ifTrue:[
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2955
            usedSym := (':',ns name,'::',aSymbol) asSymbol.
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2956
            Transcript showCR:'compile ',aSymbol,' as ',usedSym.
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2957
        ].
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2958
    ].
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2959
    ^ usedSym.
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2960
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2961
    "Created: / 05-03-2007 / 13:28:59 / cg"
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2962
!
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  2963
556
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2964
removeTempVar
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2965
    "remove a temporary variable"
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2966
558
e7ecd861b86f preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  2967
    numTemp := numTemp - 1
556
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2968
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2969
    "Created: 25.6.1997 / 14:03:00 / cg"
558
e7ecd861b86f preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  2970
    "Modified: 25.6.1997 / 15:06:10 / cg"
556
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2971
! !
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2972
2714
8137c609a40e comments
Claus Gittinger <cg@exept.de>
parents: 2623
diff changeset
  2973
!ByteCodeCompiler methodsFor:'code generation hooks'!
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2974
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2975
startCodeGenerationHookOn:codeStream
2714
8137c609a40e comments
Claus Gittinger <cg@exept.de>
parents: 2623
diff changeset
  2976
    "invoked before code is generated;
8137c609a40e comments
Claus Gittinger <cg@exept.de>
parents: 2623
diff changeset
  2977
     gives subclasses a chance to prepare and to inject code to be
8137c609a40e comments
Claus Gittinger <cg@exept.de>
parents: 2623
diff changeset
  2978
     executed on entry (instrumentation)"
8137c609a40e comments
Claus Gittinger <cg@exept.de>
parents: 2623
diff changeset
  2979
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2980
    "intentionally left blank - hook for subclasses"
2714
8137c609a40e comments
Claus Gittinger <cg@exept.de>
parents: 2623
diff changeset
  2981
8137c609a40e comments
Claus Gittinger <cg@exept.de>
parents: 2623
diff changeset
  2982
    "Modified (comment): / 30-09-2011 / 12:16:40 / cg"
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2983
! !
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2984
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  2985
!ByteCodeCompiler methodsFor:'compilation'!
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  2986
2735
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2987
compile:aString forClass:aClass inCategory:cat
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2988
    "compile a source-string for a method in classToCompileFor.
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2989
     The method will get cat as category.
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2990
     Returns the new method, #Error or nil."
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2991
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2992
    ^ self
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2993
        compile:aString
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2994
        forClass:aClass
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2995
        inCategory:cat
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2996
        notifying:nil
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2997
        install:true
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2998
        skipIfSame:false
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2999
        silent:false
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3000
        foldConstants:true
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3001
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3002
    "Created: / 30-09-2011 / 12:44:50 / cg"
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3003
!
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3004
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3005
compile:aStringArg forClass:aClassArg inCategory:cat notifying:aRequestor
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3006
                 install:install skipIfSame:skipIfSame silent:silent foldConstants:fold
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3007
3532
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3008
    aRequestor notNil ifTrue:[
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3009
        ^ self
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3010
            compile:aStringArg 
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3011
            forClass:aClassArg 
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3012
            inCategory:cat 
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3013
            notifying:aRequestor
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3014
            install:install 
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3015
            skipIfSame:skipIfSame 
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3016
            silent:silent 
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3017
            foldConstants:fold
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3018
            ifFail:nil
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3019
    ].
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3020
1459
f6ea05913a60 compatible interface
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3021
    ^ self
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3022
        compile:aStringArg 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3023
        forClass:aClassArg 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3024
        inCategory:cat 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3025
        notifying:aRequestor
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3026
        install:install 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3027
        skipIfSame:skipIfSame 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3028
        silent:silent 
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3029
        foldConstants:fold
3532
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3030
        ifFail:[:exOrNil |
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3031
                 exOrNil notNil ifTrue:[
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3032
                    ParseError new
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3033
                        errorMessage:(exOrNil errorMessage) startPosition:(exOrNil startPosition) endPosition:(exOrNil endPosition);
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3034
                        parameter:exOrNil parameter;
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3035
                        lineNumber:exOrNil lineNumber;
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3036
                        raiseRequest.
3580
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3037
                 ] ifFalse:[
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3038
                     ParseError raiseRequestErrorString:'compilation failed'. #Error 
3532
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3039
                 ].
3580
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3040
                 (install and:[selector notNil]) ifTrue:[
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3041
                     |newMethod|
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3042
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3043
                      "/ if proceeded, install a trap method
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3044
                     newMethod := (Method trapMethodForNumArgs:selector numArgs) copy.
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3045
                     newMethod mclass:nil; setPackage:nil.
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3046
                     newMethod makeInvalid.
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3047
                     newMethod source:aStringArg.
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3048
                     aClassArg basicAddSelector:selector withMethod:newMethod
6a02c462b0ec class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
  3049
                 ].
3532
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3050
        ]
2469
ac59d3aa4a61 changed:
Claus Gittinger <cg@exept.de>
parents: 2462
diff changeset
  3051
ac59d3aa4a61 changed:
Claus Gittinger <cg@exept.de>
parents: 2462
diff changeset
  3052
    "Modified: / 18-01-2011 / 11:35:21 / cg"
1459
f6ea05913a60 compatible interface
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3053
!
f6ea05913a60 compatible interface
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3054
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3055
compile:sourceCodeStringArg forClass:aClassArg inCategory:cat notifying:aRequestor
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3056
                install:install skipIfSame:skipIfSame silent:silent foldConstants:fold
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3057
                ifFail:failBlock
1459
f6ea05913a60 compatible interface
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3058
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3059
    "the basic workhorse method for compiling:
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3060
     compile a source-string for a method in classToCompileFor.
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3061
     errors are forwarded to requestor
1459
f6ea05913a60 compatible interface
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3062
     (report on Transcript and return the value of failBlock, if requestor is nil).
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3063
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3064
     The new method will get cat as category.
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3065
     If install is true, the method will go into the classes method-table,
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3066
     otherwise the method is simply returned (for anonymous methods).
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3067
     If skipIsSame is true, and the source is the same as an existing
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3068
     methods source, this is a noop (for fast fileIn).
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3069
     The argument, silent controls if errors are to be reported.
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3070
     Returns the method, #Error or nil."
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3071
1984
1a5b562ddf42 Make code more readable
Stefan Vogel <sv@exept.de>
parents: 1955
diff changeset
  3072
    |newMethod tree symbolicCodeArray oldMethod silencio newSource primNr keptOldCode answer
1999
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  3073
     aClass sourceCodeString hasErrorInMethodHeader oldCategory newCategory oldPackage 
3681
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
  3074
     newPackage installSelector ns dialogText failureReason annotationCategory|
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3075
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3076
    aClass := aClassArg.
1730
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3077
    sourceCodeString := sourceCodeStringArg.
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3078
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3079
    sourceCodeString isNil ifTrue:[^ nil].
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3080
    silencio := silent
1984
1a5b562ddf42 Make code more readable
Stefan Vogel <sv@exept.de>
parents: 1955
diff changeset
  3081
                or:[Smalltalk silentLoading
1a5b562ddf42 Make code more readable
Stefan Vogel <sv@exept.de>
parents: 1955
diff changeset
  3082
                or:[ListCompiledMethods not]].
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3083
3284
2fc49e86930e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3281
diff changeset
  3084
    "/ when a correction has been made, this signal is raised to try again    
3397
0638d768ec54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3393
diff changeset
  3085
    self class restartCompilationSignal handle:[:ex |
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3086
        "/ class could have changed ...
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3087
        aClass := self classToCompileFor.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3088
        sourceCodeString := self correctedSource ? sourceCodeStringArg.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3089
        methodArgs := methodArgNames := methodVars := methodVarNames := nil.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3090
        usedInstVars := usedClassVars := usedVars := nil.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3091
        modifiedInstVars := modifiedClassVars := modifiedGlobals := nil.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3092
        currentBlock := nil.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3093
        ex restart
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3094
    ] do:[
3531
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3095
        ParseError handle:[:ex |
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3096
            failBlock isNil ifTrue:[
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3097
                ex reject
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3098
            ].
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3099
            self showErrorMessageForClass:aClass.
3532
cf71c91f5b7e class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3531
diff changeset
  3100
            ^ failBlock valueWithOptionalArgument:ex.
3531
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3101
        ] do:[
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3102
            "create a compiler, let it parse and create the parsetree"
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3103
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3104
            self source:(ReadStream on:sourceCodeString string).
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3105
            self nextToken.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3106
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3107
            self setClassToCompileFor:aClass.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3108
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3109
            self parseForCode.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3110
            fold ifFalse:[self foldConstants:nil].
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3111
            self notifying:aRequestor.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3112
            silent ifTrue:[
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3113
                "/ self ignoreErrors:true.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3114
                self ignoreWarnings:true.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3115
                self warnUndeclared:false.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3116
            ].
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3117
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3118
            hasErrorInMethodHeader := (self parseMethodSpec == #Error).
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3119
            hasErrorInMethodHeader ifTrue:[
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3120
                self parseError:'syntax error in method specification'.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3121
                tree := #Error.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3122
            ] ifFalse:[
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3123
                tree := self parseMethodBody.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3124
                tree == #Error ifFalse:[
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3125
                    self checkForEndOfInput.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3126
                    self tree:tree.
94f9fcb3672f class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  3127
                ].
3043
9a514612b3ea class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 2938
diff changeset
  3128
            ].
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3129
        ].
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3130
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3131
1730
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3132
    hasErrorInMethodHeader ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3133
        self showErrorMessageForClass:aClass.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3134
        ^ failBlock value.
1730
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3135
    ].
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3136
1378
01bd44f4360c allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  3137
    (aClass notNil and:[selector notNil]) ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3138
        oldMethod := aClass compiledMethodAt:selector.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3139
        oldMethod notNil ifTrue:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3140
            oldCategory := oldMethod category.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3141
            oldPackage  := oldMethod package.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3142
        ].
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3143
    ].
1730
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3144
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3145
    (aClass notNil and:[aClass owningClass notNil
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3146
     and:[parserFlags allowExtensionsToPrivateClasses not]]) ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3147
        "inherit private classe's package from owning class"
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3148
        newPackage := aClass owningClass package
1730
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3149
    ] ifFalse:[
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3150
        (aRequestor respondsTo:#packageToInstall) ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3151
            "if there is an requestor who knows about the package, use it"
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3152
            newPackage := aRequestor packageToInstall
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3153
        ] ifFalse:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3154
            "if noone answers our package query, do not use the default
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3155
             but use an existing method's package instead"
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3156
            (oldPackage isNil or:[Class packageQuerySignal isHandled]) ifTrue:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3157
                newPackage := Class packageQuerySignal query.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3158
            ] ifFalse:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3159
                newPackage := oldPackage.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3160
            ].
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3161
        ].
1730
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3162
    ].
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3163
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3164
    newCategory := cat.
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3165
    newCategory isNil ifTrue:[
3281
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  3166
        newCategory := oldCategory ? (self class asYetUncategorizedMethodCategory).
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3167
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3168
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3169
    "check if same source"
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3170
    (skipIfSame and:[oldMethod notNil and:[oldMethod source = sourceCodeString]]) ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3171
        oldMethod isInvalid ifFalse:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3172
            silencio ifFalse:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3173
                Transcript showCR:('    unchanged: ',aClass name,' ',selector)
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3174
            ].
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3175
            "
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3176
             same. however, category may be different
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3177
            "
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3178
            (newCategory ~= oldCategory) ifTrue:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3179
                oldMethod category:newCategory.
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3180
"/                                aClass updateRevisionString.
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3181
                silencio ifFalse:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3182
                    Transcript showCR:('    (category change only)')
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3183
                ].
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3184
            ].
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3185
            "
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3186
             and package may be too.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3187
            "
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3188
            (newPackage notNil and:[newPackage ~~ oldPackage]) ifTrue:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3189
                oldMethod package:newPackage.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3190
                silencio ifFalse:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3191
                    Transcript showCR:('    (package-id change only)')
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3192
                ].
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3193
            ].
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3194
            ^ oldMethod
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3195
        ]
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3196
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3197
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3198
    (self errorFlag or:[tree == #Error]) ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3199
        "error in method body"
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3200
        self showErrorMessageForClass:aClass.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3201
        ^ failBlock value
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3202
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3203
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3204
    "if no error and also no selector ..."
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3205
    selector isNil ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3206
        "... it was just a comment or other empty stuff"
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3207
        ^ nil
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3208
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3209
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3210
    "
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3211
     freak-out support for inline C-code...
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3212
    "
2936
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3213
    NewPrimitives ifFalse:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3214
        ((self hasNonOptionalPrimitiveCode
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3215
          or:[(self hasPrimitiveCode and:[self class canCreateMachineCode])
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3216
          or:[ParserFlags stcCompilation == #always and:[selector ~~ #doIt]]])
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3217
         and:[(ParserFlags stcCompilation ~~ #never)]) ifTrue:[
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  3218
            ParseError handle:[:ex |
2936
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3219
                ex lineNumber notNil ifTrue:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3220
                    self parseError:(ex description) line:ex lineNumber.
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3221
                ] ifFalse:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3222
                    self parseError:(ex description) position:1.
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3223
                ].
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3224
                newMethod := #Error.
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3225
            ] do:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3226
                newMethod :=
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3227
                    (STCCompilerInterface new
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3228
                            originator:self;
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3229
                            parserFlags:parserFlags)
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3230
                        compileToMachineCode:sourceCodeString
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3231
                        forClass:aClass
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3232
                        selector:selector
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3233
                        inCategory:cat
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3234
                        notifying:aRequestor
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3235
                        install:install
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3236
                        skipIfSame:skipIfSame
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3237
                        silent:silent.
2462
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3238
            ].
2936
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3239
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3240
            newMethod == #Error ifTrue:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3241
                self showErrorMessageForClass:aClass.
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3242
                "/^ failBlock value
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3243
            ].
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3244
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3245
            (newMethod == #CannotLoad or:[newMethod == #Error]) ifTrue:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3246
                failureReason := newMethod.
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3247
                newMethod := self trappingStubMethodFor:sourceCodeString inCategory:newCategory.
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3248
                newMethod setPackage:newPackage.
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3249
                keptOldCode := false.
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3250
                install ifTrue:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3251
                    "/
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3252
                    "/ be very careful with existing methods
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3253
                    "/ (otherwise, you could easily make your system unusable in systems which cannot load)
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3254
                    "/
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3255
                    (oldMethod notNil and:[oldMethod code ~= newMethod code]) ifTrue:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3256
                        failureReason == #Error ifTrue:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3257
                            dialogText :=     
2462
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3258
'STC-compilation of ''%1>>%2''
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3259
to machine code failed .
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3260
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3261
Shall I use the old methods functionality
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3262
or instead create a dummy trap method for it ?
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3263
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3264
Hint:
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3265
  if that method is needed by the system, you better leave the
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3266
  original functionality in the system.
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3267
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3268
Close this warnBox to abort the compilation.
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3269
'
2936
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3270
                        ] ifFalse:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3271
                            dialogText :=     
2462
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3272
'installation of binary code for ''%1>>%2''
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3273
is not possible or disabled.
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3274
3514
51d1435bab3b class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  3275
Shall I use the old method''s functionality
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3276
or instead create a dummy trap method for it ?
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3277
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3278
Hint:
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3279
  if that method is needed by the system, you better leave the
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3280
  original functionality in the system.
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3281
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3282
Close this warnBox to abort the compilation.
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3283
'
2936
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3284
                        ].
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3285
                        answer := Dialog
3514
51d1435bab3b class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  3286
                                     confirmWithCancel:(dialogText bindWith:aClass name allBold with:selector allBold)
51d1435bab3b class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3451
diff changeset
  3287
                                     labels:#('Cancel' 'Keep Old' 'Trap Code')
2936
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3288
                                     default:2.
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3289
                        answer isNil ifTrue:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3290
                            ^ failBlock value
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3291
                        ].
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3292
                        answer == false ifTrue:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3293
                            newMethod code:(oldMethod code).
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3294
                            keptOldCode := true.
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3295
                        ].
2462
02ed895be692 changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Stefan Vogel <sv@exept.de>
parents: 2428
diff changeset
  3296
                    ].
2936
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3297
                    aClass addSelector:selector withMethod:newMethod
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3298
                ].
3112
c74a0f996470 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3071
diff changeset
  3299
                (install or:[failureReason ~~ #CannotLoad]) ifTrue:[
c74a0f996470 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3071
diff changeset
  3300
                    "when compiling with STC andn install is false, #CannotLoad is always returned"
c74a0f996470 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3071
diff changeset
  3301
                    self showErrorNotification:(keptOldCode
c74a0f996470 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3071
diff changeset
  3302
                                                    ifTrue:['not really compiled - method still shows previous behavior']
c74a0f996470 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3071
diff changeset
  3303
                                                    ifFalse:['not compiled to machine code - created a stub instead.'])
c74a0f996470 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3071
diff changeset
  3304
                ].
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3305
            ].
2936
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3306
            ^ newMethod
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3307
        ].
2936
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3308
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3309
        self hasNonOptionalPrimitiveCode ifTrue:[
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3310
            "/
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3311
            "/ generate a trapping method, if primitive code is present
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3312
            "/
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3313
            newMethod := self trappingStubMethodFor:sourceCodeString inCategory:newCategory.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3314
            install ifTrue:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3315
                aClass addSelector:selector withMethod:newMethod.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3316
            ].
2938
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3317
            self showErrorNotification:'not compiled to machine code - installed a stub instead.'.
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3318
            ^ newMethod
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3319
        ].
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3320
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3321
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3322
    primNr := self primitiveNumber.
1730
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3323
    (NewPrimitives or:[primNr isNil]) ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3324
        "
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3325
         produce symbolic code first
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3326
        "
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3327
        symbolicCodeArray := self genSymbolicCode.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3328
        (symbolicCodeArray == #Error) ifTrue:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3329
            self showErrorNotification:'translation error'.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3330
            ^ failBlock value
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3331
        ].
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3332
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3333
        "
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3334
         take this, producing bytecode
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  3335
         (machine code will be made by the VM when first called)
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3336
        "
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3337
        ((self genByteCodeFrom:symbolicCodeArray) == #Error) ifTrue:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3338
            self showErrorNotification:'relocation error - code must be simplified'.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3339
            ^ failBlock value
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3340
        ].
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3341
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3342
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3343
    "
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3344
     finally create the new method-object
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3345
    "
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3346
    newMethod := self createMethod.
1730
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3347
    NewPrimitives ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3348
        newMethod byteCode:(self code).
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3349
        primNr isNil ifTrue:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3350
            self hasNonOptionalPrimitiveCode ifTrue:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3351
                primNr := 0.
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3352
            ]
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3353
        ].
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3354
        primNr notNil ifTrue:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3355
            newMethod setPrimitiveNumber:primNr
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3356
        ]
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3357
    ] ifFalse:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3358
        primNr notNil ifTrue:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3359
            newMethod code:(self checkForPrimitiveCode:primNr).
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3360
        ] ifFalse:[
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3361
            newMethod byteCode:(self code).
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3362
        ].
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3363
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3364
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3365
    "
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3366
     if there where any corrections, install the updated source
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3367
    "
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3368
    (newSource := self correctedSource) isNil ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3369
        newSource := sourceCodeString string.
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3370
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3371
    (newSource includes:Character return) ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3372
        "/ see if it contains crlf's or only cr's
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3373
        newSource := self class stringWithSimpleCRs:newSource
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3374
    ].
3178
24c2aa0da075 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3169
diff changeset
  3375
    newMethod source:newSource string.
3681
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
  3376
    (newMethod hasAnnotation: #'category:') ifTrue:[
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
  3377
        annotationCategory := (newMethod annotationAt:#'category:') argumentAt:1.
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
  3378
        annotationCategory isString ifTrue:[
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
  3379
            newCategory := annotationCategory
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
  3380
        ].
4db107dbec8a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3661
diff changeset
  3381
    ].
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3382
    newMethod setCategory:newCategory.
1730
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3383
    newMethod setPackage:newPackage.
f8121ec9a7dd Keep package when recompiling an existant method and no explicit
Stefan Vogel <sv@exept.de>
parents: 1671
diff changeset
  3384
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3385
    (self contextMustBeReturnable) ifTrue:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3386
        newMethod contextMustBeReturnable:true
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3387
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3388
    install ifTrue:[
1999
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  3389
        installSelector := selector.
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  3390
        "/ when adding an extension, care for the current namespace
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  3391
        ns := self currentNameSpace.
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  3392
        (ns notNil and:[ns ~~ Smalltalk]) ifTrue:[
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  3393
            ns ~~ aClass nameSpace ifTrue:[
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  3394
                installSelector := self nameSpaceSelectorFor:(selector asSymbol).
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  3395
            ]
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  3396
        ].
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  3397
a22a49d0c362 selectorNameSpace support
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  3398
        aClass addSelector:installSelector withMethod:newMethod
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3399
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3400
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3401
    silencio ifFalse:[
1955
487f483ef4ce the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  3402
        Transcript showCR:('    compiled: ', aClass name,' ', selector)
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3403
    ].
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3404
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3405
    ^ newMethod
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3406
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3407
    "Created: / 29-10-1995 / 19:59:36 / cg"
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3408
    "Modified: / 19-03-1999 / 08:31:09 / stefan"
2536
62a35499ff1d changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  3409
    "Modified: / 05-07-2011 / 22:50:36 / cg"
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3410
!
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3411
1778
cdb6be2cc6ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
  3412
compile:methodText forClass:aBehavior install:doInstall
cdb6be2cc6ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
  3413
    "compile a source-string for a method in classToCompileFor.
cdb6be2cc6ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
  3414
     The install-argument controls if the method is to be installed into the
cdb6be2cc6ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
  3415
     classes method-dictionary, or just to be compiled and a method object to be returned.
cdb6be2cc6ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
  3416
     Returns the new method, #Error or nil."
cdb6be2cc6ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
  3417
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3418
    ^ self
3281
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  3419
        compile:methodText
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  3420
        forClass:aBehavior
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  3421
        inCategory:(self class defaultMethodCategory)
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  3422
        notifying:nil
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  3423
        install:doInstall
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  3424
        skipIfSame:false
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  3425
        silent:false
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  3426
        foldConstants:true
b4b91a50efc4 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3186
diff changeset
  3427
        ifFail:[ #Error ]
1778
cdb6be2cc6ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
  3428
cdb6be2cc6ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
  3429
    "Created: / 17-07-2006 / 18:44:53 / cg"
cdb6be2cc6ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
  3430
!
cdb6be2cc6ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
  3431
3416
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  3432
compileTree:aTree forClass:aClass
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3433
    "given an already parsed AST, generate code and return a method"
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3434
3416
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  3435
    |newMethod|
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3436
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3437
    self tree:aTree.
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3438
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3439
    newMethod := self createMethod.
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3440
    newMethod byteCode:(self code).
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3441
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3442
    (self contextMustBeReturnable) ifTrue:[
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3443
        newMethod contextMustBeReturnable:true
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3444
    ].
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3445
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3446
    ^ newMethod
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3447
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3448
    "Modified: / 19-03-1999 / 08:31:09 / stefan"
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3449
    "Created: / 06-08-2006 / 03:25:39 / cg"
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3450
!
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3451
3416
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  3452
compileTree:aMethodNode forClass:aClass ifFail:failBlock
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3453
    "given an already parsed AST, generate code and return a method"
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3454
3416
6dd29888acf6 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3412
diff changeset
  3455
    |newMethod symbolicCodeArray|
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3456
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3457
    self tree:aMethodNode.
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3458
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3459
    selector := aMethodNode selector.
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3460
    methodArgs := aMethodNode arguments ? #().
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3461
    methodArgNames := methodArgs collect:[:eachVar | eachVar name].
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3462
    methodVars := aMethodNode locals ? #().
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3463
    methodVarNames := methodVars collect:[:eachVar | eachVar name].
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3464
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3465
    "
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3466
     produce symbolic code first
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3467
    "
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3468
    symbolicCodeArray := self genSymbolicCode.
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  3469
    (symbolicCodeArray == #Error) ifTrue:[      "/ no longer happens
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3470
        self showErrorNotification:'translation error'.
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3471
        ^ failBlock value
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3472
    ].
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3473
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3474
    "
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3475
     take this, producing bytecode
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3476
     (someone willin' to make machine code :-)
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3477
    "
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3478
    ((self genByteCodeFrom:symbolicCodeArray) == #Error) ifTrue:[
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3479
        self showErrorNotification:'relocation error - code must be simplified'.
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3480
        ^ failBlock value
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3481
    ].
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3482
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3483
    newMethod := self createMethod.
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3484
    newMethod byteCode:(self code).
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3485
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3486
    (self contextMustBeReturnable) ifTrue:[
2091
18bcd32044c0 preparations for breakpointed lines
Claus Gittinger <cg@exept.de>
parents: 2084
diff changeset
  3487
        newMethod contextMustBeReturnable:true
1790
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3488
    ].
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3489
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3490
    ^ newMethod
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3491
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3492
    "Modified: / 19-03-1999 / 08:31:09 / stefan"
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3493
    "Created: / 06-08-2006 / 03:26:27 / cg"
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3494
    "Modified: / 06-08-2006 / 15:14:26 / cg"
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3495
!
a40965dae8cb tree compilation support
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  3496
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3497
showErrorNotification:message
2938
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3498
    |messageText|
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3499
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3500
    messageText := message.
2936
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3501
    selector notNil ifTrue:[
2938
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3502
        messageText := selector ,' ', messageText.
2936
cd787e6ed225 comment/format in: #showErrorNotification:
Stefan Vogel <sv@exept.de>
parents: 2868
diff changeset
  3503
    ].
2938
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3504
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3505
    self class parseWarningSignal isHandled ifTrue:[
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3506
        self class parseWarningSignal new
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3507
                errorMessage:messageText;
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3508
                parameter:self;
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3509
                raiseRequest.
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3510
    ] ifFalse:[
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3511
        Transcript show:'***'.
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3512
        Transcript showCR:messageText.
220928d3f06e changed:
Stefan Vogel <sv@exept.de>
parents: 2936
diff changeset
  3513
    ].
1363
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3514
! !
2ce77081f79a separated instance creation from parsing
penk
parents: 1343
diff changeset
  3515
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  3516
!ByteCodeCompiler methodsFor:'error handling'!
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  3517
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  3518
codeGeneratorError:aMessage
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  3519
    CompilationError raiseRequestWith:self errorString:aMessage.
3451
3bf71ab30730 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3436
diff changeset
  3520
    errorFlag := true.
3071
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  3521
    ^ #Error
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  3522
! !
a9f69e1c8b37 class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3043
diff changeset
  3523
49
02660b790c3e *** empty log message ***
claus
parents: 46
diff changeset
  3524
!ByteCodeCompiler methodsFor:'machine code generation'!
02660b790c3e *** empty log message ***
claus
parents: 46
diff changeset
  3525
97
claus
parents: 96
diff changeset
  3526
trappingStubMethodFor:aString inCategory:cat
claus
parents: 96
diff changeset
  3527
    "return a stub method which traps and reports an error whenever
claus
parents: 96
diff changeset
  3528
     called."
claus
parents: 96
diff changeset
  3529
292
163651658aee Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 287
diff changeset
  3530
    |newMethod|
97
claus
parents: 96
diff changeset
  3531
1094
745ec90c42c9 allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
  3532
    newMethod := self methodClass new:(litArray size).
292
163651658aee Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 287
diff changeset
  3533
    litArray notNil ifTrue:[
3648
a7e535c13f00 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3641
diff changeset
  3534
	newMethod literals:litArray
97
claus
parents: 96
diff changeset
  3535
    ].
277
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  3536
124
claus
parents: 120
diff changeset
  3537
    newMethod makeUncompiled.
594
11ae33ac9b34 finally replaced all sends of #numberOfMethodVars with #numerOfVars
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3538
    newMethod numberOfVars:(self numberOfMethodVars).
3648
a7e535c13f00 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3641
diff changeset
  3539
    newMethod numberOfArgs:(self numberOfMethodArgs).
682
784f564b4b7a make certain that methods source is always a string
ca
parents: 658
diff changeset
  3540
    newMethod source:aString string.
1117
f03c007dadc6 methods send category-change notifications themself
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
  3541
    newMethod setCategory:cat.
97
claus
parents: 96
diff changeset
  3542
    ^ newMethod
277
0b599e23a936 set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  3543
831
9ad749e60f55 Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 810
diff changeset
  3544
    "Modified: / 1.8.1997 / 00:27:32 / cg"
9ad749e60f55 Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 810
diff changeset
  3545
    "Modified: / 18.3.1999 / 18:12:33 / stefan"
49
02660b790c3e *** empty log message ***
claus
parents: 46
diff changeset
  3546
! !
128
61eb0b356b89 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
  3547
556
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  3548
!ByteCodeCompiler methodsFor:'queries'!
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  3549
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3550
hasLineNumber:sel
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3551
    "return true, if special send code needs lineNr"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3552
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3553
    (sel == #==) ifTrue:[^ false].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3554
    (sel == #~~) ifTrue:[^ false].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3555
    (sel == #class) ifTrue:[^ false].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3556
    (sel == #isNil) ifTrue:[^ false].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3557
    (sel == #notNil) ifTrue:[^ false].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3558
    ^ true
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3559
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3560
1810
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3561
isBuiltInSelector:sel forReceiver:receiver
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3562
    "return true, if selector sel is built-in.
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3563
     (i.e. there is a single bytecode for it)"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3564
1810
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3565
    (sel == #value)  ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3566
    (sel == #value:) ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3567
    (sel == #class)  ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3568
    (sel == #size)   ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3569
    (sel == #isNil)  ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3570
    (sel == #notNil) ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3571
    (sel == #not)    ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3572
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3573
    (sel == #new)    ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3574
    (sel == #basicNew) ifTrue:[
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3575
	"/ this one is critical - some redefine it
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3576
	receiver isGlobal ifTrue:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3577
	    (#('String' 'ByteArray' 'Array'
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3578
	       'Point' 'Rectangle' 'Object')
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3579
	    includes:receiver name) ifTrue:[^ true].
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3580
	].
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3581
    ].
1810
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3582
    (sel == #basicNew:) ifTrue:[
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3583
	"/ this one is critical - some redefine it
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3584
	receiver isGlobal ifTrue:[
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3585
	    (#('String' 'ByteArray' 'Array'
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3586
	      'Point' 'Rectangle' 'Object')
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3587
	    includes:receiver name) ifTrue:[^ true].
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3588
	].
1810
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3589
    ].
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3590
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3591
    sel == #== ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3592
    sel == #~~ ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3593
    sel == #=  ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3594
    sel == #~= ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3595
    sel == #+  ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3596
    sel == #-  ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3597
    sel == #<  ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3598
    sel == #<= ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3599
    sel == #>  ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3600
    sel == #>= ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3601
    sel == #*  ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3602
    sel == #&  ifTrue:[^ true].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3603
    sel == #|  ifTrue:[^ true].
1810
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3604
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3605
    (sel == #at:)     ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3606
    (sel == #at:put:) ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3607
    (sel == #bitAnd:) ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3608
    (sel == #bitOr:)  ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3609
    (sel == #new:)    ifTrue:[^ true].
977902a043fe tuned commin literal detection code
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  3610
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3611
    ^ false
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3612
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3613
    "Created: 17.4.1996 / 22:32:16 / cg"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3614
    "Modified: 4.6.1997 / 12:23:30 / cg"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3615
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3616
2084
a30b2599d2a5 Enable coding style checks only when compiling
Stefan Vogel <sv@exept.de>
parents: 2048
diff changeset
  3617
isCompiling
a30b2599d2a5 Enable coding style checks only when compiling
Stefan Vogel <sv@exept.de>
parents: 2048
diff changeset
  3618
    "return true if compiling code as opposed to evaluating"
a30b2599d2a5 Enable coding style checks only when compiling
Stefan Vogel <sv@exept.de>
parents: 2048
diff changeset
  3619
a30b2599d2a5 Enable coding style checks only when compiling
Stefan Vogel <sv@exept.de>
parents: 2048
diff changeset
  3620
    ^ true 
a30b2599d2a5 Enable coding style checks only when compiling
Stefan Vogel <sv@exept.de>
parents: 2048
diff changeset
  3621
!
a30b2599d2a5 Enable coding style checks only when compiling
Stefan Vogel <sv@exept.de>
parents: 2048
diff changeset
  3622
556
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  3623
numberOfTempVars
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  3624
    "return the number of additional temporary variables which
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  3625
     were created from inlined blocks (valid after parsing)"
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  3626
558
e7ecd861b86f preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  3627
    ^ maxNumTemp ? 0
556
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  3628
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  3629
    "Created: 25.6.1997 / 13:54:29 / cg"
558
e7ecd861b86f preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  3630
    "Modified: 25.6.1997 / 15:21:34 / cg"
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3631
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3632
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3633
specialGlobalCodeFor:aSymbol
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3634
    "codeExtension for globals,
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3635
     which can be accessed by specialGlobal opCode"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3636
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3637
    |idx|
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3638
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3639
    idx := self specialGlobals identityIndexOf:aSymbol ifAbsent:nil.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3640
    idx isNil ifTrue:[^ idx].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3641
    ^ idx - 1.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3642
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3643
    "Modified: 4.6.1997 / 12:31:22 / cg"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3644
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3645
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3646
specialGlobals
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3647
    "list of globals which can be accessed by specialGlobal opCode;
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3648
     adding any here requires a new VM (i.e. you cannot change it)"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3649
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3650
    ^ #(
3661
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3651
        #Array                  "/ 0
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3652
        #String                 "/ 1
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3653
        #FloatArray             "/ 2
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3654
        #DoubleArray            "/ 3
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3655
        #Point                  "/ 4
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3656
        #Symbol                 "/ 5
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3657
        #Smalltalk              "/ 6
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3658
        #Processor              "/ 7
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3659
        #SmallInteger           "/ 8
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3660
        #Character              "/ 9
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3661
        #Float                  "/ 10
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3662
        #Process                "/ 11
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3663
        #Set                    "/ 12
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3664
        #IdentitySet            "/ 13
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3665
        #Dictionary             "/ 14
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3666
        #IdentityDictionary     "/ 15
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3667
        #Semaphore              "/ 16
c16edf592f5d class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  3668
        #OrderedCollection      "/ 17
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3669
       )
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3670
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3671
    "Created: 4.6.1997 / 12:17:47 / cg"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3672
    "Modified: 4.6.1997 / 12:31:35 / cg"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3673
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3674
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3675
specialSendCodeFor:sel
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3676
    "return the codeExtension for sends,
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3677
     which can be performed by specialSend opCode"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3678
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3679
    |idx|
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3680
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3681
    idx := self specialSends identityIndexOf:sel ifAbsent:nil.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3682
    idx isNil ifTrue:[^ idx].
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3683
    ^ idx - 1.
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3684
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3685
    "Modified: 4.6.1997 / 12:31:08 / cg"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3686
!
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3687
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3688
specialSends
1815
22a30bef6f91 *** empty log message ***
fm
parents: 1813
diff changeset
  3689
    "list of selectors which can be sent by specialSend opCode;
1738
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3690
     adding any here requires a new VM (i.e. you cannot change it)"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3691
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3692
    ^ #(
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3693
	#top                    "/ 0
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3694
	#bottom                 "/ 1
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3695
	#left                   "/ 2
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3696
	#right                  "/ 3
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3697
	#x                      "/ 4
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3698
	#y                      "/ 5
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3699
	#width                  "/ 6
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3700
	#height                 "/ 7
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3701
	#origin                 "/ 8
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3702
	#extent                 "/ 9
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3703
	#asInteger              "/ 10
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3704
	#rounded                "/ 11
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3705
	#next                   "/ 12
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3706
	#peek                   "/ 13
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3707
       )
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3708
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3709
    "Created: 4.6.1997 / 12:20:28 / cg"
48362e8eb2d4 hooks for instrumenting compiler
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3710
    "Modified: 4.6.1997 / 12:31:56 / cg"
556
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  3711
! !
4a3775ada5d2 preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  3712
372
98da4d230a8d prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
  3713
!ByteCodeCompiler class methodsFor:'documentation'!
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
  3714
2735
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3715
version
3648
a7e535c13f00 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3641
diff changeset
  3716
    ^ '$Header$'
2735
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3717
!
1989b1b9173a added: #compile:forClass:inCategory:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3718
2502
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  3719
version_CVS
3648
a7e535c13f00 class: ByteCodeCompiler
Stefan Vogel <sv@exept.de>
parents: 3641
diff changeset
  3720
    ^ '$Header$'
2337
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  3721
!
dd5065f997b9 changed: #addLiteral:
Claus Gittinger <cg@exept.de>
parents: 2091
diff changeset
  3722
2502
4d66e65e1c23 Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2475
diff changeset
  3723
version_SVN
3161
feda6f6706f1 class: ByteCodeCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3112
diff changeset
  3724
    ^ '$ Id $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
  3725
! !
1324
fb29e5557fd6 default method category
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  3726
3043
9a514612b3ea class: ByteCodeCompiler
Claus Gittinger <cg@exept.de>
parents: 2938
diff changeset
  3727
209
b858b6a6880f compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents: 199
diff changeset
  3728
ByteCodeCompiler initialize!