CompiledCode.st
author ca
Wed, 06 Oct 1999 17:59:11 +0200
changeset 4854 55c5c4a38728
parent 4836 dc0c027c3c85
child 4977 17a819360ad5
permissions -rw-r--r--
oops - bad argument passing bug.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
     1
"
1eba5946aea2 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 131
diff changeset
     3
	      All Rights Reserved
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
     4
1eba5946aea2 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
1eba5946aea2 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
1eba5946aea2 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
1eba5946aea2 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
1eba5946aea2 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    11
"
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    12
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    13
ExecutableFunction variableSubclass:#CompiledCode
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    14
	instanceVariableNames:'flags byteCode'
1182
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    15
	classVariableNames:'NoByteCodeSignal InvalidByteCodeSignal InvalidInstructionSignal
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    16
		BadLiteralsSignal NonBooleanReceiverSignal ArgumentSignal'
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    17
	poolDictionaries:''
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    18
	category:'Kernel-Methods'
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    19
!
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    20
1772
d5d1d1fac79d the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents: 1771
diff changeset
    21
!CompiledCode class methodsFor:'documentation'!
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    22
88
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    23
copyright
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    24
"
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    25
 COPYRIGHT (c) 1994 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 131
diff changeset
    26
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    27
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    28
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    29
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    31
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    32
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    33
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    34
"
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    35
!
81dacba7a63a *** empty log message ***
claus
parents: 84
diff changeset
    36
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    37
documentation
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    38
"
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    39
    This is an abstract class, to merge common attributes of Blocks and
328
claus
parents: 326
diff changeset
    40
    Methods i.e. describe all objects consisting of either compiled or 
claus
parents: 326
diff changeset
    41
    interpreted code.
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    42
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    43
    Instances of CompiledCode are not to be created by user code
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    44
    (the compilers create Blocks, Methods etc.)
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    45
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    46
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    47
    [Instance variables:]
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    48
357
claus
parents: 345
diff changeset
    49
      flags       <SmallInteger>    special flag bits coded in a number
225
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    50
      byteCode    <ByteArray>       bytecode if its an interpreted codeobject
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    51
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    52
      The block/methods literals are stored in the indexed instance variables.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    53
      If there is only one indexed instvar, it contains a reference to an
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    54
      Object containing the literals.
225
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    55
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    56
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    57
    [Class variables:]
225
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    58
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    59
      NoByteCodeSignal              raised if a codeObject is about to be executed
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    60
                                    which has neither code nor byteCode (i.e. both are nil)
225
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    61
      InvalidByteCodeSignal         raised if byteCode is not an instance of ByteArray
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    62
      InvalidInstructionSignal      raised if an invalid instruction opcode is encountered
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    63
      BadLiteralsSignal             raised if literalArray is not an array
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    64
      NonBooleanReceiverSignal      raised for conditional jumps where receiver is not a boolean
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    65
      ArgumentSignal                raised if argument count is not what the codeObject expects
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    66
7c8e57cc5b13 commenting
claus
parents: 159
diff changeset
    67
    all of these signals are children of ExecutionErrorSignal.
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    68
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    69
    NOTICE: layout known by runtime system and compiler - do not change
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    70
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    71
    [author:]
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    72
        Claus Gittinger
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    73
"
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    74
! !
1eba5946aea2 Initial revision
claus
parents:
diff changeset
    75
1772
d5d1d1fac79d the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents: 1771
diff changeset
    76
!CompiledCode class methodsFor:'initialization'!
106
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
    77
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
    78
initialize
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    79
    "create signals raised by various errors"
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    80
106
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
    81
    NoByteCodeSignal isNil ifTrue:[
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    82
        NoByteCodeSignal := ExecutionErrorSignal newSignalMayProceed:true.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    83
        NoByteCodeSignal nameClass:self message:#noByteCodeSignal.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    84
        NoByteCodeSignal notifierString:'nil byteCode in code-object - not executable'.
159
514c749165c3 *** empty log message ***
claus
parents: 131
diff changeset
    85
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    86
        InvalidByteCodeSignal := ExecutionErrorSignal newSignalMayProceed:true.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    87
        InvalidByteCodeSignal nameClass:self message:#invalidByteCodeSignal.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    88
        InvalidByteCodeSignal notifierString:'invalid byteCode in code-object - not executable'.
159
514c749165c3 *** empty log message ***
claus
parents: 131
diff changeset
    89
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    90
        InvalidInstructionSignal := ExecutionErrorSignal newSignalMayProceed:true.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    91
        InvalidInstructionSignal nameClass:self message:#invalidInstructionSignal.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    92
        InvalidInstructionSignal notifierString:'invalid instruction in code-object - not executable'.
159
514c749165c3 *** empty log message ***
claus
parents: 131
diff changeset
    93
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    94
        BadLiteralsSignal := ExecutionErrorSignal newSignalMayProceed:true.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    95
        BadLiteralsSignal nameClass:self message:#badLiteralsSignal.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    96
        BadLiteralsSignal notifierString:'bad literal table in code-object - should not happen'.
159
514c749165c3 *** empty log message ***
claus
parents: 131
diff changeset
    97
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    98
        NonBooleanReceiverSignal := ExecutionErrorSignal newSignalMayProceed:true.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
    99
        NonBooleanReceiverSignal nameClass:self message:#nonBooleanReceiverSignal.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   100
        NonBooleanReceiverSignal notifierString:'if/while on non-boolean receiver'.
159
514c749165c3 *** empty log message ***
claus
parents: 131
diff changeset
   101
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   102
        ArgumentSignal := ExecutionErrorSignal newSignalMayProceed:true.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   103
        ArgumentSignal nameClass:self message:#argumentSignal.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   104
        ArgumentSignal notifierString:'bad argument(s)'.
106
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   105
    ]
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   106
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
   107
    "Modified: 22.4.1996 / 16:33:38 / cg"
106
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   108
! !
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   109
1772
d5d1d1fac79d the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents: 1771
diff changeset
   110
!CompiledCode class methodsFor:'instance creation'!
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   111
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   112
new
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   113
    "create a new method with an indirect literal array
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   114
     stored in the first and only indexed instvar"
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   115
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   116
    ^ self basicNew:1.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   117
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   118
    "Created: / 24.6.1996 / 17:21:46 / stefan"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   119
    "Modified: / 23.1.1998 / 16:31:28 / stefan"
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   120
!
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   121
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   122
new:numberOfLiterals
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   123
    "create a new method with numberOfLiterals.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   124
     Implementation note:
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   125
        If (self size) == 1, the only literal is an indirect literal
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   126
        containing an array of literals. Otherwise the literals
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   127
        are stored in self.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   128
    "
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   129
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   130
    |nlits|
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   131
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   132
    nlits := numberOfLiterals.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   133
    nlits <= 1 ifTrue:[
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   134
        nlits := nlits + 1.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   135
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   136
    ^ self basicNew:nlits.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   137
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   138
    "Created: 24.6.1996 / 17:20:13 / stefan"
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   139
    "Modified: 25.6.1996 / 14:25:14 / stefan"
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   140
! !
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   141
1772
d5d1d1fac79d the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents: 1771
diff changeset
   142
!CompiledCode class methodsFor:'Signal constants'!
106
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   143
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   144
argumentSignal
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   145
    "return the signal raised when something's wrong with the
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   146
     arguments"
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   147
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   148
    ^ ArgumentSignal
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   149
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   150
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   151
executionErrorSignal
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   152
    "return the parent-signal of all execution errors"
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   153
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   154
    ^ ExecutionErrorSignal
106
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   155
! !
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   156
1772
d5d1d1fac79d the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents: 1771
diff changeset
   157
!CompiledCode class methodsFor:'queries'!
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   158
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   159
isBuiltInClass
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   160
    "return true if this class is known by the run-time-system.
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   161
     Here, true is returned for myself, false for subclasses."
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   162
1182
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   163
    ^ self == CompiledCode
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   164
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   165
    "Modified: 23.4.1996 / 15:57:03 / cg"
2806
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   166
!
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   167
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   168
maxNumberOfArguments
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   169
    "return the maximum number of arguments a method can have.
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   170
     This is a limit in the VM, which may be removed in one of 
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   171
     the next versions ..."
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   172
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   173
%{  /* NOCONTEXT */
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   174
    RETURN (__MKSMALLINT(MAX_METHOD_ARGS));
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   175
%}
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   176
! !
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   177
4836
dc0c027c3c85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4489
diff changeset
   178
!CompiledCode methodsFor:'Compatibility - ST-80'!
2567
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   179
2696
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   180
getSource
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   181
    "return the code objects source code, nil if none is available"
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   182
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   183
    ^ self source.
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   184
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   185
    "Created: 19.6.1997 / 16:32:15 / cg"
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   186
!
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   187
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   188
getSourceForUserIfNone:aBlock
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   189
    "return the code objects source code.
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   190
     If none is available, return the result from evaluating aBlock."
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   191
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   192
    |src| 
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   193
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   194
    Screen current shiftDown ifTrue:[^ aBlock value].
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   195
    src := self source.
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   196
    src isNil ifTrue:[^ aBlock value].
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   197
    ^ src withoutTrailingSeparators
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   198
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   199
    "Modified: 19.6.1997 / 16:31:53 / cg"
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   200
!
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   201
2567
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   202
withAllBlockMethodsDo:aBlock
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   203
    aBlock value:self
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   204
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   205
    "Created: 18.4.1997 / 20:42:07 / cg"
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   206
! !
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   207
249
claus
parents: 225
diff changeset
   208
!CompiledCode methodsFor:'accessing'!
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   209
2703
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   210
allLiterals
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   211
    "return a collection of all literals (includes all block literals)"
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   212
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   213
    ^ self literals ? #()
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   214
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   215
    "Modified: 19.6.1997 / 17:37:52 / cg"
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   216
!
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   217
3076
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   218
allSymbolLiterals
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   219
    "return a collection of all symbol-literals"
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   220
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   221
    ^ self allLiterals select:[:lit | lit isSymbol]
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   222
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   223
    "Modified: / 19.6.1997 / 17:37:52 / cg"
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   224
    "Created: / 1.11.1997 / 13:14:44 / cg"
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   225
!
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   226
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   227
byteCode
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   228
    "return the bytecode (a ByteArray)"
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   229
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   230
    ^ byteCode
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   231
!
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   232
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   233
changeLiteral:aLiteral to:newLiteral
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   234
    "change aLiteral to newLiteral"
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   235
1526
2ab8c4340bd1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   236
    |lits nLits "{ Class: SmallInteger }" |
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   237
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   238
    self size == 1 ifTrue:[
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   239
        lits := self at:1.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   240
    ] ifFalse:[
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   241
        lits := self.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   242
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   243
1526
2ab8c4340bd1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   244
    nLits := lits size.
2ab8c4340bd1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   245
    1 to:nLits do:[:i|
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   246
        (lits at:i) == aLiteral ifTrue:[
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   247
            lits at:i put:newLiteral.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   248
            ^ true.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   249
        ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   250
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   251
    ^ false.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   252
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   253
    "Created: 24.6.1996 / 15:08:11 / stefan"
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   254
    "Modified: 24.6.1996 / 17:07:56 / stefan"
1526
2ab8c4340bd1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   255
    "Modified: 4.7.1996 / 11:12:39 / cg"
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   256
!
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   257
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   258
decompiledSource
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   259
    "reconstruct some synthetic source by decompiling by byteCode"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   260
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   261
    |s|
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   262
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   263
    s := '' writeStream.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   264
    self decompileTo:s.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   265
    ^ s contents
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   266
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   267
    "Modified: / 30.1.1999 / 14:53:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   268
    "Created: / 30.1.1999 / 14:54:09 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   269
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   270
2810
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   271
decompiler
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   272
    ^ Decompiler
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   273
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   274
    "Created: 30.7.1997 / 16:36:40 / cg"
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   275
!
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   276
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   277
do:aBlock
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   278
    "same as #literalsDo:, in order to get common protocol with Array"
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   279
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   280
    ^ self literalsDo:aBlock
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   281
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   282
    "Modified: 25.6.1996 / 22:16:44 / stefan"
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   283
!
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   284
3882
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
   285
flags
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   286
    "return the flags (number of method variables, stacksize etc.).
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   287
     Dont depend on the values in the flag field - its interpretations
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   288
     may change without notice."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   289
3882
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
   290
    ^ flags
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
   291
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   292
    "Modified: / 30.1.1999 / 14:51:59 / cg"
3882
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
   293
!
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
   294
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   295
literals
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   296
    "return the literal array"
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   297
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   298
    |lits numLits "{ Class: SmallInteger }"|
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   299
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   300
    numLits := self size.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   301
    numLits == 0 ifTrue:[
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   302
        ^ #()
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   303
    ].
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   304
    numLits == 1 ifTrue:[
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   305
        ^ self at:1.    
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   306
    ].
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   307
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   308
    "there may be a dummy (nil) literal to make the size > 1"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   309
    (self at:2) isNil ifTrue:[
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   310
        numLits := 1.
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   311
    ].
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   312
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   313
    lits := Array new:numLits.
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   314
    1 to:numLits do:[:i|
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   315
        lits at:i put:(self at:i).
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   316
    ].
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   317
    ^ lits.
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   318
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   319
    "
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   320
     (CompiledCode compiledMethodAt:#literals) literals
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   321
    "
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   322
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   323
    "Modified: / 30.1.1997 / 17:09:06 / cg"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   324
    "Modified: / 23.1.1998 / 16:30:07 / stefan"
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   325
!
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   326
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   327
literalsDetect:aBlock ifNone:exceptionBlock
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   328
    "execute a one arg block for each of our literals.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   329
     return the first literal for which aBlock returns true"
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   330
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   331
    |lits theLit numLits "{Class: SmallInteger }"|
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   332
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   333
    numLits := self size.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   334
    numLits > 0 ifTrue:[
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   335
        numLits == 1 ifTrue:[
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   336
            lits := self at:1.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   337
            numLits := lits size.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   338
        ] ifFalse:[
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   339
            lits := self.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   340
            "there may be a dummy (nil) literal to make the size > 1"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   341
            (self at:2) isNil ifTrue:[
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   342
                numLits := 1.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   343
            ].
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   344
        ].
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   345
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   346
        1 to:numLits do:[:i |
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   347
            theLit := lits at:i.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   348
            (aBlock value:theLit) ifTrue:[
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   349
                ^ theLit.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   350
            ].
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   351
        ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   352
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   353
    ^ exceptionBlock value.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   354
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   355
    "Created: / 24.6.1996 / 14:27:35 / stefan"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   356
    "Modified: / 30.1.1997 / 16:24:04 / cg"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   357
    "Modified: / 23.1.1998 / 17:08:37 / stefan"
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   358
!
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   359
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   360
literalsDo:aBlock
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   361
    "execute a one arg block for each of our literals"
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   362
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   363
    |lits numLits "{ Class: SmallInteger }" |
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   364
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   365
    numLits := self size.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   366
    numLits == 0 ifTrue:[
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   367
        ^ self
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   368
    ].
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   369
    numLits == 1 ifTrue:[
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   370
        lits := self at:1.
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   371
        numLits := lits size.
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   372
    ] ifFalse:[
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   373
        lits := self.
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   374
        "there may be a dummy (nil) literal to make the size > 1"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   375
        (self at:2) isNil ifTrue:[
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   376
            numLits := 1.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   377
        ].
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   378
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   379
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   380
    1 to:numLits do:[:i |
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   381
        aBlock value:(lits at:i).
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   382
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   383
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   384
    "Created: / 24.6.1996 / 14:17:12 / stefan"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   385
    "Modified: / 30.1.1997 / 17:08:05 / cg"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   386
    "Modified: / 23.1.1998 / 16:39:17 / stefan"
2695
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   387
!
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   388
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   389
mclass
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   390
    "return the class of the receivers home method.
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   391
     Thats the class of the method where the block was compiled."
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   392
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   393
    ^ self homeMethod mclass
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   394
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   395
    "Modified: 19.6.1997 / 16:24:58 / cg"
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   396
    "Created: 19.6.1997 / 16:27:34 / cg"
3328
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   397
!
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   398
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   399
numberOfMethodArgs
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   400
    "return the number of arguments, the method expects.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   401
     This method is left for backward compatibility - use #numArgs." 
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   402
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   403
    "/ self obsoleteMethodWarning:'use numArgs'.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   404
    ^ self numArgs
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   405
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   406
    "Modified: / 30.1.1999 / 14:55:27 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   407
    "Created: / 30.1.1999 / 14:55:47 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   408
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   409
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   410
numberOfMethodVars
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   411
    "return the number of method local variables. 
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   412
     This method is left for backward compatibility - use #numVars." 
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   413
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   414
    "/ self obsoleteMethodWarning:'use numVars'.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   415
    ^ self numVars
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   416
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   417
    "Modified: / 30.1.1999 / 14:55:42 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   418
    "Created: / 30.1.1999 / 14:55:51 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   419
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   420
3328
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   421
refersToLiteral:aLiteral
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   422
    "return true if the receiver or recursively any array element in the
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   423
     receiver referes to aLiteral"
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   424
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   425
    self literalsDo: [ :el | 
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   426
        el == aLiteral ifTrue:[^true].
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   427
        el class == Array ifTrue:[
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   428
            (el refersToLiteral: aLiteral) ifTrue: [^true]
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   429
        ]
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   430
    ].
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   431
    ^ false
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   432
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   433
    "
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   434
     (CompiledCode compiledMethodAt:#refersToLiteral:) refersToLiteral:#foo  
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   435
     (CompiledCode compiledMethodAt:#refersToLiteral:) refersToLiteral:#class  
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   436
    "
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   437
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   438
    "Modified: / 3.3.1998 / 00:02:28 / stefan"
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   439
! !
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   440
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   441
!CompiledCode methodsFor:'converting'!
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   442
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   443
makeRealMethod
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   444
    "by default, we are a real method.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   445
     Subclasses (e.g. LazyMethod) may redefine this"
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   446
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   447
    ^ self
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   448
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   449
    "Created: 7.6.1996 / 12:45:50 / stefan"
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   450
! !
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   451
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   452
!CompiledCode methodsFor:'debugging'!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   453
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   454
breakPointInProcess:aProcess
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   455
    "arrange for a breakpoint-debugger to be opened when this method
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   456
     is invoked from withn aProcess."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   457
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   458
    MessageTracer trapMethod:self inProcess:aProcess.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   459
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   460
    "Modified: / 12.1.1998 / 18:22:39 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   461
    "Created: / 30.1.1999 / 14:50:01 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   462
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   463
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   464
clearBreakPoint
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   465
    "remove any break/trace-point on this method"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   466
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   467
    MessageTracer unwrapMethod:self.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   468
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   469
    "Modified: / 12.1.1998 / 18:22:14 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   470
    "Created: / 30.1.1999 / 14:49:53 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   471
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   472
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   473
isCounted
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   474
    "obsolete - replaced by isCountinMemoryUsage"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   475
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   476
    ^ MessageTracer notNil
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   477
      and:[MessageTracer isCountingMemoryUsage:self]
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   478
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   479
    "Modified: / 27.7.1998 / 11:05:36 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   480
    "Created: / 30.1.1999 / 14:48:57 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   481
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   482
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   483
isCounting
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   484
    "return true, if invokations of this method are counted"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   485
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   486
    ^ MessageTracer notNil
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   487
      and:[MessageTracer isCounting:self]
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   488
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   489
    "Modified: / 27.7.1998 / 11:06:00 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   490
    "Created: / 30.1.1999 / 14:49:19 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   491
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   492
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   493
isCountingMemoryUsage
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   494
    "return true, if memory allocations done by this method (and callees)
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   495
     are counted"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   496
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   497
    ^ MessageTracer notNil
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   498
      and:[MessageTracer isCountingMemoryUsage:self]
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   499
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   500
    "Modified: / 27.7.1998 / 11:06:23 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   501
    "Created: / 30.1.1999 / 14:49:26 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   502
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   503
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   504
resetCountingStatistics
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   505
    "reset count statistics of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   506
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   507
    MessageTracer resetCountOfMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   508
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   509
    "Modified: / 12.1.1998 / 18:24:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   510
    "Created: / 30.1.1999 / 14:50:19 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   511
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   512
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   513
resetMemoryUsageStatistics
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   514
    "reset count statistics of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   515
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   516
    MessageTracer resetMemoryUsageOfMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   517
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   518
    "Modified: / 12.1.1998 / 18:24:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   519
    "Created: / 30.1.1999 / 14:50:22 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   520
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   521
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   522
resetTimingStatistics
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   523
    "reset timing statistics of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   524
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   525
    MessageTracer resetExecutionTimesOfMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   526
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   527
    "Modified: / 12.1.1998 / 18:24:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   528
    "Created: / 30.1.1999 / 14:50:25 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   529
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   530
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   531
setBreakPoint
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   532
    "arrange for a breakpoint-debugger to be opened when this method
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   533
     is invoked."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   534
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   535
    MessageTracer trapMethod:self.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   536
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   537
    "Modified: / 12.1.1998 / 18:22:36 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   538
    "Created: / 30.1.1999 / 14:50:27 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   539
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   540
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   541
setTraceFullPoint
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   542
    "arrange for a full-backtrace to be sent to the standard-error stream
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   543
     when this method is invoked."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   544
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   545
    MessageTracer traceMethodFull:self on:Transcript
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   546
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   547
    "Modified: / 12.1.1998 / 18:23:11 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   548
    "Created: / 30.1.1999 / 14:50:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   549
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   550
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   551
setTracePoint
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   552
    "arrange for a trace-message to be sent to the standard-error stream
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   553
     when this method is invoked."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   554
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   555
    MessageTracer traceMethod:self on:Transcript
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   556
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   557
    "Modified: / 12.1.1998 / 18:23:23 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   558
    "Created: / 30.1.1999 / 14:50:33 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   559
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   560
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   561
setTraceSenderPoint
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   562
    "arrange for a sender-trace-message to be sent to the standard-error stream
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   563
     when this method is invoked."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   564
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   565
    MessageTracer traceMethodSender:self on:Transcript
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   566
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   567
    "Modified: / 12.1.1998 / 18:23:31 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   568
    "Created: / 30.1.1999 / 14:50:36 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   569
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   570
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   571
startCounting
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   572
    "start counting invokations of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   573
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   574
    MessageTracer countMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   575
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   576
    "Modified: / 12.1.1998 / 18:23:45 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   577
    "Created: / 30.1.1999 / 14:50:38 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   578
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   579
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   580
startCountingMemoryUsage
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   581
    "start counting memory usage of the receiver (and every callee)"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   582
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   583
    MessageTracer countMemoryUsageOfMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   584
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   585
    "Modified: / 27.7.1998 / 11:06:55 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   586
    "Created: / 30.1.1999 / 14:50:41 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   587
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   588
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   589
startTiming
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   590
    "start timing the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   591
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   592
    MessageTracer timeMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   593
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   594
    "Modified: / 12.1.1998 / 18:24:05 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   595
    "Created: / 30.1.1999 / 14:50:44 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   596
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   597
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   598
stopCounting
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   599
    "stop counting calls of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   600
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   601
    MessageTracer stopCountingMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   602
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   603
    "Modified: / 12.1.1998 / 18:24:15 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   604
    "Created: / 30.1.1999 / 14:50:47 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   605
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   606
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   607
stopCountingMemoryUsage
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   608
    "stop counting memory usage of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   609
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   610
    MessageTracer stopCountingMemoryUsageOfMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   611
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   612
    "Modified: / 12.1.1998 / 18:24:22 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   613
    "Created: / 30.1.1999 / 14:50:51 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   614
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   615
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   616
stopTiming
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   617
    "stop timing of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   618
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   619
    MessageTracer stopTimingMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   620
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   621
    "Modified: / 12.1.1998 / 18:24:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   622
    "Created: / 30.1.1999 / 14:50:54 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   623
! !
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   624
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   625
!CompiledCode methodsFor:'error handling'!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   626
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   627
badArgumentArray
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   628
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   629
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   630
    "this error is triggered, if a non array is passed to 
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   631
     #valueWithReceiver:.. type of methods"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   632
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   633
    ^ ArgumentSignal
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   634
        raiseRequestWith:self
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   635
        errorString:'argumentArray must be an Array'
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   636
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   637
    "Modified: 4.11.1996 / 22:46:52 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   638
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   639
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   640
badLiteralTable
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   641
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   642
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   643
    "this error is triggered, when a block/method is called with a bad literal
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   644
     array (i.e. non-array) - this can only happen, if the
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   645
     compiler is broken or someone played around with a blocks/methods
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   646
     literal table or the GC is broken and corrupted it."
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   647
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   648
    ^ BadLiteralsSignal raise.
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   649
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   650
    "Modified: 4.11.1996 / 22:46:55 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   651
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   652
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   653
invalidByteCode
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   654
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   655
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   656
    "this error is triggered when the interpreter tries to execute a
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   657
     code object, where the byteCode is nonNil, but not a ByteArray.
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   658
     Can only happen when Compiler/runtime system is broken or
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   659
     someone played around with a blocks/methods code."
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   660
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   661
    ^ InvalidByteCodeSignal raise.
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   662
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   663
    "Modified: 4.11.1996 / 22:46:59 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   664
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   665
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   666
invalidInstruction
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   667
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   668
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   669
    "this error is triggered when the bytecode-interpreter tries to
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   670
     execute an invalid bytecode instruction.
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   671
     Can only happen when Compiler/runtime system is broken or
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   672
     someone played around with a blocks/methods code."
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   673
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   674
    ^ InvalidInstructionSignal raise.
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   675
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   676
    "Modified: 4.11.1996 / 22:47:03 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   677
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   678
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   679
noByteCode
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   680
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   681
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   682
    "this error is triggered when the interpreter tries to execute a
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   683
     code object, where both the code and byteCode instances are nil.
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   684
     This can happen if:
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   685
        - the Compiler/runtime system is broken, (should not happen)
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   686
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   687
        - someone played around with a block/method, (you should not do this)
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   688
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   689
        - compilation of a lazy method failed
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   690
          (i.e. the lazy method contains an error or
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   691
           it contains primitive code and there is no stc compiler available)
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   692
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   693
        - an unloaded object modules method is called for.
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   694
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   695
     Only the first case is to be considered serious 
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   696
     - it should not happen if the system is used correctly."
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   697
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   698
    ^ NoByteCodeSignal raise.
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   699
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   700
    "Modified: 4.11.1996 / 22:47:07 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   701
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   702
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   703
receiverNotBoolean:anObject
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   704
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   705
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   706
    "this error is triggered when the bytecode-interpreter tries to
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   707
     execute ifTrue:/ifFalse or whileTrue: - type of expressions where the
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   708
     receiver is neither true nor false.
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   709
     Machine compiled code does not detect this, and may behave undeterministec."
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   710
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   711
    ^ NonBooleanReceiverSignal raise.
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   712
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   713
    "Modified: 4.11.1996 / 22:47:11 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   714
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   715
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   716
tooManyArguments
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   717
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   718
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   719
    "this error is triggered, when a method/block tries to perform a send with
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   720
     more arguments than supported by the interpreter. 
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   721
     This can only happen, if the compiler has been changed without 
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   722
     updating the VM, since the compiler checks for allowed number of
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   723
     arguments."
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   724
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   725
    ^ ArgumentSignal
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   726
        raiseRequestWith:self
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   727
        errorString:'too many args in send'
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   728
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   729
    "Modified: 4.11.1996 / 22:47:14 / cg"
2827
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   730
!
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   731
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   732
wrongNumberOfArguments:numberGiven
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   733
    "{ Pragma: +optSpace }"
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   734
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   735
    "this error is triggered by the VM, if a method is called with a wrong number
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   736
     of arguments. 
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   737
     This only applies to #valueWithReceiverXXX and #perform:withArguments: - sends.
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   738
     With a normal send, this error cannot happen."
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   739
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   740
    ^ ArgumentSignal
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   741
        raiseRequestWith:self
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   742
        errorString:(self class name ,
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   743
                     ' got ' , numberGiven printString ,
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   744
                     ' arg(s) where ' , self numArgs printString , ' expected')
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   745
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   746
    "Modified: 1.8.1997 / 00:23:10 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   747
! !
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   748
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   749
!CompiledCode methodsFor:'executing'!
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   750
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   751
valueWithReceiver:anObject arguments:argArray
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   752
    "low level call of a methods code - BIG DANGER ALERT.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   753
     Perform the receiver-method on anObject as receiver and argArray as
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   754
     arguments. This does NO message lookup at all and mimics a
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   755
     traditional function call.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   756
     This method is provided for debugging- and breakpoint-support 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   757
     (replacing a method by a stub and recalling the original), or to implement
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   758
     experimental MI implementations - it is not for general use. 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   759
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   760
     The receiver must be a method compiled in anObjects class or one of its 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   761
     superclasses and also, the number of arguments given must match the methods
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   762
     expectations -
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   763
     - otherwise strange things (and also strange crashes) can occur.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   764
     The system is NOT always detecting a wrong method/receiver combination.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   765
     YOU HAVE BEEN WARNED."
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   766
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   767
    ^ self 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   768
        valueWithReceiver:anObject 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   769
        arguments:argArray 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   770
        selector:nil 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   771
        search:nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   772
        sender:nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   773
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   774
    "Modified: 4.4.1997 / 23:33:56 / cg"
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   775
    "Created: 30.7.1997 / 12:04:52 / cg"
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   776
!
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   777
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   778
valueWithReceiver:anObject arguments:argArray selector:aSymbol
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   779
    "low level call of a methods code - BIG DANGER ALERT.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   780
     Perform the receiver-method on anObject as receiver and argArray as
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   781
     arguments. This does NO message lookup at all and mimics a
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   782
     traditional function call.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   783
     This method is provided for debugging- and breakpoint-support 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   784
     (replacing a method by a stub and recalling the original), or to implement
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   785
     experimental MI implementations - it is not for general use. 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   786
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   787
     The receiver must be a method compiled in anObjects class or one of its 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   788
     superclasses and also, the number of arguments given must match the methods
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   789
     expectations -
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   790
     - otherwise strange things (and also strange crashes) can occur.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   791
     The system is NOT always detecting a wrong method/receiver combination.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   792
     YOU HAVE BEEN WARNED."
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   793
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   794
    ^ self 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   795
        valueWithReceiver:anObject 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   796
        arguments:argArray 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   797
        selector:aSymbol 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   798
        search:nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   799
        sender:nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   801
    "Modified: 4.4.1997 / 23:34:08 / cg"
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   802
    "Created: 30.7.1997 / 12:04:49 / cg"
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   803
!
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   804
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   805
valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   806
    "low level call of a methods code - BIG DANGER ALERT.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   807
     Perform the receiver-method on anObject as receiver and argArray as
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   808
     arguments. This does NO message lookup at all and mimics a
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   809
     traditional function call.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   810
     This method is provided for debugging- and breakpoint-support 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   811
     (replacing a method by a stub and recalling the original), or to implement
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   812
     experimental MI implementations - it is not for general use. 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   813
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   814
     The receiver must be a method compiled in anObjects class or one of its 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   815
     superclasses and also, the number of arguments given must match the methods
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   816
     expectations -
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   817
     - otherwise strange things (and also strange crashes) can occur.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   818
     The system is NOT always detecting a wrong method/receiver combination.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   819
     YOU HAVE BEEN WARNED."
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   820
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   821
    ^ self 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   822
        valueWithReceiver:anObject 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   823
        arguments:argArray 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   824
        selector:aSymbol 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   825
        search:nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   826
        sender:nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   827
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   828
    "Modified: 4.4.1997 / 23:34:19 / cg"
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   829
    "Created: 30.7.1997 / 12:04:46 / cg"
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   830
!
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   831
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   832
valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass sender:virtualSender
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   833
    "low level call of a methods code - BIG DANGER ALERT.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   834
     Perform the receiver-method on anObject as receiver and argArray as
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   835
     arguments. This does NO message lookup at all and mimics a
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   836
     traditional function call.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   837
     This method is provided for debugging- and breakpoint-support 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   838
     (replacing a method by a stub and recalling the original), or to implement
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   839
     experimental MI implementations - it is not for general use. 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   840
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   841
     The receiver must be a method compiled in anObjects class or one of its 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   842
     superclasses and also, the number of arguments given must match the methods
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   843
     expectations -
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   844
     - otherwise strange things (and also strange crashes) can occur.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   845
     The system is NOT always detecting a wrong method/receiver combination.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   846
     YOU HAVE BEEN WARNED."
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   847
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   848
%{
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   849
    OBJFUNC code;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   850
    OBJ searchClass;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   851
    static struct inlineCache dummy = _DUMMYILC0;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   852
    int nargs;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   853
    OBJ *ap;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   854
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   855
    /*
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   856
     * args must be an array, or nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   857
     */
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   858
    if (__isArray(argArray)) {
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   859
        nargs = __arraySize(argArray);
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   860
        ap = __ArrayInstPtr(argArray)->a_element;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   861
    } else {
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   862
        if (argArray != nil) {
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   863
            goto badArgs;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   864
        }
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   865
        nargs = 0;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   866
    }
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   867
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   868
#ifdef F_NARGS
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   869
    if (((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT) == nargs) 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   870
#endif
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   871
    {
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   872
        code = __MethodInstPtr(self)->m_code;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   873
        if (aClass == nil) {
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   874
            searchClass = dummy.ilc_class = __Class(anObject);
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   875
        } else {
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   876
            searchClass = dummy.ilc_class = aClass;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   877
        }
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   878
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   879
        if (nargs <= 15) {
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   880
          OBJ rslt;
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   881
#ifdef CONTEXT_DEBUG
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   882
          OBJ sav = __thisContext;
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   883
#endif
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   884
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   885
          /*
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   886
           * add virtual sender (unwinding) here later,
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   887
           * to allow hiding contexts in lazy methods.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   888
           * (this is cosmetics only; therefore its done later)
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   889
           */
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   890
          if (code) {
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   891
            /* compiled code */
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   892
            switch (nargs) {
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   893
                case 0:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   894
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   895
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   896
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   897
                case 1:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   898
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   899
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   900
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   901
                case 2:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   902
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   903
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   904
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   905
                case 3:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   906
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1], ap[2]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   907
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   908
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   909
                case 4:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   910
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   911
                                 ap[0], ap[1], ap[2], ap[3]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   912
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   913
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   914
                case 5:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   915
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   916
                                 ap[0], ap[1], ap[2], ap[3], ap[4]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   917
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   918
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   919
                case 6:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   920
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   921
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   922
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   923
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   924
                case 7:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   925
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   926
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   927
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   928
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   929
                case 8:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   930
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   931
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   932
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   933
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   934
                case 9:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   935
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   936
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   937
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   938
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   939
                case 10:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   940
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   941
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   942
                                 ap[9]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   943
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   944
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   945
                case 11:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   946
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   947
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   948
                                 ap[9], ap[10]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   949
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   950
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   951
                case 12:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   952
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   953
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   954
                                 ap[9], ap[10], ap[11]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   955
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   956
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   957
                case 13:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   958
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   959
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   960
                                 ap[9], ap[10], ap[11], ap[12]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   961
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   962
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   963
                case 14:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   964
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   965
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   966
                                 ap[9], ap[10], ap[11], ap[12], ap[13]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   967
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   968
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   969
                case 15:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   970
                    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, 
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   971
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   972
                                 ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   973
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   974
            }
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   975
          } else {
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   976
            /* interpreted code */
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   977
#ifdef PASS_ARG_POINTER
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   978
            rslt = __interpret(self, nargs, anObject, aSymbol, searchClass, &dummy, ap);
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   979
#else
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   980
            switch (nargs) {
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   981
                case 0:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   982
                    rslt = __interpret(self, 0, anObject, aSymbol, searchClass, &dummy);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   983
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   984
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   985
                case 1:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   986
                    rslt = __interpret(self, 1, anObject, aSymbol, searchClass, &dummy,
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   987
                                   ap[0]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   988
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   989
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   990
                case 2:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   991
                    rslt = __interpret(self, 2, anObject, aSymbol, searchClass, &dummy,
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   992
                                   ap[0], ap[1]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   993
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   994
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   995
                case 3:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   996
                    rslt = __interpret(self, 3, anObject, aSymbol, searchClass, &dummy,
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
   997
                                   ap[0], ap[1], ap[2]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
   998
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   999
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1000
                case 4:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1001
                    rslt = __interpret(self, 4, anObject, aSymbol, searchClass, &dummy,
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1002
                                   ap[0], ap[1], ap[2], ap[3]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1003
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1004
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1005
                case 5:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1006
                    rslt = __interpret(self, 5, anObject, aSymbol, searchClass, &dummy,
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1007
                                   ap[0], ap[1], ap[2], ap[3], ap[4]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1008
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1009
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1010
                case 6:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1011
                    rslt = __interpret(self, 6, anObject, aSymbol, searchClass, &dummy,
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1012
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1013
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1014
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1015
                case 7:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1016
                    rslt = __interpret(self, 7, anObject, aSymbol, searchClass, &dummy,
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1017
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1018
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1019
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1020
                case 8:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1021
                    rslt = __interpret(self, 8, anObject, aSymbol, searchClass, &dummy,
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1022
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1023
                                   ap[7]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1024
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1025
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1026
                case 9:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1027
                    rslt = __interpret(self, 9, anObject, aSymbol, searchClass, &dummy,
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1028
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1029
                                   ap[7], ap[8]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1030
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1031
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1032
                case 10:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1033
                    rslt = __interpret(self, 10, anObject, aSymbol, searchClass, &dummy,
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1034
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1035
                                   ap[7], ap[8], ap[9]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1036
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1037
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1038
                case 11:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1039
                    rslt = __interpret(self, 11, anObject, aSymbol, searchClass, &dummy,
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1040
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1041
                                   ap[7], ap[8], ap[9], ap[10]);
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1042
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1043
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1044
                case 12:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1045
                    rslt = __interpret(self, 12, anObject, aSymbol, searchClass, &dummy,
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1046
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1047
                                   ap[7], ap[8], ap[9], ap[10], ap[11]);
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1048
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1049
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1050
                case 13:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1051
                    rslt = __interpret(self, 13, anObject, aSymbol, searchClass, &dummy,
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1052
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1053
                                   ap[7], ap[8], ap[9], ap[10], ap[11], ap[12]);
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1054
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1055
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1056
                case 14:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1057
                    rslt = __interpret(self, 14, anObject, aSymbol, searchClass, &dummy,
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1058
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1059
                                   ap[7], ap[8], ap[9], ap[10], ap[11], ap[12], ap[13]);
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1060
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1061
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1062
                case 15:
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1063
                    rslt = __interpret(self, 15, anObject, aSymbol, searchClass, &dummy,
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1064
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1065
                                   ap[7], ap[8], ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]);
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1066
                    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1067
            }
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1068
#endif
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1069
          }
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1070
#ifdef CONTEXT_DEBUG
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1071
          if (sav != __thisContext) {
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1072
              if (code) {
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1073
                  printf("CONTEXT BOTCH after execution of %x\n", code);
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1074
              } else {
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1075
                  printf("CONTEXT BOTCH after execution of interpreted method\n");
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1076
                  printf("code now: %x\n", __MethodInstPtr(self)->m_code);
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1077
              }
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1078
              printf("context before:\n");
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1079
              __dumpObject__(sav);
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1080
              printf("context now:\n");
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1081
              __dumpObject__(__thisContext);
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1082
          }
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1083
#endif
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1084
          RETURN (rslt);
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1085
        }
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1086
    }
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1087
    badArgs: ;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1088
%}.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1089
    (argArray isMemberOf:Array) ifFalse:[
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1090
        "
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1091
         arguments must be either nil or an array
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1092
        "
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1093
        ^ self badArgumentArray
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1094
    ].
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1095
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1096
    (argArray size ~~ self numArgs) ifTrue:[
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1097
        "
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1098
         the method expects a different number of arguments
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1099
        "
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1100
        ^ self wrongNumberOfArguments:argArray size
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1101
    ].
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1102
    
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1103
    "/ the VM only supports a limited number of arguments in sends
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1104
    "/ (currently, 15)
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1105
    
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1106
    ^ self tooManyArguments
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1107
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1108
    "
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1109
     (Float compiledMethodAt:#+) 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1110
        valueWithReceiver:1.0 arguments:#(2.0)
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1111
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1112
     'the next example is a wrong one - which is detected by True's method ...'.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1113
     (True compiledMethodAt:#printString) 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1114
        valueWithReceiver:false arguments:nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1115
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1116
     'the next example is a wrong one - it is nowhere detected
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1117
      and a wrong value returned ...'.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1118
     (Point compiledMethodAt:#x) 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1119
        valueWithReceiver:(1->2) arguments:nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1120
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1121
     'the next example is VERY bad one - it is nowhere detected
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1122
      and may crash the system WARNING: save your work before doing this ...'.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1123
     (Point compiledMethodAt:#x) 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1124
        valueWithReceiver:(Object new) arguments:nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1125
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1126
     'the next example is a wrong one - which is detected here ...'.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1127
     (Object compiledMethodAt:#printOn:)
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1128
        valueWithReceiver:false arguments:nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1129
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1130
     'the next example is a wrong one - which is detected here ...'.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1131
     (Object compiledMethodAt:#printOn:)
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1132
        valueWithReceiver:false arguments:#() 
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1133
    "
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1134
! !
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1135
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1136
!CompiledCode methodsFor:'private accessing'!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1137
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1138
byteCode:aByteArray
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1139
    "set the bytecode field - DANGER ALERT"
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1140
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1141
    byteCode := aByteArray
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1142
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1143
1640
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1144
checked:aBoolean
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1145
    "set/clear the flag bit stating that this method has already been checked
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1146
     by the just-in-time compiler. Setting the flag prevents it from
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1147
     trying any compilation.
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1148
     Not for public use - for VM debugging only."
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1149
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1150
%{  /* NOCONTEXT */
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1151
2869
6fcc9aafb7c4 alpha64 stuff
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1152
    INT newFlags = __intVal(__INST(flags));
1640
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1153
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1154
    /* made this a primitive to get define in stc.h */
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1155
    if (aBoolean == true)
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1156
        newFlags |= F_CHECKED;
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1157
    else
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1158
        newFlags &= ~F_CHECKED;
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1159
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1160
    __INST(flags) = __MKSMALLINT(newFlags);
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1161
%}
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1162
!
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1163
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1164
dynamic
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1165
    "return the flag stating that the machine code was created
1774
ab14302c6497 comment
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
  1166
     dynamically (from bytecode) or loaded dynamically from an objectFile
ab14302c6497 comment
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
  1167
     (i.e. has machineCode, but is not in the executable)."
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1168
3662
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1169
    "/ obsolete
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1170
    ^ self isDynamic
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1171
3662
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1172
    "Modified: / 20.7.1998 / 14:22:35 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1173
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1174
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1175
literals:aLiteralArray 
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1176
    "set the literal array for evaluation - DANGER ALERT"
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1177
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1178
    |i|
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1179
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1180
    aLiteralArray isNil ifTrue:[
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1181
        ^ self.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1182
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1183
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1184
    self size == 1 ifTrue:[
3313
06da74a9cb04 make certain that literal array really is an array
Claus Gittinger <cg@exept.de>
parents: 3218
diff changeset
  1185
        self at:1 put:(aLiteralArray asArray).
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1186
    ] ifFalse:[
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1187
        i := 1.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1188
        aLiteralArray do:[:literal|
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1189
            self at:i put:literal.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1190
            i := i + 1.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1191
        ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1192
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1193
3313
06da74a9cb04 make certain that literal array really is an array
Claus Gittinger <cg@exept.de>
parents: 3218
diff changeset
  1194
    "Modified: / 25.6.1996 / 22:13:08 / stefan"
06da74a9cb04 make certain that literal array really is an array
Claus Gittinger <cg@exept.de>
parents: 3218
diff changeset
  1195
    "Modified: / 5.3.1998 / 02:05:56 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1196
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1197
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1198
markFlag
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1199
    "return the mark bits value as a boolean"
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1200
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1201
%{  /* NOCONTEXT */
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1202
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1203
    /* made this a primitive to get define in stc.h */
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1204
1771
ccb8ff5d4763 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  1205
    RETURN (( (INT)(__INST(flags)) & __MASKSMALLINT(F_MARKBIT)) ? true : false);
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1206
%}
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1207
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1208
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1209
markFlag:aBoolean
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1210
    "set/clear the mark flag bit.
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1211
     This bit is not used by the VM, but instead free to mark codeObjects
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1212
     for any (debugging/tracing) use. For example, the coverage test uses
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1213
     these to mark reached methods. (inspired by a note in c.l.s)"
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1214
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1215
%{  /* NOCONTEXT */
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1216
2869
6fcc9aafb7c4 alpha64 stuff
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1217
    INT newFlags = __intVal(__INST(flags));
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1218
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1219
    /* made this a primitive to get define in stc.h */
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1220
    if (aBoolean == true)
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1221
	newFlags |= F_MARKBIT;
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1222
    else
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1223
	newFlags &= ~F_MARKBIT;
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1224
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
  1225
    __INST(flags) = __MKSMALLINT(newFlags);
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1226
%}
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1227
! !
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1228
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1229
!CompiledCode methodsFor:'private-compiler interface'!
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1230
4489
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1231
contextMustBeReturnable:aBoolean
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1232
%{  /* NOCONTEXT */
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1233
    /* made this a primitive to get define in stc.h */
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1234
    if (aBoolean == true) {
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1235
        __INST(flags) = (OBJ)( (INT)__INST(flags) | __MASKSMALLINT(F_RETURNABLE));
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1236
    } else {
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1237
        __INST(flags) = (OBJ)( (INT)__INST(flags) & ~__MASKSMALLINT(F_RETURNABLE));
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1238
    }
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1239
%}
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1240
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1241
!
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1242
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1243
flags:newFlags
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1244
    "set the flags (number of method variables, stacksize).
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1245
     WARNING: for internal use by the compiler only.
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1246
              playing around here with incorrect values 
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1247
              may crash smalltalk badly.
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1248
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1249
     Dont depend on the values in the flag field - its interpretations
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1250
     may change without notice."
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1251
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1252
    "/ protect myself a bit - putting in an object would crash me ...
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1253
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1254
    (newFlags isMemberOf:SmallInteger) ifTrue:[
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1255
        flags := newFlags
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1256
    ]
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1257
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1258
    "Modified: 8.3.1996 / 13:26:05 / cg"
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1259
    "Created: 13.4.1997 / 00:01:11 / cg"
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1260
!
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1261
2804
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1262
numberOfArgs:aNumber
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1263
    "set the number of arguments, the codeObject expects.
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1264
     WARNING: for internal use by the compiler only.     
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1265
              playing around here with incorrect values 
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1266
              may (will ?)  crash smalltalk badly.
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1267
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1268
     The limitation in the max. number of arguments is due to the
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1269
     missing SENDxx functions in the VM and cases in #perform. This too 
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1270
     will be removed in a later release, allowing any number of arguments."
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1271
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1272
    (aNumber between:0 and:self class maxNumberOfArguments) ifFalse:[
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1273
        self error:('ST/X only supports up to a maximum of ' ,
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1274
                    self class maxNumberOfArguments printString ,
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1275
                    ' method arguments').
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1276
        ^ self
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1277
    ].
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1278
%{
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1279
    /* made this a primitive to get define in stc.h */
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1280
#ifdef F_NARGS
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1281
    __INST(flags) = __MKSMALLINT( (__intVal(__INST(flags)) & ~F_NARGS) | (__intVal(aNumber) << F_NARGSHIFT) );
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1282
#endif
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1283
%}
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1284
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1285
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1286
!
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1287
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1288
numberOfVars:aNumber
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1289
    "set the number of local variables - for use by compiler only.
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1290
     WARNING: for internal use by the compiler only.     
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1291
              playing around here with incorrect values 
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1292
              may (will ?)  crash smalltalk badly."
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1293
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1294
%{  /* NOCONTEXT */
2869
6fcc9aafb7c4 alpha64 stuff
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1295
    INT f = __intVal(__INST(flags));
2804
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1296
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1297
    /* made this a primitive to get define in stc.h */
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1298
    if (__isSmallInteger(aNumber)) {
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1299
        f = (f & ~F_NVARS) | (__intVal(aNumber) << F_NVARSHIFT);
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1300
        __INST(flags) = __MKSMALLINT(f);
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1301
    }
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1302
%}
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1303
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1304
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1305
!
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1306
2543
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1307
stackSize
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1308
    "return thedepth of the local stack in the context.
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1309
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1310
     WARNING: for internal use by ST/X debuggers only.
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1311
              This method may be removed without notice."
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1312
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1313
%{  /* NOCONTEXT */
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1314
    int n = (__intVal(__INST(flags)) & F_NSTACK) >> F_NSTACKSHIFT;
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1315
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1316
    /* made this a primitive to get define in stc.h */
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1317
    RETURN (__MKSMALLINT(n));
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1318
%}
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1319
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1320
!
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1321
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1322
stackSize:aNumber
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1323
    "set the depth of the local stack.
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1324
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1325
     WARNING: for internal use by the compiler only.
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1326
              playing around here with incorrect values 
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1327
              may crash smalltalk badly.
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1328
              (if the runtime library was compiled with DEBUG, 
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1329
               a bad stack will be detected and triggers an error)"
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1330
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1331
%{  /* NOCONTEXT */
2869
6fcc9aafb7c4 alpha64 stuff
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1332
    INT f = __intVal(__INST(flags));
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1333
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1334
    /* made this a primitive to get define in stc.h */
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1335
    if (__isSmallInteger(aNumber)) {
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1336
        f = (f & ~F_NSTACK) | (__intVal(aNumber) << F_NSTACKSHIFT);
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1337
        __INST(flags) = __MKSMALLINT(f);
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1338
    }
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1339
%}
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1340
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1341
! !
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1342
328
claus
parents: 326
diff changeset
  1343
!CompiledCode methodsFor:'queries'!
claus
parents: 326
diff changeset
  1344
1196
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1345
decompileTo:aStream
2810
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  1346
    |decompiler|
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  1347
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  1348
    decompiler := self decompiler.
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  1349
    decompiler notNil ifTrue:[
1196
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1350
        Autoload autoloadFailedSignal handle:[:ex |
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1351
            ex return
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1352
        ] do:[
2810
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  1353
            decompiler autoload.
1196
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1354
        ].
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1355
    ].
2810
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  1356
    (decompiler isNil or:[decompiler isLoaded not]) ifTrue:[
1196
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1357
        ^ false
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1358
    ].
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1359
2810
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  1360
    decompiler decompile:self to:aStream.
1196
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1361
    ^ true
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1362
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1363
    "Created: 16.4.1996 / 20:25:40 / cg"
2810
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  1364
    "Modified: 30.7.1997 / 16:37:14 / cg"
1196
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1365
!
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1366
3662
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1367
isDynamic
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1368
    "return true, if the machine code was created
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1369
     dynamically (from bytecode); false if the machine code was
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1370
     already present in an objectFile
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1371
     (i.e. has JIT-compiled machineCode, as opposed to stc-compiled code)."
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1372
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1373
%{  /* NOCONTEXT */
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1374
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1375
    /* made this a primitive to get define in stc.h */
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1376
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1377
    RETURN (( (INT)(__INST(flags)) & __MASKSMALLINT(F_DYNAMIC)) ? true : false);
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1378
%}
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1379
!
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1380
1195
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1381
isExecutable
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1382
    "return true, if this method is executable.
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1383
     I.e. neither an invalidated nor an unloaded method"
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1384
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1385
    self isInvalid ifTrue:[^ false].
3933
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1386
    ^ self byteCode notNil or:[self hasCode]
1195
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1387
3933
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1388
    "Created: / 16.4.1996 / 17:52:16 / cg"
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1389
    "Modified: / 13.11.1998 / 23:18:01 / cg"
1195
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1390
!
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1391
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1392
isUnloaded
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1393
    "return true, if the methods machine code has been unloaded
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1394
     from the system (i.e. it is not executable)."
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1395
3933
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1396
    ^ (self hasCode not and:[self byteCode isNil])
1195
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1397
3933
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1398
    "Created: / 16.4.1996 / 17:51:47 / cg"
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1399
    "Modified: / 13.11.1998 / 23:18:18 / cg"
1195
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1400
!
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1401
328
claus
parents: 326
diff changeset
  1402
messages
claus
parents: 326
diff changeset
  1403
    "return a Set of all symbols referenced by this thingy.
claus
parents: 326
diff changeset
  1404
     (this is more than the message selectors, since also global names
claus
parents: 326
diff changeset
  1405
     and symbols found in immediate arrays are included)."
claus
parents: 326
diff changeset
  1406
claus
parents: 326
diff changeset
  1407
    |symbolSet|
claus
parents: 326
diff changeset
  1408
claus
parents: 326
diff changeset
  1409
    symbolSet := IdentitySet new.
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1410
    self literalsDo: [ :lit |
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1411
        lit isSymbol ifTrue: [
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1412
            symbolSet add: lit
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1413
        ] ifFalse: [
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1414
            lit isArray ifTrue: [
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1415
                lit traverse: [ :el |
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1416
                    el isSymbol ifTrue: [symbolSet add: el]
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1417
                ]
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1418
            ]
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1419
        ]
328
claus
parents: 326
diff changeset
  1420
    ].
claus
parents: 326
diff changeset
  1421
    ^ symbolSet
claus
parents: 326
diff changeset
  1422
claus
parents: 326
diff changeset
  1423
    "
claus
parents: 326
diff changeset
  1424
     (CompiledCode compiledMethodAt:#messages) messages 
claus
parents: 326
diff changeset
  1425
    "
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1426
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1427
    "Modified: 25.6.1996 / 22:24:20 / stefan"
1190
4ad1c8d6d94d moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1182
diff changeset
  1428
!
4ad1c8d6d94d moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1182
diff changeset
  1429
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1430
numArgs
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1431
    "return the number of arguments, the method expects." 
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1432
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1433
%{  /* NOCONTEXT */
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1434
    /* made this a primitive to get define in stc.h */
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1435
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1436
    RETURN (__MKSMALLINT((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT));
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1437
%}.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1438
    "
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1439
     The old implementation simply counted the arguments from
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1440
     the methods source - new versions include this information
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1441
     in the flag instVar, for more security in #perform:
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1442
    "
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1443
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1444
    "
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1445
     (Method compiledMethodAt:#source) numArgs  
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1446
     (Method compiledMethodAt:#source:) numArgs 
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1447
    "
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1448
!
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1449
1869
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1450
numVars
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1451
    "return the number of block local variables. 
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1452
     Do not depend on the returned value - future optimizations
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1453
     may change things here (i.e. when moving locals into
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1454
     surrounding context for inlining).
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1455
     - for debugging only."
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1456
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1457
%{  /* NOCONTEXT */
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1458
    /* made this a primitive to get define in stc.h */
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1459
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1460
    RETURN (__MKSMALLINT((__intVal(__INST(flags)) & F_NVARS) >> F_NVARSHIFT));
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1461
%}
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1462
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1463
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1464
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1465
!
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1466
1190
4ad1c8d6d94d moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1182
diff changeset
  1467
referencesGlobal:aGlobalSymbol
4ad1c8d6d94d moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1182
diff changeset
  1468
    "return true, if this method references the global
3054
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1469
     bound to aGlobalSymbol.
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1470
     For now, this is the same as #referencesLiteral:,
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1471
     but this might change in the future to perform a deeper
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1472
     analyzes on the bytecodes, to detect implizit global
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1473
     refs (as done by some special bytecodes)"
1190
4ad1c8d6d94d moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1182
diff changeset
  1474
3054
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1475
    ^ self referencesLiteral:aGlobalSymbol
1190
4ad1c8d6d94d moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1182
diff changeset
  1476
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1477
    "
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1478
     (CompiledCode compiledMethodAt:#referencesGlobal:) referencesGlobal:#literalsDetect:ifNone:
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1479
     (CompiledCode compiledMethodAt:#referencesGlobal:) referencesGlobal:#bla
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1480
    "
1190
4ad1c8d6d94d moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1182
diff changeset
  1481
3054
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1482
    "Modified: / 24.6.1996 / 15:41:59 / stefan"
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1483
    "Modified: / 28.10.1997 / 13:11:11 / cg"
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1484
!
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1485
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1486
referencesLiteral:aLiteral
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1487
    "return true, if this method references the given literal."
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1488
3771
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1489
    |lit|
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1490
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1491
    lit := aLiteral.
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1492
    aLiteral isAssociation ifTrue:[
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1493
        "/ for ST80 compatibility (where variableBindings are used ...)
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1494
        lit := lit key
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1495
    ].
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1496
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1497
    ^ (self literalsDetect:[:mthdLit| mthdLit == lit] ifNone:[false]) ~~ false.
3054
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1498
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1499
    "
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1500
     (CompiledCode compiledMethodAt:#referencesLiteral:) referencesGlobal:#literalsDetect:ifNone:
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1501
     (CompiledCode compiledMethodAt:#referencesLiteral:) referencesGlobal:#bla
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1502
    "
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1503
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1504
    "Modified: / 24.6.1996 / 15:41:59 / stefan"
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1505
    "Created: / 28.10.1997 / 13:09:40 / cg"
3093
642a1fa90695 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3076
diff changeset
  1506
!
642a1fa90695 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3076
diff changeset
  1507
642a1fa90695 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3076
diff changeset
  1508
resources
642a1fa90695 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3076
diff changeset
  1509
    ^ nil
642a1fa90695 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3076
diff changeset
  1510
642a1fa90695 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3076
diff changeset
  1511
    "Created: / 3.11.1997 / 09:09:01 / cg"
328
claus
parents: 326
diff changeset
  1512
! !
claus
parents: 326
diff changeset
  1513
1772
d5d1d1fac79d the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents: 1771
diff changeset
  1514
!CompiledCode class methodsFor:'documentation'!
1182
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1515
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1516
version
4854
55c5c4a38728 oops - bad argument passing bug.
ca
parents: 4836
diff changeset
  1517
    ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.71 1999-10-06 15:59:11 ca Exp $'
1182
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1518
! !
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1519
CompiledCode initialize!