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