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