author | Claus Gittinger <cg@exept.de> |
Mon, 19 Jul 1999 21:25:00 +0200 | |
changeset 921 | 2be4f077517b |
parent 907 | 683b46536bc6 |
child 925 | 6fa294773f07 |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
45 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
Parser subclass:#ByteCodeCompiler |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
14 |
instanceVariableNames:'codeBytes codeIndex litArray stackDelta extra lineno extraLiteral |
558
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
15 |
maxStackDepth relocList methodTempVars numTemp maxNumTemp' |
172
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
16 |
classVariableNames:'JumpToAbsJump SequenceNumber STCCompilationDefines |
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
17 |
STCCompilationIncludes STCCompilationOptions STCCompilation |
407 | 18 |
ShareCode STCKeepSTIntermediate STCKeepCIntermediate |
704 | 19 |
STCModulePath CCCompilationOptions CC STC ListCompiledMethods |
751 | 20 |
STCKeepOIntermediate Verbose' |
172
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
21 |
poolDictionaries:'' |
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
22 |
category:'System-Compiler' |
0 | 23 |
! |
24 |
||
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
25 |
!ByteCodeCompiler class methodsFor:'documentation'! |
3 | 26 |
|
141 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
135
aa4f7b8f121e
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
128
diff
changeset
|
39 |
! |
20 | 40 |
|
3 | 41 |
documentation |
42 |
" |
|
19 | 43 |
This class performs compilation into ByteCodes. |
44 |
First, parsing is done using superclass methods, |
|
45 |
then the parse-tree is converted into an array of symbolic codes |
|
46 |
and a relocation table; |
|
47 |
these two are finally combined into a byteArray of the codes. |
|
0 | 48 |
|
19 | 49 |
(the intermediate step through symbolic codes is for debugging |
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
50 |
only - it may vanish in future releases) |
19 | 51 |
|
52 |
There are many dependencies to the run-time-system (especially the |
|
53 |
interpreter) in here - be careful when playing around ... |
|
0 | 54 |
|
259 | 55 |
[Instance variables:] |
0 | 56 |
|
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
57 |
codeBytes <ByteArry> bytecodes |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
58 |
codeIndex <SmallInteger> next index to put into code array |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
59 |
litArray <OrderedCollection> literals |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
60 |
stackDelta <SmallInteger> return value of byteCodeFor: |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
61 |
extra <Symbol> return value of byteCodeFor: |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
62 |
lineno <Boolean> return value of byteCodeFor: |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
63 |
extraLiteral <Symbol> return value of byteCodeFor: |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
64 |
maxStackDepth <SmallInteger> stack need of method |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
65 |
relocList <Array> used temporary for relocation |
19 | 66 |
|
259 | 67 |
[Class variables:] |
19 | 68 |
|
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
69 |
JumpToAbsJump <Dictionary> internal table to map opcodes |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
70 |
|
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
71 |
SequenceNumber <Integer> counting intermediate stc-compiled |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
72 |
objects (for unique o-file naming) |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
73 |
|
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
74 |
STCCompilationDefines passed to stc as command line arguments |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
75 |
STCCompilationIncludes |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
76 |
STCCompilationOptions |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
77 |
<String> |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
78 |
|
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
79 |
STCCompilation <Symbol> #always, #primitiveOnly or #never |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
80 |
controls when stc compilation is wanted |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
81 |
|
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
82 |
ShareCode <Boolean> reuse byteArrays for common (simple) code sequences |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
83 |
This is normally a 'good' optimization, |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
84 |
expect if you plan to modify the byteCodes. |
263 | 85 |
|
86 |
[author:] |
|
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
87 |
Claus Gittinger |
263 | 88 |
|
3 | 89 |
" |
98 | 90 |
! ! |
91 |
||
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
92 |
!ByteCodeCompiler class methodsFor:'initialization'! |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
93 |
|
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
94 |
initialize |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
95 |
ShareCode := true. |
295 | 96 |
STCKeepCIntermediate := false. |
704 | 97 |
STCKeepOIntermediate := false. |
407 | 98 |
STCKeepSTIntermediate := false. |
301
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
99 |
STCModulePath := './modules'. |
603
021722b8a427
correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents:
600
diff
changeset
|
100 |
ListCompiledMethods := false. |
021722b8a427
correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents:
600
diff
changeset
|
101 |
|
792
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
102 |
" |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
103 |
STCKeepCIntermediate := true. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
104 |
STCKeepOIntermediate := true. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
105 |
STCKeepSTIntermediate := true. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
106 |
" |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
107 |
|
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
108 |
"Modified: / 21.10.1998 / 15:39:52 / cg" |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
109 |
! ! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
110 |
|
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
111 |
!ByteCodeCompiler class methodsFor:'compiling methods'! |
98 | 112 |
|
0 | 113 |
compile:methodText forClass:classToCompileFor |
890 | 114 |
"compile a source-string for a method in classToCompileFor. |
115 |
Returns the new method, #Error or nil." |
|
116 |
||
117 |
^ self |
|
118 |
compile:methodText |
|
119 |
forClass:classToCompileFor |
|
120 |
inCategory:'others' |
|
121 |
notifying:nil |
|
122 |
install:true |
|
123 |
skipIfSame:false |
|
124 |
silent:false |
|
0 | 125 |
! |
126 |
||
127 |
compile:aString forClass:aClass inCategory:cat |
|
128 |
"compile a source-string for a method in classToCompileFor. |
|
890 | 129 |
The method will get cat as category. |
130 |
Returns the new method, #Error or nil." |
|
131 |
||
132 |
^ self |
|
133 |
compile:aString |
|
134 |
forClass:aClass |
|
135 |
inCategory:cat |
|
136 |
notifying:nil |
|
137 |
install:true |
|
138 |
skipIfSame:false |
|
139 |
silent:false |
|
0 | 140 |
! |
141 |
||
84 | 142 |
compile:aString forClass:aClass inCategory:cat notifying:requestor |
0 | 143 |
"compile a source-string for a method in classToCompileFor. |
84 | 144 |
errors are forwarded to requestor. |
890 | 145 |
The method will get cat as category. |
146 |
Returns the new method, #Error or nil." |
|
147 |
||
148 |
^ self |
|
149 |
compile:aString |
|
150 |
forClass:aClass |
|
151 |
inCategory:cat |
|
152 |
notifying:requestor |
|
153 |
install:true |
|
154 |
skipIfSame:false |
|
155 |
silent:false |
|
0 | 156 |
! |
157 |
||
141 | 158 |
compile:aString forClass:aClass inCategory:cat notifying:requestor install:install |
159 |
"compile a source-string for a method in classToCompileFor. |
|
160 |
The install-argument controls if the method is to be installed into the |
|
161 |
classes method-dictionary, or just to be compiled and a method object to be returned. |
|
890 | 162 |
Errors are forwarded to requestor. The method will get cat as category. |
163 |
Returns the new method, #Error or nil." |
|
164 |
||
165 |
^ self |
|
166 |
compile:aString |
|
167 |
forClass:aClass |
|
168 |
inCategory:cat |
|
169 |
notifying:requestor |
|
170 |
install:install |
|
171 |
skipIfSame:false |
|
172 |
silent:false |
|
141 | 173 |
! |
174 |
||
175 |
compile:aString forClass:aClass inCategory:cat notifying:requestor |
|
890 | 176 |
install:install skipIfSame:skipIfSame |
141 | 177 |
"compile a source-string for a method in classToCompileFor. |
178 |
The install-argument controls if the method is to be installed into the |
|
179 |
classes method-dictionary, or just to be compiled and a method object to be returned. |
|
180 |
Errors are forwarded to requestor. The method will get cat as category. |
|
181 |
If skipIsSame is true, and the source is the same as an existing |
|
890 | 182 |
methods source, this is a noop (for fast fileIn). |
183 |
Returns the new method, #Error or nil." |
|
184 |
||
185 |
^ self |
|
186 |
compile:aString |
|
187 |
forClass:aClass |
|
188 |
inCategory:cat |
|
189 |
notifying:requestor |
|
190 |
install:install |
|
191 |
skipIfSame:skipIfSame |
|
192 |
silent:false |
|
141 | 193 |
! |
194 |
||
84 | 195 |
compile:aString forClass:aClass inCategory:cat notifying:requestor |
890 | 196 |
install:install skipIfSame:skipIfSame silent:silent |
197 |
"compile a source-string for a method in aClass. |
|
198 |
errors are forwarded to requestor. |
|
199 |
The method will get cat as category. |
|
200 |
if install is true, the method is installed in the class. |
|
201 |
if skipIfSame, the method is not installed if there is no change |
|
202 |
(used when filing in). |
|
203 |
if silent is true, no warnings are output. |
|
204 |
Returns the new method, #Error or nil." |
|
230
54e13c76f143
allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
205 |
|
54e13c76f143
allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
206 |
^ self |
890 | 207 |
compile:aString |
208 |
forClass:aClass |
|
209 |
inCategory:cat |
|
210 |
notifying:requestor |
|
211 |
install:install |
|
212 |
skipIfSame:skipIfSame |
|
213 |
silent:silent |
|
214 |
foldConstants:true |
|
230
54e13c76f143
allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
215 |
! |
54e13c76f143
allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
216 |
|
54e13c76f143
allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
217 |
compile:aString forClass:aClass inCategory:cat notifying:requestor |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
218 |
install:install skipIfSame:skipIfSame silent:silent foldConstants:fold |
20 | 219 |
|
220 |
"the basic workhorse method for compiling: |
|
0 | 221 |
compile a source-string for a method in classToCompileFor. |
890 | 222 |
errors are forwarded to requestor |
223 |
(report on Transcript and return #Error, if requestor is nil). |
|
0 | 224 |
|
20 | 225 |
The new method will get cat as category. |
226 |
If install is true, the method will go into the classes method-table, |
|
227 |
otherwise the method is simply returned (for anonymous methods). |
|
0 | 228 |
If skipIsSame is true, and the source is the same as an existing |
20 | 229 |
methods source, this is a noop (for fast fileIn). |
890 | 230 |
The argument, silent controls if errors are to be reported. |
231 |
Returns the method, #Error or nil." |
|
0 | 232 |
|
429 | 233 |
|compiler newMethod tree symbolicCodeArray oldMethod lazy silencio |
459
3a0a95c1a0e8
unchanged methods may have a new package id
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
234 |
sourceFile sourceStream newSource primNr pos sel keptOldCode msg answer |
3a0a95c1a0e8
unchanged methods may have a new package id
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
235 |
pkg| |
0 | 236 |
|
237 |
aString isNil ifTrue:[^ nil]. |
|
603
021722b8a427
correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents:
600
diff
changeset
|
238 |
silencio := silent |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
239 |
or:[Smalltalk silentLoading == true |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
240 |
or:[ListCompiledMethods == false]]. |
0 | 241 |
|
19 | 242 |
"lazy compilation is EXPERIMENTAL" |
243 |
lazy := (LazyCompilation == true) and:[install]. |
|
244 |
||
0 | 245 |
"create a compiler, let it parse and create the parsetree" |
246 |
||
54 | 247 |
compiler := self for:(ReadStream on:aString) in:aClass. |
84 | 248 |
compiler parseForCode. |
230
54e13c76f143
allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
249 |
fold ifFalse:[compiler foldConstants:nil]. |
84 | 250 |
compiler notifying:requestor. |
54 | 251 |
silent ifTrue:[ |
252 |
"/ compiler ignoreErrors. |
|
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
253 |
compiler ignoreWarnings. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
254 |
compiler warnUndeclared:false. |
54 | 255 |
]. |
256
ae09ebb4aa35
no need to send nextToken when parsing a method
Claus Gittinger <cg@exept.de>
parents:
253
diff
changeset
|
256 |
"/ compiler nextToken. |
350
13e1dcaf87eb
oops - the classes version method may not be lazy
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
257 |
|
0 | 258 |
(compiler parseMethodSpec == #Error) ifTrue:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
259 |
compiler parseError:'syntax error in method specification'. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
260 |
tree := #Error |
0 | 261 |
] ifFalse:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
262 |
lazy ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
263 |
"/ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
264 |
"/ that one method IS required |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
265 |
"/ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
266 |
(aClass isMeta and:[compiler selector == #version]) ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
267 |
lazy := false |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
268 |
] |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
269 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
270 |
|
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
271 |
lazy ifFalse:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
272 |
"check if same source" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
273 |
(skipIfSame and:[(sel := compiler selector) notNil]) ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
274 |
oldMethod := aClass compiledMethodAt:sel. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
275 |
oldMethod notNil ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
276 |
oldMethod source = aString ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
277 |
oldMethod isInvalid ifFalse:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
278 |
silencio ifFalse:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
279 |
Transcript showCR:(' unchanged: ',aClass name,' ',compiler selector) |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
280 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
281 |
" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
282 |
same. however, category may be different |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
283 |
" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
284 |
(cat notNil and:[cat ~= oldMethod category]) ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
285 |
oldMethod category:cat. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
286 |
oldMethod changed:#category. |
459
3a0a95c1a0e8
unchanged methods may have a new package id
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
287 |
"/ aClass updateRevisionString. |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
288 |
aClass addChangeRecordForMethodCategory:oldMethod category:cat. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
289 |
silencio ifFalse:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
290 |
Transcript showCR:(' (category change only)') |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
291 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
292 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
293 |
" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
294 |
and package may be too. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
295 |
" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
296 |
pkg := Class packageQuerySignal query. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
297 |
(pkg notNil and:[pkg ~~ oldMethod package]) ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
298 |
oldMethod package:pkg. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
299 |
silencio ifFalse:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
300 |
Transcript showCR:(' (package-id change only)') |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
301 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
302 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
303 |
^ oldMethod |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
304 |
] |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
305 |
] |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
306 |
] |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
307 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
308 |
tree := compiler parseMethodBody. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
309 |
compiler tree:tree. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
310 |
] |
0 | 311 |
]. |
312 |
||
313 |
(compiler errorFlag or:[tree == #Error]) ifTrue:[ |
|
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
314 |
compiler showErrorMessageForClass:aClass. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
315 |
^ #Error |
0 | 316 |
]. |
317 |
||
191 | 318 |
sel := compiler selector. |
19 | 319 |
"if no error and also no selector ..." |
90 | 320 |
sel isNil ifTrue:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
321 |
"... it was just a comment or other empty stuff" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
322 |
^ nil |
0 | 323 |
]. |
324 |
||
191 | 325 |
lazy ifFalse:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
326 |
" |
890 | 327 |
freak-out support for inline C-code... |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
328 |
" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
329 |
((compiler hasNonOptionalPrimitiveCode |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
330 |
or:[(compiler hasPrimitiveCode and:[self canCreateMachineCode]) |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
331 |
or:[STCCompilation == #always and:[sel ~~ #doIt]]]) |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
332 |
and:[STCCompilation ~~ #never]) ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
333 |
newMethod := compiler |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
334 |
compileToMachineCode:aString |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
335 |
forClass:aClass |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
336 |
inCategory:cat |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
337 |
notifying:requestor |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
338 |
install:install |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
339 |
skipIfSame:skipIfSame |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
340 |
silent:silent. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
341 |
|
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
342 |
newMethod == #Error ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
343 |
compiler showErrorMessageForClass:aClass. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
344 |
^ #Error |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
345 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
346 |
|
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
347 |
(newMethod == #CannotLoad) ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
348 |
newMethod := compiler trappingStubMethodFor:aString inCategory:cat. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
349 |
|
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
350 |
keptOldCode := false. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
351 |
install ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
352 |
"/ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
353 |
"/ be very careful with existing methods |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
354 |
"/ (otherwise, you could easily make your system unusable in systems which cannot load) |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
355 |
"/ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
356 |
sel notNil ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
357 |
oldMethod := aClass compiledMethodAt:sel |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
358 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
359 |
(oldMethod notNil and:[oldMethod code ~= newMethod code]) ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
360 |
answer := Dialog |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
361 |
confirm: |
649
06675201ca18
name the class/selector in the compilation-failed-dialog.
Claus Gittinger <cg@exept.de>
parents:
632
diff
changeset
|
362 |
'installation of binary code for ''' , aClass name , '>>' , compiler selector , ''' |
06675201ca18
name the class/selector in the compilation-failed-dialog.
Claus Gittinger <cg@exept.de>
parents:
632
diff
changeset
|
363 |
is not possible or disabled. |
97 | 364 |
|
172
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
365 |
Shall I use the old methods functionality |
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
366 |
or instead create a dummy trap method for it ? |
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
367 |
|
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
368 |
Hint: |
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
369 |
if that method is needed by the system, you better leave the |
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
370 |
original functionality in the system. |
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
371 |
|
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
372 |
Close this warnBox to abort the compilation. |
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
373 |
' |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
374 |
yesLabel:'trap code' |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
375 |
noLabel:'keep old'. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
376 |
answer isNil ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
377 |
^ #Error |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
378 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
379 |
answer == false ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
380 |
newMethod code:(oldMethod code). |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
381 |
keptOldCode := true. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
382 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
383 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
384 |
aClass addSelector:sel withMethod:newMethod |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
385 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
386 |
Transcript show:'*** '. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
387 |
sel notNil ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
388 |
Transcript show:(sel ,' ') |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
389 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
390 |
keptOldCode ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
391 |
msg := 'not really compiled - method still shows previous behavior'. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
392 |
] ifFalse:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
393 |
msg := 'not compiled to machine code - created a stub instead.'. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
394 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
395 |
Transcript showCR:msg. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
396 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
397 |
^ newMethod |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
398 |
]. |
19 | 399 |
]. |
400 |
||
726
9f9ca909fc5e
fixed stc-compilation==#never case.
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
401 |
compiler hasNonOptionalPrimitiveCode ifTrue:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
402 |
newMethod := compiler trappingStubMethodFor:aString inCategory:cat. |
890 | 403 |
install ifTrue:[ |
404 |
aClass addSelector:sel withMethod:newMethod. |
|
405 |
]. |
|
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
406 |
Transcript show:'*** '. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
407 |
sel notNil ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
408 |
Transcript show:(sel ,' ') |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
409 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
410 |
Transcript showCR:'not compiled to machine code - created a stub instead.'. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
411 |
^ newMethod |
726
9f9ca909fc5e
fixed stc-compilation==#never case.
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
412 |
]. |
9f9ca909fc5e
fixed stc-compilation==#never case.
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
413 |
|
54 | 414 |
" |
415 |
EXPERIMENTAL: quick loading |
|
416 |
only create a lazyMethod, which has no byteCode and will |
|
417 |
compile itself when first called. |
|
418 |
" |
|
19 | 419 |
lazy ifTrue:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
420 |
newMethod := LazyMethod new. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
421 |
(ClassCategoryReader sourceMode == #sourceReference) ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
422 |
sourceFile := ObjectMemory nameForSources. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
423 |
sourceFile notNil ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
424 |
sourceStream := sourceFile asFilename appendingWriteStream. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
425 |
] |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
426 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
427 |
sourceStream isNil ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
428 |
newMethod source:aString string. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
429 |
] ifFalse:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
430 |
sourceStream setToEnd. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
431 |
pos := sourceStream position. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
432 |
sourceStream nextChunkPut:aString. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
433 |
sourceStream close. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
434 |
newMethod sourceFilename:sourceFile position:pos. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
435 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
436 |
newMethod category:cat. |
833
740fd0e90414
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
831
diff
changeset
|
437 |
newMethod package:(Class packageQuerySignal query). |
415 | 438 |
"/ Project notNil ifTrue:[ |
439 |
"/ newMethod package:(Project currentPackageName) |
|
440 |
"/ ]. |
|
19 | 441 |
|
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
442 |
aClass addSelector:sel withLazyMethod:newMethod. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
443 |
^ newMethod |
19 | 444 |
]. |
445 |
||
90 | 446 |
(primNr := compiler primitiveNumber) isNil ifTrue:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
447 |
" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
448 |
produce symbolic code first |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
449 |
" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
450 |
symbolicCodeArray := compiler genSymbolicCode. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
451 |
|
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
452 |
(symbolicCodeArray == #Error) ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
453 |
Transcript show:' '. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
454 |
sel notNil ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
455 |
Transcript show:(sel ,' ') |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
456 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
457 |
Transcript showCR:'translation error'. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
458 |
^ #Error |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
459 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
460 |
|
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
461 |
" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
462 |
take this, producing bytecode |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
463 |
(someone willin' to make machine code :-) |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
464 |
" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
465 |
((compiler genByteCodeFrom:symbolicCodeArray) == #Error) ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
466 |
Transcript show:' '. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
467 |
sel notNil ifTrue:[ |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
468 |
Transcript show:(sel ,' ') |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
469 |
]. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
470 |
Transcript showCR:'relocation error - must be simplified'. |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
471 |
^ #Error |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
472 |
]. |
0 | 473 |
]. |
474 |
||
54 | 475 |
" |
476 |
finally create the new method-object |
|
477 |
" |
|
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
478 |
newMethod := compiler createMethod. |
90 | 479 |
primNr notNil ifTrue:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
480 |
newMethod code:(compiler checkForPrimitiveCode:primNr). |
78 | 481 |
] ifFalse:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
482 |
newMethod byteCode:(compiler code). |
78 | 483 |
]. |
19 | 484 |
|
54 | 485 |
" |
486 |
if there where any corrections, install the updated source |
|
487 |
" |
|
90 | 488 |
(newSource := compiler correctedSource) notNil ifTrue:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
489 |
newMethod source:newSource string |
19 | 490 |
] ifFalse:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
491 |
newMethod source:aString string. |
19 | 492 |
]. |
0 | 493 |
newMethod category:cat. |
833
740fd0e90414
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
831
diff
changeset
|
494 |
newMethod package:(Class packageQuerySignal query). |
0 | 495 |
|
496 |
install ifTrue:[ |
|
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
497 |
aClass addSelector:sel withMethod:newMethod |
0 | 498 |
]. |
499 |
||
54 | 500 |
silencio ifFalse:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
501 |
Transcript showCR:(' compiled: ', aClass name,' ', sel) |
0 | 502 |
]. |
503 |
||
504 |
^ newMethod |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
505 |
|
649
06675201ca18
name the class/selector in the compilation-failed-dialog.
Claus Gittinger <cg@exept.de>
parents:
632
diff
changeset
|
506 |
"Created: / 29.10.1995 / 19:59:36 / cg" |
726
9f9ca909fc5e
fixed stc-compilation==#never case.
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
507 |
"Modified: / 13.6.1998 / 13:51:31 / cg" |
833
740fd0e90414
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
831
diff
changeset
|
508 |
"Modified: / 19.3.1999 / 08:31:09 / stefan" |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
509 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
510 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
511 |
compile:methodText forClass:classToCompileFor notifying:requestor |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
512 |
"compile a source-string for a method in classToCompileFor. |
890 | 513 |
Errors are forwarded to requestor. |
514 |
Returns the new method, #Error or nil." |
|
515 |
||
516 |
^ self |
|
517 |
compile:methodText |
|
518 |
forClass:classToCompileFor |
|
519 |
inCategory:'others' |
|
520 |
notifying:requestor |
|
521 |
install:true |
|
522 |
skipIfSame:false |
|
523 |
silent:false |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
524 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
525 |
|
141 | 526 |
compile:textOrStream in:aClass notifying:requestor ifFail:exceptionBlock |
890 | 527 |
"name alias for ST-80 compatibility. |
528 |
Returns the new method, #Error or nil." |
|
141 | 529 |
|
530 |
|m| |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
531 |
|
141 | 532 |
m := self |
890 | 533 |
compile:textOrStream |
534 |
forClass:aClass |
|
535 |
inCategory:'others' |
|
536 |
notifying:requestor |
|
537 |
install:true |
|
538 |
skipIfSame:false |
|
539 |
silent:false. |
|
141 | 540 |
m == #Error ifTrue:[ |
890 | 541 |
^ exceptionBlock value |
141 | 542 |
]. |
543 |
^ m |
|
544 |
||
0 | 545 |
! ! |
546 |
||
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
547 |
!ByteCodeCompiler class methodsFor:'constants'! |
15 | 548 |
|
549 |
byteCodeFor:aSymbol |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
550 |
"returns the numeric code for some symbolic bytecodes." |
15 | 551 |
|
25 | 552 |
(aSymbol == #retNil) ifTrue:[^ 1]. |
553 |
(aSymbol == #retTrue) ifTrue:[^ 2]. |
|
554 |
(aSymbol == #retFalse) ifTrue:[^ 3]. |
|
555 |
(aSymbol == #ret0) ifTrue:[^ 4]. |
|
556 |
(aSymbol == #retTop) ifTrue:[^ 0]. |
|
557 |
||
15 | 558 |
(aSymbol == #push0) ifTrue:[^120]. |
559 |
(aSymbol == #push1) ifTrue:[^121]. |
|
560 |
(aSymbol == #push2) ifTrue:[^139]. |
|
561 |
(aSymbol == #pushMinus1) ifTrue:[^122]. |
|
562 |
(aSymbol == #pushNil) ifTrue:[^ 10]. |
|
563 |
(aSymbol == #pushTrue) ifTrue:[^ 11]. |
|
564 |
(aSymbol == #pushFalse) ifTrue:[^ 12]. |
|
565 |
(aSymbol == #pushSelf) ifTrue:[^ 15]. |
|
566 |
self error |
|
567 |
! ! |
|
568 |
||
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
569 |
!ByteCodeCompiler class methodsFor:'stc compilation defaults'! |
54 | 570 |
|
141 | 571 |
canCreateMachineCode |
572 |
"return true, if compilation to machine code is supported. |
|
573 |
Currently, all SYSV4 and Linux systems do so; |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
574 |
REAL/IX and HPUX9.x do not (due to the need for dynamic loading |
141 | 575 |
of object files, which is not supported by those). |
576 |
MIPS ULTRIX is almost finished, but not yet released. |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
577 |
(late note - we no longer care for mips-ultrix) |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
578 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
579 |
However, if no stc compiler is around (i.e. the demo distribution), |
141 | 580 |
there is no chance ..." |
581 |
||
582 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
583 |
ObjectFileLoader canLoadObjectFiles ifFalse:[^ false]. |
|
584 |
||
585 |
"/ no chance, if no stc is available |
|
586 |
^ self incrementalStcPath notNil |
|
124 | 587 |
|
588 |
" |
|
141 | 589 |
Compiler canCreateMachineCode |
590 |
" |
|
591 |
||
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
592 |
"Modified: / 13.9.1995 / 15:15:11 / claus" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
593 |
"Modified: / 3.9.1998 / 15:56:07 / cg" |
141 | 594 |
! |
595 |
||
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
596 |
ccCompilationOptions |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
597 |
"return the options used with cc compilation" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
598 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
599 |
CCCompilationOptions isNil ifTrue:[^ '']. |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
600 |
^ CCCompilationOptions |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
601 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
602 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
603 |
Compiler ccCompilationOptions |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
604 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
605 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
606 |
"Modified: 5.11.1996 / 17:38:56 / cg" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
607 |
! |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
608 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
609 |
ccCompilationOptions:aString |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
610 |
"define the compilation options |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
611 |
to be used when compiling to machine code. |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
612 |
These are passed to cc. Can be set from your private.rc file." |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
613 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
614 |
CCCompilationOptions := aString |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
615 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
616 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
617 |
Compiler ccCompilationOptions:'-O' |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
618 |
Compiler ccCompilationOptions:'-O -fPIC' |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
619 |
Compiler ccCompilationOptions |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
620 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
621 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
622 |
"Created: 5.11.1996 / 17:37:05 / cg" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
623 |
"Modified: 5.11.1996 / 17:38:32 / cg" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
624 |
! |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
625 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
626 |
ccPath |
768 | 627 |
"return the path to (name of) the cc command for incremental method compilation" |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
628 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
629 |
CC isNil ifTrue:[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
630 |
OperatingSystem isMSDOSlike ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
631 |
OperatingSystem getCCDefine = '__BORLANDC__' ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
632 |
^'bcc32' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
633 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
634 |
^'cl' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
635 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
636 |
OperatingSystem getCCDefine = '__GNUC__' ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
637 |
^'gcc' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
638 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
639 |
^ 'cc' |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
640 |
]. |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
641 |
^ CC |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
642 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
643 |
" |
772 | 644 |
CC := nil |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
645 |
Compiler ccPath |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
646 |
Compiler ccPath:'gcc' |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
647 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
648 |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
649 |
"Modified: / 13.9.1995 / 15:15:04 / claus" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
650 |
"Created: / 5.11.1996 / 17:35:40 / cg" |
772 | 651 |
"Modified: / 4.9.1998 / 15:48:40 / cg" |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
652 |
! |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
653 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
654 |
ccPath:aPathOrCommandName |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
655 |
"set the path to the cc command for incremental method compilation" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
656 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
657 |
CC := aPathOrCommandName |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
658 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
659 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
660 |
Compiler ccPath |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
661 |
Compiler ccPath:'gcc' |
773 | 662 |
Compiler ccPath:'bcc32' |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
663 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
664 |
|
773 | 665 |
"Modified: / 13.9.1995 / 15:15:04 / claus" |
666 |
"Created: / 5.11.1996 / 17:38:11 / cg" |
|
667 |
"Modified: / 23.8.1998 / 13:58:57 / cg" |
|
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
668 |
! |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
669 |
|
141 | 670 |
incrementalStcPath |
671 |
"return the path to the stc command for incremental method compilation, |
|
672 |
or nil if not found." |
|
673 |
||
674 |
|f| |
|
675 |
||
695 | 676 |
STC notNil ifTrue:[ |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
677 |
^ STC |
695 | 678 |
]. |
141 | 679 |
(f := self stcPathOf:'stc') notNil ifTrue:[^ f]. |
680 |
^ self stcPathOf:'demostc' |
|
681 |
||
682 |
" |
|
695 | 683 |
Compiler stcPath:'../../stc/stc' |
141 | 684 |
Compiler incrementalStcPath |
685 |
" |
|
686 |
||
687 |
"Created: 13.9.1995 / 14:36:36 / claus" |
|
688 |
"Modified: 13.9.1995 / 15:15:04 / claus" |
|
689 |
! |
|
690 |
||
691 |
stcCompilation |
|
692 |
"return the flag which controls compilation to machine code. |
|
693 |
If #always, methods are always compiled to machine code (which takes |
|
694 |
longer, but provides faster code). If #none, methods are never compiled |
|
695 |
to machine code, instead for non-primitive ones, compilation is to bytecode |
|
696 |
and for primitive ones, a trapping stub is generated. |
|
697 |
Anything else lets the compiler compile to bytecode, |
|
698 |
except for methods containing primitive code. |
|
699 |
This can be set from your private.rc file or from a workspace |
|
700 |
for selective compilation to machine code." |
|
124 | 701 |
|
141 | 702 |
^ STCCompilation |
54 | 703 |
|
704 |
" |
|
141 | 705 |
Compiler stcCompilation |
124 | 706 |
" |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
707 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
708 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
709 |
stcCompilation:how |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
710 |
"set the flag which controls compilation to machine code. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
711 |
If #always, methods are always compiled to machine code (which takes |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
712 |
longer, but provides faster code). If #none, methods are never compiled |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
713 |
to machine code, instead for non-primitive ones, compilation is to bytecode |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
714 |
and for primitive ones, a trapping stub is generated. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
715 |
Anything else lets the compiler compile to bytecode, |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
716 |
except for methods containing primitive code. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
717 |
This can be set from your private.rc file or from a workspace |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
718 |
for selective compilation to machine code." |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
719 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
720 |
|ret| |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
721 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
722 |
ret := STCCompilation. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
723 |
STCCompilation := how. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
724 |
^ ret |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
725 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
726 |
" |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
727 |
Compiler stcCompilation:#always |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
728 |
Compiler stcCompilation:#never |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
729 |
Compiler stcCompilation:#default |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
730 |
" |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
731 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
732 |
|
141 | 733 |
stcCompilationDefines |
734 |
"return the defines used with stc compilation" |
|
735 |
||
736 |
^ STCCompilationDefines |
|
737 |
! |
|
738 |
||
739 |
stcCompilationDefines:aString |
|
740 |
"define the flags (for example, additional -D defines) |
|
741 |
to be used when compiling to machine code. |
|
742 |
These are passed to stc. Can be set from your private.rc file." |
|
743 |
||
744 |
STCCompilationDefines := aString |
|
745 |
||
746 |
" |
|
747 |
Compiler stcCompilationDefines:'-DVGL -DDEBUG' |
|
773 | 748 |
Compiler stcCompilationDefines:'-DWIN32' |
141 | 749 |
" |
773 | 750 |
|
751 |
"Modified: / 23.8.1998 / 14:00:40 / cg" |
|
141 | 752 |
! |
753 |
||
754 |
stcCompilationIncludes |
|
755 |
"return the includes used with stc compilation" |
|
756 |
||
757 |
^ STCCompilationIncludes |
|
758 |
! |
|
759 |
||
760 |
stcCompilationIncludes:aString |
|
761 |
"define the include directories via additional -I flags. |
|
762 |
These are passed to stc. Can be set in your private.rc file" |
|
763 |
||
586
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
764 |
|libDir incDir| |
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
765 |
|
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
766 |
STCCompilationIncludes := aString. |
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
767 |
|
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
768 |
"/ if STX_LIBDIR is defined, and not in passed argument, |
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
769 |
"/ add it here. |
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
770 |
|
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
771 |
libDir := OperatingSystem getEnvironment:'STX_LIBDIR'. |
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
772 |
(libDir notNil and:[libDir asFilename exists]) ifTrue:[ |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
773 |
incDir := libDir asFilename construct:'include'. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
774 |
incDir exists ifTrue:[ |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
775 |
(STCCompilationIncludes asCollectionOfWords includes:('-I' , incDir pathName)) ifFalse:[ |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
776 |
STCCompilationIncludes := aString , ' ' , ('-I' , incDir pathName). |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
777 |
] |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
778 |
] |
586
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
779 |
] |
141 | 780 |
|
781 |
" |
|
782 |
Compiler stcCompilationIncludes:'-I/usr/local/include -I../../include' |
|
783 |
Compiler stcCompilationIncludes:(Compiler stcCompilationIncludes , ' -I../../libxt') |
|
784 |
" |
|
586
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
785 |
|
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
786 |
"Modified: 18.7.1997 / 18:04:25 / cg" |
141 | 787 |
! |
788 |
||
124 | 789 |
stcCompilationOptions |
790 |
"return the options used with stc compilation" |
|
791 |
||
792 |
^ STCCompilationOptions |
|
793 |
! |
|
794 |
||
141 | 795 |
stcCompilationOptions:aString |
796 |
"define the compilation options |
|
797 |
to be used when compiling to machine code. |
|
798 |
These are passed to stc. Can be set from your private.rc file." |
|
101 | 799 |
|
141 | 800 |
STCCompilationOptions := aString |
101 | 801 |
|
802 |
" |
|
141 | 803 |
Compiler stcCompilationOptions:'+optinline' |
101 | 804 |
" |
805 |
! |
|
806 |
||
301
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
807 |
stcModulePath |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
808 |
"return the path, where temporary modules are created" |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
809 |
|
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
810 |
^ STCModulePath |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
811 |
|
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
812 |
"Created: 12.7.1996 / 12:15:26 / cg" |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
813 |
! |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
814 |
|
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
815 |
stcModulePath:aPath |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
816 |
"set the path to the directory, where temporary modules are created" |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
817 |
|
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
818 |
STCModulePath := aPath |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
819 |
|
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
820 |
"Created: 12.7.1996 / 12:15:49 / cg" |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
821 |
! |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
822 |
|
141 | 823 |
stcPath |
824 |
"return the path to the stc command, or nil if not found." |
|
825 |
||
695 | 826 |
^ STC ? (self stcPathOf:'stc') |
141 | 827 |
|
828 |
" |
|
829 |
Compiler stcPath |
|
830 |
" |
|
831 |
||
832 |
"Modified: 13.9.1995 / 14:37:26 / claus" |
|
833 |
! |
|
834 |
||
695 | 835 |
stcPath:aPath |
836 |
"set the path to the stc command - useful if private stc is wanted" |
|
837 |
||
838 |
STC := aPath |
|
839 |
||
840 |
" |
|
841 |
Compiler stcPath:'../../stc/stc' |
|
773 | 842 |
Compiler stcPath:'..\stc\stc' |
695 | 843 |
" |
844 |
||
773 | 845 |
"Modified: / 13.9.1995 / 14:37:26 / claus" |
846 |
"Modified: / 23.8.1998 / 13:59:24 / cg" |
|
695 | 847 |
! |
848 |
||
120 | 849 |
stcPathOf:command |
850 |
"return the path to an stc command, or nil if not found." |
|
101 | 851 |
|
623 | 852 |
|f d reqdSuffix cmd| |
853 |
||
854 |
"/ |
|
855 |
"/ care for executable suffix |
|
856 |
"/ |
|
857 |
cmd := command. |
|
858 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
859 |
reqdSuffix := 'exe' |
|
860 |
] ifFalse:[ |
|
861 |
OperatingSystem isVMSlike ifTrue:[ |
|
862 |
reqdSuffix := 'EXE' |
|
863 |
]. |
|
864 |
]. |
|
865 |
reqdSuffix notNil ifTrue:[ |
|
658 | 866 |
(f := cmd asFilename) suffix isEmpty ifTrue:[ |
867 |
cmd := (f withSuffix:reqdSuffix) name |
|
623 | 868 |
] |
869 |
]. |
|
870 |
"/ |
|
871 |
"/ for our convenience, also check in current |
|
872 |
"/ and parent directories; even if PATH does not |
|
873 |
"/ include them ... |
|
874 |
"/ |
|
658 | 875 |
"/ look in current ... |
623 | 876 |
d := Filename currentDirectory. |
877 |
(f := d construct:cmd) isExecutable ifTrue:[ |
|
101 | 878 |
^ f pathName |
879 |
]. |
|
658 | 880 |
"/ look in ../stc ... |
623 | 881 |
d := d construct:'..'. |
882 |
(f := (d construct:'stc') construct:cmd) isExecutable ifTrue:[ |
|
883 |
^ f pathName |
|
884 |
]. |
|
658 | 885 |
"/ look in ../../stc ... |
623 | 886 |
d := d construct:'..'. |
887 |
(f := (d construct:'stc') construct:cmd) isExecutable ifTrue:[ |
|
888 |
^ f pathName |
|
889 |
]. |
|
890 |
||
891 |
"/ |
|
892 |
"/ ok, stc must be installed in some directory along the PATH |
|
893 |
"/ |
|
126 | 894 |
^ OperatingSystem pathOfCommand:command |
97 | 895 |
|
896 |
" |
|
120 | 897 |
Compiler stcPathOf:'stc' |
898 |
" |
|
899 |
||
900 |
"Created: 13.9.1995 / 14:37:16 / claus" |
|
54 | 901 |
! ! |
902 |
||
921 | 903 |
!ByteCodeCompiler methodsFor:'Compatibility - ST-80'! |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
904 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
905 |
compile:textOrStream in:aClass notifying:requestor ifFail:exceptionBlock |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
906 |
"name alias for ST-80 compatibility" |
0 | 907 |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
908 |
^ self class |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
909 |
compile:textOrStream |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
910 |
in:aClass |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
911 |
notifying:requestor |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
912 |
ifFail:exceptionBlock |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
913 |
"/ |m| |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
914 |
"/ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
915 |
"/ m := self class |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
916 |
"/ compile:textOrStream |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
917 |
"/ forClass:aClass |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
918 |
"/ inCategory:'no category' |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
919 |
"/ notifying:requestor |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
920 |
"/ install:true |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
921 |
"/ skipIfSame:false |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
922 |
"/ silent:false. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
923 |
"/ m == #Error ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
924 |
"/ ^ exceptionBlock value |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
925 |
"/ ]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
926 |
"/ ^ m |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
927 |
! ! |
0 | 928 |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
929 |
!ByteCodeCompiler methodsFor:'accessing'! |
0 | 930 |
|
931 |
code |
|
3 | 932 |
"return the bytecode array - only valid after code-generation" |
0 | 933 |
|
49 | 934 |
^ codeBytes |
0 | 935 |
! |
936 |
||
141 | 937 |
literalArray |
938 |
"return the literal array - only valid after parsing" |
|
939 |
||
940 |
^ litArray |
|
941 |
! |
|
942 |
||
0 | 943 |
maxStackDepth |
944 |
"return the stack-need of the method - only valid after code-generation" |
|
945 |
||
946 |
^ maxStackDepth |
|
947 |
! ! |
|
948 |
||
949 |
!ByteCodeCompiler methodsFor:'code generation'! |
|
950 |
||
141 | 951 |
absJumpFromJump:code |
952 |
"given a jump-symbolic code, return corresponding absolute jump" |
|
0 | 953 |
|
141 | 954 |
JumpToAbsJump isNil ifTrue:[ |
955 |
JumpToAbsJump := IdentityDictionary new. |
|
956 |
JumpToAbsJump at:#jump put:#jumpabs. |
|
957 |
JumpToAbsJump at:#trueJump put:#trueJumpabs. |
|
958 |
JumpToAbsJump at:#falseJump put:#falseJumpabs. |
|
959 |
JumpToAbsJump at:#nilJump put:#nilJumpabs. |
|
960 |
JumpToAbsJump at:#notNilJump put:#notNilJumpabs. |
|
961 |
JumpToAbsJump at:#eqJump put:#eqJumpabs. |
|
962 |
JumpToAbsJump at:#notEqJump put:#notEqJumpabs. |
|
963 |
JumpToAbsJump at:#zeroJump put:#zeroJumpabs. |
|
964 |
JumpToAbsJump at:#notZeroJump put:#notZeroJumpabs. |
|
965 |
JumpToAbsJump at:#makeBlock put:#makeBlockabs. |
|
0 | 966 |
]. |
141 | 967 |
^ JumpToAbsJump at:code |
0 | 968 |
! |
969 |
||
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
970 |
addLiteral:anObject |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
971 |
"add a literal to the literalArray - watch for and eliminate |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
972 |
duplicates. return the index of the literal in the Array" |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
973 |
|
429 | 974 |
|index "{ Class: SmallInteger }" class| |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
975 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
976 |
litArray isNil ifTrue:[ |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
977 |
litArray := Array with:anObject. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
978 |
^ 1 |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
979 |
]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
980 |
index := litArray identityIndexOf:anObject. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
981 |
(index == 0) ifTrue:[ |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
982 |
" |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
983 |
reuse constants if same value and same class |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
984 |
" |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
985 |
class := anObject class. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
986 |
((class == Float) |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
987 |
or:[class == Fraction |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
988 |
or:[class == LargeInteger |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
989 |
"or:[class == String] --only if literalString option has been added---" ]]) ifTrue:[ |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
990 |
index := litArray indexOf:anObject. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
991 |
]. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
992 |
((index == 0) or:[(litArray at:index) class ~~ class]) ifTrue:[ |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
993 |
litArray := litArray copyWith:anObject. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
994 |
^ litArray size |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
995 |
]. |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
996 |
]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
997 |
^ index |
632 | 998 |
|
999 |
"Modified: / 12.11.1997 / 18:49:43 / cg" |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1000 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1001 |
|
141 | 1002 |
addReloc:symIndex |
1003 |
"remember to relocate offset at symIndex later ..." |
|
3 | 1004 |
|
141 | 1005 |
relocList isNil ifTrue:[ |
1006 |
relocList := OrderedCollection new. |
|
1 | 1007 |
]. |
141 | 1008 |
relocList add:symIndex |
1 | 1009 |
! |
1010 |
||
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1011 |
appendByte:aByte |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1012 |
"append a byte to the code-Array, checking for byte-range (debug-only)" |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1013 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1014 |
|idx "{Class: SmallInteger }"| |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1015 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1016 |
idx := codeIndex. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1017 |
(aByte between:0 and:255) ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1018 |
codeBytes at:idx put:aByte. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1019 |
codeIndex := idx + 1 |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1020 |
] ifFalse:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1021 |
self error:'byte range error'. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1022 |
errorFlag := #Error |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1023 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1024 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1025 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1026 |
appendByteCodeFor:codeSymbol |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1027 |
"append the byteCode for an instructionSymbol to the code-Array" |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1028 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1029 |
|idx "{Class: SmallInteger }"| |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1030 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1031 |
idx := codeIndex. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1032 |
codeBytes at:idx put:(self byteCodeFor:codeSymbol). |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1033 |
codeIndex := idx + 1 |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1034 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1035 |
|
141 | 1036 |
appendEmptyByte |
1037 |
"append an empty byte to the code-Array" |
|
3 | 1038 |
|
141 | 1039 |
|idx "{Class: SmallInteger }"| |
3 | 1040 |
|
141 | 1041 |
idx := codeIndex. |
1042 |
codeBytes at:idx put:0. |
|
1043 |
codeIndex := idx + 1 |
|
45 | 1044 |
! |
1045 |
||
199
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1046 |
appendEmptyLong |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1047 |
"append an empty long (4 bytes) to the code-Array" |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1048 |
|
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1049 |
|idx "{Class: SmallInteger }"| |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1050 |
|
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1051 |
idx := codeIndex. |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1052 |
codeBytes at:idx put:0. |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1053 |
codeBytes at:idx+1 put:0. |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1054 |
codeBytes at:idx+2 put:0. |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1055 |
codeBytes at:idx+3 put:0. |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1056 |
codeIndex := idx + 4 |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1057 |
! |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1058 |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1059 |
appendEmptyShort |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1060 |
"append an empty short (2 bytes) to the code-Array" |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1061 |
|
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1062 |
|idx "{Class: SmallInteger }"| |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1063 |
|
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1064 |
idx := codeIndex. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1065 |
codeBytes at:idx put:0. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1066 |
codeBytes at:idx+1 put:0. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1067 |
codeIndex := idx + 2 |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1068 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1069 |
|
0 | 1070 |
appendSignedByte:aByte |
1071 |
"append a signedbyte (as in jump-offsets) to the code-Array, |
|
1072 |
check range and report an error if invalid" |
|
1073 |
||
49 | 1074 |
|b "{Class: SmallInteger }" |
1075 |
idx "{Class: SmallInteger }"| |
|
0 | 1076 |
|
49 | 1077 |
idx := codeIndex. |
0 | 1078 |
b := aByte. |
1079 |
(b >= 0) ifTrue:[ |
|
45 | 1080 |
(b > 127) ifTrue:[ |
1081 |
self error:'jump-range error'. |
|
1082 |
errorFlag := #Error |
|
1083 |
]. |
|
49 | 1084 |
codeBytes at:idx put:b |
0 | 1085 |
] ifFalse:[ |
45 | 1086 |
(b < -128) ifTrue:[ |
1087 |
self error:'jump-range error'. |
|
1088 |
errorFlag := #Error |
|
1089 |
]. |
|
49 | 1090 |
b := 256 + b |
0 | 1091 |
]. |
49 | 1092 |
codeBytes at:idx put:b. |
1093 |
codeIndex := idx + 1 |
|
0 | 1094 |
! |
1095 |
||
46 | 1096 |
appendSignedWord:aWord |
1097 |
"append a signed word to the code-Array, |
|
1098 |
check range and report an error if invalid" |
|
1099 |
||
49 | 1100 |
|w "{Class: SmallInteger }"| |
46 | 1101 |
|
1102 |
w := aWord. |
|
1103 |
(w >= 0) ifTrue:[ |
|
1104 |
(w > 16r7FFFF) ifTrue:[ |
|
1105 |
self error:'word-range error'. |
|
1106 |
errorFlag := #Error |
|
1107 |
]. |
|
1108 |
] ifFalse:[ |
|
1109 |
(w < 16r-8000) ifTrue:[ |
|
1110 |
self error:'word-range error'. |
|
1111 |
errorFlag := #Error |
|
1112 |
]. |
|
1113 |
w := (16r10000 + w). |
|
1114 |
]. |
|
1115 |
self appendWord:w |
|
1116 |
! |
|
1117 |
||
141 | 1118 |
appendWord:aWord |
1119 |
"append an unsigned word (low-high) to the code-Array, |
|
1120 |
checking for word-range (debug-only)" |
|
1121 |
||
1122 |
|idx "{Class: SmallInteger }"| |
|
1123 |
||
1124 |
idx := codeIndex. |
|
1125 |
(aWord between:0 and:16rFFFF) ifTrue:[ |
|
1126 |
codeBytes at:idx put:(aWord bitAnd:16rFF). |
|
1127 |
idx := idx + 1. |
|
1128 |
codeBytes at:idx put:(aWord bitShift:-8). |
|
1129 |
codeIndex := idx + 1 |
|
1130 |
] ifFalse:[ |
|
1131 |
self error:'word range error'. |
|
1132 |
errorFlag := #Error |
|
1133 |
] |
|
1134 |
! |
|
1135 |
||
0 | 1136 |
byteCodeFor:aSymbol |
1137 |
"given a symbolic instruction, return the corresponding bytecode. |
|
1138 |
as a side-effect, leave number of bytes pushed/popped by this instr. |
|
1139 |
in stackDelta, and, if the instruction needs extra arguments, leave |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1140 |
this info in extra. Also lineno is set to true, if this code has line |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1141 |
information and extraLiteral is set if any hidden send is performed by it." |
0 | 1142 |
|
1143 |
"standard bytecodes" |
|
1144 |
||
1145 |
(aSymbol == #pushNil) ifTrue:[stackDelta := 1. ^ 10]. |
|
1146 |
(aSymbol == #pushTrue) ifTrue:[stackDelta := 1. ^ 11]. |
|
1147 |
(aSymbol == #pushFalse) ifTrue:[stackDelta := 1. ^ 12]. |
|
1148 |
(aSymbol == #pushLit) ifTrue:[stackDelta := 1. extra := #lit. ^ 14]. |
|
105 | 1149 |
(aSymbol == #pushLitS) ifTrue:[stackDelta := 1. extra := #index. ^ 14]. |
0 | 1150 |
(aSymbol == #pushSelf) ifTrue:[stackDelta := 1. ^ 15]. |
1151 |
(aSymbol == #pushNum) ifTrue:[stackDelta := 1. extra := #number. ^ 16]. |
|
1152 |
||
1153 |
(aSymbol == #pushMethodArg) ifTrue:[stackDelta := 1. extra := #index. ^ 30]. |
|
1154 |
(aSymbol == #pushMethodVar) ifTrue:[stackDelta := 1. extra := #index. ^ 31]. |
|
1155 |
(aSymbol == #pushBlockArg) ifTrue:[stackDelta := 1. extra := #index. ^ 32]. |
|
1156 |
(aSymbol == #pushBlockVar) ifTrue:[stackDelta := 1. extra := #index. ^ 33]. |
|
1157 |
(aSymbol == #pushInstVar) ifTrue:[stackDelta := 1. extra := #index. ^ 34]. |
|
1 | 1158 |
(aSymbol == #pushOuterBlockArg) ifTrue:[stackDelta := 1. extra := #indexLevel. ^ 42]. |
1159 |
(aSymbol == #pushOuterBlockVar) ifTrue:[stackDelta := 1. extra := #indexLevel. ^ 128]. |
|
0 | 1160 |
|
1161 |
(aSymbol == #retTop) ifTrue:[stackDelta := -1. ^ 0]. |
|
1162 |
(aSymbol == #retSelf) ifTrue:[^5]. |
|
1163 |
||
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1164 |
(aSymbol == #==) ifTrue:[stackDelta := -1. extraLiteral := aSymbol. ^ 45]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1165 |
(aSymbol == #~~) ifTrue:[stackDelta := -1. extraLiteral := aSymbol. ^ 46]. |
0 | 1166 |
|
1167 |
(aSymbol == #falseJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 50]. |
|
1168 |
(aSymbol == #trueJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 51]. |
|
1169 |
(aSymbol == #nilJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 52]. |
|
1170 |
(aSymbol == #notNilJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 53]. |
|
1171 |
(aSymbol == #jump) ifTrue:[extra := #offset. ^ 54]. |
|
1 | 1172 |
(aSymbol == #makeBlock) ifTrue:[stackDelta := 1. extra := #offsetNvarNarg. ^ 55]. |
0 | 1173 |
(aSymbol == #zeroJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 56]. |
1174 |
(aSymbol == #notZeroJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 57]. |
|
1175 |
(aSymbol == #eqJump) ifTrue:[stackDelta := -2. extra := #offset. ^ 58]. |
|
1176 |
(aSymbol == #notEqJump) ifTrue:[stackDelta := -2. extra := #offset. ^ 59]. |
|
1177 |
||
54 | 1178 |
(aSymbol == #lineno) ifTrue:[lineno := true. ^ 8]. |
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
1179 |
(aSymbol == #lineno16) ifTrue:[lineno := true. ^ 9]. |
54 | 1180 |
|
106 | 1181 |
(aSymbol == #send) ifTrue:[lineno := true. extra := #special. ^ 19]. |
1182 |
(aSymbol == #superSend) ifTrue:[lineno := true. extra := #special. ^ 20]. |
|
1183 |
(aSymbol == #hereSend) ifTrue:[lineno := true. extra := #special. ^ 20]. |
|
117 | 1184 |
(aSymbol == #sendSelf) ifTrue:[lineno := true. extra := #special. ^ 13]. |
0 | 1185 |
|
1186 |
(aSymbol == #drop) ifTrue:[stackDelta := -1. ^ 18]. |
|
1187 |
(aSymbol == #dup) ifTrue:[stackDelta := 1. ^ 47]. |
|
1188 |
||
117 | 1189 |
(aSymbol == #storeMethodVar) ifTrue:[extra := #index. stackDelta := -1. ^ 37]. |
1190 |
(aSymbol == #storeBlockVar) ifTrue:[extra := #index. stackDelta := -1. ^ 38]. |
|
1191 |
(aSymbol == #storeInstVar) ifTrue:[extra := #index. stackDelta := -1. ^ 39]. |
|
0 | 1192 |
|
117 | 1193 |
(aSymbol == #pushClassVarS) ifTrue:[stackDelta := 1. extra := #speciallitS. ^ 35]. |
356
bb3beb18de1f
6empty slots in GLOBL/CLASSVAR bytecodes removed
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
1194 |
(aSymbol == #pushGlobalS) ifTrue:[stackDelta := 1. extra := #speciallitS. ^ 36]. |
117 | 1195 |
|
1196 |
(aSymbol == #storeClassVarS) ifTrue:[extra := #speciallitS.stackDelta := -1. ^ 40]. |
|
356
bb3beb18de1f
6empty slots in GLOBL/CLASSVAR bytecodes removed
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
1197 |
(aSymbol == #storeGlobalS) ifTrue:[extra := #speciallitS. stackDelta := -1. ^ 41]. |
247 | 1198 |
(aSymbol == #pushSpecialGlobal) ifTrue:[stackDelta := 1. extra := #index. ^ 200]. |
117 | 1199 |
|
1 | 1200 |
(aSymbol == #storeOuterBlockVar) ifTrue:[stackDelta := -1. extra := #indexLevel. ^ 129]. |
0 | 1201 |
|
117 | 1202 |
(aSymbol == #pushClassInstVar) ifTrue:[stackDelta := 1. extra := #index. ^ 176]. |
1203 |
(aSymbol == #storeClassInstVar) ifTrue:[extra := #index.stackDelta := -1. ^ 177]. |
|
105 | 1204 |
|
0 | 1205 |
"optimized bytecodes" |
1206 |
||
1207 |
(aSymbol == #retNil) ifTrue:[^ 1]. |
|
1208 |
(aSymbol == #retTrue) ifTrue:[^ 2]. |
|
1209 |
(aSymbol == #retFalse) ifTrue:[^ 3]. |
|
1210 |
(aSymbol == #ret0) ifTrue:[^ 4]. |
|
1211 |
(aSymbol == #retNum) ifTrue:[extra := #number. ^ 127]. |
|
25 | 1212 |
(aSymbol == #homeRetTop) ifTrue:[^ 7]. |
0 | 1213 |
|
46 | 1214 |
(aSymbol == #pushNum16) ifTrue:[stackDelta := 1. extra := #number16. ^ 17]. |
0 | 1215 |
(aSymbol == #push0) ifTrue:[stackDelta := 1. ^120]. |
1216 |
(aSymbol == #push1) ifTrue:[stackDelta := 1. ^121]. |
|
3 | 1217 |
(aSymbol == #push2) ifTrue:[stackDelta := 1. ^139]. |
0 | 1218 |
(aSymbol == #pushMinus1) ifTrue:[stackDelta := 1. ^122]. |
1219 |
||
106 | 1220 |
(aSymbol == #send0) ifTrue:[lineno := true. extra := #index. ^21]. |
1221 |
(aSymbol == #send1) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^22]. |
|
1222 |
(aSymbol == #send2) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^23]. |
|
1223 |
(aSymbol == #send3) ifTrue:[lineno := true. extra := #index. stackDelta := -3. ^24]. |
|
0 | 1224 |
|
106 | 1225 |
(aSymbol == #sendSelf0) ifTrue:[lineno := true. extra := #index. stackDelta := 1. ^180]. |
1226 |
(aSymbol == #sendSelf1) ifTrue:[lineno := true. extra := #index. ^181]. |
|
1227 |
(aSymbol == #sendSelf2) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^182]. |
|
1228 |
(aSymbol == #sendSelf3) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^183]. |
|
1229 |
(aSymbol == #sendSelfDrop0) ifTrue:[lineno := true. extra := #index. ^184]. |
|
1230 |
(aSymbol == #sendSelfDrop1) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^185]. |
|
1231 |
(aSymbol == #sendSelfDrop2) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^186]. |
|
1232 |
(aSymbol == #sendSelfDrop3) ifTrue:[lineno := true. extra := #index. stackDelta := -3. ^187]. |
|
0 | 1233 |
|
106 | 1234 |
(aSymbol == #sendDrop) ifTrue:[lineno := true. extra := #special. ^25]. |
1235 |
(aSymbol == #sendDrop0) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^26]. |
|
1236 |
(aSymbol == #sendDrop1) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^27]. |
|
1237 |
(aSymbol == #sendDrop2) ifTrue:[lineno := true. extra := #index. stackDelta := -3. ^28]. |
|
1238 |
(aSymbol == #sendDrop3) ifTrue:[lineno := true. extra := #index. stackDelta := -4. ^29]. |
|
0 | 1239 |
|
1240 |
(aSymbol == #pushMethodVar1) ifTrue:[stackDelta := 1. ^80]. |
|
1241 |
(aSymbol == #pushMethodVar2) ifTrue:[stackDelta := 1. ^81]. |
|
1242 |
(aSymbol == #pushMethodVar3) ifTrue:[stackDelta := 1. ^82]. |
|
1243 |
(aSymbol == #pushMethodVar4) ifTrue:[stackDelta := 1. ^83]. |
|
1244 |
(aSymbol == #pushMethodVar5) ifTrue:[stackDelta := 1. ^84]. |
|
1245 |
(aSymbol == #pushMethodVar6) ifTrue:[stackDelta := 1. ^85]. |
|
1246 |
||
1247 |
(aSymbol == #pushMethodArg1) ifTrue:[stackDelta := 1. ^86]. |
|
1248 |
(aSymbol == #pushMethodArg2) ifTrue:[stackDelta := 1. ^87]. |
|
1249 |
(aSymbol == #pushMethodArg3) ifTrue:[stackDelta := 1. ^88]. |
|
1250 |
(aSymbol == #pushMethodArg4) ifTrue:[stackDelta := 1. ^89]. |
|
1251 |
||
1252 |
(aSymbol == #pushInstVar1) ifTrue:[stackDelta := 1. ^90]. |
|
1253 |
(aSymbol == #pushInstVar2) ifTrue:[stackDelta := 1. ^91]. |
|
1254 |
(aSymbol == #pushInstVar3) ifTrue:[stackDelta := 1. ^92]. |
|
1255 |
(aSymbol == #pushInstVar4) ifTrue:[stackDelta := 1. ^93]. |
|
1256 |
(aSymbol == #pushInstVar5) ifTrue:[stackDelta := 1. ^94]. |
|
1257 |
(aSymbol == #pushInstVar6) ifTrue:[stackDelta := 1. ^95]. |
|
1258 |
(aSymbol == #pushInstVar7) ifTrue:[stackDelta := 1. ^96]. |
|
1259 |
(aSymbol == #pushInstVar8) ifTrue:[stackDelta := 1. ^97]. |
|
1260 |
(aSymbol == #pushInstVar9) ifTrue:[stackDelta := 1. ^98]. |
|
1261 |
(aSymbol == #pushInstVar10) ifTrue:[stackDelta := 1. ^99]. |
|
1262 |
||
1263 |
(aSymbol == #storeMethodVar1) ifTrue:[stackDelta := -1. ^100]. |
|
1264 |
(aSymbol == #storeMethodVar2) ifTrue:[stackDelta := -1. ^101]. |
|
1265 |
(aSymbol == #storeMethodVar3) ifTrue:[stackDelta := -1. ^102]. |
|
1266 |
(aSymbol == #storeMethodVar4) ifTrue:[stackDelta := -1. ^103]. |
|
1267 |
(aSymbol == #storeMethodVar5) ifTrue:[stackDelta := -1. ^104]. |
|
1268 |
(aSymbol == #storeMethodVar6) ifTrue:[stackDelta := -1. ^105]. |
|
1269 |
||
1270 |
(aSymbol == #storeInstVar1) ifTrue:[stackDelta := -1. ^110]. |
|
1271 |
(aSymbol == #storeInstVar2) ifTrue:[stackDelta := -1. ^111]. |
|
1272 |
(aSymbol == #storeInstVar3) ifTrue:[stackDelta := -1. ^112]. |
|
1273 |
(aSymbol == #storeInstVar4) ifTrue:[stackDelta := -1. ^113]. |
|
1274 |
(aSymbol == #storeInstVar5) ifTrue:[stackDelta := -1. ^114]. |
|
1275 |
(aSymbol == #storeInstVar6) ifTrue:[stackDelta := -1. ^115]. |
|
1276 |
(aSymbol == #storeInstVar7) ifTrue:[stackDelta := -1. ^116]. |
|
1277 |
(aSymbol == #storeInstVar8) ifTrue:[stackDelta := -1. ^117]. |
|
1278 |
(aSymbol == #storeInstVar9) ifTrue:[stackDelta := -1. ^118]. |
|
1279 |
(aSymbol == #storeInstVar10) ifTrue:[stackDelta := -1. ^119]. |
|
1280 |
||
103 | 1281 |
(aSymbol == #pushLit1) ifTrue:[stackDelta := 1. ^ 222]. |
1282 |
(aSymbol == #pushLit2) ifTrue:[stackDelta := 1. ^ 223]. |
|
1283 |
(aSymbol == #pushLit3) ifTrue:[stackDelta := 1. ^ 224]. |
|
1284 |
(aSymbol == #pushLit4) ifTrue:[stackDelta := 1. ^ 225]. |
|
1285 |
(aSymbol == #pushLit5) ifTrue:[stackDelta := 1. ^ 226]. |
|
1286 |
(aSymbol == #pushLit6) ifTrue:[stackDelta := 1. ^ 227]. |
|
1287 |
(aSymbol == #pushLit7) ifTrue:[stackDelta := 1. ^ 228]. |
|
1288 |
(aSymbol == #pushLit8) ifTrue:[stackDelta := 1. ^ 229]. |
|
1289 |
||
0 | 1290 |
(aSymbol == #retMethodVar1) ifTrue:[^160]. |
1291 |
(aSymbol == #retMethodVar2) ifTrue:[^161]. |
|
1292 |
(aSymbol == #retMethodVar3) ifTrue:[^162]. |
|
1293 |
(aSymbol == #retMethodVar4) ifTrue:[^163]. |
|
1294 |
(aSymbol == #retMethodVar5) ifTrue:[^164]. |
|
1295 |
(aSymbol == #retMethodVar6) ifTrue:[^165]. |
|
1296 |
||
1297 |
(aSymbol == #retInstVar1) ifTrue:[^166]. |
|
1298 |
(aSymbol == #retInstVar2) ifTrue:[^167]. |
|
1299 |
(aSymbol == #retInstVar3) ifTrue:[^168]. |
|
1300 |
(aSymbol == #retInstVar4) ifTrue:[^169]. |
|
1301 |
(aSymbol == #retInstVar5) ifTrue:[^170]. |
|
1302 |
(aSymbol == #retInstVar6) ifTrue:[^171]. |
|
1303 |
(aSymbol == #retInstVar7) ifTrue:[^172]. |
|
1304 |
(aSymbol == #retInstVar8) ifTrue:[^173]. |
|
1305 |
||
1306 |
(aSymbol == #retMethodArg1) ifTrue:[^174]. |
|
1307 |
(aSymbol == #retMethodArg2) ifTrue:[^175]. |
|
1308 |
||
1309 |
(aSymbol == #pushBlockArg1) ifTrue:[stackDelta := 1. ^140]. |
|
1310 |
(aSymbol == #pushBlockArg2) ifTrue:[stackDelta := 1. ^141]. |
|
1311 |
(aSymbol == #pushBlockArg3) ifTrue:[stackDelta := 1. ^142]. |
|
1312 |
(aSymbol == #pushBlockArg4) ifTrue:[stackDelta := 1. ^143]. |
|
1313 |
||
1 | 1314 |
(aSymbol == #pushOuter1BlockArg) ifTrue:[stackDelta := 1. extra := #index. ^ 43]. |
1315 |
(aSymbol == #pushOuter2BlockArg) ifTrue:[stackDelta := 1. extra := #index. ^ 44]. |
|
0 | 1316 |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1317 |
(aSymbol == #=) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^130]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1318 |
(aSymbol == #+) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^131]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1319 |
(aSymbol == #~=) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^132]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1320 |
(aSymbol == #-) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^133]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1321 |
(aSymbol == #*) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^230]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1322 |
(aSymbol == #class) ifTrue:[extraLiteral := aSymbol. ^134]. |
400
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1323 |
"/ (aSymbol == #x) ifTrue:[lineno := true. extraLiteral := aSymbol. ^106]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1324 |
"/ (aSymbol == #y) ifTrue:[lineno := true. extraLiteral := aSymbol. ^107]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1325 |
"/ (aSymbol == #width) ifTrue:[lineno := true. extraLiteral := aSymbol. ^108]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1326 |
"/ (aSymbol == #height) ifTrue:[lineno := true. extraLiteral := aSymbol. ^109]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1327 |
"/ (aSymbol == #origin) ifTrue:[lineno := true. extraLiteral := aSymbol. ^154]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1328 |
"/ (aSymbol == #extent) ifTrue:[lineno := true. extraLiteral := aSymbol. ^155]. |
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1329 |
(aSymbol == #at:) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^135]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1330 |
(aSymbol == #at:put:)ifTrue:[lineno := true. stackDelta := -2. extraLiteral := aSymbol. ^136]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1331 |
(aSymbol == #bitAnd:) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^137]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1332 |
(aSymbol == #bitOr:) ifTrue:[lineno := true. stackDelta := -1. extraLiteral := aSymbol. ^138]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1333 |
(aSymbol == #plus1) ifTrue:[lineno := true. extraLiteral := #+. ^123]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1334 |
(aSymbol == #minus1) ifTrue:[lineno := true. extraLiteral := #-. ^124]. |
0 | 1335 |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1336 |
(aSymbol == #incMethodVar) ifTrue:[lineno := true. extraLiteral := #+. extra := #index. ^125]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1337 |
(aSymbol == #decMethodVar) ifTrue:[lineno := true. extraLiteral := #-. extra := #index. ^126]. |
0 | 1338 |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1339 |
(aSymbol == #eq0) ifTrue:[extraLiteral := #==. ^48]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1340 |
(aSymbol == #ne0) ifTrue:[extraLiteral := #~~. ^49]. |
0 | 1341 |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1342 |
(aSymbol == #>) ifTrue:[lineno := true. extraLiteral := aSymbol. stackDelta := -1. ^ 145]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1343 |
(aSymbol == #>=) ifTrue:[lineno := true. extraLiteral := aSymbol. stackDelta := -1. ^ 146]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1344 |
(aSymbol == #<) ifTrue:[lineno := true. extraLiteral := aSymbol. stackDelta := -1. ^ 147]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1345 |
(aSymbol == #<=) ifTrue:[lineno := true. extraLiteral := aSymbol. stackDelta := -1. ^ 148]. |
400
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1346 |
"/ (aSymbol == #next) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 149]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1347 |
"/ (aSymbol == #peek) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 150]. |
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1348 |
(aSymbol == #value) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 151]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1349 |
(aSymbol == #value:) ifTrue:[lineno := true. extraLiteral := aSymbol. stackDelta := -1. ^ 152]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1350 |
(aSymbol == #value:value:) ifTrue:[lineno := true. extraLiteral := aSymbol. stackDelta := -2. ^ 178]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1351 |
(aSymbol == #size) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 153]. |
400
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1352 |
"/ (aSymbol == #asInteger) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 158]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1353 |
"/ (aSymbol == #rounded) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 159]. |
0 | 1354 |
(aSymbol == #mk0Block) ifTrue:[^ 156]. |
1355 |
(aSymbol == #mkNilBlock) ifTrue:[^ 157]. |
|
1356 |
||
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1357 |
(aSymbol == #gt0) ifTrue:[lineno := true. extraLiteral := #>. ^ 212]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1358 |
(aSymbol == #pushgt0) ifTrue:[lineno := true. stackDelta := 1. extraLiteral := #>. ^ 208]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1359 |
(aSymbol == #basicNew) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 211]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1360 |
(aSymbol == #new) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 213]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1361 |
(aSymbol == #basicNew:) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 214]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1362 |
(aSymbol == #new:) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 215]. |
103 | 1363 |
|
217 | 1364 |
(aSymbol == #pushBlockVar1) ifTrue:[stackDelta := 1. ^ 232]. |
1365 |
(aSymbol == #pushBlockVar2) ifTrue:[stackDelta := 1. ^ 233]. |
|
1366 |
(aSymbol == #pushBlockVar3) ifTrue:[stackDelta := 1. ^ 234]. |
|
1367 |
(aSymbol == #storeBlockVar1) ifTrue:[stackDelta := -1. ^ 235]. |
|
1368 |
(aSymbol == #storeBlockVar2) ifTrue:[stackDelta := -1. ^ 236]. |
|
1369 |
(aSymbol == #storeBlockVar3) ifTrue:[stackDelta := -1. ^ 237]. |
|
1370 |
||
0 | 1371 |
(aSymbol == #falseJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 190]. |
1372 |
(aSymbol == #trueJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 191]. |
|
1373 |
(aSymbol == #nilJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 192]. |
|
1374 |
(aSymbol == #notNilJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 193]. |
|
1375 |
(aSymbol == #jumpabs) ifTrue:[extra := #absoffset. ^ 194]. |
|
1 | 1376 |
(aSymbol == #makeBlockabs) ifTrue:[stackDelta := 1. extra := #absoffsetNvarNarg. ^ 195]. |
0 | 1377 |
(aSymbol == #zeroJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 196]. |
1378 |
(aSymbol == #notZeroJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 197]. |
|
1 | 1379 |
(aSymbol == #eqJumpabs) ifTrue:[stackDelta := -2. extra := #absoffset. ^ 198]. |
1380 |
(aSymbol == #notEqJumpabs) ifTrue:[stackDelta := -2. extra := #absoffset. ^ 199]. |
|
0 | 1381 |
|
1382 |
(aSymbol == #pushThisContext) ifTrue:[stackDelta := 1. ^ 144]. |
|
1383 |
||
425
b046a32edb08
remember &, | and not in literal array
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1384 |
(aSymbol == #isNil) ifTrue:[extraLiteral := aSymbol. ^ 188]. |
b046a32edb08
remember &, | and not in literal array
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1385 |
(aSymbol == #notNil) ifTrue:[extraLiteral := aSymbol. ^ 189]. |
b046a32edb08
remember &, | and not in literal array
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1386 |
(aSymbol == #not) ifTrue:[extraLiteral := aSymbol. lineno := true. ^ 179]. |
b046a32edb08
remember &, | and not in literal array
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1387 |
(aSymbol == #&) ifTrue:[extraLiteral := aSymbol. lineno := true. ^ 216]. |
b046a32edb08
remember &, | and not in literal array
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1388 |
(aSymbol == #|) ifTrue:[extraLiteral := aSymbol. lineno := true. ^ 217]. |
76 | 1389 |
|
117 | 1390 |
(aSymbol == #pushClassVarL) ifTrue:[stackDelta := 1. extra := #speciallitL. ^ 218]. |
1391 |
(aSymbol == #pushGlobalL) ifTrue:[stackDelta := 1. extra := #speciallitL. ^ 218]. |
|
1392 |
(aSymbol == #storeClassVarL) ifTrue:[extra := #speciallitL.stackDelta := -1. ^ 219]. |
|
1393 |
(aSymbol == #storeGlobalL) ifTrue:[extra := #speciallitL. stackDelta := -1. ^ 219]. |
|
1394 |
(aSymbol == #pushLitL) ifTrue:[stackDelta := 1. extra := #unsigned16. ^ 201]. |
|
1395 |
||
1396 |
(aSymbol == #sendL) ifTrue:[lineno := true. extra := #specialL. ^ 205]. |
|
1397 |
(aSymbol == #sendSelfL) ifTrue:[lineno := true. extra := #specialL. ^ 207]. |
|
1398 |
(aSymbol == #sendDropL) ifTrue:[lineno := true. extra := #specialL. ^ 204]. |
|
1399 |
(aSymbol == #superSendL) ifTrue:[lineno := true. extra := #specialL. ^ 206]. |
|
1400 |
(aSymbol == #hereSendL) ifTrue:[lineno := true. extra := #specialL. ^ 206]. |
|
106 | 1401 |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1402 |
(aSymbol == #top) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1403 |
(aSymbol == #bottom) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1404 |
(aSymbol == #left) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1405 |
(aSymbol == #right) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
199
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1406 |
|
400
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1407 |
(aSymbol == #x) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1408 |
(aSymbol == #y) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1409 |
(aSymbol == #width) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1410 |
(aSymbol == #height) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1411 |
(aSymbol == #origin) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1412 |
(aSymbol == #extent) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1413 |
(aSymbol == #next) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1414 |
(aSymbol == #peek) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1415 |
(aSymbol == #asInteger) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1416 |
(aSymbol == #rounded) ifTrue:[lineno := true. extraLiteral := aSymbol. extra := #specialSend. ^ 231]. |
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1417 |
|
217 | 1418 |
(aSymbol == #blockRef) ifTrue:[stackDelta := 0. ^ 238]. |
549 | 1419 |
(aSymbol == #over) ifTrue:[stackDelta := 1. ^ 6]. |
217 | 1420 |
|
0 | 1421 |
self error:'invalid code symbol'. |
1422 |
errorFlag := #Error |
|
117 | 1423 |
|
1424 |
"Modified: 3.9.1995 / 12:58:47 / claus" |
|
549 | 1425 |
"Modified: 25.6.1997 / 11:47:26 / cg" |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1426 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1427 |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1428 |
checkForCommonCode:symbolicCodeArray |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1429 |
"hook to return the code for common code sequences. |
212
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1430 |
This reduces the in-memory number of byteArrays somewhat. |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1431 |
|
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1432 |
Not yet fully implemented - just an idea ... theres certainly more to do here |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1433 |
(does it make sense to scan all methods, collect code in a set and unify things |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1434 |
automatically in the background - or upon request ?)" |
199
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1435 |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1436 |
|sz insn1| |
199
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1437 |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1438 |
(sz := symbolicCodeArray size) == 2 ifTrue:[ |
212
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1439 |
"/ |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1440 |
"/ a very common sequence: return the first literal |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1441 |
"/ |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1442 |
(insn1 := symbolicCodeArray at:1) == #pushLit1 ifTrue:[ |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1443 |
(symbolicCodeArray at:2) == #retTop ifTrue:[ |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1444 |
^ #[222 0] |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1445 |
] |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1446 |
] |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1447 |
]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1448 |
sz == 1 ifTrue:[ |
212
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1449 |
"/ |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1450 |
"/ another common sequence: return the receiver |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1451 |
"/ |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1452 |
(insn1 := symbolicCodeArray at:1) == #retSelf ifTrue:[ |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1453 |
^ #[5] |
212
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1454 |
]. |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1455 |
insn1 == #retTrue ifTrue:[ |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1456 |
^ #[2] |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1457 |
]. |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1458 |
insn1 == #retFalse ifTrue:[ |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1459 |
^ #[3] |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1460 |
]. |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1461 |
]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1462 |
^ nil |
199
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1463 |
! |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1464 |
|
141 | 1465 |
checkForPrimitiveCode:nr |
1466 |
"return the code for an ST-80 primitive method. |
|
1467 |
Since many primitives available on ST-80 should also be available |
|
1468 |
somewhere in ST/X, this may work for many primitive numbers. |
|
1469 |
However, more information is needed and more things to be added below. |
|
1470 |
||
1471 |
This was added to allow emulation of (some) ST-80 |
|
1472 |
primitives (to fileIn RemoteInvocation & Monitor41 packages)" |
|
1473 |
||
1474 |
|cls sel| |
|
1475 |
||
1476 |
(nr == 75) ifTrue:[ cls := Object. sel := #identityHash ]. |
|
1477 |
(nr == 110) ifTrue:[ cls := Object. sel := #== ]. |
|
1478 |
(nr == 111) ifTrue:[ cls := Object. sel := #class ]. |
|
1479 |
" |
|
1480 |
should add more here, to be able to fileIn ST-80 methods |
|
1481 |
containing primitive calls (who gives me the numbers ... ?) |
|
512 | 1482 |
mhmh - got some ..." |
907 | 1483 |
"/ ST80: |
1484 |
"/ |
|
512 | 1485 |
"/ 18 Number @ |
1486 |
"/ 21 LargePositiveInteger + |
|
1487 |
"/ 22 LargePositiveInteger - |
|
1488 |
"/ 29 LargePositiveInteger * |
|
1489 |
"/ 30 LargePositiveInteger / |
|
1490 |
"/ 31 LargePositiveInteger \\ |
|
1491 |
"/ 32 LargePositiveInteger // |
|
1492 |
"/ 34 LargePositiveInteger bitAnd: |
|
1493 |
"/ 35 LargePositiveInteger bitOr: |
|
1494 |
"/ 36 LargePositiveInteger bitXor: |
|
1495 |
"/ 37 LargePositiveInteger bitShift: |
|
1496 |
"/ 40 SmallInteger asFloat |
|
1497 |
"/ 41 Float + |
|
1498 |
"/ 42 Float - |
|
1499 |
"/ 49 Float * |
|
1500 |
"/ 50 Float / |
|
1501 |
"/ 52 Float fractionPart |
|
1502 |
"/ 54 Float timesTwoPower: |
|
1503 |
"/ 70 Behavior basicNew |
|
1504 |
"/ 71 Behavior basicNew: |
|
1505 |
"/ 89 Behavior flushVMmethodCache |
|
1506 |
"/ 91 InputState primCursorLocPut: |
|
1507 |
"/ 105 ByteArray replaceElementsFrom:to:withByteArray:startingAt: |
|
1508 |
"/ 223 ByteString = |
|
1509 |
"/ 306 ObjectMemory class sizesAtStartup |
|
1510 |
"/ 307 ObjectMemory class defaultSizesAtStartup |
|
1511 |
"/ 309 ObjectMemory class defaultThresholds |
|
1512 |
"/ 326 ObjectMemory class getMemoryUsageAndZeroFragmentationStatisticsIf: |
|
1513 |
"/ 395 ExternalInterface ??? |
|
1514 |
"/ 400 FormBitmap class newWidth:height: |
|
1515 |
"/ 414 TwoByteString replaceElementsFrom:to:withTwoByteString:startingAt: |
|
1516 |
"/ 415 TwoByteString = |
|
1517 |
"/ 417 String trueCompare: |
|
1518 |
"/ 418 ByteString nextIndexOf:from:to: |
|
1519 |
"/ 419 ByteString prevIndexOf:from:to: |
|
1520 |
"/ 422 WeakArray indexOf:replaceWith:startingAt:stoppingAt: |
|
1521 |
"/ 522 Behavior flushVMmethodCacheEntriesFor: |
|
1522 |
"/ 524 Context nFromVPC: |
|
1523 |
"/ 525 Context vFromNPC: |
|
1524 |
"/ 532 Object shallowCopy |
|
1525 |
"/ 536 Behavior atomicAllInstances |
|
1526 |
"/ 537 Object allOwners |
|
1527 |
"/ 538 ObjectMemory class allObjects |
|
1528 |
"/ 546 UninterpretedBytes longAt: |
|
1529 |
"/ 548 UninterpretedBytes floatAt: |
|
1530 |
"/ 550 UninterpretedBytes longFloatAt: |
|
1531 |
"/ 544 UninterpretedBytes unsignedLongAt: |
|
1532 |
"/ 559 ByteArray replaceBytesFrom:to:with:startingAt: |
|
1533 |
"/ 560 Double class fromNumber: |
|
1534 |
"/ 561 Double + |
|
1535 |
"/ 562 Double - |
|
1536 |
"/ 569 Double * |
|
1537 |
"/ 570 Double / |
|
1538 |
"/ 572 Double fractionPart |
|
1539 |
"/ 574 Double timesTwoPower: |
|
1540 |
"/ 576 Double sin |
|
1541 |
"/ 577 Double cos |
|
1542 |
"/ 578 Double tan |
|
1543 |
"/ 579 Double arcSin |
|
1544 |
"/ 580 Double arcCos |
|
1545 |
"/ 581 Double arcTan |
|
1546 |
"/ 582 Double sqrt |
|
1547 |
"/ 583 Double ln |
|
1548 |
"/ 584 Double exp |
|
1549 |
"/ 585 Double raisedTo: |
|
1550 |
"/ 587 Double floorLog10 |
|
1551 |
"/ 588 Double asFloat |
|
1552 |
"/ 591 Float cos |
|
1553 |
"/ 592 Float arcSin |
|
1554 |
"/ 593 Float arcCos |
|
1555 |
"/ 600 Float sin |
|
1556 |
"/ 601 Float tan |
|
1557 |
"/ 602 Float arcTan |
|
1558 |
"/ 603 Float sqrt |
|
1559 |
"/ 604 Float ln |
|
1560 |
"/ 605 Float exp |
|
1561 |
"/ 606 Float raisedTo: |
|
1562 |
"/ 609 Float floorLog10 |
|
1563 |
"/ 610 Filename getDatesErrInto: |
|
1564 |
"/ 614 DosFilename class getVolumes |
|
1565 |
"/ 615 UnixFilename primSetProtection:errInto: |
|
1566 |
"/ 616 UnixFilename class primSetCreationMask:errInto: |
|
1567 |
"/ 617 UnixFilename primGetProtectionErrInto: |
|
1568 |
"/ 620 Filename listDirectoryErrInto: |
|
1569 |
"/ 621 Filename deleteErrInto: |
|
1570 |
"/ 622 Filename isDirectoryErrInto: |
|
1571 |
"/ 623 Filename renameTo:errInto: |
|
1572 |
"/ 624 Filename makeDirectoryErrInto: |
|
1573 |
"/ 625 Filename class defaultDirectoryErrInto: |
|
1574 |
"/ 626 Filename fileSizeErrInto: |
|
1575 |
"/ 627 Filename isWritableErrInto: |
|
1576 |
"/ 628 Filename setWritable:errInto: |
|
1577 |
"/ 629 Filename existsErrInto: |
|
1578 |
"/ 630 SocketAccessor setOptionsLevel:name:value: |
|
1579 |
"/ 631 SocketAccessor getOptionsLevel:name: |
|
1580 |
"/ 632 SocketAccessor primGetName |
|
1581 |
"/ 633 SocketAccessor primGetPeer |
|
1582 |
"/ 634 SocketAccessor atMark |
|
1583 |
"/ 637 UnixTtyAccessor primGetOptions |
|
1584 |
"/ 638 UnixTtyAccessor setOptions: |
|
1585 |
"/ 639 UnixRealTtyAccessor modemBits:mask:sendBreak: |
|
1586 |
"/ 640 IPSocketAddress class primHostAddressByName: |
|
1587 |
"/ 641 IPSocketAddress class netAddressByName: |
|
1588 |
"/ 642 IPSocketAddress class protocolNumberByName: |
|
1589 |
"/ 643 IPSocketAddress class servicePortByName: |
|
1590 |
"/ 645 IPSocketAddress class primHostNameByAddress: |
|
1591 |
"/ 646 IPSocketAddress class netNameByAddress: |
|
1592 |
"/ 647 IPSocketAddress class protocolNameByNumber: |
|
1593 |
"/ 648 IPSocketAddress class serviceNameByPort: |
|
1594 |
"/ 649 SocketAccessor class getHostname |
|
1595 |
"/ 650 Filename primOpenFileNamed:direction:creation:errorInto: |
|
1596 |
"/ 651 IOAccessor primClose |
|
1597 |
"/ 652 UnixPipeAccessor class primPipeErrorInto: |
|
1598 |
"/ 653 UnixPseudoTtyAccessor class primPtyErrorInto: |
|
1599 |
"/ 654 SocketAccessor class primPairErrorInto: |
|
1600 |
"/ 655 UnixRealTtyAccessor class primOpen:errInto: |
|
1601 |
"/ 660 IOAccessor primReadInto:startingAt:for: |
|
1602 |
"/ 661 IOAccessor primWriteFrom:startingAt:for: |
|
1603 |
"/ 662 IOAccessor primSeekTo: |
|
1604 |
"/ 664 IOAccessor truncateTo: |
|
1605 |
"/ 665 DosDiskFileAccessor commit |
|
1606 |
"/ 666 IOAccessor primGetSize |
|
1607 |
"/ 667 MacDiskFileAccessor lock:for: |
|
1608 |
"/ 669 UnixIOAccessor bytesForRead |
|
1609 |
"/ 670 SocketAccessor class primFamily:type:protocol:errInto: |
|
1610 |
"/ 671 SocketAccessor primAccept |
|
1611 |
"/ 672 SocketAccessor bindTo: |
|
1612 |
"/ 673 SocketAccessor listenFor: |
|
1613 |
"/ 674 SocketAccessor primConnectTo: |
|
1614 |
"/ 675 SocketAccessor primReceiveFrom:buffer:start:for:flags: |
|
1615 |
"/ 676 SocketAccessor sendTo:buffer:start:for:flags: |
|
1616 |
"/ 677 SocketAccessor shutdown: |
|
1617 |
"/ 681 UnixProcess class primFork:arguments:environment:descriptors:errorTo: |
|
1618 |
"/ 682 UnixProcess class reapOne |
|
1619 |
"/ 683 UnixProcess kill: |
|
1620 |
"/ 690 CEnvironment class primEnvironment |
|
1621 |
"/ 697 OSErrorHolder class errorDescriptionFor: |
|
1622 |
"/ 697 ErrorHolder class errorDescriptionFor: |
|
1623 |
"/ 698 SocketAccessor class primInit: |
|
1624 |
"/ 700 ParagraphEditor class getExternalSelectionOrNil: |
|
1625 |
"/ 701 ParagraphEditor class putExternalSelection:with: |
|
1626 |
"/ 705 Screen ringBell |
|
1627 |
"/ 706 Cursor class primOpenImage:mask:hotSpotX:hotSpotY:background:foreground: |
|
1628 |
"/ 707 Cursor primBeCursor |
|
1629 |
"/ 708 Cursor primFreeCursor |
|
1630 |
"/ 772 SoundManager enumerateSoundsFrom: |
|
1631 |
"/ 773 SoundManager playSoundFrom:sound: |
|
1632 |
"/ 774 SoundManager simpleBeep: |
|
1633 |
"/ 775 Pixmap primFromClipboard |
|
1634 |
"/ 776 Pixmap toClipboard |
|
1635 |
"/ 808 Context findNextMarkedUpTo: |
|
1636 |
"/ 809 Context terminateTo: |
|
1637 |
"/ 710 DosTtyAccessor class primOpen:errInto: |
|
1638 |
"/ 711 DosTtyAccessor primClose |
|
1639 |
"/ 712 DosTtyAccessor primReadInto:startingAt:for: |
|
1640 |
"/ 713 DosTtyAccessor primWriteFrom:startingAt:for: |
|
1641 |
"/ 714 DosTtyAccessor primGetOptions |
|
1642 |
"/ 715 DosTtyAccessor primSetOptions: |
|
1643 |
"/ 716 DosTtyAccessor setSem:forWrite: |
|
1644 |
"/ 717 DosTtyAccessor modemBits:mask:sendBreak: |
|
1645 |
"/ 750 MacFilename class getVolumes |
|
1646 |
"/ 752 MacFilename primSetCreator:type:errInto: |
|
1647 |
"/ 754 MacIOAccessor class getAccessories |
|
1648 |
"/ 755 MacIOAccessor class runAccessory: |
|
1649 |
"/ 756 MacOSFilename class getFileTypes:errInto: |
|
1650 |
"/ 757 MacOSFilename putFileWithPrompt:errInto: |
|
1651 |
"/ 758 MacOSFilename getFileInfoErrInto: |
|
1652 |
"/ 759 MacOSFilename stringFromVRefErrInto: |
|
1653 |
"/ 761 MacOSFilename class getStartupFilesErrInto: |
|
1654 |
"/ 770 DosFilename printPSFileErrInto: |
|
1655 |
"/ 771 DosFilename printTextFileErrInto: |
|
1656 |
"/ 780 MacTtyAccessor class primOpen:errInto: |
|
1657 |
"/ 781 MacTtyAccessor primClose |
|
1658 |
"/ 782 MacTtyAccessor primReadInto:startingAt:for: |
|
1659 |
"/ 783 MacTtyAccessor primWriteFrom:startingAt:for: |
|
1660 |
"/ 786 MacTtyAccessor primGetOptions |
|
1661 |
"/ 787 MacTtyAccessor setOptions: |
|
1662 |
"/ 788 MacTtyAccessor primBreak: |
|
1663 |
"/ 790 MacTtyAccessor primGetStatus |
|
1664 |
"/ 792 MacTtyAccessor setSem:forWrite: |
|
1665 |
"/ 793 MacTtyAccessor primAssertDTR: |
|
1666 |
"/ 794 MacTtyAccessor primGetSize |
|
1667 |
"/ 933 ByteArray copyBitsClippedStride:... |
|
1668 |
"/ 934 ByteArray tileBits32By32Stride:... |
|
1669 |
"/ 935 Screen dragShape:... |
|
1670 |
"/ 936 Screen resizeRectangle... |
|
1671 |
"/ 937 Screen displayShape:... |
|
1672 |
"/ 938 Window resizeFromUserWithMinimum:maximum: |
|
1673 |
"/ 940 Window primClose |
|
1674 |
"/ 942 Window getDimensions |
|
1675 |
"/ 943 Window moveTo:resize: |
|
1676 |
"/ 944 Window primMap |
|
1677 |
"/ 945 Window class primNewAt:extent:min:max:windowType: |
|
1678 |
"/ 946 Screen flush |
|
1679 |
"/ 947 Screen getScreenDimensions |
|
1680 |
"/ 948 Window unmap |
|
1681 |
"/ 950 Screen sync |
|
1682 |
"/ 951 Window setIconMask: |
|
1683 |
"/ 952 Window label:iconLabel: |
|
1684 |
"/ 953 Window raise |
|
1685 |
"/ 954 Window lower |
|
1686 |
"/ 955 Screen queryStackingOrder |
|
1687 |
"/ 956 TextMeasurer primScanCharactersFrom:... |
|
1688 |
"/ 957 GraphicsContext displayMappedString:from:to:at:withMap: |
|
1689 |
"/ 959 Window setBackgroundPixel: |
|
1690 |
"/ 960 Screen class primOpen: |
|
1691 |
"/ 965 UnmappableSurface contentsOfAreaOriginX:y:width:height: |
|
1692 |
"/ 966 Window contentsOfAreaOriginX:y:width:height: |
|
1693 |
"/ 967 Screen contentsOfAreaOriginX:y:width:height: |
|
1694 |
"/ 970 Mask class primExtent:depth: |
|
1695 |
"/ 971 Mask privateClose |
|
1696 |
"/ 976 GraphicsContext displayCharacterOfIndex:at: |
|
1697 |
"/ 978 DeviceFont class listFonts |
|
1698 |
"/ 979 DeviceFont primLoadFont |
|
1699 |
"/ 980 DeviceFont primUnLoadFont |
|
1700 |
"/ 985 GraphicsContext displayLineFrom:to: |
|
1701 |
"/ 986 GraphicsContext displayPolyline:at: |
|
1702 |
"/ 987 GraphicsContext displayPolygon:at: |
|
1703 |
"/ 988 GraphicsContext primDisplayRectangleOrigin:extent: |
|
1704 |
"/ 989 GraphicsContext primDisplayRectangularBorderOrigin:extent: |
|
1705 |
"/ 990 GraphicsContext primDisplayArcBBoxOrigin:extent:startAngle:sweepAngle: |
|
1706 |
"/ 991 GraphicsContext primDisplayWedgeBBoxOrigin:extent:startAngle:sweepAngle: |
|
1707 |
"/ 992 GraphicsContext displayMask:at:" |
|
1708 |
"/ 993 GraphicsContext displayUninterpretedImageBits:at: |
|
1709 |
"/ 994 GraphicsContext primCopyRectangularAreaExtent:from:sourceOffset:destinationOffset: |
|
1710 |
"/ 995 GraphicsContext primCopyMaskedArea:from:sourceOffset:destinationOffset: |
|
1711 |
"/ 996 Screen deviceColormap |
|
1712 |
"/ 998 GraphicsContext displayUninterpretedMonoImageBits:foreground:background:at: |
|
1713 |
||
907 | 1714 |
"/ Squeak: |
1715 |
"/ |
|
1716 |
"/ 1 + |
|
1717 |
"/ 2 - |
|
1718 |
"/ 3 < |
|
1719 |
"/ 4 > |
|
1720 |
"/ 5 <= |
|
1721 |
"/ 6 >= |
|
1722 |
"/ 7 = |
|
1723 |
"/ 8 ~= |
|
1724 |
"/ 9 * |
|
1725 |
"/ 10 / |
|
1726 |
"/ 11 mod: |
|
1727 |
"/ 12 div: |
|
1728 |
"/ 13 quo: |
|
1729 |
"/ 14 bitAnd: |
|
1730 |
"/ 15 bitOr: |
|
1731 |
"/ 16 bitXor: |
|
1732 |
"/ 17 bitShift: |
|
1733 |
"/ 18 @ |
|
1734 |
"/ 19 |
|
1735 |
"/ ... |
|
1736 |
"/ 39 fail - reserved/unimplemented |
|
1737 |
"/ 40 asFloat |
|
1738 |
"/ 41 Float + |
|
1739 |
"/ 42 Float - |
|
1740 |
"/ 43 Float < |
|
1741 |
"/ 44 Float > |
|
1742 |
"/ 45 Float <= |
|
1743 |
"/ 46 Float >= |
|
1744 |
"/ 47 Float = |
|
1745 |
"/ 48 Float ~= |
|
1746 |
"/ 49 Float * |
|
1747 |
"/ 50 Float / |
|
1748 |
"/ 51 Float truncated |
|
1749 |
"/ 52 Float fractionalPart |
|
1750 |
"/ 53 Float exponent |
|
1751 |
"/ 54 Float timeTwoPower |
|
1752 |
"/ 55 Float sqrt |
|
1753 |
"/ 56 Float sine |
|
1754 |
"/ 57 Float arcTan |
|
1755 |
"/ 58 Float logN |
|
1756 |
"/ 59 Float exp |
|
1757 |
"/ 60 at: |
|
1758 |
"/ 61 at:put: |
|
1759 |
"/ 62 size |
|
1760 |
"/ 63 stringAt: |
|
1761 |
"/ 64 stringAt:put: |
|
1762 |
"/ 65 next |
|
1763 |
"/ 66 nextPut: |
|
1764 |
"/ 67 atEnd |
|
1765 |
"/ 68 objectAt: |
|
1766 |
"/ 69 objectAt:put: |
|
1767 |
"/ 70 new |
|
1768 |
"/ 71 new: |
|
1769 |
"/ 72 becomeOneWay |
|
1770 |
"/ 73 instVarAt: |
|
1771 |
"/ 74 instVarAtPut: |
|
1772 |
"/ 75 asOop |
|
1773 |
"/ 76 storeStackP |
|
1774 |
"/ 77 someInstance |
|
1775 |
"/ 78 nextInstance |
|
1776 |
"/ 79 newMethod |
|
1777 |
"/ 80 blockCopy |
|
1778 |
"/ 81 value |
|
1779 |
"/ 82 valueWithArgs |
|
1780 |
"/ 83 perform |
|
1781 |
"/ 84 performWithArgs |
|
1782 |
"/ 85 signal |
|
1783 |
"/ 86 wait |
|
1784 |
"/ 87 resume |
|
1785 |
"/ 88 suspend |
|
1786 |
"/ 89 flushCache |
|
1787 |
"/ 90 mousePoint |
|
1788 |
"/ 91 fail/unimplemented/reserved |
|
1789 |
"/ 92 fail/unimplemented/reserved |
|
1790 |
"/ 93 inputSemaphore |
|
1791 |
"/ 94 fail/unimplemented/reserved |
|
1792 |
"/ 95 inputWord |
|
1793 |
"/ 96 copyBits |
|
1794 |
"/ 97 snapShot |
|
1795 |
"/ 98 fail/unimplemented/reserved |
|
1796 |
"/ 99 fail/unimplemented/reserved |
|
1797 |
"/ 100 fail/unimplemented/reserved |
|
1798 |
"/ 101 beCursor |
|
1799 |
"/ 102 beDisplay |
|
1800 |
"/ 103 scanCharacters |
|
1801 |
"/ 104 drawLoop |
|
1802 |
"/ 105 stringReplace |
|
1803 |
"/ 106 screenSize |
|
1804 |
"/ 107 mouseButtons |
|
1805 |
"/ 108 kbdNext |
|
1806 |
"/ 109 kbdPeek |
|
1807 |
"/ 110 equivalent |
|
1808 |
"/ 111 class |
|
1809 |
"/ 112 bytesLeft |
|
1810 |
"/ 113 quit |
|
1811 |
"/ 114 exitToDebugger |
|
1812 |
"/ 115 fail/unimplemented/reserved |
|
1813 |
"/ 116 flushCacheByMethod |
|
1814 |
"/ 117 externalCall |
|
1815 |
"/ 118 doPrimitiveWithArg |
|
1816 |
"/ 119 flushCacheSelective |
|
1817 |
"/ 120 fail/unimplemented/reserved |
|
1818 |
"/ 121 imageName |
|
1819 |
"/ 122 noop |
|
1820 |
"/ 123 fail/unimplemented/reserved |
|
1821 |
"/ 124 lowSpaceSemaphore |
|
1822 |
"/ 125 signalAtBytesLeft |
|
1823 |
"/ 126 deferDisplayUpdate |
|
1824 |
"/ 127 showDisplayRect |
|
1825 |
"/ 128 arrayBecome |
|
1826 |
"/ 129 specialObjectsOop |
|
1827 |
"/ 130 fullGC |
|
1828 |
"/ 131 incrementalGC |
|
1829 |
"/ 132 objectPointsTo |
|
1830 |
"/ 133 setInterruptKey |
|
1831 |
"/ 134 interruptSemaphore |
|
1832 |
"/ 135 millisecondClock |
|
1833 |
"/ 136 signalAtMilliseconds |
|
1834 |
"/ 137 secondsClock |
|
1835 |
"/ 138 someObject |
|
1836 |
"/ 139 nextObject |
|
1837 |
"/ 140 beep |
|
1838 |
"/ 141 clipboardText |
|
1839 |
"/ 142 vmPath |
|
1840 |
"/ 143 shortAt |
|
1841 |
"/ 144 shortAtPut |
|
1842 |
"/ 145 constantFill |
|
1843 |
"/ 146 readJoystick |
|
1844 |
"/ 147 warpBits |
|
1845 |
"/ 148 clone |
|
1846 |
"/ 149 getAttribute |
|
1847 |
"/ 150 fileAtEnd |
|
1848 |
"/ 151 fileClose |
|
1849 |
"/ 152 fileGetPosition |
|
1850 |
"/ 153 fileOpen |
|
1851 |
"/ 154 fileRead |
|
1852 |
"/ 155 fileSetPosition |
|
1853 |
"/ 156 fileDelete |
|
1854 |
"/ 157 fileSize |
|
1855 |
"/ 158 fileWrite |
|
1856 |
"/ 159 fileRename |
|
1857 |
"/ 160 directoryCreate |
|
1858 |
"/ 161 directoryDelimiter |
|
1859 |
"/ 162 directoryLookup |
|
1860 |
"/ 163 fail |
|
1861 |
"/ 164 fail |
|
1862 |
"/ 165 fail |
|
1863 |
"/ 166 fail |
|
1864 |
"/ 167 fail |
|
1865 |
"/ 168 fail |
|
1866 |
"/ 169 directorySetMacType |
|
1867 |
"/ 170 soundStart |
|
1868 |
"/ 171 soundStartWithSemaphore |
|
1869 |
"/ 172 soundStop |
|
1870 |
"/ 173 soundAvailableSpace |
|
1871 |
"/ 174 soundPlaySamples |
|
1872 |
"/ 175 soundPlaySilence |
|
1873 |
"/ 176 waveTableSoundmixSampleCountIntoStarrtingAtpan |
|
1874 |
"/ 177 fmSoundmixSampleCountintostartingAtpan |
|
1875 |
"/ 178 pluckedSoundmixSampleCountintostartingAtpan |
|
1876 |
"/ 179 sampledSoundmixSampleCountintostartingAtpan |
|
1877 |
"/ 180 fmSoundmixSampleCountintostartingAtleftVolrightVol |
|
1878 |
"/ 181 pluckedSoundmixSampleCountintostartingAtleftVolrightVol |
|
1879 |
"/ 182 sampledSoundmixSampleCountintostartingAtleftVolrightVol |
|
1880 |
"/ 183 reverbSoundapplyReverbTostartingAtcount |
|
1881 |
"/ 184 loopedSampledSoundmixSampleCountintostartingAtleftVolrightVol |
|
1882 |
"/ 185 fail |
|
1883 |
"/ 186 fail |
|
1884 |
"/ 187 fail |
|
1885 |
"/ 188 fail |
|
1886 |
"/ 189 soundInsertSamples |
|
1887 |
"/ 190 soundStartRecording |
|
1888 |
"/ 191 soundStopRecording |
|
1889 |
"/ 192 soundGetRecordingSampleRate |
|
1890 |
"/ 193 soundRecordSamples |
|
1891 |
"/ 194 soundSetRecordLevel |
|
1892 |
"/ 195 fail |
|
1893 |
"/ 196 fail |
|
1894 |
"/ 197 fail |
|
1895 |
"/ 198 fail |
|
1896 |
"/ 199 fail |
|
1897 |
"/ 200 initializeNetwork |
|
1898 |
"/ 201 resolverStartNameLookup |
|
1899 |
"/ 202 resolverNameLookupResult |
|
1900 |
"/ 203 resolverStartAddressLookup |
|
1901 |
"/ 204 resolverAddressLookupResult |
|
1902 |
"/ 205 resolverAbortLookup |
|
1903 |
"/ 206 resolverLocalAddress |
|
1904 |
"/ 207 resolverStatus |
|
1905 |
"/ 208 resolverError |
|
1906 |
"/ 209 socketCreate |
|
1907 |
"/ 210 socketDestroy |
|
1908 |
"/ 211 socketConnectionStatus |
|
1909 |
"/ 212 socketError |
|
1910 |
"/ 213 socketLocalAddress |
|
1911 |
"/ 214 socketLocalPort |
|
1912 |
"/ 215 socketRemoteAddress |
|
1913 |
"/ 216 socketRemotePort |
|
1914 |
"/ 217 socketConnectToPort |
|
1915 |
"/ 218 socketListenOnPort |
|
1916 |
"/ 219 socketCloseConnection |
|
1917 |
"/ 220 socketAbortConnection |
|
1918 |
"/ 221 socketReceiveDataBufCount |
|
1919 |
"/ 222 socketReceiveDataAvailable |
|
1920 |
"/ 223 socketSendDataBufCount |
|
1921 |
"/ 224 socketSendDone |
|
1922 |
"/ 225 fail |
|
1923 |
"/ 226 fail |
|
1924 |
"/ 227 fail |
|
1925 |
"/ 228 fail |
|
1926 |
"/ 229 fail |
|
1927 |
"/ 230 relinquishProcessor |
|
1928 |
"/ 231 forceDisplayUpdate |
|
1929 |
"/ 232 formPrint |
|
1930 |
"/ 233 setFullScreen |
|
1931 |
"/ 234 bitmapdecompressfromByteArrayat |
|
1932 |
"/ 235 stringcomparewithcollated |
|
1933 |
"/ 236 sampledSoundconvert8bitSignedFromto16Bit |
|
1934 |
"/ 237 bitmapcompresstoByteArray |
|
1935 |
"/ 238 serialPortOpen |
|
1936 |
"/ 239 serialPortClose |
|
1937 |
"/ 240 serialPortWrite |
|
1938 |
"/ 241 serialPortRead |
|
1939 |
"/ 242 fail |
|
1940 |
"/ 243 stringtranslatefromtotable |
|
1941 |
"/ 244 stringfindFirstInStringinSetstartingAt |
|
1942 |
"/ 245 stringindexOfAsciiinStringstartingAt |
|
1943 |
"/ 246 stringfindSubstringinstartingAtmatchTable |
|
1944 |
"/ 247 fail |
|
1945 |
"/ 248 fail |
|
1946 |
"/ 249 fail |
|
1947 |
"/ 250 clearProfile |
|
1948 |
"/ 251 dumpProfile |
|
1949 |
"/ 252 startProfiling |
|
1950 |
"/ 253 stopProfiling |
|
1951 |
"/ 254 vmParameter |
|
1952 |
"/ 255 instVarsPutFromStack |
|
1953 |
"/ 256 pushSelf |
|
1954 |
"/ 257 pushTrue |
|
1955 |
"/ 258 pushFalse |
|
1956 |
"/ 259 pushNil |
|
1957 |
"/ 260 pushMinusOne |
|
1958 |
"/ 261 pushZero |
|
1959 |
"/ 262 pushOne |
|
1960 |
"/ 263 pushTwo |
|
1961 |
"/ 264 loadInstVar |
|
1962 |
"/ .. loadInstVar |
|
1963 |
"/ 519 loadInstVar |
|
1964 |
"/ 520 fail |
|
1965 |
"/ 521 MIDIClosePort |
|
1966 |
"/ 522 MIDIGetClock |
|
1967 |
"/ 523 MIDIGetPortCount |
|
1968 |
"/ 524 MIDIGetPortDirectionality |
|
1969 |
"/ 525 MIDIGetPortName |
|
1970 |
"/ 526 MIDIOpenPort |
|
1971 |
"/ 527 MIDIParameterGetOrSet |
|
1972 |
"/ 528 MIDIRead |
|
1973 |
"/ 529 MIDIWrite |
|
1974 |
"/ 530 fail |
|
1975 |
"/ .. fail |
|
1976 |
"/ 539 fail |
|
1977 |
"/ 540 asyncFileClose |
|
1978 |
"/ 541 asyncFileOpen |
|
1979 |
"/ 542 asyncFileReadResult |
|
1980 |
"/ 543 asyncFileReadStart |
|
1981 |
"/ 544 asyncFileWriteResult |
|
1982 |
"/ 545 asyncFileWriteStart |
|
1983 |
"/ 546 fail |
|
1984 |
"/ .. |
|
1985 |
"/ 700 fail |
|
1986 |
||
141 | 1987 |
cls notNil ifTrue:[ |
907 | 1988 |
^ (cls compiledMethodAt:sel) code |
141 | 1989 |
]. |
1990 |
^ nil |
|
1991 |
! |
|
1992 |
||
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
1993 |
createMethod |
429 | 1994 |
|newMethod| |
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
1995 |
|
292
163651658aee
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
287
diff
changeset
|
1996 |
newMethod := Method new:(litArray size). |
163651658aee
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
287
diff
changeset
|
1997 |
litArray notNil ifTrue:[ |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1998 |
"/ fixup CheapBlocks method-field in literal array, |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1999 |
litArray do:[:aLiteral | |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2000 |
(aLiteral isMemberOf:CheapBlock) ifTrue:[ |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2001 |
aLiteral setMethod:newMethod. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2002 |
] |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2003 |
]. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2004 |
newMethod literals:litArray |
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2005 |
]. |
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2006 |
|
594
11ae33ac9b34
finally replaced all sends of #numberOfMethodVars with #numerOfVars
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2007 |
newMethod numberOfVars:(self numberOfMethodVars + (maxNumTemp ? 0)). |
11ae33ac9b34
finally replaced all sends of #numberOfMethodVars with #numerOfVars
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2008 |
newMethod numberOfArgs:(self numberOfMethodArgs). |
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2009 |
newMethod stackSize:(self maxStackDepth). |
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2010 |
|
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2011 |
primitiveResource notNil ifTrue:[ |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2012 |
newMethod setResourceFlag |
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2013 |
]. |
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2014 |
|
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2015 |
^ newMethod |
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2016 |
|
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2017 |
"Created: 18.5.1996 / 16:33:17 / cg" |
292
163651658aee
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
287
diff
changeset
|
2018 |
"Modified: 24.6.1996 / 12:32:50 / stefan" |
594
11ae33ac9b34
finally replaced all sends of #numberOfMethodVars with #numerOfVars
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2019 |
"Modified: 1.8.1997 / 00:27:29 / cg" |
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2020 |
! |
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2021 |
|
141 | 2022 |
genByteCodeFrom:symbolicCodeArray |
2023 |
"convert symbolicCode into bytecodes" |
|
2024 |
||
2025 |
|symIndex "{Class: SmallInteger }" |
|
2026 |
codeSize "{Class: SmallInteger }" |
|
2027 |
symCodeSize "{Class: SmallInteger }" |
|
429 | 2028 |
index nextSym addr |
141 | 2029 |
codeSymbol nargs needRetry |
429 | 2030 |
stackDepth relocInfo level nvars round| |
141 | 2031 |
|
2032 |
symbolicCodeArray isNil ifTrue:[^ self]. |
|
2033 |
||
2034 |
round := 0. |
|
2035 |
needRetry := true. |
|
2036 |
symCodeSize := symbolicCodeArray size. |
|
192
5f5ecdcffc67
share common byteCodes - just an idea and more is needed for most compact code
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2037 |
ShareCode ifTrue:[ |
512 | 2038 |
codeBytes := self checkForCommonCode:symbolicCodeArray. |
2039 |
codeBytes notNil ifTrue:[ |
|
2040 |
^ self |
|
2041 |
]. |
|
192
5f5ecdcffc67
share common byteCodes - just an idea and more is needed for most compact code
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2042 |
]. |
141 | 2043 |
codeSize := symCodeSize. |
2044 |
||
2045 |
[needRetry] whileTrue:[ |
|
512 | 2046 |
stackDepth := 0. |
2047 |
maxStackDepth := 0. |
|
2048 |
||
2049 |
codeBytes := ByteArray uninitializedNew:codeSize. |
|
2050 |
relocInfo := Array basicNew:(codeSize + 1). |
|
2051 |
symIndex := 1. |
|
2052 |
codeIndex := 1. |
|
2053 |
||
2054 |
needRetry := false. |
|
2055 |
round := round + 1. |
|
2056 |
||
2057 |
[symIndex <= symCodeSize] whileTrue:[ |
|
2058 |
relocInfo at:symIndex put:codeIndex. |
|
2059 |
||
2060 |
codeSymbol := symbolicCodeArray at:symIndex. |
|
2061 |
symIndex := symIndex + 1. |
|
2062 |
stackDelta := 0. |
|
2063 |
extra := extraLiteral := nil. |
|
2064 |
lineno := false. |
|
2065 |
||
2066 |
self appendByteCodeFor:codeSymbol. |
|
2067 |
||
2068 |
extraLiteral notNil ifTrue:[ |
|
2069 |
self addLiteral:extraLiteral |
|
2070 |
]. |
|
2071 |
||
2072 |
lineno ifTrue:[ |
|
2073 |
self appendByte:((symbolicCodeArray at:symIndex) min:255). |
|
2074 |
symIndex := symIndex + 1. |
|
2075 |
codeSymbol == #lineno16 ifTrue:[ |
|
2076 |
self appendByte:((symbolicCodeArray at:symIndex) min:255). |
|
2077 |
symIndex := symIndex + 1 |
|
2078 |
] |
|
2079 |
]. |
|
2080 |
||
2081 |
extra notNil ifTrue:[ |
|
2082 |
nextSym := symbolicCodeArray at:symIndex. |
|
2083 |
||
2084 |
(extra == #number) ifTrue:[ |
|
2085 |
index := nextSym. |
|
2086 |
symIndex := symIndex + 1. |
|
2087 |
self appendSignedByte:index |
|
2088 |
||
2089 |
] ifFalse:[ (extra == #number16) ifTrue:[ |
|
2090 |
index := nextSym. |
|
2091 |
symIndex := symIndex + 2. |
|
2092 |
self appendSignedWord:index |
|
2093 |
||
2094 |
] ifFalse:[ (extra == #unsigned16) ifTrue:[ |
|
2095 |
index := nextSym. |
|
2096 |
symIndex := symIndex + 2. |
|
2097 |
self appendWord:index |
|
2098 |
||
2099 |
] ifFalse:[ (extra == #index) ifTrue:[ |
|
2100 |
index := nextSym. |
|
2101 |
symIndex := symIndex + 1. |
|
2102 |
self appendByte:index |
|
2103 |
||
2104 |
] ifFalse:[ (extra == #lit) ifTrue:[ |
|
2105 |
index := self addLiteral:nextSym. |
|
2106 |
symIndex := symIndex + 1. |
|
2107 |
self appendByte:index |
|
2108 |
||
2109 |
] ifFalse:[ (extra == #speciallit) ifTrue:[ |
|
2110 |
index := self addLiteral:nextSym. |
|
2111 |
index > 255 ifTrue:[ |
|
2112 |
self parseError:'too many globals (' , |
|
2113 |
(symbolicCodeArray at:symIndex) , |
|
2114 |
' index=' , index printString , |
|
2115 |
') in method - please simplify'. |
|
2116 |
^ #Error |
|
2117 |
]. |
|
2118 |
symIndex := symIndex + 1. |
|
2119 |
self appendByte:index. |
|
2120 |
||
2121 |
] ifFalse:[ (extra == #speciallitS) ifTrue:[ |
|
2122 |
index := nextSym. |
|
2123 |
symIndex := symIndex + 1. |
|
2124 |
self appendByte:index. |
|
2125 |
||
2126 |
] ifFalse:[ (extra == #speciallitL) ifTrue:[ |
|
2127 |
index := nextSym. |
|
2128 |
symIndex := symIndex + 2. |
|
2129 |
self appendWord:index. |
|
2130 |
||
2131 |
] ifFalse:[ (extra == #offset) ifTrue:[ |
|
2132 |
relocInfo at:symIndex put:codeIndex. |
|
2133 |
self addReloc:symIndex. |
|
2134 |
symIndex := symIndex + 1. |
|
2135 |
self appendByte:0 |
|
2136 |
||
2137 |
] ifFalse:[ (extra == #indexLevel) ifTrue:[ |
|
2138 |
index := nextSym. |
|
2139 |
symIndex := symIndex + 1. |
|
2140 |
self appendByte:index. |
|
2141 |
level := symbolicCodeArray at:symIndex. |
|
2142 |
symIndex := symIndex + 1. |
|
2143 |
self appendByte:level |
|
2144 |
||
2145 |
] ifFalse:[ (extra == #offsetNvarNarg) ifTrue:[ |
|
2146 |
relocInfo at:symIndex put:codeIndex. |
|
2147 |
self addReloc:symIndex. |
|
2148 |
symIndex := symIndex + 1. |
|
2149 |
self appendEmptyByte. |
|
2150 |
nvars := symbolicCodeArray at:symIndex. |
|
2151 |
symIndex := symIndex + 1. |
|
2152 |
self appendByte:nvars. |
|
2153 |
level := symbolicCodeArray at:symIndex. |
|
2154 |
symIndex := symIndex + 1. |
|
2155 |
self appendByte:level |
|
2156 |
||
2157 |
] ifFalse:[ (extra == #absoffset) ifTrue:[ |
|
2158 |
relocInfo at:symIndex put:codeIndex. |
|
2159 |
self addReloc:symIndex. |
|
2160 |
addr := symbolicCodeArray at:symIndex. |
|
2161 |
symIndex := symIndex + 1. |
|
2162 |
self appendByte:(addr bitAnd:16rFF). |
|
2163 |
self appendByte:((addr bitShift:-8) bitAnd:16rFF). |
|
2164 |
||
2165 |
] ifFalse:[ (extra == #absoffsetNvarNarg) ifTrue:[ |
|
2166 |
relocInfo at:symIndex put:codeIndex. |
|
2167 |
self addReloc:symIndex. |
|
2168 |
addr := symbolicCodeArray at:symIndex. |
|
2169 |
symIndex := symIndex + 1. |
|
2170 |
self appendByte:(addr bitAnd:16rFF). |
|
2171 |
self appendByte:((addr bitShift:-8) bitAnd:16rFF). |
|
2172 |
nvars := symbolicCodeArray at:symIndex. |
|
2173 |
symIndex := symIndex + 1. |
|
2174 |
self appendByte:nvars. |
|
2175 |
level := symbolicCodeArray at:symIndex. |
|
2176 |
symIndex := symIndex + 1. |
|
2177 |
self appendByte:level |
|
2178 |
||
2179 |
] ifFalse:[ (extra == #special) ifTrue:[ |
|
2180 |
((codeSymbol == #send) |
|
2181 |
or:[codeSymbol == #sendSelf |
|
2182 |
or:[codeSymbol == #superSend |
|
2183 |
or:[codeSymbol == #hereSend]]]) ifTrue:[ |
|
2184 |
index := nextSym. |
|
2185 |
symIndex := symIndex + 1. |
|
2186 |
nargs := symbolicCodeArray at:symIndex. |
|
2187 |
symIndex := symIndex + 1. |
|
2188 |
self appendByte:nargs. |
|
2189 |
self appendByte:index. |
|
2190 |
||
2191 |
(codeSymbol == #superSend |
|
2192 |
or:[codeSymbol == #hereSend]) ifTrue:[ |
|
2193 |
index := symbolicCodeArray at:symIndex. |
|
2194 |
symIndex := symIndex + 1. |
|
2195 |
self appendByte:index |
|
2196 |
]. |
|
2197 |
stackDelta := nargs negated. |
|
2198 |
codeSymbol == #sendSelf ifTrue:[ |
|
2199 |
stackDelta := stackDelta + 1 |
|
2200 |
] |
|
2201 |
] ifFalse:[ (codeSymbol == #sendDrop) ifTrue:[ |
|
2202 |
index := nextSym. |
|
2203 |
symIndex := symIndex + 1. |
|
2204 |
nargs := symbolicCodeArray at:symIndex. |
|
2205 |
symIndex := symIndex + 1. |
|
2206 |
self appendByte:nargs. |
|
2207 |
self appendByte:index. |
|
2208 |
stackDelta := (nargs + 1) negated |
|
2209 |
]] |
|
2210 |
||
2211 |
] ifFalse:[ (extra == #specialL) ifTrue:[ |
|
2212 |
((codeSymbol == #sendL) |
|
2213 |
or:[codeSymbol == #sendSelfL |
|
2214 |
or:[codeSymbol == #superSendL |
|
2215 |
or:[codeSymbol == #hereSendL]]]) ifTrue:[ |
|
2216 |
index := nextSym. |
|
2217 |
symIndex := symIndex + 2. |
|
2218 |
nargs := symbolicCodeArray at:symIndex. |
|
2219 |
symIndex := symIndex + 1. |
|
2220 |
self appendByte:nargs. |
|
2221 |
self appendWord:index. |
|
2222 |
(codeSymbol == #superSendL |
|
2223 |
or:[codeSymbol == #hereSendL]) ifTrue:[ |
|
2224 |
index := symbolicCodeArray at:symIndex. |
|
2225 |
symIndex := symIndex + 2. |
|
2226 |
self appendWord:index. |
|
2227 |
]. |
|
2228 |
stackDelta := nargs negated. |
|
2229 |
codeSymbol == #sendSelfL ifTrue:[ |
|
2230 |
stackDelta := stackDelta + 1 |
|
2231 |
] |
|
2232 |
] |
|
2233 |
] ifFalse:[ (extra == #specialSend) ifTrue:[ |
|
2234 |
index := nextSym. |
|
2235 |
symIndex := symIndex + 1. |
|
2236 |
self appendByte:index. |
|
2237 |
||
2238 |
] ifFalse:[ |
|
2239 |
"/ self halt:'internal error' |
|
475 | 2240 |
|
512 | 2241 |
]]]]]]]]]]]]]]]] |
2242 |
]. |
|
2243 |
||
2244 |
stackDepth := stackDepth + stackDelta. |
|
2245 |
(stackDepth > maxStackDepth) ifTrue:[ |
|
2246 |
maxStackDepth := stackDepth |
|
2247 |
] |
|
2248 |
]. |
|
2249 |
relocInfo at:symIndex put:codeIndex. |
|
2250 |
||
2251 |
needRetry ifFalse:[ |
|
2252 |
" |
|
2253 |
now relocate - returns true if ok, false if we have to do it again |
|
2254 |
(when short jumps have been changed to long jumps) |
|
2255 |
" |
|
2256 |
relocList notNil ifTrue:[ |
|
2257 |
needRetry := (self relocateWith:symbolicCodeArray relocInfo:relocInfo) not. |
|
2258 |
" |
|
2259 |
if returned with false, a relative jump was made into |
|
2260 |
an absolute jump - need to start over with one more byte space |
|
2261 |
" |
|
2262 |
needRetry ifTrue:[ |
|
2263 |
relocList := nil. |
|
2264 |
codeSize := codeSize + 1. |
|
2265 |
] |
|
2266 |
] |
|
2267 |
] ifTrue:[ |
|
2268 |
'Compiler [info]: compiling again ...' infoPrintCR. |
|
2269 |
] |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2270 |
]. |
141 | 2271 |
"code printNL." |
2272 |
^ errorFlag |
|
2273 |
||
2274 |
"Modified: 3.9.1995 / 12:59:43 / claus" |
|
475 | 2275 |
"Modified: 10.1.1997 / 15:17:51 / cg" |
141 | 2276 |
! |
2277 |
||
2278 |
genSymbolicCode |
|
2279 |
"traverse the parse-tree producing symbolicCode - return the codeArray" |
|
2280 |
||
2281 |
|codeStream code thisStatement lastStatement| |
|
2282 |
||
2283 |
litArray := nil. |
|
2284 |
codeStream := WriteStream on:(OrderedCollection new:100). |
|
2285 |
||
2286 |
thisStatement := tree. |
|
2287 |
[thisStatement notNil] whileTrue:[ |
|
512 | 2288 |
lastStatement := thisStatement. |
2289 |
thisStatement codeForSideEffectOn:codeStream inBlock:nil for:self. |
|
2290 |
thisStatement := thisStatement nextStatement |
|
141 | 2291 |
]. |
2292 |
(lastStatement isNil or:[lastStatement isReturnNode not]) |
|
2293 |
ifTrue:[ |
|
512 | 2294 |
"not a return - add retSelf" |
2295 |
" |
|
2296 |
if the last statement was a send for side-effect, |
|
2297 |
replace the previous drop by a retSelf. |
|
2298 |
In this case we have to keep an extra retSelf bacause |
|
2299 |
it could be a jump target. |
|
2300 |
" |
|
2301 |
(lastStatement notNil |
|
2302 |
and:[(code := codeStream contents) notNil |
|
2303 |
and:[code size > 0 |
|
2304 |
and:[code last == #drop]]]) ifTrue:[ |
|
2305 |
codeStream backStep. |
|
2306 |
codeStream nextPut:#retSelf |
|
2307 |
]. |
|
2308 |
codeStream nextPut:#retSelf |
|
141 | 2309 |
]. |
2310 |
^ codeStream contents |
|
328 | 2311 |
|
330
9b9a1ff67ba3
Bad change in previous version. Need extra bytecode as jump target.
Stefan Vogel <sv@exept.de>
parents:
328
diff
changeset
|
2312 |
"Modified: 15.8.1996 / 17:35:02 / stefan" |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2313 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2314 |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2315 |
hasLineNumber:sel |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2316 |
"return true, if special send code needs lineNr" |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2317 |
|
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2318 |
(sel == #==) ifTrue:[^ false]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2319 |
(sel == #~~) ifTrue:[^ false]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2320 |
(sel == #class) ifTrue:[^ false]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2321 |
(sel == #isNil) ifTrue:[^ false]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2322 |
(sel == #notNil) ifTrue:[^ false]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2323 |
^ true |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2324 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2325 |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2326 |
isBuiltIn1ArgSelector:sel forReceiver:receiver |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2327 |
"return true, if selector sel is built-in. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2328 |
(i.e. there is a single bytecode for it)" |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2329 |
|
530 | 2330 |
(sel == #at:) ifTrue:[^ true]. |
2331 |
(sel == #value:) ifTrue:[^ true]. |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2332 |
(sel == #bitAnd:) ifTrue:[^ true]. |
530 | 2333 |
(sel == #bitOr:) ifTrue:[^ true]. |
2334 |
(sel == #new:) ifTrue:[^ true]. |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2335 |
(sel == #basicNew:) ifTrue:[ |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2336 |
"/ this one is critical - some redefine it |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2337 |
receiver isGlobal ifTrue:[ |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2338 |
(#('String' 'ByteArray' 'Array' |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2339 |
'Point' 'Rectangle' 'Object') |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2340 |
includes:receiver name) ifTrue:[^ true]. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2341 |
]. |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2342 |
]. |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2343 |
^ false |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2344 |
|
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2345 |
"Created: 17.4.1996 / 22:33:13 / cg" |
530 | 2346 |
"Modified: 4.6.1997 / 12:24:18 / cg" |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2347 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2348 |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2349 |
isBuiltIn2ArgSelector:sel forReceiver:receiver |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2350 |
"return true, if selector sel is built-in. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2351 |
(i.e. there is a single bytecode for it)" |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2352 |
|
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2353 |
(sel == #at:put:) ifTrue:[^ true]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2354 |
^ false |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2355 |
|
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2356 |
"Created: 17.4.1996 / 22:33:16 / cg" |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2357 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2358 |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2359 |
isBuiltInBinarySelector:sel forReceiver:receiver |
530 | 2360 |
"return true, if binary selector sel is built-in. |
2361 |
(i.e. there is a single bytecode for it)" |
|
2362 |
||
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2363 |
sel == #== ifTrue:[^ true]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2364 |
sel == #~~ ifTrue:[^ true]. |
530 | 2365 |
sel == #= ifTrue:[^ true]. |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2366 |
sel == #~= ifTrue:[^ true]. |
530 | 2367 |
sel == #+ ifTrue:[^ true]. |
2368 |
sel == #- ifTrue:[^ true]. |
|
2369 |
sel == #< ifTrue:[^ true]. |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2370 |
sel == #<= ifTrue:[^ true]. |
530 | 2371 |
sel == #> ifTrue:[^ true]. |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2372 |
sel == #>= ifTrue:[^ true]. |
530 | 2373 |
sel == #* ifTrue:[^ true]. |
2374 |
sel == #& ifTrue:[^ true]. |
|
2375 |
sel == #| ifTrue:[^ true]. |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2376 |
^ false |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2377 |
|
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2378 |
"Created: 17.4.1996 / 22:34:27 / cg" |
530 | 2379 |
"Modified: 4.6.1997 / 12:24:00 / cg" |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2380 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2381 |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2382 |
isBuiltInUnarySelector:sel forReceiver:receiver |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2383 |
"return true, if unary selector sel is built-in. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2384 |
(i.e. there is a single bytecode for it)" |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2385 |
|
530 | 2386 |
(sel == #value) ifTrue:[^ true]. |
2387 |
(sel == #class) ifTrue:[^ true]. |
|
2388 |
(sel == #size) ifTrue:[^ true]. |
|
2389 |
(sel == #isNil) ifTrue:[^ true]. |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2390 |
(sel == #notNil) ifTrue:[^ true]. |
530 | 2391 |
(sel == #not) ifTrue:[^ true]. |
2392 |
||
2393 |
(sel == #new) ifTrue:[^ true]. |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2394 |
(sel == #basicNew) ifTrue:[ |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2395 |
"/ this one is critical - some redefine it |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2396 |
receiver isGlobal ifTrue:[ |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2397 |
(#('String' 'ByteArray' 'Array' |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2398 |
'Point' 'Rectangle' 'Object') |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2399 |
includes:receiver name) ifTrue:[^ true]. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2400 |
]. |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2401 |
]. |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2402 |
^ false |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2403 |
|
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2404 |
"Created: 17.4.1996 / 22:32:16 / cg" |
530 | 2405 |
"Modified: 4.6.1997 / 12:23:30 / cg" |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2406 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2407 |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2408 |
moveGlobalsToFront |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2409 |
"move all global-literals to the front of the literal array. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2410 |
This may be the last chance to compile the method, since |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2411 |
for globals, the maximum literal index is 255 - while for normal |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2412 |
literals its a stress-less 65535" |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2413 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2414 |
litArray isNil ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2415 |
^ self error:'oops compiler botch'. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2416 |
]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2417 |
litArray sort:[:a :b | "a < b -> #(a b)" |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2418 |
(a isMemberOf:Symbol) ifFalse:[false] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2419 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2420 |
(b isMemberOf:Symbol) ifFalse:[true] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2421 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2422 |
(a at:1) isUppercase ifFalse:[false] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2423 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2424 |
(b at:1) isUppercase ifFalse:[true] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2425 |
ifTrue:[a < b]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2426 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2427 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2428 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2429 |
]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2430 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2431 |
" |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2432 |
#(#A #c #B #D #E #a #b #F) |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2433 |
sort:[:a :b | |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2434 |
(a isMemberOf:Symbol) ifFalse:[false] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2435 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2436 |
(b isMemberOf:Symbol) ifFalse:[true] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2437 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2438 |
(a at:1) isUppercase ifFalse:[false] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2439 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2440 |
(b at:1) isUppercase ifFalse:[true] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2441 |
ifTrue:[(a < b)]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2442 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2443 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2444 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2445 |
]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2446 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2447 |
" |
141 | 2448 |
! |
2449 |
||
2450 |
relocateWith:symbolicCodeArray relocInfo:relocInfo |
|
2451 |
"helper for genByteCodeFrom - relocate code using relocInfo. |
|
2452 |
if relocation fails badly (due to long relative jumps) patch |
|
2453 |
symbolicCode to use absolute jumps instead and return false |
|
2454 |
(genByteCodeFrom will then try again). Otherwise return true. |
|
2455 |
Also, on the fly, jumps to jumps and jumps to return are handled." |
|
2456 |
||
2457 |
|delta "{Class: SmallInteger }" |
|
2458 |
codePos "{Class: SmallInteger }" |
|
2459 |
opCodePos "{Class: SmallInteger }" |
|
2460 |
codeOffset "{Class: SmallInteger }" |
|
2461 |
symOffset |
|
2462 |
opcode "{Class: SmallInteger }" |
|
2463 |
dstOpcode jumpTarget |
|
2464 |
jumpCode deleteSet| |
|
2465 |
||
2466 |
deleteSet := OrderedCollection new. |
|
2467 |
relocList do:[:sIndex | |
|
2468 |
"have to relocate symCode at sIndex ..." |
|
2469 |
symOffset := symbolicCodeArray at:sIndex. "the target in the symbolic code" |
|
2470 |
codePos := relocInfo at:sIndex. "position of the offet in byte code" |
|
2471 |
codeOffset := relocInfo at:symOffset. "position of the target in byte code" |
|
2472 |
delta := codeOffset - codePos - 1. |
|
2473 |
opCodePos := codePos - 1. |
|
2474 |
opcode := codeBytes at:opCodePos. |
|
2475 |
||
2476 |
(opcode between:190 and:199) ifTrue:[ |
|
2477 |
"an absolute jump/makeBlock" |
|
2478 |
||
2479 |
codeBytes at:codePos put:(codeOffset bitAnd:16rFF). |
|
2480 |
codeBytes at:(codePos + 1) put:(codeOffset bitShift:-8) |
|
2481 |
] ifFalse:[ |
|
2482 |
"get jump-code from long and vlong codes" |
|
2483 |
(opcode between:50 and:59) ifFalse:[ |
|
2484 |
(opcode between:60 and:69) ifTrue:[ |
|
2485 |
opcode := opcode - 10 |
|
2486 |
] ifFalse:[ |
|
2487 |
(opcode between:70 and:79) ifTrue:[ |
|
2488 |
opcode := opcode - 20 |
|
2489 |
] ifFalse:[ |
|
2490 |
self error:'invalid code to relocate' |
|
2491 |
] |
|
2492 |
]. |
|
2493 |
]. |
|
2494 |
||
2495 |
"optimize jump to return and jump to jump" |
|
2496 |
||
2497 |
(opcode == 54) ifTrue:[ |
|
2498 |
"a jump" |
|
2499 |
dstOpcode := symbolicCodeArray at:symOffset. |
|
2500 |
||
2501 |
(#(retSelf retTop retNil retTrue retFalse ret0 "blockRetTop") includes:dstOpcode) ifTrue:[ |
|
2502 |
"a jump to a return - put in the return instead jump" |
|
2503 |
||
2504 |
symbolicCodeArray at:(sIndex - 1) put:dstOpcode. |
|
2505 |
symbolicCodeArray at:sIndex put:dstOpcode. |
|
2506 |
codeBytes at:opCodePos put:(self byteCodeFor:dstOpcode). |
|
2507 |
delta := 0. |
|
2508 |
deleteSet add:sIndex. |
|
2509 |
||
2510 |
" |
|
2511 |
'jump to return at: ' print. (sIndex - 1) printNL. |
|
2512 |
" |
|
2513 |
] ifFalse:[ |
|
2514 |
(dstOpcode == #jump) ifTrue:[ |
|
2515 |
"jump to jump to be done soon" |
|
2516 |
jumpTarget := symbolicCodeArray at:(symOffset + 1). |
|
2517 |
" |
|
2518 |
'jump to jump at: ' print. (sIndex - 1) print. |
|
2519 |
' newTarget:' print. jumpTarget printNL. |
|
2520 |
" |
|
2521 |
||
2522 |
symbolicCodeArray at:sIndex put:jumpTarget. |
|
2523 |
symOffset := jumpTarget. |
|
2524 |
codeOffset := relocInfo at:symOffset. |
|
2525 |
delta := codeOffset - codePos - 1. |
|
2526 |
||
2527 |
"continue with new delta" |
|
2528 |
] |
|
2529 |
] |
|
2530 |
]. |
|
2531 |
(#(50 51 52 53 56 57 58 59) includes:opcode) ifTrue:[ |
|
2532 |
"a conditional jump" |
|
2533 |
||
2534 |
dstOpcode := symbolicCodeArray at:symOffset. |
|
2535 |
(dstOpcode == #jump) ifTrue:[ |
|
2536 |
"conditional jump to unconditional jump" |
|
2537 |
jumpTarget := symbolicCodeArray at:(symOffset + 1). |
|
2538 |
" |
|
2539 |
'cond jump to jump at: ' print. (sIndex - 1) print. |
|
2540 |
' newTarget:' print. jumpTarget printNL. |
|
2541 |
" |
|
2542 |
||
2543 |
symbolicCodeArray at:sIndex put:jumpTarget. |
|
2544 |
symOffset := jumpTarget. |
|
2545 |
codeOffset := relocInfo at:symOffset. |
|
2546 |
delta := codeOffset - codePos - 1. |
|
2547 |
||
2548 |
"continue with new delta" |
|
2549 |
]. |
|
2550 |
]. |
|
2551 |
||
2552 |
(delta >= 0) ifTrue:[ |
|
2553 |
(delta > 127) ifTrue:[ |
|
2554 |
(opcode between:50 and:59) ifFalse:[ |
|
2555 |
self error:'invalid code to relocate' |
|
2556 |
] ifTrue:[ |
|
2557 |
(delta > 255) ifTrue:[ |
|
2558 |
"change jmp into vljmp ..." |
|
2559 |
codeBytes at:opCodePos put:(opcode + 20). |
|
2560 |
delta := delta - 256 |
|
2561 |
] ifFalse:[ |
|
2562 |
"change jmp into ljmp ..." |
|
2563 |
codeBytes at:opCodePos put:(opcode + 10). |
|
2564 |
delta := delta - 128 |
|
2565 |
]. |
|
2566 |
(delta > 127) ifTrue:[ |
|
2567 |
"change symbolic into a jump absolute and fail" |
|
2568 |
jumpCode := symbolicCodeArray at:(sIndex - 1). |
|
2569 |
symbolicCodeArray at:(sIndex - 1) put:(self absJumpFromJump:jumpCode). |
|
2570 |
symbolicCodeArray at:sIndex put:symOffset. |
|
2571 |
" |
|
2572 |
'change short into abs jump' printNL. |
|
2573 |
" |
|
2574 |
deleteSet do:[:d | relocList remove:d]. |
|
2575 |
^ false |
|
2576 |
] |
|
2577 |
]. |
|
2578 |
]. |
|
2579 |
codeBytes at:codePos put:delta |
|
2580 |
] ifFalse:[ |
|
2581 |
(delta < -128) ifTrue:[ |
|
2582 |
(opcode between:50 and:59) ifFalse:[ |
|
2583 |
self error:'invalid code to relocate' |
|
2584 |
] ifTrue:[ |
|
2585 |
(delta < -256) ifTrue:[ |
|
2586 |
"change jmp into vljmp ..." |
|
2587 |
codeBytes at:opCodePos put:(opcode + 20). |
|
2588 |
delta := delta + 256 |
|
2589 |
] ifFalse:[ |
|
2590 |
"change jmp into ljmp ..." |
|
2591 |
codeBytes at:opCodePos put:(opcode + 10). |
|
2592 |
delta := delta + 128 |
|
2593 |
]. |
|
2594 |
(delta < -128) ifTrue:[ |
|
2595 |
"change symbolic into a jump absolute and fail" |
|
2596 |
jumpCode := symbolicCodeArray at:(sIndex - 1). |
|
2597 |
symbolicCodeArray at:(sIndex - 1) put:(self absJumpFromJump:jumpCode). |
|
2598 |
symbolicCodeArray at:sIndex put:symOffset. |
|
2599 |
" |
|
2600 |
'change short into abs jump' printNL. |
|
2601 |
" |
|
2602 |
deleteSet do:[:d | relocList remove:d]. |
|
2603 |
^ false |
|
2604 |
] |
|
2605 |
] |
|
2606 |
]. |
|
2607 |
codeBytes at:codePos put:(256 + delta) |
|
2608 |
] |
|
2609 |
] |
|
2610 |
]. |
|
2611 |
(errorFlag == #Error) ifTrue:[ |
|
2612 |
self error:'relocation range error' |
|
2613 |
]. |
|
2614 |
^ true |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2615 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2616 |
|
247 | 2617 |
specialGlobalCodeFor:aSymbol |
530 | 2618 |
"codeExtension for globals, |
2619 |
which can be accessed by specialGlobal opCode" |
|
2620 |
||
2621 |
|idx| |
|
2622 |
||
2623 |
idx := self specialGlobals identityIndexOf:aSymbol ifAbsent:nil. |
|
2624 |
idx isNil ifTrue:[^ idx]. |
|
2625 |
^ idx - 1. |
|
2626 |
||
2627 |
"Modified: 4.6.1997 / 12:31:22 / cg" |
|
2628 |
! |
|
2629 |
||
2630 |
specialGlobals |
|
2631 |
"list of globals which can be accessed by specialGlobal opCode; |
|
2632 |
adding any here requires a new VM (i.e. you cannot change it)" |
|
2633 |
||
2634 |
^ #( |
|
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2635 |
#Array "/ 0 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2636 |
#String "/ 1 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2637 |
#FloatArray "/ 2 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2638 |
#DoubleArray "/ 3 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2639 |
#Point "/ 4 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2640 |
#Symbol "/ 5 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2641 |
#Smalltalk "/ 6 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2642 |
#Processor "/ 7 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2643 |
#SmallInteger "/ 8 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2644 |
#Character "/ 9 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2645 |
#Float "/ 10 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2646 |
#Process "/ 11 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2647 |
#Set "/ 12 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2648 |
#IdentitySet "/ 13 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2649 |
#Dictionary "/ 14 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2650 |
#IdentityDictionary "/ 15 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2651 |
#Sempahore "/ 16 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2652 |
#OrderedCollection "/ 17 |
530 | 2653 |
) |
2654 |
||
2655 |
"Created: 4.6.1997 / 12:17:47 / cg" |
|
2656 |
"Modified: 4.6.1997 / 12:31:35 / cg" |
|
247 | 2657 |
! |
2658 |
||
400
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
2659 |
specialSendCodeFor:sel |
530 | 2660 |
"return the codeExtension for sends, |
2661 |
which can be performed by specialSend opCode" |
|
2662 |
||
2663 |
|idx| |
|
2664 |
||
2665 |
idx := self specialSends identityIndexOf:sel ifAbsent:nil. |
|
2666 |
idx isNil ifTrue:[^ idx]. |
|
2667 |
^ idx - 1. |
|
2668 |
||
2669 |
"Modified: 4.6.1997 / 12:31:08 / cg" |
|
2670 |
! |
|
2671 |
||
2672 |
specialSends |
|
2673 |
"list of selectors which can be sent by specialSend opCode; |
|
2674 |
adding any here requires a new VM (i.e. you cannot change it)" |
|
2675 |
||
2676 |
^ #( |
|
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2677 |
#top "/ 0 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2678 |
#bottom "/ 1 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2679 |
#left "/ 2 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2680 |
#right "/ 3 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2681 |
#x "/ 4 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2682 |
#y "/ 5 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2683 |
#width "/ 6 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2684 |
#height "/ 7 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2685 |
#origin "/ 8 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2686 |
#extent "/ 9 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2687 |
#asInteger "/ 10 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2688 |
#rounded "/ 11 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2689 |
#next "/ 12 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2690 |
#peek "/ 13 |
530 | 2691 |
) |
2692 |
||
2693 |
"Created: 4.6.1997 / 12:20:28 / cg" |
|
2694 |
"Modified: 4.6.1997 / 12:31:56 / cg" |
|
0 | 2695 |
! ! |
49 | 2696 |
|
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2697 |
!ByteCodeCompiler methodsFor:'code generation helpers'! |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2698 |
|
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2699 |
addTempVar |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2700 |
"add a temporary variable; return its position (1-based). |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2701 |
Used when a block with args/locals is inlined." |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2702 |
|
558
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
2703 |
numTemp isNil ifTrue:[numTemp := maxNumTemp := 0]. |
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
2704 |
numTemp := numTemp + 1. |
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
2705 |
maxNumTemp := maxNumTemp max:numTemp. |
560
9311c79529d4
inline blocks withs args/vars
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
2706 |
^ numTemp + methodVars size |
9311c79529d4
inline blocks withs args/vars
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
2707 |
|
9311c79529d4
inline blocks withs args/vars
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
2708 |
"Modified: 26.6.1997 / 10:22:23 / cg" |
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2709 |
! |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2710 |
|
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2711 |
removeTempVar |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2712 |
"remove a temporary variable" |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2713 |
|
558
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
2714 |
numTemp := numTemp - 1 |
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2715 |
|
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2716 |
"Created: 25.6.1997 / 14:03:00 / cg" |
558
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
2717 |
"Modified: 25.6.1997 / 15:06:10 / cg" |
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2718 |
! ! |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2719 |
|
49 | 2720 |
!ByteCodeCompiler methodsFor:'machine code generation'! |
2721 |
||
2722 |
compileToMachineCode:aString forClass:aClass inCategory:cat |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2723 |
notifying:requestor install:install skipIfSame:skipIfSame silent:silent |
49 | 2724 |
"this is called to compile primitive code. |
2725 |
This is EXPERIMENTAL and going to be changed to raise an error, |
|
2726 |
an redefined in subclasses which can do it (either by direct compilation, or by calling |
|
2727 |
the external stc do do it. |
|
2728 |
For a description of the arguments, see compile:forClass....." |
|
2729 |
||
721
b98c67a8f4e8
must add cpuDefine to cflags.
Claus Gittinger <cg@exept.de>
parents:
704
diff
changeset
|
2730 |
|stFileName stream handle address stcFlags cFlags def |
429 | 2731 |
command oFileName cFileName |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
2732 |
initName newMethod ok status className sep class stcPath ccPath |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2733 |
errorStream errorMessages eMsg m supers mP moduleFileName |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2734 |
dummyHandle f mapFileName libFileName| |
301
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
2735 |
|
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
2736 |
(mP := STCModulePath asFilename) exists ifFalse:[ |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
2737 |
mP makeDirectory |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
2738 |
]. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2739 |
(mP isDirectory and:[mP isReadable and:[mP isWritable]]) ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2740 |
self parseError:('no access to tempDir: ' , mP pathName) position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2741 |
^ #CannotLoad |
301
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
2742 |
]. |
96 | 2743 |
|
172
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
2744 |
ObjectFileLoader isNil ifTrue:[^ #CannotLoad]. |
85ad12831217
give user a chance to choose between trapCode and original code if compilation to binary is not possible
Claus Gittinger <cg@exept.de>
parents:
162
diff
changeset
|
2745 |
STCCompilation == #never ifTrue:[^ #CannotLoad]. |
120 | 2746 |
(stcPath := self class incrementalStcPath) isNil ifTrue:[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2747 |
self parseError:'no stc compiler available - cannot create machine code' position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2748 |
^ #CannotLoad |
120 | 2749 |
]. |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
2750 |
(ccPath := self class ccPath) isNil ifTrue:[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2751 |
self parseError:'no cc compiler available - cannot create machine code' position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2752 |
^ #CannotLoad |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2753 |
]. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2754 |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2755 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2756 |
self parseError:'no dynamic loader configured - cannot create machine code' position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2757 |
^ #CannotLoad |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
2758 |
]. |
54 | 2759 |
|
298
118648c3b590
include the processID in the dynamic modules name;
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
2760 |
"/ generate a unique name, consisting of my processID and a sequence number |
118648c3b590
include the processID in the dynamic modules name;
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
2761 |
"/ the processId is added to allow filein of modules from different |
118648c3b590
include the processID in the dynamic modules name;
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
2762 |
"/ lifes |
118648c3b590
include the processID in the dynamic modules name;
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
2763 |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2764 |
SequenceNumber isNil ifTrue:[SequenceNumber := 0]. |
54 | 2765 |
SequenceNumber := SequenceNumber + 1. |
49 | 2766 |
|
298
118648c3b590
include the processID in the dynamic modules name;
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
2767 |
initName := 'm_' , OperatingSystem getProcessId printString, '_' , SequenceNumber printString. |
118648c3b590
include the processID in the dynamic modules name;
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
2768 |
|
751 | 2769 |
stFileName := (Filename currentDirectory construct:(initName , '.st')) name. |
54 | 2770 |
stream := stFileName asFilename writeStream. |
187 | 2771 |
stream isNil ifTrue:[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2772 |
self parseError:'cannot create temporary sourcefile for compilation'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2773 |
^ #CannotLoad |
187 | 2774 |
]. |
49 | 2775 |
|
407 | 2776 |
[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2777 |
|definedClasses| |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2778 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2779 |
definedClasses := IdentitySet new. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2780 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2781 |
sep := stream class chunkSeparator. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2782 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2783 |
class := aClass. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2784 |
class isMeta ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2785 |
class := aClass soleInstance |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2786 |
]. |
792
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2787 |
|
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2788 |
Class fileOutNameSpaceQuerySignal answer:true |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2789 |
do:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2790 |
supers := class allSuperclasses. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2791 |
supers notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2792 |
supers reverseDo:[:cls| |
792
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2793 |
true "cls ~~ Object" ifTrue:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2794 |
cls isLoaded ifFalse:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2795 |
stream close. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2796 |
^ #CannotLoad |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2797 |
]. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2798 |
cls fileOutDefinitionOn:stream. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2799 |
stream nextPut:sep; cr. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2800 |
definedClasses add:cls. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2801 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2802 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2803 |
]. |
792
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2804 |
class fileOutDefinitionOn:stream. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2805 |
stream nextPut:sep; cr. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2806 |
definedClasses add:class. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2807 |
|
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2808 |
class privateClassesSorted do:[:aPrivateClass | |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2809 |
supers := aPrivateClass allSuperclasses. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2810 |
supers notNil ifTrue:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2811 |
supers reverseDo:[:cls| |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2812 |
(definedClasses includes:cls) ifFalse:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2813 |
true "cls ~~ Object" ifTrue:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2814 |
cls isLoaded ifFalse:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2815 |
stream close. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2816 |
^ #CannotLoad |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2817 |
]. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2818 |
cls fileOutDefinitionOn:stream. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2819 |
stream nextPut:sep; cr. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2820 |
definedClasses add:cls. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2821 |
] |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2822 |
] |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2823 |
] |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2824 |
]. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2825 |
(definedClasses includes:aPrivateClass) ifFalse:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2826 |
aPrivateClass fileOutDefinitionOn:stream. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2827 |
stream nextPut:sep; cr. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2828 |
definedClasses add:aPrivateClass. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2829 |
] |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2830 |
]. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2831 |
|
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
2832 |
class fileOutPrimitiveDefinitionsOn:stream. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2833 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2834 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2835 |
stream nextPut:sep. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2836 |
className := class name. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2837 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2838 |
stream nextPutAll:className. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2839 |
aClass isMeta ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2840 |
stream nextPutAll:' class'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2841 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2842 |
stream nextPutAll:' methodsFor:'''; nextPutAll:cat; nextPutAll:''''. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2843 |
stream nextPut:sep; cr. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2844 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2845 |
stream nextPutLine:'"{ Line: 0 }"'; |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2846 |
nextChunkPut:aString; |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2847 |
space; nextPut:sep. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2848 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2849 |
stream close. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2850 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2851 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2852 |
call stc to compile it |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2853 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2854 |
oFileName := stFileName asFilename withoutSuffix name , (ObjectFileLoader objectFileExtension). |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2855 |
cFileName := (stFileName asFilename withSuffix:'c') name. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2856 |
mapFileName := (stFileName asFilename withSuffix:'map') name. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2857 |
libFileName := (stFileName asFilename withSuffix:'lib') name. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2858 |
oFileName asFilename delete. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2859 |
cFileName asFilename delete. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2860 |
|
781
7de50bbbf651
no need to set stcFlags to -commonSymbols and +sharedLibCode
Claus Gittinger <cg@exept.de>
parents:
773
diff
changeset
|
2861 |
"/ stcFlags := '-commonSymbols +sharedLibCode +newIncremental -E:errorOutput -N' , initName . |
7de50bbbf651
no need to set stcFlags to -commonSymbols and +sharedLibCode
Claus Gittinger <cg@exept.de>
parents:
773
diff
changeset
|
2862 |
stcFlags := '+newIncremental -E:errorOutput -N' , initName . |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2863 |
cFlags := OperatingSystem getOSDefine. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2864 |
cFlags isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2865 |
cFlags := '' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2866 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2867 |
(def := OperatingSystem getCPUDefine) notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2868 |
cFlags := cFlags , ' ' , def |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2869 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2870 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2871 |
STCCompilationDefines notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2872 |
cFlags := cFlags , ' ' , STCCompilationDefines |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2873 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2874 |
STCCompilationIncludes notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2875 |
stcFlags := STCCompilationIncludes , ' ' , stcFlags. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2876 |
cFlags := cFlags , ' ' , STCCompilationIncludes. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2877 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2878 |
STCCompilationOptions notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2879 |
stcFlags := STCCompilationOptions , ' ' , stcFlags |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2880 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2881 |
CCCompilationOptions notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2882 |
cFlags := cFlags , ' ' , CCCompilationOptions |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2883 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2884 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2885 |
command := stcPath , ' ' , stcFlags , ' -C ' , stFileName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2886 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2887 |
Verbose == true ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2888 |
'executing: ' infoPrint. command infoPrintCR. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2889 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2890 |
errorStream := 'errorOutput' asFilename writeStream. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2891 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2892 |
self activityNotification:'compiling (stc)'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2893 |
ok := OperatingSystem |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2894 |
executeCommand:command |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2895 |
inputFrom:nil |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2896 |
outputTo:errorStream |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2897 |
errorTo:errorStream |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2898 |
onError:[:stat| |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2899 |
status := stat. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2900 |
false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2901 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2902 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2903 |
cFileName asFilename exists ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2904 |
ok ifFalse:[ |
810 | 2905 |
'Compiler [info]: oops - system says stc failed - but c-file is there ...' infoPrintCR. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2906 |
ok := true |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2907 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2908 |
] ifFalse:[ |
810 | 2909 |
ok ifTrue:[ |
2910 |
'Compiler [info]: oops - system says stc ok - but no c-file is there ...' infoPrintCR. |
|
2911 |
]. |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2912 |
ok := false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2913 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2914 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2915 |
ok ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2916 |
"/ now compile to machine code |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2917 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2918 |
command := ccPath , ' ' , cFlags , ' -c ' , cFileName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2919 |
Verbose == true ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2920 |
'executing: ' infoPrint. command infoPrintCR. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2921 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2922 |
self activityNotification:'compiling (' , ccPath , ')'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2923 |
ok := OperatingSystem |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2924 |
executeCommand:command |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2925 |
inputFrom:nil |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2926 |
outputTo:errorStream |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2927 |
errorTo:errorStream |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2928 |
onError:[:stat| |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2929 |
status := stat. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2930 |
false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2931 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2932 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2933 |
oFileName asFilename exists ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2934 |
ok ifFalse:[ |
810 | 2935 |
'Compiler [info]: system says compile failed - but o-file is there ...' infoPrintCR. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2936 |
ok := true |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2937 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2938 |
] ifFalse:[ |
810 | 2939 |
ok ifTrue:[ |
2940 |
'Compiler [info]: system says compile ok - but no o-file is there ...' infoPrintCR. |
|
2941 |
]. |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2942 |
ok := false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2943 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2944 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2945 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2946 |
ok ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2947 |
(status notNil and:[status couldNotExecute]) ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2948 |
eMsg := 'oops, no STC - cannot create machine code' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2949 |
] ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2950 |
errorStream := 'errorOutput' asFilename readStream. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2951 |
errorStream notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2952 |
errorMessages := errorStream contents. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2953 |
errorStream close. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2954 |
errorMessages notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2955 |
errorMessages := errorMessages asStringCollection. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2956 |
errorMessages size > 20 ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2957 |
errorMessages := (errorMessages copyTo:20) copyWith:'... more messages skipped' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2958 |
]. |
407 | 2959 |
"/ errorMessages := errorMessages collect:[:line | |
2960 |
"/ (line startsWith:(stFileName , ':')) ifTrue:[ |
|
2961 |
"/ 'Line: ' , (line copyFrom:(stFileName size + 2)) |
|
2962 |
"/ ] ifFalse:[ |
|
2963 |
"/ line |
|
2964 |
"/ ] |
|
2965 |
"/ ]. |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2966 |
errorMessages := errorMessages asString |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2967 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2968 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2969 |
errorMessages isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2970 |
errorMessages := '' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2971 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2972 |
errorMessages isEmpty ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2973 |
eMsg := 'STC / CC error during compilation:\\unspecified error' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2974 |
] ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2975 |
eMsg := 'STC / CC error during compilation:\\',errorMessages |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2976 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2977 |
eMsg := eMsg withCRs |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2978 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2979 |
self activityNotification:'compilation failed'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2980 |
self parseError:eMsg position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2981 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2982 |
self activityNotification:''. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2983 |
^ #Error |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2984 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2985 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2986 |
self activityNotification:''. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2987 |
OperatingSystem removeFile:'errorOutput'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2988 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2989 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2990 |
if required, make a shared or otherwise loadable object file for it |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2991 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2992 |
self activityNotification:'linking'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2993 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2994 |
oFileName := ObjectFileLoader createLoadableObjectFor:initName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2995 |
oFileName isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2996 |
"/ something went wrong |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2997 |
self parseError:(ObjectFileLoader lastError) position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2998 |
^ #CannotLoad |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
2999 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3000 |
oFileName asFilename exists ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3001 |
self parseError:'link failed - cannot create machine code' position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3002 |
^ #CannotLoad |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3003 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3004 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3005 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3006 |
move it into the modules directory |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3007 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3008 |
moduleFileName := (STCModulePath asFilename construct:(initName , '.' , (oFileName asFilename suffix))) name. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3009 |
oFileName asFilename moveTo:moduleFileName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3010 |
(moduleFileName asFilename exists |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3011 |
and:[moduleFileName asFilename isReadable]) ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3012 |
self parseError:'link failed - cannot move shared library module to ''modules'' directory' position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3013 |
^ #CannotLoad |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3014 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3015 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3016 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3017 |
load the objectfile |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3018 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3019 |
self activityNotification:'loading'. |
781
7de50bbbf651
no need to set stcFlags to -commonSymbols and +sharedLibCode
Claus Gittinger <cg@exept.de>
parents:
773
diff
changeset
|
3020 |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3021 |
handle := ObjectFileLoader loadDynamicObject:moduleFileName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3022 |
handle isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3023 |
OperatingSystem removeFile:moduleFileName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3024 |
self parseError:'dynamic load failed - cannot create machine code' position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3025 |
^ #CannotLoad |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3026 |
]. |
407 | 3027 |
"/ ('handle is ' , handle printString) infoPrintCR. |
3028 |
||
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3029 |
"/ try libs to resolve symbols. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3030 |
(ObjectFileLoader hasUndefinedSymbolsIn:handle) ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3031 |
ObjectFileLoader searchedLibraries do:[:libName | |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3032 |
(ObjectFileLoader hasUndefinedSymbolsIn:handle) ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3033 |
Transcript showCR:' ... trying ' , libName , ' to resolve undefined symbols ...'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3034 |
dummyHandle := Array new:4. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3035 |
dummyHandle := ObjectFileLoader primLoadDynamicObject:libName into:dummyHandle. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3036 |
dummyHandle isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3037 |
Transcript showCR:' ... load of library ' , libName , ' failed.'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3038 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3039 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3040 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3041 |
(ObjectFileLoader hasUndefinedSymbolsIn:handle) isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3042 |
Transcript showCR:('LOADER: still undefined symbols in ',initName,'.'). |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3043 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3044 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3045 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3046 |
address := ObjectFileLoader getFunction:'__' , initName , '_Init' from:handle. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3047 |
address isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3048 |
address := ObjectFileLoader getFunction:'_' , initName , '_Init' from:handle. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3049 |
address isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3050 |
address := ObjectFileLoader getFunction:initName , '_Init' from:handle. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3051 |
address isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3052 |
(ObjectFileLoader getListOfUndefinedSymbolsFrom:handle) size > 0 ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3053 |
ObjectFileLoader listUndefinedSymbolsIn:handle. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3054 |
eMsg := 'undefined symbols in primitive code'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3055 |
] ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3056 |
eMsg := initName , '_Init() lookup failed' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3057 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3058 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3059 |
ObjectFileLoader unloadDynamicObject:handle. |
599
9eaffb06df33
#createLoadableObjectFor: has been moved into ObjectFileLoader.
Stefan Vogel <sv@exept.de>
parents:
594
diff
changeset
|
3060 |
|
704 | 3061 |
"/ OperatingSystem getSystemType = 'osf' ifTrue:[ |
3062 |
"/ OperatingSystem executeCommand:('nm -u ' , moduleFileName) |
|
3063 |
"/ ]. |
|
3064 |
||
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3065 |
"/ OperatingSystem removeFile:moduleFileName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3066 |
self parseError:(eMsg , ' - cannot create machine code') position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3067 |
^ #CannotLoad |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3068 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3069 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3070 |
]. |
407 | 3071 |
|
3072 |
"/ ('init at ' , address printString) infoPrintCR. |
|
3073 |
||
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3074 |
m := ObjectFileLoader |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3075 |
callInitFunctionAt:address |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3076 |
specialInit:true |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3077 |
forceOld:true |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3078 |
interruptable:false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3079 |
argument:2 |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3080 |
identifyAs:handle |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3081 |
returnsObject:true. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3082 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3083 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3084 |
did it work ? |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3085 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3086 |
newMethod := aClass compiledMethodAt:selector. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3087 |
newMethod notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3088 |
m ~~ newMethod ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3089 |
'Compiler [warning]: loaded method installed itself in another class' errorPrintCR. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3090 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3091 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3092 |
newMethod source:aString string. |
833
740fd0e90414
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
831
diff
changeset
|
3093 |
newMethod package:(Class packageQuerySignal query). |
415 | 3094 |
"/ Project notNil ifTrue:[ |
3095 |
"/ newMethod package:(Project currentPackageName) |
|
3096 |
"/ ]. |
|
407 | 3097 |
|
3098 |
"/ aClass updateRevisionString. |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3099 |
aClass addChangeRecordForMethod:newMethod. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3100 |
(silent or:[Smalltalk silentLoading == true]) ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3101 |
Transcript showCR:(' compiled: ', className,' ',selector,' - machine code') |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3102 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3103 |
ObjectMemory flushCaches. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3104 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3105 |
handle method:newMethod. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3106 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3107 |
"/ check for obsolete loaded objects and unload them |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3108 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3109 |
ObjectFileLoader loadedObjectHandlesDo:[:anotherHandle | |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3110 |
anotherHandle isMethodHandle ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3111 |
anotherHandle method isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3112 |
ObjectFileLoader unloadObjectFile:anotherHandle pathName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3113 |
OperatingSystem removeFile:anotherHandle pathName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3114 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3115 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3116 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3117 |
^ newMethod. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3118 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3119 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3120 |
OperatingSystem removeFile:moduleFileName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3121 |
self parseError:'dynamic load failed' position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3122 |
^ #CannotLoad |
407 | 3123 |
] valueNowOrOnUnwindDo:[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3124 |
STCKeepSTIntermediate ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3125 |
OperatingSystem removeFile:stFileName. |
792
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3126 |
OperatingSystem removeFile:'errorOutput'. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3127 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3128 |
STCKeepOIntermediate == true ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3129 |
(oFileName notNil and:[oFileName asFilename exists]) ifTrue:[oFileName asFilename delete]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3130 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3131 |
STCKeepCIntermediate == true ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3132 |
(cFileName notNil and:[cFileName asFilename exists]) ifTrue:[cFileName asFilename delete]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3133 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3134 |
OperatingSystem isMSDOSlike ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3135 |
"/ (mapFileName notNil and:[mapFileName asFilename exists]) ifTrue:[mapFileName asFilename delete]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3136 |
"/ (libFileName notNil and:[libFileName asFilename exists]) ifTrue:[libFileName asFilename delete]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3137 |
]. |
407 | 3138 |
]. |
49 | 3139 |
|
3140 |
" |
|
3141 |
|m| |
|
3142 |
||
3143 |
Object subclass:#Test |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3144 |
instanceVariableNames:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3145 |
classVariableNames:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3146 |
poolDictionaries:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3147 |
category:'tests'. |
49 | 3148 |
m := ByteCodeCompiler |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3149 |
compile:'foo ^ ''hello''' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3150 |
forClass:Test |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3151 |
inCategory:'tests' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3152 |
notifying:nil |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3153 |
install:false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3154 |
skipIfSame:false. |
49 | 3155 |
m inspect |
3156 |
" |
|
3157 |
" |
|
3158 |
|m| |
|
3159 |
||
3160 |
Object subclass:#Test |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3161 |
instanceVariableNames:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3162 |
classVariableNames:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3163 |
poolDictionaries:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3164 |
category:'tests'. |
49 | 3165 |
m := ByteCodeCompiler |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3166 |
compileToMachineCode:'foo %{ RETURN (_MKSMALLINT(1)); %}' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3167 |
forClass:Test |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3168 |
inCategory:'tests' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3169 |
notifying:nil |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3170 |
install:false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3171 |
skipIfSame:false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3172 |
silent:false. |
49 | 3173 |
m inspect |
3174 |
" |
|
120 | 3175 |
|
723
188be048b0b2
when generating machine code,
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
3176 |
"Modified: / 14.9.1995 / 22:33:04 / claus" |
810 | 3177 |
"Modified: / 15.2.1999 / 15:53:05 / cg" |
833
740fd0e90414
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
831
diff
changeset
|
3178 |
"Modified: / 19.3.1999 / 08:31:42 / stefan" |
182
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
3179 |
! |
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
3180 |
|
97 | 3181 |
trappingStubMethodFor:aString inCategory:cat |
3182 |
"return a stub method which traps and reports an error whenever |
|
3183 |
called." |
|
3184 |
||
292
163651658aee
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
287
diff
changeset
|
3185 |
|newMethod| |
97 | 3186 |
|
292
163651658aee
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
287
diff
changeset
|
3187 |
newMethod := Method new:(litArray size). |
163651658aee
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
287
diff
changeset
|
3188 |
litArray notNil ifTrue:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
3189 |
newMethod literals:litArray |
97 | 3190 |
]. |
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
3191 |
|
124 | 3192 |
newMethod makeUncompiled. |
594
11ae33ac9b34
finally replaced all sends of #numberOfMethodVars with #numerOfVars
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3193 |
newMethod numberOfVars:(self numberOfMethodVars). |
11ae33ac9b34
finally replaced all sends of #numberOfMethodVars with #numerOfVars
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3194 |
newMethod numberOfArgs:(self numberOfMethodArgs). |
682 | 3195 |
newMethod source:aString string. |
97 | 3196 |
newMethod category:cat. |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
3197 |
newMethod package:(Class packageQuerySignal query). |
415 | 3198 |
"/ Project notNil ifTrue:[ |
3199 |
"/ newMethod package:(Project currentPackageName) |
|
3200 |
"/ ]. |
|
97 | 3201 |
^ newMethod |
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
3202 |
|
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
3203 |
"Modified: / 1.8.1997 / 00:27:32 / cg" |
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
3204 |
"Modified: / 18.3.1999 / 18:12:33 / stefan" |
49 | 3205 |
! ! |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
3206 |
|
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3207 |
!ByteCodeCompiler methodsFor:'queries'! |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3208 |
|
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3209 |
numberOfTempVars |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3210 |
"return the number of additional temporary variables which |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3211 |
were created from inlined blocks (valid after parsing)" |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3212 |
|
558
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
3213 |
^ maxNumTemp ? 0 |
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3214 |
|
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3215 |
"Created: 25.6.1997 / 13:54:29 / cg" |
558
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
3216 |
"Modified: 25.6.1997 / 15:21:34 / cg" |
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3217 |
! ! |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3218 |
|
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
3219 |
!ByteCodeCompiler class methodsFor:'documentation'! |
148 | 3220 |
|
3221 |
version |
|
921 | 3222 |
^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.152 1999-07-19 19:24:49 cg Exp $' |
148 | 3223 |
! ! |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
3224 |
ByteCodeCompiler initialize! |