CompiledCode.st
author Claus Gittinger <cg@exept.de>
Wed, 24 Oct 2012 18:36:16 +0200
changeset 14426 6ac120dc7add
parent 14423 10c643ab2647
child 14441 a002093030c3
permissions -rw-r--r--
changed: #initializeSystem temporary with traces
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
"
5426
eef3df49b4e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    12
"{ Package: 'stx:libbasic' }"
eef3df49b4e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    13
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    14
ExecutableFunction variableSubclass:#CompiledCode
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    15
	instanceVariableNames:'flags byteCode'
7603
88c60268d47f Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents: 7261
diff changeset
    16
	classVariableNames:''
1182
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
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
    40
    Methods i.e. describe all objects consisting of either compiled or
328
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
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
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:]
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
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:'instance creation'!
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    77
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    78
new
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
    79
    "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
    80
     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
    81
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    82
    ^ self basicNew:1.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    83
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
    84
    "Created: / 24.6.1996 / 17:21:46 / stefan"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
    85
    "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
    86
!
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    87
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    88
new:numberOfLiterals
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    89
    "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
    90
     Implementation note:
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
    91
	If (self size) == 1, the only literal is an indirect literal
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
    92
	containing an array of literals. Otherwise the literals
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
    93
	are stored in self.
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    94
    "
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    95
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    96
    |nlits|
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    97
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    98
    nlits := numberOfLiterals.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    99
    nlits <= 1 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   100
	nlits := nlits + 1.
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   101
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   102
    ^ self basicNew:nlits.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   103
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   104
    "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
   105
    "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
   106
! !
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   107
1772
d5d1d1fac79d the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents: 1771
diff changeset
   108
!CompiledCode class methodsFor:'Signal constants'!
106
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   109
7150
a1fe0a0313a8 uses class-based exceptions
Claus Gittinger <cg@exept.de>
parents: 6663
diff changeset
   110
wongNumberOfArgumentsSignal
a1fe0a0313a8 uses class-based exceptions
Claus Gittinger <cg@exept.de>
parents: 6663
diff changeset
   111
    "return the signal raised when the number of arguments is wrong in a call"
a1fe0a0313a8 uses class-based exceptions
Claus Gittinger <cg@exept.de>
parents: 6663
diff changeset
   112
a1fe0a0313a8 uses class-based exceptions
Claus Gittinger <cg@exept.de>
parents: 6663
diff changeset
   113
    ^ WrongNumberOfArgumentsError
106
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   114
! !
a5906085b3e5 errors now raise signals
claus
parents: 92
diff changeset
   115
1772
d5d1d1fac79d the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents: 1771
diff changeset
   116
!CompiledCode class methodsFor:'queries'!
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   117
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   118
isBuiltInClass
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   119
    "return true if this class is known by the run-time-system.
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   120
     Here, true is returned for myself, false for subclasses."
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   121
1182
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   122
    ^ self == CompiledCode
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   123
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   124
    "Modified: 23.4.1996 / 15:57:03 / cg"
2806
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   125
!
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   126
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   127
maxNumberOfArguments
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   128
    "return the maximum number of arguments a method can have.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   129
     This is a limit in the VM, which may be removed in one of
2806
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   130
     the next versions ..."
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   131
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   132
%{  /* NOCONTEXT */
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
   133
    RETURN (__mkSmallInteger(MAX_METHOD_ARGS));
2806
9d3c4cf5f6e9 moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
   134
%}
5674
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   135
!
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   136
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   137
numArgsMaskInFlags
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   138
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   139
%{  /* NOCONTEXT */
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   140
    /* made this a primitive to get define in stc.h */
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   141
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
   142
    RETURN (__mkSmallInteger(F_NARGS));
5674
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   143
%}.
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   144
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   145
    "
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   146
     self numArgsMaskInFlags
5729
63af78505f23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   147
    "
63af78505f23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   148
!
5674
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   149
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   150
numArgsShiftInFlags
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   151
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   152
%{  /* NOCONTEXT */
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   153
    /* made this a primitive to get define in stc.h */
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   154
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
   155
    RETURN (__mkSmallInteger(F_NARGSHIFT));
5674
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   156
%}.
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   157
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   158
    "
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   159
     self numArgsShiftInFlags
5729
63af78505f23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   160
    "
63af78505f23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   161
!
5674
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   162
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   163
numVarsMaskInFlags
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   164
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   165
%{  /* NOCONTEXT */
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   166
    /* made this a primitive to get define in stc.h */
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   167
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
   168
    RETURN (__mkSmallInteger(F_NVARS));
5674
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   169
%}.
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   170
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   171
    "
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   172
     self numVarsMaskInFlags
5729
63af78505f23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   173
    "
63af78505f23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   174
!
5674
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   175
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   176
numVarsShiftInFlags
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   177
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   178
%{  /* NOCONTEXT */
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   179
    /* made this a primitive to get define in stc.h */
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   180
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
   181
    RETURN (__mkSmallInteger(F_NVARSHIFT));
5674
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   182
%}.
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   183
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   184
    "
9decc87cc11b queries added
Claus Gittinger <cg@exept.de>
parents: 5555
diff changeset
   185
     self numVarsShiftInFlags
5729
63af78505f23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   186
    "
63af78505f23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   187
! !
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   188
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7258
diff changeset
   189
!CompiledCode methodsFor:'Compatibility-ST80'!
2567
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   190
2696
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   191
getSource
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   192
    "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
   193
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   194
    ^ self source.
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   195
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   196
    "Created: 19.6.1997 / 16:32:15 / cg"
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   197
!
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
getSourceForUserIfNone:aBlock
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   200
    "return the code objects source code.
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   201
     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
   202
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   203
    |src|
2696
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   204
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   205
    Screen current shiftDown ifTrue:[^ aBlock value].
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   206
    src := self source.
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   207
    src isNil ifTrue:[^ aBlock value].
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   208
    ^ src withoutTrailingSeparators
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   209
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   210
    "Modified: 19.6.1997 / 16:31:53 / cg"
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   211
!
0ab535637edc added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
   212
5304
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   213
methodClass
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   214
    "return the class I am defined in"
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   215
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   216
    ^ self mclass.
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   217
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   218
    "Created: 19.6.1997 / 16:32:15 / cg"
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   219
!
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   220
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   221
sourceString
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   222
    "return the code objects source code, nil if none is available"
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   223
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   224
    ^ self source.
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   225
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   226
    "Created: 19.6.1997 / 16:32:15 / cg"
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   227
!
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   228
2567
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   229
withAllBlockMethodsDo:aBlock
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   230
    aBlock value:self
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   231
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   232
    "Created: 18.4.1997 / 20:42:07 / cg"
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   233
! !
f7a78b772aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2543
diff changeset
   234
14044
1a21e789f373 added: #bytecodes
Claus Gittinger <cg@exept.de>
parents: 13777
diff changeset
   235
!CompiledCode methodsFor:'Compatibility-V''Age'!
1a21e789f373 added: #bytecodes
Claus Gittinger <cg@exept.de>
parents: 13777
diff changeset
   236
1a21e789f373 added: #bytecodes
Claus Gittinger <cg@exept.de>
parents: 13777
diff changeset
   237
bytecodes
1a21e789f373 added: #bytecodes
Claus Gittinger <cg@exept.de>
parents: 13777
diff changeset
   238
    ^ self byteCode
1a21e789f373 added: #bytecodes
Claus Gittinger <cg@exept.de>
parents: 13777
diff changeset
   239
1a21e789f373 added: #bytecodes
Claus Gittinger <cg@exept.de>
parents: 13777
diff changeset
   240
    "Created: / 05-03-2012 / 15:51:48 / cg"
1a21e789f373 added: #bytecodes
Claus Gittinger <cg@exept.de>
parents: 13777
diff changeset
   241
! !
1a21e789f373 added: #bytecodes
Claus Gittinger <cg@exept.de>
parents: 13777
diff changeset
   242
249
claus
parents: 225
diff changeset
   243
!CompiledCode methodsFor:'accessing'!
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   244
2703
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   245
allLiterals
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   246
    "return a collection of all literals (includes all block literals)"
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   247
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   248
    ^ self literals ? #()
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   249
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   250
    "Modified: 19.6.1997 / 17:37:52 / cg"
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   251
!
80bc29446b42 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   252
3076
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   253
allSymbolLiterals
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   254
    "return a collection of all symbol-literals"
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   255
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   256
    ^ self allLiterals select:[:lit | lit isSymbol]
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   257
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   258
    "Modified: / 19.6.1997 / 17:37:52 / cg"
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   259
    "Created: / 1.11.1997 / 13:14:44 / cg"
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   260
!
a383cf6706fa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3054
diff changeset
   261
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   262
byteCode
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   263
    "return the bytecode (a ByteArray)"
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   264
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   265
    ^ byteCode
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   266
!
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   267
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   268
changeLiteral:aLiteral to:newLiteral
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   269
    "change aLiteral to newLiteral"
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   270
1526
2ab8c4340bd1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   271
    |lits nLits "{ Class: SmallInteger }" |
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   272
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   273
    self size == 1 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   274
	lits := self at:1.
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   275
    ] ifFalse:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   276
	lits := self.
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   277
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   278
1526
2ab8c4340bd1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   279
    nLits := lits size.
2ab8c4340bd1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   280
    1 to:nLits do:[:i|
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   281
	(lits at:i) == aLiteral ifTrue:[
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   282
	    lits at:i put:newLiteral.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   283
	    ^ true.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   284
	].
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   285
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   286
    ^ false.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   287
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   288
    "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
   289
    "Modified: 24.6.1996 / 17:07:56 / stefan"
1526
2ab8c4340bd1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   290
    "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
   291
!
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   292
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   293
decompiledSource
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   294
    "reconstruct some synthetic source by decompiling by byteCode"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   295
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   296
    |s|
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   297
8222
f2c454a9a038 replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents: 7603
diff changeset
   298
    s := String writeStream.
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   299
    self decompileTo:s.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   300
    ^ s contents
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   301
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   302
    "Modified: / 30.1.1999 / 14:53:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   303
    "Created: / 30.1.1999 / 14:54:09 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   304
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   305
6084
c6cf46dc9ac8 #decompiler -> #decompilerClass
Claus Gittinger <cg@exept.de>
parents: 6013
diff changeset
   306
decompilerClass
2810
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   307
    ^ Decompiler
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   308
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   309
    "Created: 30.7.1997 / 16:36:40 / cg"
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   310
!
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   311
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   312
do:aBlock
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   313
    "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
   314
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   315
    ^ self literalsDo:aBlock
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   316
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   317
    "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
   318
!
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   319
3882
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
   320
flags
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   321
    "return the flags (number of method variables, stacksize etc.).
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   322
     Dont depend on the values in the flag field - its interpretations
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   323
     may change without notice."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   324
3882
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
   325
    ^ flags
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
   326
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   327
    "Modified: / 30.1.1999 / 14:51:59 / cg"
3882
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
   328
!
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
   329
5744
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   330
literalAt:index
10472
75266538f2d1 homeMethod fixed;
Claus Gittinger <cg@exept.de>
parents: 9447
diff changeset
   331
    "return a literal element"
75266538f2d1 homeMethod fixed;
Claus Gittinger <cg@exept.de>
parents: 9447
diff changeset
   332
75266538f2d1 homeMethod fixed;
Claus Gittinger <cg@exept.de>
parents: 9447
diff changeset
   333
    ^ self literalAt:index ifAbsent:[self error:'bad literal index']
75266538f2d1 homeMethod fixed;
Claus Gittinger <cg@exept.de>
parents: 9447
diff changeset
   334
!
75266538f2d1 homeMethod fixed;
Claus Gittinger <cg@exept.de>
parents: 9447
diff changeset
   335
75266538f2d1 homeMethod fixed;
Claus Gittinger <cg@exept.de>
parents: 9447
diff changeset
   336
literalAt:index ifAbsent:exceptionalValue
75266538f2d1 homeMethod fixed;
Claus Gittinger <cg@exept.de>
parents: 9447
diff changeset
   337
    "return a literal element"
5744
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   338
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   339
    |lits numLits "{ Class: SmallInteger }"|
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   340
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   341
    numLits := self size.
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   342
    numLits == 0 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   343
	^ exceptionalValue value
5744
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   344
    ].
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   345
    numLits == 1 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   346
	lits := self at:1.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   347
	lits isArray ifFalse:[
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   348
	    index == 1 ifTrue:[^ lits].
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   349
	    ^ exceptionalValue value
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   350
	].
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   351
	^ lits at:index.
5744
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   352
    ].
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   353
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   354
    "there may be a dummy (nil) literal to make the size > 1"
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   355
    (self at:2) isNil ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   356
	index == 1 ifTrue:[^ self at:1].
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   357
	^ exceptionalValue value
5744
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   358
    ].
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   359
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   360
    ^ self at:index
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   361
!
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   362
9447
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   363
literalAt:index put:newValue
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   364
    "change a literal slots value.
10472
75266538f2d1 homeMethod fixed;
Claus Gittinger <cg@exept.de>
parents: 9447
diff changeset
   365
     WARNING: dangerous internal interface; only for knowledgable users"
9447
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   366
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   367
    |lits numLits "{ Class: SmallInteger }"|
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   368
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   369
    numLits := self size.
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   370
    numLits == 0 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   371
	self error:'bad literal index'
9447
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   372
    ].
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   373
    numLits == 1 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   374
	lits := self at:1.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   375
	lits isArray ifFalse:[
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   376
	    index == 1 ifTrue:[^ self at:1 put:newValue.].
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   377
	    self error:'bad literal index'
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   378
	].
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   379
	^ lits at:index put:newValue.
9447
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   380
    ].
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   381
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   382
    "there may be a dummy (nil) literal to make the size > 1"
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   383
    (self at:2) isNil ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   384
	index == 1 ifTrue:[^ self at:1 put:newValue].
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   385
	self error:'bad literal index'.
9447
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   386
    ].
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   387
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   388
    ^ self at:index put:newValue
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   389
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   390
    "Created: / 16-07-2006 / 13:01:15 / cg"
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   391
!
6c4162883f37 +literalAt:put:
Claus Gittinger <cg@exept.de>
parents: 9304
diff changeset
   392
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   393
literals
6013
67fe7838f006 refactoring
Claus Gittinger <cg@exept.de>
parents: 5744
diff changeset
   394
    "return the literals as an array"
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   395
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   396
    |lits numLits "{ Class: SmallInteger }"|
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   397
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   398
    numLits := self size.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   399
    numLits == 0 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   400
	^ #()
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   401
    ].
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   402
    numLits == 1 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   403
	lits := self at:1.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   404
	lits isArray ifFalse:[
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   405
	    ^ Array with:lits.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   406
	].
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   407
	^ lits.
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   408
    ].
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   409
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   410
    "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
   411
    (self at:2) isNil ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   412
	numLits := 1.
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   413
    ].
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   414
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   415
    lits := Array new:numLits.
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   416
    1 to:numLits do:[:i|
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   417
	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
   418
    ].
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   419
    ^ lits.
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   420
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   421
    "
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   422
     (CompiledCode compiledMethodAt:#literals) literals
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   423
    "
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   424
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   425
    "Modified: / 30.1.1997 / 17:09:06 / cg"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   426
    "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
   427
!
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   428
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   429
literalsDetect:aBlock ifNone:exceptionBlock
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   430
    "execute a one arg block for each of our literals.
6013
67fe7838f006 refactoring
Claus Gittinger <cg@exept.de>
parents: 5744
diff changeset
   431
     return the first literal for which aBlock returns true,
67fe7838f006 refactoring
Claus Gittinger <cg@exept.de>
parents: 5744
diff changeset
   432
     or the value from exceptionBlock, if either no literals or
67fe7838f006 refactoring
Claus Gittinger <cg@exept.de>
parents: 5744
diff changeset
   433
     none satisfied the block"
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   434
6013
67fe7838f006 refactoring
Claus Gittinger <cg@exept.de>
parents: 5744
diff changeset
   435
    self literalsDo:[:eachLiteral |
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   436
	(aBlock value:eachLiteral) ifTrue:[
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   437
	    ^ eachLiteral
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   438
	]
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   439
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   440
    ^ exceptionBlock value.
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   441
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   442
    "Created: / 24.6.1996 / 14:27:35 / stefan"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   443
    "Modified: / 30.1.1997 / 16:24:04 / cg"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   444
    "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
   445
!
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   446
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   447
literalsDo:aBlock
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   448
    "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
   449
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   450
    |lits numLits "{ Class: SmallInteger }" |
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   451
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   452
    numLits := self size.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   453
    numLits == 0 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   454
	^ self
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   455
    ].
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   456
    numLits == 1 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   457
	lits := self at:1.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   458
	numLits := lits size.
6308
9722a8992196 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6084
diff changeset
   459
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   460
	lits isArray ifFalse:[
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   461
	    lits := self.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   462
	    numLits := 1.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   463
	]
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   464
    ] ifFalse:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   465
	lits := self.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   466
	"there may be a dummy (nil) literal to make the size > 1"
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   467
	(self at:2) isNil ifTrue:[
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   468
	    numLits := 1.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   469
	].
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   470
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   471
2330
6f501907d079 type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   472
    1 to:numLits do:[:i |
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   473
	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
   474
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   475
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   476
    "Created: / 24.6.1996 / 14:17:12 / stefan"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   477
    "Modified: / 30.1.1997 / 17:08:05 / cg"
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
   478
    "Modified: / 23.1.1998 / 16:39:17 / stefan"
2695
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   479
!
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   480
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   481
mclass
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   482
    "return the class of the receivers home method.
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   483
     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
   484
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   485
    ^ self homeMethod mclass
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   486
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   487
    "Modified: 19.6.1997 / 16:24:58 / cg"
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   488
    "Created: 19.6.1997 / 16:27:34 / cg"
3328
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   489
!
0988d93b89c4 Add #refersToLiteral
Stefan Vogel <sv@exept.de>
parents: 3313
diff changeset
   490
10601
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   491
numLiterals
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   492
    "return the number of literals I have"
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   493
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   494
    |lits numLits "{ Class: SmallInteger }" |
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   495
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   496
    numLits := self size.
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   497
    numLits == 1 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   498
	lits := self at:1.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   499
	numLits := lits size.
10601
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   500
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   501
	lits isArray ifFalse:[
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   502
	    lits := self.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   503
	    numLits := 1.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   504
	]
10601
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   505
    ] ifFalse:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   506
	lits := self.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   507
	"there may be a dummy (nil) literal to make the size > 1"
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   508
	(self at:2) isNil ifTrue:[
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   509
	    numLits := 1.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   510
	].
10601
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   511
    ].
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   512
    ^ numLits
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   513
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   514
    "Created: / 07-06-2007 / 10:08:01 / cg"
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   515
!
2974d94894ae +numLiterals
Claus Gittinger <cg@exept.de>
parents: 10472
diff changeset
   516
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   517
numberOfMethodArgs
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   518
    "return the number of arguments, the method expects.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   519
     This method is left for backward compatibility - use #numArgs."
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   520
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   521
    "/ self obsoleteMethodWarning:'use numArgs'.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   522
    ^ self numArgs
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   523
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   524
    "Modified: / 30.1.1999 / 14:55:27 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   525
    "Created: / 30.1.1999 / 14:55:47 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   526
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   527
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   528
numberOfMethodVars
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   529
    "return the number of method local variables.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   530
     This method is left for backward compatibility - use #numVars."
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   531
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   532
    "/ self obsoleteMethodWarning:'use numVars'.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   533
    ^ self numVars
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   534
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   535
    "Modified: / 30.1.1999 / 14:55:42 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   536
    "Created: / 30.1.1999 / 14:55:51 / cg"
84
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   537
! !
1eba5946aea2 Initial revision
claus
parents:
diff changeset
   538
6546
9cada8214da7 allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents: 6544
diff changeset
   539
!CompiledCode methodsFor:'compiler interface'!
9cada8214da7 allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents: 6544
diff changeset
   540
12160
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   541
compilerClass
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   542
    "who is responsible to parse the source code?
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   543
     Fetch it from the class"
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   544
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   545
    ^ self programmingLanguage compilerClass
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   546
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   547
    "
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   548
     (Object compiledMethodAt:#at:) compilerClass
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   549
    "
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   550
!
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   551
8419
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8314
diff changeset
   552
parserClass
9304
df985c5f2bda comment
Stefan Vogel <sv@exept.de>
parents: 9296
diff changeset
   553
    "who is responsible to parse the source code?
df985c5f2bda comment
Stefan Vogel <sv@exept.de>
parents: 9296
diff changeset
   554
     Fetch it from the class"
df985c5f2bda comment
Stefan Vogel <sv@exept.de>
parents: 9296
diff changeset
   555
12160
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   556
    ^ self programmingLanguage parserClass
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   557
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   558
    "
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   559
     (Object compiledMethodAt:#at:) parserClass
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   560
    "
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   561
!
8425
d9a9a254584a *** empty log message ***
martin
parents: 8419
diff changeset
   562
12160
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   563
programmingLanguage
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   564
"/ the following is correct, but might be too slow...
14153
6f22f72de84d changed: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents: 14068
diff changeset
   565
"/ we have language-specific methods anyway, so simply redefine there.
12160
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   566
"/    |mclass|
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   567
"/
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   568
"/    mclass := self mclass.
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   569
"/    mclass isNil ifTrue:[^ SmalltalkLanguage].
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   570
"/    ^ mclass programmingLanguage
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   571
    ^  SmalltalkLanguage instance
8419
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8314
diff changeset
   572
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8314
diff changeset
   573
    "
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8314
diff changeset
   574
     (Object compiledMethodAt:#at:) parserClass
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8314
diff changeset
   575
    "
14153
6f22f72de84d changed: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents: 14068
diff changeset
   576
6f22f72de84d changed: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents: 14068
diff changeset
   577
    "Modified (comment): / 01-06-2012 / 21:10:56 / cg"
8419
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8314
diff changeset
   578
!
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8314
diff changeset
   579
6546
9cada8214da7 allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents: 6544
diff changeset
   580
syntaxHighlighterClass
9cada8214da7 allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents: 6544
diff changeset
   581
    "if #askClass is returned here, my owning class will be asked for the syntaxHighlighter.
9cada8214da7 allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents: 6544
diff changeset
   582
     if nil is returned, no syntaxHighlighting will be done.
9cada8214da7 allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents: 6544
diff changeset
   583
     Can be redefined in subclasses (MetaMethod) which use special syntax."
9cada8214da7 allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents: 6544
diff changeset
   584
12160
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
   585
    ^ self programmingLanguage syntaxHighlighterClass
6546
9cada8214da7 allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents: 6544
diff changeset
   586
! !
9cada8214da7 allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents: 6544
diff changeset
   587
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   588
!CompiledCode methodsFor:'converting'!
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   589
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   590
makeRealMethod
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   591
    "by default, we are a real method.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   592
     Subclasses (e.g. LazyMethod) may redefine this"
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   593
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   594
    ^ self
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   595
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   596
    "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
   597
! !
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1293
diff changeset
   598
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   599
!CompiledCode methodsFor:'debugging'!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   600
5304
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   601
breakPointAfter:countInvocations
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   602
    "arrange for a breakpoint-debugger to be opened when this method
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   603
     was invoked countInvocations times."
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   604
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   605
    MessageTracer trapMethod:self after:countInvocations.
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   606
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   607
!
5a6bdbd6e340 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5190
diff changeset
   608
5538
e0cd72dbdda7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
   609
breakPointIf:conditionBlock
e0cd72dbdda7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
   610
    "arrange for a breakpoint-debugger to be opened when this method
e0cd72dbdda7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
   611
     is invoked AND conditionBlock evaluates to true."
e0cd72dbdda7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
   612
e0cd72dbdda7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
   613
    MessageTracer trapMethod:self if:conditionBlock
e0cd72dbdda7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
   614
e0cd72dbdda7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
   615
    "Created: / 18.8.2000 / 22:09:59 / cg"
e0cd72dbdda7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
   616
!
e0cd72dbdda7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
   617
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   618
breakPointInProcess:aProcess
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   619
    "arrange for a breakpoint-debugger to be opened when this method
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   620
     is invoked from withn aProcess."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   621
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   622
    MessageTracer trapMethod:self inProcess:aProcess.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   623
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   624
    "Modified: / 12.1.1998 / 18:22:39 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   625
    "Created: / 30.1.1999 / 14:50:01 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   626
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   627
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   628
clearBreakPoint
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   629
    "remove any break/trace-point on this method"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   630
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   631
    MessageTracer unwrapMethod:self.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   632
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   633
    "Modified: / 12.1.1998 / 18:22:14 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   634
    "Created: / 30.1.1999 / 14:49:53 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   635
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   636
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   637
isCounted
5525
c4329e3e6c06 added #isTiming
Claus Gittinger <cg@exept.de>
parents: 5522
diff changeset
   638
    "obsolete - replaced by isCountingMemoryUsage"
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   639
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   640
    ^ MessageTracer notNil
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   641
      and:[MessageTracer isCountingMemoryUsage:self]
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   642
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   643
    "Modified: / 27.7.1998 / 11:05:36 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   644
    "Created: / 30.1.1999 / 14:48:57 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   645
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   646
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   647
isCounting
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   648
    "return true, if invokations of this method are counted"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   649
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   650
    ^ MessageTracer notNil
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   651
      and:[MessageTracer isCounting:self]
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   652
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   653
    "Modified: / 27.7.1998 / 11:06:00 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   654
    "Created: / 30.1.1999 / 14:49:19 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   655
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   656
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   657
isCountingMemoryUsage
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   658
    "return true, if memory allocations done by this method (and callees)
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   659
     are counted"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   660
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   661
    ^ MessageTracer notNil
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   662
      and:[MessageTracer isCountingMemoryUsage:self]
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   663
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   664
    "Modified: / 27.7.1998 / 11:06:23 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   665
    "Created: / 30.1.1999 / 14:49:26 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   666
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   667
5525
c4329e3e6c06 added #isTiming
Claus Gittinger <cg@exept.de>
parents: 5522
diff changeset
   668
isTiming
c4329e3e6c06 added #isTiming
Claus Gittinger <cg@exept.de>
parents: 5522
diff changeset
   669
    "return true, if timiing statistics are being gathered on this method."
c4329e3e6c06 added #isTiming
Claus Gittinger <cg@exept.de>
parents: 5522
diff changeset
   670
c4329e3e6c06 added #isTiming
Claus Gittinger <cg@exept.de>
parents: 5522
diff changeset
   671
    ^ MessageTracer notNil
c4329e3e6c06 added #isTiming
Claus Gittinger <cg@exept.de>
parents: 5522
diff changeset
   672
      and:[MessageTracer isTiming:self]
c4329e3e6c06 added #isTiming
Claus Gittinger <cg@exept.de>
parents: 5522
diff changeset
   673
!
c4329e3e6c06 added #isTiming
Claus Gittinger <cg@exept.de>
parents: 5522
diff changeset
   674
3962
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   675
resetCountingStatistics
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   676
    "reset count statistics of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   677
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   678
    MessageTracer resetCountOfMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   679
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   680
    "Modified: / 12.1.1998 / 18:24:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   681
    "Created: / 30.1.1999 / 14:50:19 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   682
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   683
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   684
resetMemoryUsageStatistics
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   685
    "reset count statistics of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   686
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   687
    MessageTracer resetMemoryUsageOfMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   688
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   689
    "Modified: / 12.1.1998 / 18:24:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   690
    "Created: / 30.1.1999 / 14:50:22 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   691
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   692
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   693
resetTimingStatistics
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   694
    "reset timing statistics of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   695
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   696
    MessageTracer resetExecutionTimesOfMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   697
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   698
    "Modified: / 12.1.1998 / 18:24:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   699
    "Created: / 30.1.1999 / 14:50:25 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   700
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   701
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   702
setBreakPoint
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   703
    "arrange for a breakpoint-debugger to be opened when this method
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   704
     is invoked."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   705
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   706
    MessageTracer trapMethod:self.
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   707
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   708
    "Modified: / 12.1.1998 / 18:22:36 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   709
    "Created: / 30.1.1999 / 14:50:27 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   710
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   711
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   712
setTraceFullPoint
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   713
    "arrange for a full-backtrace to be sent to the standard-error stream
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   714
     when this method is invoked."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   715
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   716
    MessageTracer traceMethodFull:self on:Transcript
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   717
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   718
    "Modified: / 12.1.1998 / 18:23:11 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   719
    "Created: / 30.1.1999 / 14:50:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   720
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   721
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   722
setTracePoint
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   723
    "arrange for a trace-message to be sent to the standard-error stream
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   724
     when this method is invoked."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   725
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   726
    MessageTracer traceMethod:self on:Transcript
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   727
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   728
    "Modified: / 12.1.1998 / 18:23:23 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   729
    "Created: / 30.1.1999 / 14:50:33 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   730
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   731
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   732
setTraceSenderPoint
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   733
    "arrange for a sender-trace-message to be sent to the standard-error stream
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   734
     when this method is invoked."
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   735
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   736
    MessageTracer traceMethodSender:self on:Transcript
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   737
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   738
    "Modified: / 12.1.1998 / 18:23:31 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   739
    "Created: / 30.1.1999 / 14:50:36 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   740
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   741
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   742
startCounting
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   743
    "start counting invokations of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   744
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   745
    MessageTracer countMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   746
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   747
    "Modified: / 12.1.1998 / 18:23:45 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   748
    "Created: / 30.1.1999 / 14:50:38 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   749
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   750
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   751
startCountingMemoryUsage
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   752
    "start counting memory usage of the receiver (and every callee)"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   753
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   754
    MessageTracer countMemoryUsageOfMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   755
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   756
    "Modified: / 27.7.1998 / 11:06:55 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   757
    "Created: / 30.1.1999 / 14:50:41 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   758
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   759
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   760
startTiming
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   761
    "start timing the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   762
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   763
    MessageTracer timeMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   764
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   765
    "Modified: / 12.1.1998 / 18:24:05 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   766
    "Created: / 30.1.1999 / 14:50:44 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   767
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   768
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   769
stopCounting
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   770
    "stop counting calls of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   771
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   772
    MessageTracer stopCountingMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   773
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   774
    "Modified: / 12.1.1998 / 18:24:15 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   775
    "Created: / 30.1.1999 / 14:50:47 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   776
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   777
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   778
stopCountingMemoryUsage
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   779
    "stop counting memory usage of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   780
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   781
    MessageTracer stopCountingMemoryUsageOfMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   782
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   783
    "Modified: / 12.1.1998 / 18:24:22 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   784
    "Created: / 30.1.1999 / 14:50:51 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   785
!
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   786
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   787
stopTiming
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   788
    "stop timing of the receiver"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   789
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   790
    MessageTracer stopTimingMethod:self
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   791
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   792
    "Modified: / 12.1.1998 / 18:24:30 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   793
    "Created: / 30.1.1999 / 14:50:54 / cg"
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   794
! !
c941b3a72553 code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents: 3933
diff changeset
   795
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   796
!CompiledCode methodsFor:'error handling'!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   797
7150
a1fe0a0313a8 uses class-based exceptions
Claus Gittinger <cg@exept.de>
parents: 6663
diff changeset
   798
badArgumentArray:argsGiven
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   799
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   800
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   801
    "this error is triggered, if a non-array is passed to
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   802
     #valueWithReceiver:.. type of methods"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   803
7603
88c60268d47f Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents: 7261
diff changeset
   804
    ^ ArgumentError
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   805
	raiseRequestWith:self
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   806
	errorString:' - argumentArray is not an Array'
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   807
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   808
    "Modified: 4.11.1996 / 22:46:52 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   809
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   810
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   811
badLiteralTable
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   812
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   813
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   814
    "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
   815
     array (i.e. non-array) - this can only happen, if the
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   816
     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
   817
     literal table or the GC is broken and corrupted it."
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   818
7603
88c60268d47f Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents: 7261
diff changeset
   819
    ^ BadLiteralsError raise.
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   820
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   821
    "Modified: 4.11.1996 / 22:46:55 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   822
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   823
5744
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   824
interpretWithReceiver:aReceiver
6544
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   825
    "invoked by VM for non-Smalltalk-methods (MetaMethods)"
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   826
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   827
    self subclassResponsibility
5744
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   828
!
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   829
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   830
interpretWithReceiver:aReceiver arg:arg1
6544
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   831
    "invoked by VM for non-Smalltalk-methods (MetaMethods)"
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   832
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   833
    self subclassResponsibility
5744
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   834
!
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   835
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   836
interpretWithReceiver:aReceiver arg:arg1 arg:arg2
6544
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   837
    "invoked by VM for non-Smalltalk-methods (MetaMethods)"
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   838
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   839
    self subclassResponsibility
5744
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   840
!
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   841
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   842
interpretWithReceiver:aReceiver arg:arg1 arg:arg2 arg:arg3
6544
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   843
    "invoked by VM for non-Smalltalk-methods (MetaMethods)"
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   844
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   845
    self subclassResponsibility
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   846
!
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   847
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   848
interpretWithReceiver:aReceiver arguments:argVector
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   849
    "invoked by VM for non-Smalltalk-methods (MetaMethods)"
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   850
7f5d747a9a92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6308
diff changeset
   851
    self subclassResponsibility
5744
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   852
!
229241968e2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5729
diff changeset
   853
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   854
invalidByteCode
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   855
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   856
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   857
    "this error is triggered when the interpreter tries to execute a
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   858
     code object, where the byteCode is nonNil, but not a ByteArray.
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   859
     Can only happen when Compiler/runtime system is broken or
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   860
     someone played around with a blocks/methods code."
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   861
7603
88c60268d47f Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents: 7261
diff changeset
   862
    ^ InvalidByteCodeError raise.
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   863
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   864
    "Modified: 4.11.1996 / 22:46:59 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   865
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   866
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   867
invalidInstruction
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   868
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   869
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   870
    "this error is triggered when the bytecode-interpreter tries to
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   871
     execute an invalid bytecode instruction.
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   872
     Can only happen when Compiler/runtime system is broken or
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   873
     someone played around with a blocks/methods code."
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   874
7603
88c60268d47f Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents: 7261
diff changeset
   875
    ^ InvalidInstructionError raise.
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   876
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   877
    "Modified: 4.11.1996 / 22:47:03 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   878
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   879
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   880
noByteCode
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   881
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   882
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   883
    "this error is triggered when the interpreter tries to execute a
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   884
     code object, where both the code and byteCode instances are nil.
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   885
     This can happen if:
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   886
	- the Compiler/runtime system is broken, (should not happen)
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   887
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   888
	- someone played around with a block/method, (you should not do this)
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   889
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   890
	- compilation of a lazy method failed
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   891
	  (i.e. the lazy method contains an error or
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   892
	   it contains primitive code and there is no stc compiler available)
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   893
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   894
	- an unloaded object modules method is called for.
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   895
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   896
     Only the first case is to be considered serious
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   897
     - it should not happen if the system is used correctly."
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   898
9296
ff844fd2a954 NoByteCodeError is proceedable
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   899
    ^ NoByteCodeError raiseRequest.
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   900
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   901
    "Modified: 4.11.1996 / 22:47:07 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   902
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   903
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   904
receiverNotBoolean:anObject
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   905
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   906
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   907
    "this error is triggered when the bytecode-interpreter tries to
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   908
     execute ifTrue:/ifFalse or whileTrue: - type of expressions where the
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   909
     receiver is neither true nor false.
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   910
     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
   911
7603
88c60268d47f Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents: 7261
diff changeset
   912
    ^ NonBooleanReceiverError raise.
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   913
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   914
    "Modified: 4.11.1996 / 22:47:11 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   915
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   916
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   917
tooManyArguments
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   918
    "{ Pragma: +optSpace }"
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   919
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   920
    "this error is triggered, when a method/block tries to perform a send with
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   921
     more arguments than supported by the interpreter.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   922
     This can only happen, if the compiler has been changed without
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   923
     updating the VM, since the compiler checks for allowed number of
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   924
     arguments."
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   925
7603
88c60268d47f Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents: 7261
diff changeset
   926
    ^ ArgumentError
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   927
	raiseRequestWith:self
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   928
	errorString:' - too many args in send'
1544
ed34e792e12d comments
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   929
1872
8a0f9ae176e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   930
    "Modified: 4.11.1996 / 22:47:14 / cg"
2827
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   931
!
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   932
7150
a1fe0a0313a8 uses class-based exceptions
Claus Gittinger <cg@exept.de>
parents: 6663
diff changeset
   933
wrongNumberOfArguments:numArgsGiven
2827
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   934
    "{ Pragma: +optSpace }"
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   935
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   936
    "this error is triggered by the VM, if a method is called with a wrong number
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   937
     of arguments.
2827
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   938
     This only applies to #valueWithReceiverXXX and #perform:withArguments: - sends.
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   939
     With a normal send, this error cannot happen."
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   940
7150
a1fe0a0313a8 uses class-based exceptions
Claus Gittinger <cg@exept.de>
parents: 6663
diff changeset
   941
    ^ WrongNumberOfArgumentsError
14423
10c643ab2647 changed: #wrongNumberOfArguments:
Claus Gittinger <cg@exept.de>
parents: 14255
diff changeset
   942
        raiseRequestWith:self
10c643ab2647 changed: #wrongNumberOfArguments:
Claus Gittinger <cg@exept.de>
parents: 14255
diff changeset
   943
        errorString:(' - %1 got %2 arg(s) where %3 expected'
10c643ab2647 changed: #wrongNumberOfArguments:
Claus Gittinger <cg@exept.de>
parents: 14255
diff changeset
   944
                        bindWith:self printString "/ self class name
10c643ab2647 changed: #wrongNumberOfArguments:
Claus Gittinger <cg@exept.de>
parents: 14255
diff changeset
   945
                        with:numArgsGiven
10c643ab2647 changed: #wrongNumberOfArguments:
Claus Gittinger <cg@exept.de>
parents: 14255
diff changeset
   946
                        with:self numArgs)
2827
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   947
6663
a0a42694a4d5 errorStrings when raising exceptions.
Stefan Vogel <sv@exept.de>
parents: 6546
diff changeset
   948
    "
10905
96c44ab0e80f wrongNumberOfArguments: error message
Claus Gittinger <cg@exept.de>
parents: 10601
diff changeset
   949
     2 perform:#+
6663
a0a42694a4d5 errorStrings when raising exceptions.
Stefan Vogel <sv@exept.de>
parents: 6546
diff changeset
   950
    "
a0a42694a4d5 errorStrings when raising exceptions.
Stefan Vogel <sv@exept.de>
parents: 6546
diff changeset
   951
2827
0f653b53179a provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   952
    "Modified: 1.8.1997 / 00:23:10 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   953
! !
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   954
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   955
!CompiledCode methodsFor:'executing'!
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   956
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   957
valueWithReceiver:anObject arguments:argArray
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   958
    "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
   959
     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
   960
     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
   961
     traditional function call.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   962
     This method is provided for debugging- and breakpoint-support
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   963
     (replacing a method by a stub and recalling the original), or to implement
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   964
     experimental MI implementations - it is not for general use.
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   965
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   966
     The receiver must be a method compiled in anObjects class or one of its
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   967
     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
   968
     expectations -
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   969
     - 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
   970
     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
   971
     YOU HAVE BEEN WARNED."
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   972
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   973
    ^ self
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   974
	valueWithReceiver:anObject
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   975
	arguments:argArray
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   976
	selector:nil
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   977
	search:nil
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   978
	sender:nil
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   979
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   980
    "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
   981
    "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
   982
!
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   983
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   984
valueWithReceiver:anObject arguments:argArray selector:aSymbol
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   985
    "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
   986
     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
   987
     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
   988
     traditional function call.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   989
     This method is provided for debugging- and breakpoint-support
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   990
     (replacing a method by a stub and recalling the original), or to implement
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   991
     experimental MI implementations - it is not for general use.
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   992
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
   993
     The receiver must be a method compiled in anObjects class or one of its
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   994
     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
   995
     expectations -
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   996
     - 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
   997
     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
   998
     YOU HAVE BEEN WARNED."
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   999
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1000
    ^ self
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1001
	valueWithReceiver:anObject
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1002
	arguments:argArray
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1003
	selector:aSymbol
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1004
	search:nil
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1005
	sender:nil
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1006
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1007
    "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
  1008
    "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
  1009
!
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1010
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1011
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
  1012
    "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
  1013
     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
  1014
     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
  1015
     traditional function call.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1016
     This method is provided for debugging- and breakpoint-support
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1017
     (replacing a method by a stub and recalling the original), or to implement
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1018
     experimental MI implementations - it is not for general use.
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1019
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1020
     The receiver must be a method compiled in anObjects class or one of its
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1021
     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
  1022
     expectations -
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1023
     - 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
  1024
     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
  1025
     YOU HAVE BEEN WARNED."
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1026
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1027
    ^ self
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1028
	valueWithReceiver:anObject
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1029
	arguments:argArray
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1030
	selector:aSymbol
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1031
	search:nil
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1032
	sender:nil
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1033
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1034
    "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
  1035
    "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
  1036
!
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1037
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1038
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
  1039
    "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
  1040
     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
  1041
     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
  1042
     traditional function call.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1043
     This method is provided for debugging- and breakpoint-support
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1044
     (replacing a method by a stub and recalling the original), or to implement
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1045
     experimental MI implementations - it is not for general use.
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1046
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1047
     The receiver must be a method compiled in anObjects class or one of its
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1048
     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
  1049
     expectations -
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1050
     - 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
  1051
     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
  1052
     YOU HAVE BEEN WARNED."
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1053
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1054
%{
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1055
    OBJFUNC code;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1056
    OBJ searchClass;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1057
    static struct inlineCache dummy = _DUMMYILC0;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1058
    int nargs;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1059
    OBJ *ap;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1060
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1061
    /*
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1062
     * args must be an array, or nil
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1063
     */
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1064
    if (__isArray(argArray)) {
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1065
	nargs = __arraySize(argArray);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1066
	ap = __ArrayInstPtr(argArray)->a_element;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1067
    } else {
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1068
	if (argArray != nil) {
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1069
	    goto badArgs;
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1070
	}
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1071
	nargs = 0;
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1072
	ap = (OBJ *)0;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1073
    }
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1074
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1075
#ifdef F_NARGS
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1076
    if (((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT) == nargs)
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1077
#endif
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1078
    {
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1079
	code = __MethodInstPtr(self)->m_code;
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1080
	if (aClass == nil) {
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1081
	    searchClass = dummy.ilc_class = __Class(anObject);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1082
	} else {
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1083
	    searchClass = dummy.ilc_class = aClass;
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1084
	}
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1085
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1086
	if (nargs <= 15) {
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1087
	  OBJ rslt;
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1088
#ifdef CONTEXT_DEBUG
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1089
	  OBJ sav = __thisContext;
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1090
#endif
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1091
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1092
	  /*
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1093
	   * add virtual sender (unwinding) here later,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1094
	   * to allow hiding contexts in lazy methods.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1095
	   * (this is cosmetics only; therefore its done later)
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1096
	   */
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1097
	  if (code) {
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1098
	    /* compiled code */
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1099
	    switch (nargs) {
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1100
		case 0:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1101
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1102
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1103
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1104
		case 1:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1105
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1106
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1107
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1108
		case 2:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1109
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1110
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1111
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1112
		case 3:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1113
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1], ap[2]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1114
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1115
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1116
		case 4:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1117
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1118
				 ap[0], ap[1], ap[2], ap[3]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1119
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1120
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1121
		case 5:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1122
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1123
				 ap[0], ap[1], ap[2], ap[3], ap[4]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1124
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1125
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1126
		case 6:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1127
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1128
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1129
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1130
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1131
		case 7:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1132
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1133
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1134
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1135
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1136
		case 8:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1137
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1138
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1139
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1140
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1141
		case 9:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1142
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1143
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1144
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1145
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1146
		case 10:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1147
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1148
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1149
				 ap[9]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1150
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1151
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1152
		case 11:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1153
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1154
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1155
				 ap[9], ap[10]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1156
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1157
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1158
		case 12:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1159
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1160
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1161
				 ap[9], ap[10], ap[11]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1162
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1163
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1164
		case 13:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1165
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1166
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1167
				 ap[9], ap[10], ap[11], ap[12]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1168
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1169
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1170
		case 14:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1171
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1172
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1173
				 ap[9], ap[10], ap[11], ap[12], ap[13]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1174
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1175
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1176
		case 15:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1177
		    rslt = (*code)(anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1178
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1179
				 ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1180
		    break;
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1181
	    }
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1182
	  } else {
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1183
	    /* interpreted code */
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1184
#ifdef PASS_ARG_POINTER
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1185
	    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
  1186
#else
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1187
	    switch (nargs) {
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1188
		case 0:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1189
		    rslt = __interpret(self, 0, anObject, aSymbol, searchClass, &dummy);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1190
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1191
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1192
		case 1:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1193
		    rslt = __interpret(self, 1, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1194
				   ap[0]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1195
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1196
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1197
		case 2:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1198
		    rslt = __interpret(self, 2, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1199
				   ap[0], ap[1]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1200
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1201
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1202
		case 3:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1203
		    rslt = __interpret(self, 3, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1204
				   ap[0], ap[1], ap[2]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1205
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1206
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1207
		case 4:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1208
		    rslt = __interpret(self, 4, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1209
				   ap[0], ap[1], ap[2], ap[3]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1210
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1211
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1212
		case 5:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1213
		    rslt = __interpret(self, 5, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1214
				   ap[0], ap[1], ap[2], ap[3], ap[4]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1215
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1216
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1217
		case 6:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1218
		    rslt = __interpret(self, 6, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1219
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1220
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1221
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1222
		case 7:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1223
		    rslt = __interpret(self, 7, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1224
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1225
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1226
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1227
		case 8:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1228
		    rslt = __interpret(self, 8, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1229
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1230
				   ap[7]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1231
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1232
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1233
		case 9:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1234
		    rslt = __interpret(self, 9, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1235
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1236
				   ap[7], ap[8]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1237
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1238
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1239
		case 10:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1240
		    rslt = __interpret(self, 10, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1241
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1242
				   ap[7], ap[8], ap[9]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1243
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1244
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1245
		case 11:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1246
		    rslt = __interpret(self, 11, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1247
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1248
				   ap[7], ap[8], ap[9], ap[10]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1249
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1250
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1251
		case 12:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1252
		    rslt = __interpret(self, 12, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1253
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1254
				   ap[7], ap[8], ap[9], ap[10], ap[11]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1255
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1256
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1257
		case 13:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1258
		    rslt = __interpret(self, 13, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1259
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1260
				   ap[7], ap[8], ap[9], ap[10], ap[11], ap[12]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1261
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1262
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1263
		case 14:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1264
		    rslt = __interpret(self, 14, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1265
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1266
				   ap[7], ap[8], ap[9], ap[10], ap[11], ap[12], ap[13]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1267
		    break;
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1268
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1269
		case 15:
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1270
		    rslt = __interpret(self, 15, anObject, aSymbol, searchClass, &dummy,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1271
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1272
				   ap[7], ap[8], ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1273
		    break;
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1274
	    }
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1275
#endif
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1276
	  }
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1277
#ifdef CONTEXT_DEBUG
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1278
	  if (sav != __thisContext) {
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1279
	      if (code) {
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1280
		  printf("CONTEXT BOTCH after execution of %x\n", code);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1281
	      } else {
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1282
		  printf("CONTEXT BOTCH after execution of interpreted method\n");
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1283
		  printf("code now: %x\n", __MethodInstPtr(self)->m_code);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1284
	      }
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1285
	      printf("context before:\n");
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1286
	      __dumpObject__(sav, __LINE__);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1287
	      printf("context now:\n");
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1288
	      __dumpObject__(__thisContext, __LINE__);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1289
	  }
3140
184145ae63f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3093
diff changeset
  1290
#endif
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1291
	  RETURN (rslt);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1292
	}
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1293
    }
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1294
    badArgs: ;
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1295
%}.
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1296
    (argArray isMemberOf:Array) ifFalse:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1297
	(self numArgs ~~ 0
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1298
	or:[argArray notNil]) ifTrue:[
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1299
	    "
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1300
	     arguments must be either nil or an array
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1301
	    "
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1302
	    ^ self badArgumentArray:argArray
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1303
	]
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1304
    ].
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1305
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1306
    (argArray size ~~ self numArgs) ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1307
	"
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1308
	 the method expects a different number of arguments
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1309
	"
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1310
	^ self wrongNumberOfArguments:argArray size
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1311
    ].
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1312
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1313
    "/ 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
  1314
    "/ (currently, 15)
5426
eef3df49b4e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  1315
    argArray size > self class maxNumberOfArguments ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1316
	^ self tooManyArguments
5426
eef3df49b4e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  1317
    ].
eef3df49b4e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  1318
    ^ self primitiveFailed
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1319
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1320
    "
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1321
     (Float compiledMethodAt:#+)
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1322
	valueWithReceiver:1.0 arguments:#(2.0)
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1323
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1324
     'the next example is a wrong one - which is detected by True's method ...'.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1325
     (True compiledMethodAt:#printString)
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1326
	valueWithReceiver:false arguments:nil
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1327
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1328
     '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
  1329
      and a wrong value returned ...'.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1330
     (Point compiledMethodAt:#x)
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1331
	valueWithReceiver:(1->2) arguments:nil
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1332
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1333
     '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
  1334
      and may crash the system WARNING: save your work before doing this ...'.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1335
     (Point compiledMethodAt:#x)
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1336
	valueWithReceiver:(Object new) arguments:nil
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1337
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1338
     '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
  1339
     (Object compiledMethodAt:#printOn:)
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1340
	valueWithReceiver:false arguments:nil
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1341
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1342
     '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
  1343
     (Object compiledMethodAt:#printOn:)
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1344
	valueWithReceiver:false arguments:#()
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1345
    "
13776
7705d7d06a11 changed: #valueWithReceiver:arguments:selector:search:sender:
Claus Gittinger <cg@exept.de>
parents: 13640
diff changeset
  1346
13777
7308f6b1eede changed: #valueWithReceiver:arguments:selector:search:sender:
Claus Gittinger <cg@exept.de>
parents: 13776
diff changeset
  1347
    "Modified: / 07-10-2011 / 13:58:21 / cg"
2800
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1348
! !
f6ab31b2a27d moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1349
7258
9ccdbee7d1ad method category rename
Claus Gittinger <cg@exept.de>
parents: 7150
diff changeset
  1350
!CompiledCode methodsFor:'private-accessing'!
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1351
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1352
byteCode:aByteArray
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1353
    "set the bytecode field - DANGER ALERT"
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1354
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1355
    byteCode := aByteArray
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1356
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1357
1640
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1358
checked:aBoolean
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1359
    "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
  1360
     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
  1361
     trying any compilation.
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1362
     Not for public use - for VM debugging only."
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1363
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1364
%{  /* NOCONTEXT */
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1365
2869
6fcc9aafb7c4 alpha64 stuff
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1366
    INT newFlags = __intVal(__INST(flags));
1640
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1367
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1368
    /* made this a primitive to get define in stc.h */
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1369
    if (aBoolean == true)
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1370
	newFlags |= F_CHECKED;
1640
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1371
    else
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1372
	newFlags &= ~F_CHECKED;
1640
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1373
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
  1374
    __INST(flags) = __mkSmallInteger(newFlags);
1640
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1375
%}
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1376
!
db4aef0f601b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1544
diff changeset
  1377
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1378
dynamic
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1379
    "return the flag stating that the machine code was created
1774
ab14302c6497 comment
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
  1380
     dynamically (from bytecode) or loaded dynamically from an objectFile
ab14302c6497 comment
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
  1381
     (i.e. has machineCode, but is not in the executable)."
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1382
3662
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1383
    "/ obsolete
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1384
    ^ self isDynamic
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1385
3662
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1386
    "Modified: / 20.7.1998 / 14:22:35 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1387
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1388
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1389
literals:aLiteralArray
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1390
    "set the literal array for evaluation - DANGER ALERT"
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1391
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1392
    |i|
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1393
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1394
    aLiteralArray isNil ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1395
	^ self.
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1396
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1397
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1398
    self size == 1 ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1399
	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
  1400
    ] ifFalse:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1401
	i := 1.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1402
	aLiteralArray do:[:literal|
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1403
	    self at:i put:literal.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1404
	    i := i + 1.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1405
	].
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1406
    ].
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1407
3313
06da74a9cb04 make certain that literal array really is an array
Claus Gittinger <cg@exept.de>
parents: 3218
diff changeset
  1408
    "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
  1409
    "Modified: / 5.3.1998 / 02:05:56 / cg"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1410
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1411
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1412
markFlag
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1413
    "return the mark bits value as a boolean"
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1414
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1415
%{  /* NOCONTEXT */
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1416
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1417
    /* made this a primitive to get define in stc.h */
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1418
1771
ccb8ff5d4763 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  1419
    RETURN (( (INT)(__INST(flags)) & __MASKSMALLINT(F_MARKBIT)) ? true : false);
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1420
%}
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1421
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1422
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1423
markFlag:aBoolean
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1424
    "set/clear the mark flag bit.
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1425
     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
  1426
     for any (debugging/tracing) use. For example, the coverage test uses
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1427
     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
  1428
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1429
%{  /* NOCONTEXT */
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1430
2869
6fcc9aafb7c4 alpha64 stuff
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1431
    INT newFlags = __intVal(__INST(flags));
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1432
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1433
    /* made this a primitive to get define in stc.h */
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1434
    if (aBoolean == true)
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1435
	newFlags |= F_MARKBIT;
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1436
    else
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1437
	newFlags &= ~F_MARKBIT;
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1438
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
  1439
    __INST(flags) = __mkSmallInteger(newFlags);
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1440
%}
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1441
! !
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1442
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1443
!CompiledCode methodsFor:'private-compiler interface'!
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1444
4489
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1445
contextMustBeReturnable:aBoolean
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1446
%{  /* NOCONTEXT */
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1447
    /* made this a primitive to get define in stc.h */
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1448
    if (aBoolean == true) {
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1449
	__INST(flags) = (OBJ)( (INT)__INST(flags) | __MASKSMALLINT(F_RETURNABLE));
4489
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1450
    } else {
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1451
	__INST(flags) = (OBJ)( (INT)__INST(flags) & ~__MASKSMALLINT(F_RETURNABLE));
4489
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1452
    }
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1453
%}
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1454
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1455
!
b7e297fa3f64 pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1456
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1457
flags:newFlags
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1458
    "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
  1459
     WARNING: for internal use by the compiler only.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1460
	      playing around here with incorrect values
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1461
	      may crash smalltalk badly.
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1462
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1463
     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
  1464
     may change without notice."
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1465
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1466
    "/ 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
  1467
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1468
    (newFlags isMemberOf:SmallInteger) ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1469
	flags := newFlags
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1470
    ]
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1471
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1472
    "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
  1473
    "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
  1474
!
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1475
13427
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1476
marked: aBoolean
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1477
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1478
    "Sets the mark bit. You may use it for whatever you want. Actually,
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1479
     it's used for marking profiled methods"
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1480
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1481
%{  /* NOCONTEXT */
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1482
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1483
    INT newFlags = __intVal(__INST(flags));
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1484
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1485
    /* made this a primitive to get define in stc.h */
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1486
    if (aBoolean == true)
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1487
	newFlags |= F_MARKBIT;
13427
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1488
    else
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1489
	newFlags &= ~F_MARKBIT;
13427
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1490
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1491
    __INST(flags) = __mkSmallInteger(newFlags);
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1492
%}
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1493
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1494
    "Created: / 29-11-2010 / 21:20:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1495
!
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1496
2804
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1497
numberOfArgs:aNumber
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1498
    "set the number of arguments, the codeObject expects.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1499
     WARNING: for internal use by the compiler only.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1500
	      playing around here with incorrect values
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1501
	      may (will ?)  crash smalltalk badly.
2804
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1502
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1503
     The limitation in the max. number of arguments is due to the
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1504
     missing SENDxx functions in the VM and cases in #perform. This too
2804
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1505
     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
  1506
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1507
    (aNumber between:0 and:self class maxNumberOfArguments) ifFalse:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1508
	self error:('ST/X only supports up to a maximum of ' ,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1509
		    self class maxNumberOfArguments printString ,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1510
		    ' method arguments').
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1511
	^ self
2804
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1512
    ].
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1513
%{
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1514
    /* made this a primitive to get define in stc.h */
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1515
#ifdef F_NARGS
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
  1516
    __INST(flags) = __mkSmallInteger( (__intVal(__INST(flags)) & ~F_NARGS) | (__intVal(aNumber) << F_NARGSHIFT) );
2804
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1517
#endif
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1518
%}
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1519
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1520
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1521
!
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1522
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1523
numberOfVars:aNumber
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1524
    "set the number of local variables - for use by compiler only.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1525
     WARNING: for internal use by the compiler only.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1526
	      playing around here with incorrect values
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1527
	      may (will ?)  crash smalltalk badly."
2804
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1528
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1529
%{  /* NOCONTEXT */
2869
6fcc9aafb7c4 alpha64 stuff
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1530
    INT f = __intVal(__INST(flags));
2804
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1531
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1532
    /* made this a primitive to get define in stc.h */
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1533
    if (__isSmallInteger(aNumber)) {
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1534
	f = (f & ~F_NVARS) | (__intVal(aNumber) << F_NVARSHIFT);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1535
	__INST(flags) = __mkSmallInteger(f);
2804
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1536
    }
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1537
%}
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1538
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1539
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1540
!
6b8a6d6bedf0 added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
  1541
2543
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1542
stackSize
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1543
    "return thedepth of the local stack in the context.
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1544
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1545
     WARNING: for internal use by ST/X debuggers only.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1546
	      This method may be removed without notice."
2543
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1547
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1548
%{  /* NOCONTEXT */
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
  1549
    INT n = (__intVal(__INST(flags)) & F_NSTACK) >> F_NSTACKSHIFT;
2543
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1550
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1551
    /* made this a primitive to get define in stc.h */
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
  1552
    RETURN (__mkSmallInteger(n));
2543
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1553
%}
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1554
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1555
!
b401cd5167e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  1556
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1557
stackSize:aNumber
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1558
    "set the depth of the local stack.
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1559
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1560
     WARNING: for internal use by the compiler only.
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1561
	      playing around here with incorrect values
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1562
	      may crash smalltalk badly.
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1563
	      (if the runtime library was compiled with DEBUG,
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1564
	       a bad stack will be detected and triggers an error)"
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1565
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1566
%{  /* NOCONTEXT */
2869
6fcc9aafb7c4 alpha64 stuff
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1567
    INT f = __intVal(__INST(flags));
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1568
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1569
    /* 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
  1570
    if (__isSmallInteger(aNumber)) {
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1571
	f = (f & ~F_NSTACK) | (__intVal(aNumber) << F_NSTACKSHIFT);
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1572
	__INST(flags) = __mkSmallInteger(f);
2540
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1573
    }
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1574
%}
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1575
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1576
! !
a9388e872a51 moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1577
328
claus
parents: 326
diff changeset
  1578
!CompiledCode methodsFor:'queries'!
claus
parents: 326
diff changeset
  1579
8688
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1580
argumentCount
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1581
    "ANSI alias for numArgs: return the number of arguments, the method expects."
8688
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1582
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1583
%{  /* NOCONTEXT */
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1584
    /* made this a primitive to get define in stc.h */
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1585
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
  1586
    RETURN (__mkSmallInteger((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT));
8688
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1587
%}.
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1588
    "
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1589
     The old implementation simply counted the arguments from
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1590
     the methods source - new versions include this information
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1591
     in the flag instVar, for more security in #perform:
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1592
    "
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1593
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1594
    "
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1595
     (Method compiledMethodAt:#source) numArgs
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1596
     (Method compiledMethodAt:#source:) numArgs
8688
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1597
    "
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1598
!
c3de1df6642a Define #argumentCount as ANSI alias for #numArgs
Stefan Vogel <sv@exept.de>
parents: 8425
diff changeset
  1599
1196
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1600
decompileTo:aStream
8835
d9b8b58d6566 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8688
diff changeset
  1601
    |decompilerClass decompiler|
2810
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  1602
8835
d9b8b58d6566 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8688
diff changeset
  1603
    decompilerClass := self decompilerClass.
d9b8b58d6566 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8688
diff changeset
  1604
    decompilerClass isNil ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1605
	^ false
1196
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1606
    ].
8314
fc73718968f5 Streamline autoloading.
Stefan Vogel <sv@exept.de>
parents: 8222
diff changeset
  1607
fc73718968f5 Streamline autoloading.
Stefan Vogel <sv@exept.de>
parents: 8222
diff changeset
  1608
    Autoload autoloadFailedSignal handle:[:ex |
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1609
	^ false.
8314
fc73718968f5 Streamline autoloading.
Stefan Vogel <sv@exept.de>
parents: 8222
diff changeset
  1610
    ] do:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1611
	decompilerClass autoload.
1196
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1612
    ].
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1613
8835
d9b8b58d6566 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8688
diff changeset
  1614
    decompiler := decompilerClass new.
d9b8b58d6566 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8688
diff changeset
  1615
    decompiler targetClass:self mclass.
2810
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  1616
    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
  1617
    ^ true
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1618
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1619
    "Created: 16.4.1996 / 20:25:40 / cg"
2810
fd62b379212a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
  1620
    "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
  1621
!
7b3eeec128d3 moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1622
13427
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1623
isChecked
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1624
    "return true, if this method has been analyzed for jitting"
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1625
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1626
%{  /* NOCONTEXT */
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1627
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1628
    /* made this a primitive to get define in stc.h */
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1629
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1630
    RETURN (( (INT)(__INST(flags)) & __MASKSMALLINT(F_CHECKED)) ? true : false);
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1631
%}
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1632
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1633
    "Created: / 29-11-2010 / 21:16:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1634
!
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1635
3662
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1636
isDynamic
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1637
    "return true, if the machine code was created
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1638
     dynamically (from bytecode); false if the machine code was
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1639
     already present in an objectFile
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1640
     (i.e. has JIT-compiled machineCode, as opposed to stc-compiled code)."
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1641
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1642
%{  /* NOCONTEXT */
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1643
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1644
    /* made this a primitive to get define in stc.h */
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1645
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1646
    RETURN (( (INT)(__INST(flags)) & __MASKSMALLINT(F_DYNAMIC)) ? true : false);
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1647
%}
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1648
!
efe759ae4541 renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1649
1195
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1650
isExecutable
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1651
    "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
  1652
     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
  1653
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1654
    self isInvalid ifTrue:[^ false].
3933
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1655
    ^ self byteCode notNil or:[self hasCode]
1195
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1656
3933
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1657
    "Created: / 16.4.1996 / 17:52:16 / cg"
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1658
    "Modified: / 13.11.1998 / 23:18:01 / cg"
1195
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1659
!
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1660
13640
d5ffef38fdd8 added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13427
diff changeset
  1661
isExtension
d5ffef38fdd8 added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13427
diff changeset
  1662
    "return true, if this method is an extension (i.e. package ~= classes' package)"
d5ffef38fdd8 added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13427
diff changeset
  1663
d5ffef38fdd8 added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13427
diff changeset
  1664
    ^ false
d5ffef38fdd8 added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13427
diff changeset
  1665
d5ffef38fdd8 added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13427
diff changeset
  1666
    "Created: / 07-09-2011 / 09:28:57 / cg"
d5ffef38fdd8 added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13427
diff changeset
  1667
!
d5ffef38fdd8 added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13427
diff changeset
  1668
13427
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1669
isMarked
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1670
    "return true, if this method has been marked (for whatever reason)"
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1671
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1672
%{  /* NOCONTEXT */
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1673
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1674
    /* made this a primitive to get define in stc.h */
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1675
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1676
    RETURN (( (INT)(__INST(flags)) & __MASKSMALLINT(F_MARKBIT)) ? true : false);
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1677
%}
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1678
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1679
    "Created: / 29-11-2010 / 21:17:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1680
!
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1681
1195
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1682
isUnloaded
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1683
    "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
  1684
     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
  1685
3933
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1686
    ^ (self hasCode not and:[self byteCode isNil])
1195
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1687
3933
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1688
    "Created: / 16.4.1996 / 17:51:47 / cg"
eb5fcca95dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1689
    "Modified: / 13.11.1998 / 23:18:18 / cg"
1195
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1690
!
618e2cf3fb56 moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1691
328
claus
parents: 326
diff changeset
  1692
messages
claus
parents: 326
diff changeset
  1693
    "return a Set of all symbols referenced by this thingy.
claus
parents: 326
diff changeset
  1694
     (this is more than the message selectors, since also global names
claus
parents: 326
diff changeset
  1695
     and symbols found in immediate arrays are included)."
claus
parents: 326
diff changeset
  1696
claus
parents: 326
diff changeset
  1697
    |symbolSet|
claus
parents: 326
diff changeset
  1698
claus
parents: 326
diff changeset
  1699
    symbolSet := IdentitySet new.
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1700
    self literalsDo: [ :lit |
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1701
	lit isSymbol ifTrue: [
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1702
	    symbolSet add: lit
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1703
	] ifFalse: [
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1704
	    lit isArray ifTrue: [
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1705
		lit traverse: [ :el |
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1706
		    el isSymbol ifTrue: [symbolSet add: el]
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1707
		]
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1708
	    ]
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1709
	]
328
claus
parents: 326
diff changeset
  1710
    ].
claus
parents: 326
diff changeset
  1711
    ^ symbolSet
claus
parents: 326
diff changeset
  1712
claus
parents: 326
diff changeset
  1713
    "
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1714
     (CompiledCode compiledMethodAt:#messages) messages
328
claus
parents: 326
diff changeset
  1715
    "
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1716
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1717
    "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
  1718
!
4ad1c8d6d94d moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1182
diff changeset
  1719
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1720
numArgs
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1721
    "return the number of arguments, the method expects."
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1722
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1723
%{  /* NOCONTEXT */
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1724
    /* 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
  1725
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
  1726
    RETURN (__mkSmallInteger((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT));
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1727
%}.
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1728
    "
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1729
     The old implementation simply counted the arguments from
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1730
     the methods source - new versions include this information
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1731
     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
  1732
    "
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1733
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1734
    "
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1735
     (Method compiledMethodAt:#source) numArgs
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1736
     (Method compiledMethodAt:#source:) numArgs
3218
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1737
    "
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1738
!
78255e232c66 Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents: 3145
diff changeset
  1739
1869
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1740
numVars
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1741
    "return the number of block local variables.
1869
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1742
     Do not depend on the returned value - future optimizations
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1743
     may change things here (i.e. when moving locals into
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1744
     surrounding context for inlining).
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1745
     - for debugging only."
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1746
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1747
%{  /* NOCONTEXT */
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1748
    /* made this a primitive to get define in stc.h */
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1749
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8835
diff changeset
  1750
    RETURN (__mkSmallInteger((__intVal(__INST(flags)) & F_NVARS) >> F_NVARSHIFT));
1869
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1751
%}
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1752
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1753
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1754
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1755
!
829415f1c38b lifted numVars
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1756
1190
4ad1c8d6d94d moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1182
diff changeset
  1757
referencesGlobal:aGlobalSymbol
4ad1c8d6d94d moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1182
diff changeset
  1758
    "return true, if this method references the global
3054
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1759
     bound to aGlobalSymbol.
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1760
     For now, this is the same as #referencesLiteral:,
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1761
     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
  1762
     analyzes on the bytecodes, to detect implizit global
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1763
     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
  1764
3054
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1765
    ^ 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
  1766
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1767
    "
4977
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1768
     (CompiledCode compiledMethodAt:#referencesGlobal:) referencesGlobal:#referencesLiteral:
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1769
     (CompiledCode compiledMethodAt:#referencesGlobal:) referencesGlobal:#bla
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1770
    "
1190
4ad1c8d6d94d moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1182
diff changeset
  1771
3054
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1772
    "Modified: / 24.6.1996 / 15:41:59 / stefan"
4977
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1773
    "Modified: / 9.11.1999 / 17:03:44 / cg"
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1774
!
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1775
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1776
referencesGlobalMatching:aMatchPattern
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1777
    "return true, if this method references the given a literal symbol, which
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1778
     matches the given pattern."
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1779
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1780
    ^ (self literalsDetect:[:mthdLit|
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1781
				(mthdLit isMemberOf:Symbol)
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1782
				  and:[aMatchPattern match:mthdLit]
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1783
			   ] ifNone:[false]) ~~ false.
4977
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1784
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1785
    "
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1786
     (CompiledCode compiledMethodAt:#referencesGlobalMatching:) referencesGlobalMatching:'*atch*'
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1787
     (CompiledCode compiledMethodAt:#referencesGlobalMatching:) referencesGlobalMatching:'*batch*'
4977
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1788
    "
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1789
17a819360ad5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4854
diff changeset
  1790
    "Modified: / 9.11.1999 / 17:03:16 / cg"
3054
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1791
!
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1792
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1793
referencesLiteral:aLiteral
5537
05d01dd462f6 comments
Claus Gittinger <cg@exept.de>
parents: 5533
diff changeset
  1794
    "return true, if this method references the given literal directly  (i.e. a flat search)."
3054
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1795
3771
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1796
    |lit|
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1797
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1798
    lit := aLiteral.
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1799
    aLiteral isAssociation ifTrue:[
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1800
	"/ for ST80 compatibility (where variableBindings are used ...)
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1801
	lit := lit key
3771
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1802
    ].
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1803
9136d26808a9 allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
  1804
    ^ (self literalsDetect:[:mthdLit| mthdLit == lit] ifNone:[false]) ~~ false.
3054
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1805
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1806
    "
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1807
     (CompiledCode compiledMethodAt:#referencesLiteral:) referencesGlobal:#literalsDetect:ifNone:
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1808
     (CompiledCode compiledMethodAt:#referencesLiteral:) referencesGlobal:#bla
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1809
    "
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1810
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1811
    "Modified: / 24.6.1996 / 15:41:59 / stefan"
a9616d9bc9a0 cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  1812
    "Created: / 28.10.1997 / 13:09:40 / cg"
5537
05d01dd462f6 comments
Claus Gittinger <cg@exept.de>
parents: 5533
diff changeset
  1813
    "Modified: / 18.8.2000 / 21:18:51 / cg"
3093
642a1fa90695 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3076
diff changeset
  1814
!
642a1fa90695 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3076
diff changeset
  1815
5522
754c11dfd208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5426
diff changeset
  1816
refersToLiteral:aLiteral
754c11dfd208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5426
diff changeset
  1817
    "return true if the receiver or recursively any array element in the
5537
05d01dd462f6 comments
Claus Gittinger <cg@exept.de>
parents: 5533
diff changeset
  1818
     receiver refers to aLiteral (i.e. a deep search)"
5522
754c11dfd208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5426
diff changeset
  1819
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1820
    self literalsDo: [ :el |
14255
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1821
        el == aLiteral ifTrue:[^true].
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1822
        el class == Array ifTrue:[
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1823
            (el refersToLiteral: aLiteral) ifTrue: [^true]
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1824
        ]
5522
754c11dfd208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5426
diff changeset
  1825
    ].
754c11dfd208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5426
diff changeset
  1826
    ^ false
754c11dfd208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5426
diff changeset
  1827
754c11dfd208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5426
diff changeset
  1828
    "
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1829
     (CompiledCode compiledMethodAt:#refersToLiteral:) refersToLiteral:#foo
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 14044
diff changeset
  1830
     (CompiledCode compiledMethodAt:#refersToLiteral:) refersToLiteral:#class
5522
754c11dfd208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5426
diff changeset
  1831
    "
754c11dfd208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5426
diff changeset
  1832
14255
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1833
    "Modified: / 03-03-1998 / 00:02:28 / stefan"
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1834
    "Modified: / 26-07-2012 / 15:44:33 / cg"
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1835
!
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1836
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1837
refersToLiteralMatching:aMatchPattern
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1838
    "return true if the receiver or recursively any array element in the
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1839
     receiver is symbolic and matches aMatchPattern (i.e. a deep search)"
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1840
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1841
    self literalsDo: [ :el |
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1842
        (el isSymbol and:[ aMatchPattern match: el]) ifTrue:[^true].
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1843
        el class == Array ifTrue:[
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1844
            (el refersToLiteralMatching: aMatchPattern) ifTrue: [^true]
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1845
        ]
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1846
    ].
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1847
    ^ false
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1848
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1849
    "
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1850
     (CompiledCode compiledMethodAt:#refersToLiteralMatching:) refersToLiteral:'is*'
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1851
     (CompiledCode compiledMethodAt:#refersToLiteralMatching:) refersToLiteral:'foo*'
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1852
    "
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1853
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1854
    "Modified: / 03-03-1998 / 00:02:28 / stefan"
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1855
    "Modified: / 18-08-2000 / 21:17:47 / cg"
a5b9d39ad244 added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents: 14153
diff changeset
  1856
    "Created: / 26-07-2012 / 15:37:23 / cg"
328
claus
parents: 326
diff changeset
  1857
! !
claus
parents: 326
diff changeset
  1858
1772
d5d1d1fac79d the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents: 1771
diff changeset
  1859
!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
  1860
13777
7308f6b1eede changed: #valueWithReceiver:arguments:selector:search:sender:
Claus Gittinger <cg@exept.de>
parents: 13776
diff changeset
  1861
version
14423
10c643ab2647 changed: #wrongNumberOfArguments:
Claus Gittinger <cg@exept.de>
parents: 14255
diff changeset
  1862
    ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.117 2012-10-23 13:38:10 cg Exp $'
13777
7308f6b1eede changed: #valueWithReceiver:arguments:selector:search:sender:
Claus Gittinger <cg@exept.de>
parents: 13776
diff changeset
  1863
!
7308f6b1eede changed: #valueWithReceiver:arguments:selector:search:sender:
Claus Gittinger <cg@exept.de>
parents: 13776
diff changeset
  1864
13427
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1865
version_CVS
14423
10c643ab2647 changed: #wrongNumberOfArguments:
Claus Gittinger <cg@exept.de>
parents: 14255
diff changeset
  1866
    ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.117 2012-10-23 13:38:10 cg Exp $'
12160
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
  1867
!
48e09b1971f3 compiler interface
fm
parents: 10905
diff changeset
  1868
13427
6a957644862b Jan's changes
vrany
parents: 12160
diff changeset
  1869
version_SVN
13640
d5ffef38fdd8 added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13427
diff changeset
  1870
    ^ '§ Id: CompiledCode.st 10643 2011-06-08 21:53:07Z vranyj1  §'
1182
d8f8e18928a5 only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1871
! !