author | werner |
Wed, 07 Apr 2004 21:22:53 +0200 | |
changeset 1508 | da9642ca353a |
parent 1506 | 57797ad0802c |
child 1549 | dd2913f2fbb3 |
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 |
||
1046 | 13 |
"{ Package: 'stx:libcomp' }" |
14 |
||
0 | 15 |
Parser subclass:#ByteCodeCompiler |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
16 |
instanceVariableNames:'codeBytes codeIndex litArray stackDelta extra lineno extraLiteral |
1094
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
17 |
maxStackDepth relocList methodTempVars numTemp maxNumTemp |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
18 |
methodClass' |
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
|
19 |
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
|
20 |
STCCompilationIncludes STCCompilationOptions STCCompilation |
407 | 21 |
ShareCode STCKeepSTIntermediate STCKeepCIntermediate |
704 | 22 |
STCModulePath CCCompilationOptions CC STC ListCompiledMethods |
1138 | 23 |
STCKeepOIntermediate Verbose NewCodeSet NewPrimitives |
1221
2768cbe3be2b
finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
24 |
AllowExtensionsToPrivateClasses' |
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
|
25 |
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
|
26 |
category:'System-Compiler' |
0 | 27 |
! |
28 |
||
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
29 |
!ByteCodeCompiler class methodsFor:'documentation'! |
3 | 30 |
|
1030 | 31 |
byteCode |
32 |
" |
|
33 |
TOS - top of stack |
|
34 |
NOS - next on stack |
|
35 |
uu - byte-valued unsigned (0..16rFF) |
|
36 |
uuuu - twoByte-valued unsigned (0..16rFFFF); msb-first |
|
37 |
ll - byte-valued literal index (0..16rFF) |
|
38 |
nn - byte-valued signed (-128..+127) |
|
39 |
nnnn - twoByte-valued signed (16r-8000 .. 16r7FFF) |
|
40 |
||
41 |
Notes: |
|
42 |
- bytecode optimized for space, not interpreter speed, |
|
43 |
since JITTER is assumed to be present and compensate for decoding |
|
44 |
overhead. |
|
45 |
- number assignments due to backward compatible extensions of the |
|
46 |
bytecode set - reassignment & cleanup would be nice. |
|
47 |
- codes marked with (*) make the minimal set; all others duplicate |
|
48 |
the functionality of a minimalSet code, but provides dense encoding |
|
49 |
||
50 |
definition of ST/X byteCode: |
|
51 |
||
52 |
* 00 RET_TOP return TOS from current context |
|
53 |
01 RET_NIL return nil from current context |
|
54 |
02 RET_TRUE return true from current context |
|
55 |
03 RET_FALSE return false from current context |
|
56 |
04 RET_0 return 0 (zero) from current context |
|
57 |
05 RET_SELF return the current receiver from current context |
|
58 |
* 06 DUP_OVER push NOS (used with inlined loops) |
|
59 |
* 07 HOME_RET_TOP return TOS from home context (method return from block) |
|
60 |
08 uu LINENO line number information dummy |
|
61 |
* 09 uuuu LINENO16 line number information dummy |
|
62 |
0A PUSH_NIL push nil onto stack |
|
63 |
0B PUSH_TRUE push true onto stack |
|
64 |
0C PUSH_FALSE push false onto stack |
|
65 |
0D SEND_SELF self-send |
|
66 |
* 0E ll PUSH_LIT push a literal |
|
67 |
0F PUSH_SELF push the current receiver onto stack |
|
68 |
10 nn PUSH_NUM push a byte-valued smallInteger onto stack |
|
69 |
11 nnnn PUSH_NUM16 push a twoByte-valued smallInteger onto stack |
|
70 |
* 12 DROP pop & forget |
|
71 |
* 13 SEND send |
|
72 |
* 14 SUPER_SEND super-send (actually: directed send) |
|
73 |
15 SEND0 send 0-arg message |
|
74 |
16 SEND1 send 1-arg message |
|
75 |
17 SEND2 send 2-arg message |
|
76 |
18 SEND3 send 3-arg message |
|
77 |
19 SEND_DROP send & forget result |
|
78 |
1A SEND0_DROP send 0-arg message & forget result |
|
79 |
1B SEND1_DROP send 1-arg message & forget result |
|
80 |
1C SEND2_DROP send 2-arg message & forget result |
|
81 |
1D SEND3_DROP send 3-arg message & forget result |
|
82 |
* 1E PUSH_MARG push method arg |
|
83 |
* 1F PUSH_MVAR push method variable |
|
84 |
* 20 PUSH_BARG push block arg |
|
85 |
* 21 PUSH_BVAR push block variable |
|
86 |
* 22 PUSH_IVAR push instance variable |
|
87 |
23 PUSH_CVAR -- obsolete -- no longer used. |
|
88 |
* 24 PUSH_GLOB push global |
|
89 |
* 25 STORE_MVAR pop and store into method variable |
|
90 |
* 26 STORE_BVAR pop and store into block variable |
|
91 |
* 27 STORE_IVAR pop and store into instance variable |
|
92 |
28 STORE_CVAR -- obsolete -- no longer used. |
|
93 |
* 29 STORE_GLOB pop and store into global |
|
94 |
* 2A PUSH_OBARG push outer block arg (n levels) |
|
95 |
2B PUSH_OBARG1 push outer block arg (1 level) |
|
96 |
2C PUSH_OBARG2 push outer block arg (2 levels) |
|
97 |
2D EQEQ == -> pop a,b; push a==b |
|
98 |
2E NENE ~~ -> pop a,b; push a~~b |
|
99 |
* 2F DUP duplicate TOS |
|
100 |
30 EQEQ0 ==0 -> pop a; push a==0 |
|
101 |
31 NENE0 ~~0 -> pop a; push a~~0 |
|
102 |
||
103 |
32 JMP_FALSE pop; branch if false |
|
104 |
33 JMP_TRUE pop; branch if true |
|
105 |
34 JMP_NIL pop; branch if nil |
|
106 |
35 JMP_NOTNIL pop; branch if not nil |
|
107 |
36 JMP branch always |
|
108 |
37 MAKE_BLOCK make a block |
|
109 |
38 JMP_ZERO pop; branch if ==0 |
|
110 |
39 JMP_NOTZERO pop; branch if ~~0 |
|
111 |
3A JMP_EQEQ pop a,b; branch if a==b |
|
112 |
3B JMP_NENE pop a,b; branch if a~~b |
|
113 |
||
114 |
3C JMPL_FALSE like above, extended branch delta, (add +128/-128 to offs) |
|
115 |
... ... |
|
116 |
45 JMPL_NENE like above, extended branch delta, (add +128/-128 to offs) |
|
117 |
||
118 |
46 JMPVL_FALSE like above, extended branch delta, (add +256/-256 to offs) |
|
119 |
... ... |
|
120 |
4F JMPVL_NENE like above, extended branch delta, (add +256/-256 to offs) |
|
121 |
||
122 |
50 PUSH_MVAR1 push method variable 1 (first variable) |
|
123 |
51 PUSH_MVAR2 push method variable 2 |
|
124 |
52 PUSH_MVAR3 push method variable 3 |
|
125 |
53 PUSH_MVAR4 push method variable 4 |
|
126 |
54 PUSH_MVAR5 push method variable 5 |
|
127 |
55 PUSH_MVAR6 push method variable 6 |
|
128 |
||
129 |
56 PUSH_MARG1 push method arg 1 |
|
130 |
57 PUSH_MARG2 push method arg 2 |
|
131 |
58 PUSH_MARG3 push method arg 3 |
|
132 |
59 PUSH_MARG4 push method arg 4 |
|
133 |
||
134 |
5A PUSH_IVAR1 push inst variable 1 (first variable) |
|
135 |
5B PUSH_IVAR2 push inst variable 2 |
|
136 |
5C PUSH_IVAR3 push inst variable 3 |
|
137 |
5D PUSH_IVAR4 push inst variable 4 |
|
138 |
5E PUSH_IVAR5 push inst variable 5 |
|
139 |
5F PUSH_IVAR6 push inst variable 6 |
|
140 |
60 PUSH_IVAR7 push inst variable 7 |
|
141 |
61 PUSH_IVAR8 push inst variable 8 |
|
142 |
62 PUSH_IVAR9 push inst variable 9 |
|
143 |
63 PUSH_IVAR10 push inst variable 10 |
|
144 |
||
145 |
64 STORE_MVAR1 pop and store into method variable 1 (first variable) |
|
146 |
65 STORE_MVAR2 pop and store into method variable 2 |
|
147 |
66 STORE_MVAR3 pop and store into method variable 3 |
|
148 |
67 STORE_MVAR4 pop and store into method variable 4 |
|
149 |
68 STORE_MVAR5 pop and store into method variable 5 |
|
150 |
69 STORE_MVAR6 pop and store into method variable 6 |
|
151 |
||
152 |
6A unused |
|
153 |
6B unused |
|
154 |
6C unused |
|
155 |
6D unused |
|
156 |
||
157 |
6E STORE_IVAR1 pop and store into inst variable 1 (first variable) |
|
158 |
6F STORE_IVAR2 pop and store into inst variable 2 |
|
159 |
70 STORE_IVAR3 pop and store into inst variable 3 |
|
160 |
71 STORE_IVAR4 pop and store into inst variable 4 |
|
161 |
72 STORE_IVAR5 pop and store into inst variable 5 |
|
162 |
73 STORE_IVAR6 pop and store into inst variable 6 |
|
163 |
74 STORE_IVAR7 pop and store into inst variable 7 |
|
164 |
75 STORE_IVAR8 pop and store into inst variable 8 |
|
165 |
76 STORE_IVAR9 pop and store into inst variable 9 |
|
166 |
77 STORE_IVAR10 pop and store into inst variable 10 |
|
167 |
||
168 |
78 PUSH_0 push smallinteger 0 constant |
|
169 |
79 PUSH_1 push smallinteger 1 constant |
|
170 |
7A PUSH_M1 push smallinteger -1 constant |
|
171 |
||
1031 | 172 |
7B SEND_PLUS1 send '+ 1' to TOS; replace TOS by result |
173 |
7C SEND_MINUS1 send '- 1' to TOS; replace TOS by result |
|
174 |
7D INC_MVAR send '+ 1' to a method variable; store result into same mvar (for inlined loops) |
|
175 |
7E DEC_MVAR send '- 1' to a method variable; store result into same mvar (for inlined loops) |
|
1030 | 176 |
7F nn RET_NUM return a smallInteger from current context |
177 |
* 80 PUSH_OBVAR push outer block variable |
|
178 |
* 81 STORE_OBVAR pop and store into outer block variable |
|
179 |
||
1031 | 180 |
82 SEND_EQ send #= |
181 |
83 SEND_PLUS send #+ |
|
182 |
84 SEND_NE send #~= |
|
183 |
85 SEND_MINUS send #- |
|
184 |
86 SEND_CLASS send #class |
|
185 |
87 SEND_AT send #at: |
|
186 |
88 SEND_ATPUT send #at:put: |
|
187 |
89 SEND_BITAND send #bitAnd: |
|
188 |
8A SEND_BITOR send #bitOr: |
|
189 |
||
190 |
8B PUSH_2 push constant 2 |
|
191 |
||
192 |
8C PUSH_BARG1 push block argument 1 |
|
193 |
8D PUSH_BARG2 |
|
194 |
8E PUSH_BARG3 |
|
195 |
8F PUSH_BARG4 |
|
196 |
||
197 |
* 90 PUSH_CONTEXT push thisContext |
|
198 |
||
199 |
91 SEND_GT send > |
|
200 |
92 SEND_GE send >= |
|
201 |
93 SEND_LT send < |
|
202 |
94 SEND_LE send <= |
|
203 |
||
204 |
95 UNUSED_149 obsolete; was: send #next |
|
205 |
96 UNUSED_150 obsolete; was: send #peek |
|
206 |
97 SEND_VALUE send #value |
|
207 |
98 SEND_VALUE1 send #value: |
|
208 |
99 SEND_SIZE send #size |
|
209 |
9A UNUSED_154 |
|
210 |
9B UNUSED_155 |
|
211 |
||
212 |
9C MK0BLOCK make a 0-returning block |
|
213 |
9D MKNILBLOCK make a nil-returning block |
|
214 |
||
215 |
9E UNUSED_158 obsolete; was: send #asInteger */ |
|
216 |
9F UNUSED_159 obsolete; was: send #rounded */ |
|
217 |
||
218 |
A0 RET_MVAR1 return method variable 1 from current context |
|
219 |
A1 RET_MVAR2 return method variable 2 from current context |
|
220 |
A2 RET_MVAR3 |
|
221 |
A3 RET_MVAR4 |
|
222 |
A4 RET_MVAR5 |
|
223 |
A5 RET_MVAR6 return method variable 6 from current context |
|
224 |
||
225 |
A6 RET_IVAR1 return instance variable 1 from current context |
|
226 |
A7 RET_IVAR2 return instance variable 2 from current context |
|
227 |
A8 RET_IVAR3 |
|
228 |
A9 RET_IVAR4 |
|
229 |
AA RET_IVAR5 |
|
230 |
AB RET_IVAR6 |
|
231 |
AC RET_IVAR7 |
|
232 |
AD RET_IVAR8 return instance variable 8 from current context |
|
233 |
||
234 |
AE RET_MARG1 return method arg 1 from current context |
|
235 |
AF RET_MARG2 return method arg 1 from current context |
|
236 |
||
237 |
B0 PUSH_CIVAR obsolete; push class instance variable |
|
238 |
B1 STORE_CIVAR obsolete; store top of stack in class instance variable |
|
239 |
||
240 |
B2 SEND_VALUE2 send #value:value: |
|
241 |
B3 SEND_NOT send #not |
|
242 |
||
243 |
B4 SEND_SELF0 send a 0-arg message to self |
|
244 |
B5 SEND_SELF1 send a 1-arg message to self |
|
245 |
B6 SEND_SELF2 send a 2-arg message to self |
|
246 |
B7 SEND_SELF3 send a 3-arg message to self |
|
247 |
||
248 |
B8 SEND_SELF_DROP0 send a 0-arg message to self forget result |
|
249 |
B9 SEND_SELF_DROP1 send a 1-arg message to self forget result |
|
250 |
BA SEND_SELF_DROP2 send a 2-arg message to self forget result |
|
251 |
BB SEND_SELF_DROP3 send a 3-arg message to self forget result |
|
252 |
||
253 |
BC ISNIL replace TOS by 'TOS isNil' |
|
254 |
BD NOTNIL replace TOS by 'TOS notNil' |
|
255 |
||
256 |
BE uuuu JMPA_FALSE jumps to absolute offset (2 byte hi-lo) |
|
257 |
BF uuuu JMPA_TRUE |
|
258 |
C0 uuuu JMPA_NIL |
|
259 |
C1 uuuu JMPA_NOTNIL |
|
260 |
C2 uuuu JMPA |
|
261 |
C3 MAKE_ABLOCK |
|
262 |
C4 uuuu JMPA_ZERO |
|
263 |
C5 uuuu JMPA_NOTZERO |
|
264 |
C6 uuuu JMPA_EQ |
|
265 |
C7 uuuu JMPA_NOTEQ |
|
266 |
||
267 |
C8 xx PUSH_GSPECIAL push a special global; xx specifies what: |
|
268 |
00 Array (push 'Smalltalk at:#Array'; i.e. the Array class) |
|
269 |
01 String (push 'Smalltalk at:#String'; i.e. the String class) |
|
270 |
02 FloatArray |
|
271 |
03 DoubleArray |
|
272 |
04 Point |
|
273 |
05 Symbol |
|
274 |
06 Smalltalk |
|
275 |
07 Processor |
|
276 |
08 SmallInteger |
|
277 |
09 Character |
|
278 |
0A Float |
|
279 |
0B Process |
|
280 |
0C Set |
|
281 |
0D IdentitySet |
|
282 |
0E Dictionary |
|
283 |
0F IdentityDictionary |
|
284 |
10 Semaphore |
|
285 |
11 OrderedCollection |
|
286 |
||
287 |
C9 uuuu PUSH_LLIT push a literal (2-byte literal-number) |
|
288 |
||
289 |
CA nn JMP_FALSE_L jump if top is false (+127 .. -128) |
|
290 |
CB nn JMP_TRUE_L jump if top is true |
|
291 |
||
292 |
CC UNUSED_204 |
|
293 |
CD LSEND_MSG send with 16 bit literal index */ |
|
294 |
CE LSUPERSEND_MSG super send with 16 bit literal index */ |
|
295 |
CF LSEND_SELF self-send send with 16 bit literal index */ |
|
296 |
D0 PUSH_GT0 push 'TOS > 0'; leaves original TOS as NOS |
|
297 |
||
298 |
D1 UNUSED_209 |
|
299 |
||
300 |
D2 SEND_ARRAY_NEW use for new/basicNew; top is size (0 for Array new) |
|
301 |
D3 SEND_BASICNEW top is class (receiver) |
|
302 |
D4 SEND_GT0 replace TOS by result of send 'TOS > 0' |
|
303 |
D5 SEND_NEW top is class (receiver) |
|
304 |
D6 SEND_BASICNEWN top is class (receiver) and arg |
|
305 |
D7 SEND_NEWN top is class (receiver) and arg |
|
306 |
D8 SEND_LOGAND send & |
|
307 |
D9 SEND_LOGOR send | |
|
308 |
||
309 |
DA uuuu PUSH_LGLOB push global variable word index literal |
|
310 |
DB uuuu STORE_LGLOB store global with word index literal |
|
311 |
||
312 |
DC UNUSED_220 |
|
313 |
DE UNUSED_221 |
|
314 |
||
315 |
DF PUSH_LIT1 push 1st literal |
|
316 |
E0 PUSH_LIT2 push 2nd literal |
|
317 |
E1 PUSH_LIT3 push literal 3 |
|
318 |
E2 PUSH_LIT4 push literal 4 |
|
319 |
E3 PUSH_LIT5 push literal 5 |
|
320 |
E4 PUSH_LIT6 push literal 6 |
|
321 |
E5 PUSH_LIT7 push literal 7 |
|
322 |
E6 PUSH_LIT8 push literal 8 |
|
323 |
||
324 |
E7 SEND_MUL send #* |
|
325 |
E8 xx SEND_SPECIAL special send; as specified by xx: |
|
326 |
00 top send #top |
|
327 |
01 bottom send #bottom |
|
328 |
02 left send #left |
|
329 |
03 right send #right |
|
330 |
04 x send #x |
|
331 |
05 y send #y |
|
332 |
06 width send #width |
|
333 |
07 height send #height |
|
334 |
08 origin send #origin |
|
335 |
09 extent send #extent |
|
336 |
0A asInteger send #asInteger |
|
337 |
0B rounded send #rounded |
|
338 |
0C next send #next |
|
339 |
0D peek send #peek |
|
340 |
||
341 |
E9 PUSH_BVAR1 push block variable 1 |
|
342 |
EA PUSH_BVAR2 push block variable 2 |
|
343 |
EB PUSH_BVAR3 push block variable 3 |
|
344 |
||
345 |
EC STORE_BVAR1 store TOS in block variable 1 and drop |
|
346 |
ED STORE_BVAR2 store TOS in block variable 2 and drop |
|
347 |
EE STORE_BVAR3 store TOS in block variable 3 and drop |
|
348 |
||
349 |
* EF BLOCK_REF internal - check if a block is referenced by TOS |
|
350 |
||
351 |
F0 PUSH_LVAR push local variable 0..numArgs-1 for args; numArgs..numArgs+nLocal-1 for mVars |
|
352 |
F1 STORE_LVAR store local variable 0..numArgs-1 for args; numArgs..numArgs+nLocal-1 for mVars |
|
353 |
||
354 |
F2 UNUSED_242 |
|
355 |
F3 UNUSED_243 |
|
356 |
F4 UNUSED_244 |
|
357 |
F5 UNUSED_245 |
|
358 |
F6 UNUSED_246 |
|
359 |
F7 UNUSED_247 |
|
360 |
F8 UNUSED_248 |
|
361 |
F9 UNUSED_249 |
|
362 |
FA UNUSED_250 |
|
363 |
FB UNUSED_251 |
|
364 |
FC UNUSED_252 |
|
365 |
FD UNUSED_253 |
|
366 |
FE UNUSED_254 |
|
367 |
FF UNUSED_255 |
|
1030 | 368 |
|
369 |
[author:] |
|
370 |
Claus Gittinger |
|
371 |
||
372 |
" |
|
373 |
! |
|
374 |
||
141 | 375 |
copyright |
376 |
" |
|
377 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
378 |
All Rights Reserved |
|
379 |
||
380 |
This software is furnished under a license and may be used |
|
381 |
only in accordance with the terms of that license and with the |
|
382 |
inclusion of the above copyright notice. This software may not |
|
383 |
be provided or otherwise made available to, or used by, any |
|
384 |
other person. No title to or ownership of the software is |
|
385 |
hereby transferred. |
|
386 |
" |
|
135
aa4f7b8f121e
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
128
diff
changeset
|
387 |
! |
20 | 388 |
|
3 | 389 |
documentation |
390 |
" |
|
19 | 391 |
This class performs compilation into ByteCodes. |
392 |
First, parsing is done using superclass methods, |
|
393 |
then the parse-tree is converted into an array of symbolic codes |
|
394 |
and a relocation table; |
|
395 |
these two are finally combined into a byteArray of the codes. |
|
0 | 396 |
|
19 | 397 |
(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
|
398 |
only - it may vanish in future releases) |
19 | 399 |
|
400 |
There are many dependencies to the run-time-system (especially the |
|
401 |
interpreter) in here - be careful when playing around ... |
|
0 | 402 |
|
259 | 403 |
[Instance variables:] |
0 | 404 |
|
1055 | 405 |
codeBytes <ByteArry> bytecodes |
406 |
codeIndex <SmallInteger> next index to put into code array |
|
407 |
litArray <OrderedCollection> literals |
|
408 |
stackDelta <SmallInteger> return value of byteCodeFor: |
|
409 |
extra <Symbol> return value of byteCodeFor: |
|
410 |
lineno <Boolean> return value of byteCodeFor: |
|
411 |
extraLiteral <Symbol> return value of byteCodeFor: |
|
412 |
maxStackDepth <SmallInteger> stack need of method |
|
413 |
relocList <Array> used temporary for relocation |
|
19 | 414 |
|
259 | 415 |
[Class variables:] |
19 | 416 |
|
1055 | 417 |
JumpToAbsJump <Dictionary> internal table to map opcodes |
418 |
||
419 |
SequenceNumber <Integer> counting intermediate stc-compiled |
|
420 |
objects (for unique o-file naming) |
|
421 |
||
422 |
STCCompilationDefines passed to stc as command line arguments |
|
423 |
STCCompilationIncludes |
|
424 |
STCCompilationOptions |
|
425 |
<String> |
|
426 |
||
427 |
STCCompilation <Symbol> #always, #primitiveOnly or #never |
|
428 |
controls when stc compilation is wanted |
|
429 |
||
430 |
ShareCode <Boolean> reuse byteArrays for common (simple) code sequences |
|
431 |
This is normally a 'good' optimization, |
|
432 |
except if you plan to modify the byteCodes. |
|
263 | 433 |
|
434 |
[author:] |
|
1055 | 435 |
Claus Gittinger |
263 | 436 |
|
3 | 437 |
" |
98 | 438 |
! ! |
439 |
||
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
440 |
!ByteCodeCompiler class methodsFor:'initialization'! |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
441 |
|
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
442 |
initialize |
1050 | 443 |
Smalltalk vmMajorVersionNr >= 5 ifTrue:[ |
444 |
NewCodeSet := true. |
|
445 |
NewPrimitives := true. |
|
446 |
] ifFalse:[ |
|
447 |
NewCodeSet := false. |
|
448 |
NewPrimitives := false. |
|
449 |
]. |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
450 |
ShareCode := true. |
295 | 451 |
STCKeepCIntermediate := false. |
704 | 452 |
STCKeepOIntermediate := false. |
407 | 453 |
STCKeepSTIntermediate := false. |
301
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
454 |
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
|
455 |
ListCompiledMethods := false. |
1138 | 456 |
AllowExtensionsToPrivateClasses := true. |
1219
e5c891489441
support compilation restart (after a fix)
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
457 |
RestartCompilationSignal := Signal new. |
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
|
458 |
|
792
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
459 |
" |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
460 |
STCKeepCIntermediate := true. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
461 |
STCKeepOIntermediate := true. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
462 |
STCKeepSTIntermediate := true. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
463 |
" |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
464 |
|
1219
e5c891489441
support compilation restart (after a fix)
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
465 |
"Modified: / 15.11.2001 / 17:20:51 / cg" |
1046 | 466 |
! |
467 |
||
468 |
newCodeSet |
|
469 |
^ NewCodeSet |
|
470 |
||
471 |
! |
|
472 |
||
473 |
newCodeSet:aBoolean |
|
474 |
NewCodeSet := aBoolean. |
|
475 |
||
476 |
" |
|
477 |
ByteCodeCompiler newCodeSet:true |
|
478 |
" |
|
1049 | 479 |
! |
480 |
||
481 |
newPrimitives |
|
482 |
^ NewPrimitives |
|
483 |
||
484 |
! |
|
485 |
||
486 |
newPrimitives:aBoolean |
|
487 |
NewPrimitives := aBoolean. |
|
488 |
||
489 |
" |
|
490 |
ByteCodeCompiler newPrimitives:true |
|
491 |
" |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
492 |
! ! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
493 |
|
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
494 |
!ByteCodeCompiler class methodsFor:'compiling methods'! |
98 | 495 |
|
0 | 496 |
compile:methodText forClass:classToCompileFor |
890 | 497 |
"compile a source-string for a method in classToCompileFor. |
498 |
Returns the new method, #Error or nil." |
|
499 |
||
500 |
^ self |
|
501 |
compile:methodText |
|
502 |
forClass:classToCompileFor |
|
503 |
inCategory:'others' |
|
504 |
notifying:nil |
|
505 |
install:true |
|
506 |
skipIfSame:false |
|
507 |
silent:false |
|
0 | 508 |
! |
509 |
||
510 |
compile:aString forClass:aClass inCategory:cat |
|
511 |
"compile a source-string for a method in classToCompileFor. |
|
890 | 512 |
The method will get cat as category. |
513 |
Returns the new method, #Error or nil." |
|
514 |
||
515 |
^ self |
|
516 |
compile:aString |
|
517 |
forClass:aClass |
|
518 |
inCategory:cat |
|
519 |
notifying:nil |
|
520 |
install:true |
|
521 |
skipIfSame:false |
|
522 |
silent:false |
|
0 | 523 |
! |
524 |
||
84 | 525 |
compile:aString forClass:aClass inCategory:cat notifying:requestor |
0 | 526 |
"compile a source-string for a method in classToCompileFor. |
84 | 527 |
errors are forwarded to requestor. |
890 | 528 |
The method will get cat as category. |
529 |
Returns the new method, #Error or nil." |
|
530 |
||
531 |
^ self |
|
532 |
compile:aString |
|
533 |
forClass:aClass |
|
534 |
inCategory:cat |
|
535 |
notifying:requestor |
|
536 |
install:true |
|
537 |
skipIfSame:false |
|
538 |
silent:false |
|
0 | 539 |
! |
540 |
||
141 | 541 |
compile:aString forClass:aClass inCategory:cat notifying:requestor install:install |
542 |
"compile a source-string for a method in classToCompileFor. |
|
543 |
The install-argument controls if the method is to be installed into the |
|
544 |
classes method-dictionary, or just to be compiled and a method object to be returned. |
|
890 | 545 |
Errors are forwarded to requestor. The method will get cat as category. |
546 |
Returns the new method, #Error or nil." |
|
547 |
||
548 |
^ self |
|
549 |
compile:aString |
|
550 |
forClass:aClass |
|
551 |
inCategory:cat |
|
552 |
notifying:requestor |
|
553 |
install:install |
|
554 |
skipIfSame:false |
|
555 |
silent:false |
|
141 | 556 |
! |
557 |
||
558 |
compile:aString forClass:aClass inCategory:cat notifying:requestor |
|
890 | 559 |
install:install skipIfSame:skipIfSame |
141 | 560 |
"compile a source-string for a method in classToCompileFor. |
561 |
The install-argument controls if the method is to be installed into the |
|
562 |
classes method-dictionary, or just to be compiled and a method object to be returned. |
|
563 |
Errors are forwarded to requestor. The method will get cat as category. |
|
564 |
If skipIsSame is true, and the source is the same as an existing |
|
890 | 565 |
methods source, this is a noop (for fast fileIn). |
566 |
Returns the new method, #Error or nil." |
|
567 |
||
568 |
^ self |
|
569 |
compile:aString |
|
570 |
forClass:aClass |
|
571 |
inCategory:cat |
|
572 |
notifying:requestor |
|
573 |
install:install |
|
574 |
skipIfSame:skipIfSame |
|
575 |
silent:false |
|
141 | 576 |
! |
577 |
||
84 | 578 |
compile:aString forClass:aClass inCategory:cat notifying:requestor |
890 | 579 |
install:install skipIfSame:skipIfSame silent:silent |
580 |
"compile a source-string for a method in aClass. |
|
581 |
errors are forwarded to requestor. |
|
582 |
The method will get cat as category. |
|
583 |
if install is true, the method is installed in the class. |
|
584 |
if skipIfSame, the method is not installed if there is no change |
|
585 |
(used when filing in). |
|
586 |
if silent is true, no warnings are output. |
|
587 |
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
|
588 |
|
54e13c76f143
allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
589 |
^ self |
890 | 590 |
compile:aString |
591 |
forClass:aClass |
|
592 |
inCategory:cat |
|
593 |
notifying:requestor |
|
594 |
install:install |
|
595 |
skipIfSame:skipIfSame |
|
596 |
silent:silent |
|
597 |
foldConstants:true |
|
230
54e13c76f143
allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
598 |
! |
54e13c76f143
allow constant folding to be turned off
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
599 |
|
1221
2768cbe3be2b
finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
600 |
compile:aStringArg forClass:aClassArg inCategory:cat notifying:requestor |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
601 |
install:install skipIfSame:skipIfSame silent:silent foldConstants:fold |
20 | 602 |
|
603 |
"the basic workhorse method for compiling: |
|
0 | 604 |
compile a source-string for a method in classToCompileFor. |
890 | 605 |
errors are forwarded to requestor |
606 |
(report on Transcript and return #Error, if requestor is nil). |
|
0 | 607 |
|
20 | 608 |
The new method will get cat as category. |
609 |
If install is true, the method will go into the classes method-table, |
|
610 |
otherwise the method is simply returned (for anonymous methods). |
|
0 | 611 |
If skipIsSame is true, and the source is the same as an existing |
20 | 612 |
methods source, this is a noop (for fast fileIn). |
890 | 613 |
The argument, silent controls if errors are to be reported. |
614 |
Returns the method, #Error or nil." |
|
0 | 615 |
|
1363 | 616 |
^ self new |
617 |
compile:aStringArg forClass:aClassArg inCategory:cat notifying:requestor |
|
618 |
install:install skipIfSame:skipIfSame silent:silent foldConstants:fold |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
619 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
620 |
|
1466 | 621 |
compile:methodText forClass:classToCompileFor install:doInstall |
622 |
"compile a source-string for a method in classToCompileFor. |
|
623 |
The install-argument controls if the method is to be installed into the |
|
624 |
classes method-dictionary, or just to be compiled and a method object to be returned. |
|
625 |
Returns the new method, #Error or nil." |
|
626 |
||
627 |
^ self |
|
628 |
compile:methodText |
|
629 |
forClass:classToCompileFor |
|
630 |
inCategory:'others' |
|
631 |
notifying:nil |
|
632 |
install:doInstall |
|
633 |
skipIfSame:false |
|
634 |
silent:false |
|
635 |
! |
|
636 |
||
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
637 |
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
|
638 |
"compile a source-string for a method in classToCompileFor. |
890 | 639 |
Errors are forwarded to requestor. |
640 |
Returns the new method, #Error or nil." |
|
641 |
||
642 |
^ self |
|
643 |
compile:methodText |
|
644 |
forClass:classToCompileFor |
|
645 |
inCategory:'others' |
|
646 |
notifying:requestor |
|
647 |
install:true |
|
648 |
skipIfSame:false |
|
649 |
silent:false |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
650 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
651 |
|
141 | 652 |
compile:textOrStream in:aClass notifying:requestor ifFail:exceptionBlock |
890 | 653 |
"name alias for ST-80 compatibility. |
1201 | 654 |
Returns the new method, or the value from exceptionBlock." |
141 | 655 |
|
1459 | 656 |
^ self new compile:textOrStream in:aClass notifying:requestor ifFail:exceptionBlock |
0 | 657 |
! ! |
658 |
||
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
659 |
!ByteCodeCompiler class methodsFor:'constants'! |
15 | 660 |
|
661 |
byteCodeFor:aSymbol |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
662 |
"returns the numeric code for some symbolic bytecodes." |
15 | 663 |
|
25 | 664 |
(aSymbol == #retNil) ifTrue:[^ 1]. |
665 |
(aSymbol == #retTrue) ifTrue:[^ 2]. |
|
666 |
(aSymbol == #retFalse) ifTrue:[^ 3]. |
|
667 |
(aSymbol == #ret0) ifTrue:[^ 4]. |
|
1402 | 668 |
(aSymbol == #retSelf) ifTrue:[^5]. |
1300
be5542fc877e
more bytecodes in #byteCodeFor class method
Stefan Vogel <sv@exept.de>
parents:
1280
diff
changeset
|
669 |
(aSymbol == #retNum) ifTrue:[^ 127]. |
25 | 670 |
(aSymbol == #retTop) ifTrue:[^ 0]. |
671 |
||
1300
be5542fc877e
more bytecodes in #byteCodeFor class method
Stefan Vogel <sv@exept.de>
parents:
1280
diff
changeset
|
672 |
(aSymbol == #mk0Block) ifTrue:[^ 156]. |
be5542fc877e
more bytecodes in #byteCodeFor class method
Stefan Vogel <sv@exept.de>
parents:
1280
diff
changeset
|
673 |
(aSymbol == #mkNilBlock) ifTrue:[^ 157]. |
be5542fc877e
more bytecodes in #byteCodeFor class method
Stefan Vogel <sv@exept.de>
parents:
1280
diff
changeset
|
674 |
|
15 | 675 |
(aSymbol == #push0) ifTrue:[^120]. |
676 |
(aSymbol == #push1) ifTrue:[^121]. |
|
677 |
(aSymbol == #push2) ifTrue:[^139]. |
|
678 |
(aSymbol == #pushMinus1) ifTrue:[^122]. |
|
679 |
(aSymbol == #pushNil) ifTrue:[^ 10]. |
|
680 |
(aSymbol == #pushTrue) ifTrue:[^ 11]. |
|
681 |
(aSymbol == #pushFalse) ifTrue:[^ 12]. |
|
682 |
(aSymbol == #pushSelf) ifTrue:[^ 15]. |
|
1402 | 683 |
self error:'unknown instruction'. |
15 | 684 |
! ! |
685 |
||
1324 | 686 |
!ByteCodeCompiler class methodsFor:'defaults'! |
687 |
||
688 |
defaultMethodCategory |
|
689 |
"/ ^ '** As yet uncategorized **'. |
|
690 |
^ '* uncategorized *' |
|
691 |
! ! |
|
692 |
||
1414 | 693 |
!ByteCodeCompiler class methodsFor:'private-utilities'! |
1280 | 694 |
|
695 |
stringWithSimpleCRs:aString |
|
696 |
|src dst ch| |
|
697 |
||
1496
7f31982d2933
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
1479
diff
changeset
|
698 |
dst := String writeStream. |
1280 | 699 |
src := aString readStream. |
700 |
[src atEnd] whileFalse:[ |
|
701 |
ch := src next. |
|
702 |
ch = Character return ifTrue:[ |
|
1367 | 703 |
src peek == Character linefeed ifTrue:[ |
1280 | 704 |
src next. |
705 |
]. |
|
706 |
ch := Character cr. |
|
707 |
]. |
|
708 |
dst nextPut:ch |
|
709 |
]. |
|
710 |
^ dst contents |
|
711 |
! ! |
|
712 |
||
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
713 |
!ByteCodeCompiler class methodsFor:'stc compilation defaults'! |
54 | 714 |
|
141 | 715 |
canCreateMachineCode |
716 |
"return true, if compilation to machine code is supported. |
|
717 |
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
|
718 |
REAL/IX and HPUX9.x do not (due to the need for dynamic loading |
141 | 719 |
of object files, which is not supported by those). |
720 |
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
|
721 |
(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
|
722 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
723 |
However, if no stc compiler is around (i.e. the demo distribution), |
141 | 724 |
there is no chance ..." |
725 |
||
726 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
727 |
ObjectFileLoader canLoadObjectFiles ifFalse:[^ false]. |
|
728 |
||
729 |
"/ no chance, if no stc is available |
|
730 |
^ self incrementalStcPath notNil |
|
124 | 731 |
|
732 |
" |
|
141 | 733 |
Compiler canCreateMachineCode |
734 |
" |
|
735 |
||
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
736 |
"Modified: / 13.9.1995 / 15:15:11 / claus" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
737 |
"Modified: / 3.9.1998 / 15:56:07 / cg" |
141 | 738 |
! |
739 |
||
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
740 |
ccCompilationOptions |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
741 |
"return the options used with cc compilation" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
742 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
743 |
CCCompilationOptions isNil ifTrue:[^ '']. |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
744 |
^ CCCompilationOptions |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
745 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
746 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
747 |
Compiler ccCompilationOptions |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
748 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
749 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
750 |
"Modified: 5.11.1996 / 17:38:56 / cg" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
751 |
! |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
752 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
753 |
ccCompilationOptions:aString |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
754 |
"define the compilation options |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
755 |
to be used when compiling to machine code. |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
756 |
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
|
757 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
758 |
CCCompilationOptions := aString |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
759 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
760 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
761 |
Compiler ccCompilationOptions:'-O' |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
762 |
Compiler ccCompilationOptions:'-O -fPIC' |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
763 |
Compiler ccCompilationOptions |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
764 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
765 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
766 |
"Created: 5.11.1996 / 17:37:05 / cg" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
767 |
"Modified: 5.11.1996 / 17:38:32 / cg" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
768 |
! |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
769 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
770 |
ccPath |
768 | 771 |
"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
|
772 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
773 |
CC isNil ifTrue:[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
774 |
OperatingSystem isMSDOSlike ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
775 |
OperatingSystem getCCDefine = '__BORLANDC__' ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
776 |
^'bcc32' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
777 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
778 |
^'cl' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
779 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
780 |
OperatingSystem getCCDefine = '__GNUC__' ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
781 |
^'gcc' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
782 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
783 |
^ 'cc' |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
784 |
]. |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
785 |
^ CC |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
786 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
787 |
" |
772 | 788 |
CC := nil |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
789 |
Compiler ccPath |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
790 |
Compiler ccPath:'gcc' |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
791 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
792 |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
793 |
"Modified: / 13.9.1995 / 15:15:04 / claus" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
794 |
"Created: / 5.11.1996 / 17:35:40 / cg" |
772 | 795 |
"Modified: / 4.9.1998 / 15:48:40 / cg" |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
796 |
! |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
797 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
798 |
ccPath:aPathOrCommandName |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
799 |
"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
|
800 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
801 |
CC := aPathOrCommandName |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
802 |
|
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
803 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
804 |
Compiler ccPath |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
805 |
Compiler ccPath:'gcc' |
773 | 806 |
Compiler ccPath:'bcc32' |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
807 |
" |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
808 |
|
773 | 809 |
"Modified: / 13.9.1995 / 15:15:04 / claus" |
810 |
"Created: / 5.11.1996 / 17:38:11 / cg" |
|
811 |
"Modified: / 23.8.1998 / 13:58:57 / cg" |
|
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
812 |
! |
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
813 |
|
141 | 814 |
incrementalStcPath |
815 |
"return the path to the stc command for incremental method compilation, |
|
816 |
or nil if not found." |
|
817 |
||
1374 | 818 |
|f cmd| |
141 | 819 |
|
695 | 820 |
STC notNil ifTrue:[ |
1374 | 821 |
cmd := STC |
822 |
] ifFalse:[ |
|
823 |
(f := self stcPathOf:'stc') notNil ifTrue:[ |
|
824 |
cmd := f |
|
825 |
] ifFalse:[ |
|
826 |
cmd := self stcPathOf:'demostc' |
|
827 |
] |
|
695 | 828 |
]. |
1506 | 829 |
(cmd notNil and:[cmd includes:Character space]) ifTrue:[ |
1374 | 830 |
cmd := '"' , cmd , '"'. |
831 |
]. |
|
832 |
^cmd |
|
141 | 833 |
|
834 |
" |
|
695 | 835 |
Compiler stcPath:'../../stc/stc' |
141 | 836 |
Compiler incrementalStcPath |
837 |
" |
|
838 |
||
839 |
"Created: 13.9.1995 / 14:36:36 / claus" |
|
840 |
"Modified: 13.9.1995 / 15:15:04 / claus" |
|
841 |
! |
|
842 |
||
843 |
stcCompilation |
|
844 |
"return the flag which controls compilation to machine code. |
|
845 |
If #always, methods are always compiled to machine code (which takes |
|
846 |
longer, but provides faster code). If #none, methods are never compiled |
|
847 |
to machine code, instead for non-primitive ones, compilation is to bytecode |
|
848 |
and for primitive ones, a trapping stub is generated. |
|
849 |
Anything else lets the compiler compile to bytecode, |
|
850 |
except for methods containing primitive code. |
|
851 |
This can be set from your private.rc file or from a workspace |
|
852 |
for selective compilation to machine code." |
|
124 | 853 |
|
141 | 854 |
^ STCCompilation |
54 | 855 |
|
856 |
" |
|
141 | 857 |
Compiler stcCompilation |
124 | 858 |
" |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
859 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
860 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
861 |
stcCompilation:how |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
862 |
"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
|
863 |
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
|
864 |
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
|
865 |
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
|
866 |
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
|
867 |
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
|
868 |
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
|
869 |
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
|
870 |
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
|
871 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
872 |
|ret| |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
873 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
874 |
ret := STCCompilation. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
875 |
STCCompilation := how. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
876 |
^ ret |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
877 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
878 |
" |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
879 |
Compiler stcCompilation:#always |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
880 |
Compiler stcCompilation:#never |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
881 |
Compiler stcCompilation:#default |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
882 |
" |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
883 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
884 |
|
141 | 885 |
stcCompilationDefines |
886 |
"return the defines used with stc compilation" |
|
887 |
||
888 |
^ STCCompilationDefines |
|
889 |
! |
|
890 |
||
891 |
stcCompilationDefines:aString |
|
892 |
"define the flags (for example, additional -D defines) |
|
893 |
to be used when compiling to machine code. |
|
894 |
These are passed to stc. Can be set from your private.rc file." |
|
895 |
||
896 |
STCCompilationDefines := aString |
|
897 |
||
898 |
" |
|
899 |
Compiler stcCompilationDefines:'-DVGL -DDEBUG' |
|
773 | 900 |
Compiler stcCompilationDefines:'-DWIN32' |
141 | 901 |
" |
773 | 902 |
|
903 |
"Modified: / 23.8.1998 / 14:00:40 / cg" |
|
141 | 904 |
! |
905 |
||
906 |
stcCompilationIncludes |
|
907 |
"return the includes used with stc compilation" |
|
908 |
||
909 |
^ STCCompilationIncludes |
|
910 |
! |
|
911 |
||
912 |
stcCompilationIncludes:aString |
|
913 |
"define the include directories via additional -I flags. |
|
914 |
These are passed to stc. Can be set in your private.rc file" |
|
915 |
||
586
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
916 |
|libDir incDir| |
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
917 |
|
1508 | 918 |
STCCompilationIncludes := aString ? ''. |
586
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
919 |
|
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
920 |
"/ 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
|
921 |
"/ add it here. |
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
922 |
|
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
923 |
libDir := OperatingSystem getEnvironment:'STX_LIBDIR'. |
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
924 |
(libDir notNil and:[libDir asFilename exists]) ifTrue:[ |
1508 | 925 |
incDir := libDir asFilename construct:'include'. |
926 |
incDir exists ifTrue:[ |
|
927 |
(STCCompilationIncludes asCollectionOfWords includes:('-I' , incDir pathName)) ifFalse:[ |
|
928 |
STCCompilationIncludes := STCCompilationIncludes , ' ' , ('-I' , incDir pathName). |
|
929 |
] |
|
930 |
] |
|
586
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
931 |
] |
141 | 932 |
|
933 |
" |
|
934 |
Compiler stcCompilationIncludes:'-I/usr/local/include -I../../include' |
|
935 |
Compiler stcCompilationIncludes:(Compiler stcCompilationIncludes , ' -I../../libxt') |
|
936 |
" |
|
586
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
937 |
|
e9ef451f36d0
automatically include STX_LIBDIR in -I-list
Claus Gittinger <cg@exept.de>
parents:
560
diff
changeset
|
938 |
"Modified: 18.7.1997 / 18:04:25 / cg" |
141 | 939 |
! |
940 |
||
124 | 941 |
stcCompilationOptions |
942 |
"return the options used with stc compilation" |
|
943 |
||
944 |
^ STCCompilationOptions |
|
945 |
! |
|
946 |
||
141 | 947 |
stcCompilationOptions:aString |
948 |
"define the compilation options |
|
949 |
to be used when compiling to machine code. |
|
950 |
These are passed to stc. Can be set from your private.rc file." |
|
101 | 951 |
|
141 | 952 |
STCCompilationOptions := aString |
101 | 953 |
|
954 |
" |
|
141 | 955 |
Compiler stcCompilationOptions:'+optinline' |
101 | 956 |
" |
957 |
! |
|
958 |
||
301
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
959 |
stcModulePath |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
960 |
"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
|
961 |
|
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
962 |
^ STCModulePath |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
963 |
|
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
964 |
"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
|
965 |
! |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
966 |
|
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
967 |
stcModulePath:aPath |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
968 |
"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
|
969 |
|
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
970 |
STCModulePath := aPath |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
971 |
|
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
972 |
"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
|
973 |
! |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
974 |
|
141 | 975 |
stcPath |
976 |
"return the path to the stc command, or nil if not found." |
|
977 |
||
695 | 978 |
^ STC ? (self stcPathOf:'stc') |
141 | 979 |
|
980 |
" |
|
981 |
Compiler stcPath |
|
982 |
" |
|
983 |
||
984 |
"Modified: 13.9.1995 / 14:37:26 / claus" |
|
985 |
! |
|
986 |
||
695 | 987 |
stcPath:aPath |
988 |
"set the path to the stc command - useful if private stc is wanted" |
|
989 |
||
990 |
STC := aPath |
|
991 |
||
992 |
" |
|
993 |
Compiler stcPath:'../../stc/stc' |
|
773 | 994 |
Compiler stcPath:'..\stc\stc' |
695 | 995 |
" |
996 |
||
773 | 997 |
"Modified: / 13.9.1995 / 14:37:26 / claus" |
998 |
"Modified: / 23.8.1998 / 13:59:24 / cg" |
|
695 | 999 |
! |
1000 |
||
120 | 1001 |
stcPathOf:command |
1002 |
"return the path to an stc command, or nil if not found." |
|
101 | 1003 |
|
623 | 1004 |
|f d reqdSuffix cmd| |
1005 |
||
1006 |
"/ |
|
1007 |
"/ care for executable suffix |
|
1008 |
"/ |
|
1009 |
cmd := command. |
|
1010 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
1011 |
reqdSuffix := 'exe' |
|
1012 |
] ifFalse:[ |
|
1013 |
OperatingSystem isVMSlike ifTrue:[ |
|
1014 |
reqdSuffix := 'EXE' |
|
1015 |
]. |
|
1016 |
]. |
|
1017 |
reqdSuffix notNil ifTrue:[ |
|
658 | 1018 |
(f := cmd asFilename) suffix isEmpty ifTrue:[ |
1019 |
cmd := (f withSuffix:reqdSuffix) name |
|
623 | 1020 |
] |
1021 |
]. |
|
1022 |
"/ |
|
1023 |
"/ for our convenience, also check in current |
|
1024 |
"/ and parent directories; even if PATH does not |
|
1025 |
"/ include them ... |
|
1026 |
"/ |
|
658 | 1027 |
"/ look in current ... |
623 | 1028 |
d := Filename currentDirectory. |
1029 |
(f := d construct:cmd) isExecutable ifTrue:[ |
|
101 | 1030 |
^ f pathName |
1031 |
]. |
|
658 | 1032 |
"/ look in ../stc ... |
623 | 1033 |
d := d construct:'..'. |
1034 |
(f := (d construct:'stc') construct:cmd) isExecutable ifTrue:[ |
|
1035 |
^ f pathName |
|
1036 |
]. |
|
658 | 1037 |
"/ look in ../../stc ... |
623 | 1038 |
d := d construct:'..'. |
1039 |
(f := (d construct:'stc') construct:cmd) isExecutable ifTrue:[ |
|
1040 |
^ f pathName |
|
1041 |
]. |
|
1042 |
||
1043 |
"/ |
|
1044 |
"/ ok, stc must be installed in some directory along the PATH |
|
1045 |
"/ |
|
126 | 1046 |
^ OperatingSystem pathOfCommand:command |
97 | 1047 |
|
1048 |
" |
|
120 | 1049 |
Compiler stcPathOf:'stc' |
1050 |
" |
|
1051 |
||
1052 |
"Created: 13.9.1995 / 14:37:16 / claus" |
|
54 | 1053 |
! ! |
1054 |
||
1417 | 1055 |
!ByteCodeCompiler methodsFor:'Compatibility-ST80'! |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1056 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1057 |
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
|
1058 |
"name alias for ST-80 compatibility" |
0 | 1059 |
|
1459 | 1060 |
^ self |
1061 |
compile:textOrStream |
|
1062 |
forClass:aClass |
|
1063 |
inCategory:'others' |
|
1064 |
notifying:requestor |
|
1065 |
install:true |
|
1066 |
skipIfSame:false |
|
1067 |
silent:false |
|
1068 |
foldConstants:true |
|
1069 |
ifFail:exceptionBlock. |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1070 |
! ! |
0 | 1071 |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1072 |
!ByteCodeCompiler methodsFor:'accessing'! |
0 | 1073 |
|
1074 |
code |
|
3 | 1075 |
"return the bytecode array - only valid after code-generation" |
0 | 1076 |
|
49 | 1077 |
^ codeBytes |
0 | 1078 |
! |
1079 |
||
141 | 1080 |
literalArray |
1081 |
"return the literal array - only valid after parsing" |
|
1082 |
||
1083 |
^ litArray |
|
1084 |
! |
|
1085 |
||
0 | 1086 |
maxStackDepth |
1087 |
"return the stack-need of the method - only valid after code-generation" |
|
1088 |
||
1089 |
^ maxStackDepth |
|
1094
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1090 |
! |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1091 |
|
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1092 |
methodClass |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1093 |
^ methodClass ? Method |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1094 |
! |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1095 |
|
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1096 |
methodClass:aClass |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
1097 |
methodClass := aClass |
0 | 1098 |
! ! |
1099 |
||
1100 |
!ByteCodeCompiler methodsFor:'code generation'! |
|
1101 |
||
141 | 1102 |
absJumpFromJump:code |
1103 |
"given a jump-symbolic code, return corresponding absolute jump" |
|
0 | 1104 |
|
141 | 1105 |
JumpToAbsJump isNil ifTrue:[ |
1106 |
JumpToAbsJump := IdentityDictionary new. |
|
1107 |
JumpToAbsJump at:#jump put:#jumpabs. |
|
1108 |
JumpToAbsJump at:#trueJump put:#trueJumpabs. |
|
1109 |
JumpToAbsJump at:#falseJump put:#falseJumpabs. |
|
1110 |
JumpToAbsJump at:#nilJump put:#nilJumpabs. |
|
1111 |
JumpToAbsJump at:#notNilJump put:#notNilJumpabs. |
|
1112 |
JumpToAbsJump at:#eqJump put:#eqJumpabs. |
|
1113 |
JumpToAbsJump at:#notEqJump put:#notEqJumpabs. |
|
1114 |
JumpToAbsJump at:#zeroJump put:#zeroJumpabs. |
|
1115 |
JumpToAbsJump at:#notZeroJump put:#notZeroJumpabs. |
|
1116 |
JumpToAbsJump at:#makeBlock put:#makeBlockabs. |
|
0 | 1117 |
]. |
141 | 1118 |
^ JumpToAbsJump at:code |
0 | 1119 |
! |
1120 |
||
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1121 |
addLiteral:anObject |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1122 |
"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
|
1123 |
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
|
1124 |
|
1343 | 1125 |
|index "{ Class: SmallInteger }" oldLit class| |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1126 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1127 |
litArray isNil ifTrue:[ |
1343 | 1128 |
litArray := Array with:anObject. |
1129 |
^ 1 |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1130 |
]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1131 |
index := litArray identityIndexOf:anObject. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1132 |
(index == 0) ifTrue:[ |
1343 | 1133 |
" |
1134 |
reuse constants if same value and same class |
|
1135 |
" |
|
1136 |
class := anObject class. |
|
1137 |
((class == Float) |
|
1138 |
or:[class == Fraction |
|
1139 |
or:[class == LargeInteger |
|
1140 |
"or:[class == String] --only if literalString option has been added---" ]]) ifTrue:[ |
|
1141 |
index := litArray indexOf:anObject. |
|
1142 |
index ~~ 0 ifTrue:[ |
|
1143 |
oldLit := litArray at:index. |
|
1144 |
oldLit class == class ifFalse:[ |
|
1145 |
index := 0. |
|
1146 |
] ifTrue:[ |
|
1147 |
"/ dont mess up negative with positive zeros |
|
1148 |
anObject = 0.0 ifTrue:[ |
|
1149 |
anObject isNegativeZero ~~ oldLit isNegativeZero ifTrue:[ |
|
1150 |
index := 0 |
|
1151 |
] |
|
1152 |
] |
|
1153 |
]. |
|
1154 |
]. |
|
1155 |
]. |
|
1156 |
(index == 0) ifTrue:[ |
|
1157 |
litArray := litArray copyWith:anObject. |
|
1158 |
^ litArray size |
|
1159 |
]. |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1160 |
]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1161 |
^ index |
632 | 1162 |
|
1163 |
"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
|
1164 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1165 |
|
141 | 1166 |
addReloc:symIndex |
1167 |
"remember to relocate offset at symIndex later ..." |
|
3 | 1168 |
|
141 | 1169 |
relocList isNil ifTrue:[ |
1170 |
relocList := OrderedCollection new. |
|
1 | 1171 |
]. |
141 | 1172 |
relocList add:symIndex |
1 | 1173 |
! |
1174 |
||
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1175 |
appendByte:aByte |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1176 |
"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
|
1177 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1178 |
|idx "{Class: SmallInteger }"| |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1179 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1180 |
idx := codeIndex. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1181 |
(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
|
1182 |
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
|
1183 |
codeIndex := idx + 1 |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1184 |
] ifFalse:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1185 |
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
|
1186 |
errorFlag := #Error |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1187 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1188 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1189 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1190 |
appendByteCodeFor:codeSymbol |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1191 |
"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
|
1192 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1193 |
|idx "{Class: SmallInteger }"| |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1194 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1195 |
idx := codeIndex. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1196 |
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
|
1197 |
codeIndex := idx + 1 |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1198 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1199 |
|
141 | 1200 |
appendEmptyByte |
1201 |
"append an empty byte to the code-Array" |
|
3 | 1202 |
|
141 | 1203 |
|idx "{Class: SmallInteger }"| |
3 | 1204 |
|
141 | 1205 |
idx := codeIndex. |
1206 |
codeBytes at:idx put:0. |
|
1207 |
codeIndex := idx + 1 |
|
45 | 1208 |
! |
1209 |
||
199
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1210 |
appendEmptyLong |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1211 |
"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
|
1212 |
|
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1213 |
|idx "{Class: SmallInteger }"| |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1214 |
|
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1215 |
idx := codeIndex. |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1216 |
codeBytes at:idx put:0. |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1217 |
codeBytes at:idx+1 put:0. |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1218 |
codeBytes at:idx+2 put:0. |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1219 |
codeBytes at:idx+3 put:0. |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1220 |
codeIndex := idx + 4 |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1221 |
! |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1222 |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1223 |
appendEmptyShort |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1224 |
"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
|
1225 |
|
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1226 |
|idx "{Class: SmallInteger }"| |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1227 |
|
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1228 |
idx := codeIndex. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1229 |
codeBytes at:idx put:0. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1230 |
codeBytes at:idx+1 put:0. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1231 |
codeIndex := idx + 2 |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1232 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1233 |
|
0 | 1234 |
appendSignedByte:aByte |
1235 |
"append a signedbyte (as in jump-offsets) to the code-Array, |
|
1236 |
check range and report an error if invalid" |
|
1237 |
||
49 | 1238 |
|b "{Class: SmallInteger }" |
1239 |
idx "{Class: SmallInteger }"| |
|
0 | 1240 |
|
49 | 1241 |
idx := codeIndex. |
0 | 1242 |
b := aByte. |
1243 |
(b >= 0) ifTrue:[ |
|
45 | 1244 |
(b > 127) ifTrue:[ |
1245 |
self error:'jump-range error'. |
|
1246 |
errorFlag := #Error |
|
1247 |
]. |
|
49 | 1248 |
codeBytes at:idx put:b |
0 | 1249 |
] ifFalse:[ |
45 | 1250 |
(b < -128) ifTrue:[ |
1251 |
self error:'jump-range error'. |
|
1252 |
errorFlag := #Error |
|
1253 |
]. |
|
49 | 1254 |
b := 256 + b |
0 | 1255 |
]. |
49 | 1256 |
codeBytes at:idx put:b. |
1257 |
codeIndex := idx + 1 |
|
0 | 1258 |
! |
1259 |
||
46 | 1260 |
appendSignedWord:aWord |
1261 |
"append a signed word to the code-Array, |
|
1262 |
check range and report an error if invalid" |
|
1263 |
||
49 | 1264 |
|w "{Class: SmallInteger }"| |
46 | 1265 |
|
1266 |
w := aWord. |
|
1267 |
(w >= 0) ifTrue:[ |
|
1268 |
(w > 16r7FFFF) ifTrue:[ |
|
1269 |
self error:'word-range error'. |
|
1270 |
errorFlag := #Error |
|
1271 |
]. |
|
1272 |
] ifFalse:[ |
|
1273 |
(w < 16r-8000) ifTrue:[ |
|
1274 |
self error:'word-range error'. |
|
1275 |
errorFlag := #Error |
|
1276 |
]. |
|
1277 |
w := (16r10000 + w). |
|
1278 |
]. |
|
1279 |
self appendWord:w |
|
1280 |
! |
|
1281 |
||
141 | 1282 |
appendWord:aWord |
1283 |
"append an unsigned word (low-high) to the code-Array, |
|
1284 |
checking for word-range (debug-only)" |
|
1285 |
||
1286 |
|idx "{Class: SmallInteger }"| |
|
1287 |
||
1288 |
idx := codeIndex. |
|
1289 |
(aWord between:0 and:16rFFFF) ifTrue:[ |
|
1290 |
codeBytes at:idx put:(aWord bitAnd:16rFF). |
|
1291 |
idx := idx + 1. |
|
1292 |
codeBytes at:idx put:(aWord bitShift:-8). |
|
1293 |
codeIndex := idx + 1 |
|
1294 |
] ifFalse:[ |
|
1295 |
self error:'word range error'. |
|
1296 |
errorFlag := #Error |
|
1297 |
] |
|
1298 |
! |
|
1299 |
||
0 | 1300 |
byteCodeFor:aSymbol |
1301 |
"given a symbolic instruction, return the corresponding bytecode. |
|
1302 |
as a side-effect, leave number of bytes pushed/popped by this instr. |
|
1303 |
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
|
1304 |
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
|
1305 |
information and extraLiteral is set if any hidden send is performed by it." |
0 | 1306 |
|
1307 |
"standard bytecodes" |
|
1308 |
||
1309 |
(aSymbol == #pushNil) ifTrue:[stackDelta := 1. ^ 10]. |
|
1310 |
(aSymbol == #pushTrue) ifTrue:[stackDelta := 1. ^ 11]. |
|
1311 |
(aSymbol == #pushFalse) ifTrue:[stackDelta := 1. ^ 12]. |
|
1312 |
(aSymbol == #pushLit) ifTrue:[stackDelta := 1. extra := #lit. ^ 14]. |
|
105 | 1313 |
(aSymbol == #pushLitS) ifTrue:[stackDelta := 1. extra := #index. ^ 14]. |
0 | 1314 |
(aSymbol == #pushSelf) ifTrue:[stackDelta := 1. ^ 15]. |
1315 |
(aSymbol == #pushNum) ifTrue:[stackDelta := 1. extra := #number. ^ 16]. |
|
1316 |
||
1317 |
(aSymbol == #pushMethodArg) ifTrue:[stackDelta := 1. extra := #index. ^ 30]. |
|
1318 |
(aSymbol == #pushMethodVar) ifTrue:[stackDelta := 1. extra := #index. ^ 31]. |
|
1319 |
(aSymbol == #pushBlockArg) ifTrue:[stackDelta := 1. extra := #index. ^ 32]. |
|
1320 |
(aSymbol == #pushBlockVar) ifTrue:[stackDelta := 1. extra := #index. ^ 33]. |
|
1321 |
(aSymbol == #pushInstVar) ifTrue:[stackDelta := 1. extra := #index. ^ 34]. |
|
1 | 1322 |
(aSymbol == #pushOuterBlockArg) ifTrue:[stackDelta := 1. extra := #indexLevel. ^ 42]. |
1323 |
(aSymbol == #pushOuterBlockVar) ifTrue:[stackDelta := 1. extra := #indexLevel. ^ 128]. |
|
0 | 1324 |
|
1325 |
(aSymbol == #retTop) ifTrue:[stackDelta := -1. ^ 0]. |
|
1326 |
(aSymbol == #retSelf) ifTrue:[^5]. |
|
1327 |
||
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1328 |
(aSymbol == #==) ifTrue:[stackDelta := -1. extraLiteral := aSymbol. ^ 45]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1329 |
(aSymbol == #~~) ifTrue:[stackDelta := -1. extraLiteral := aSymbol. ^ 46]. |
0 | 1330 |
|
1331 |
(aSymbol == #falseJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 50]. |
|
1332 |
(aSymbol == #trueJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 51]. |
|
1333 |
(aSymbol == #nilJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 52]. |
|
1334 |
(aSymbol == #notNilJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 53]. |
|
1335 |
(aSymbol == #jump) ifTrue:[extra := #offset. ^ 54]. |
|
1 | 1336 |
(aSymbol == #makeBlock) ifTrue:[stackDelta := 1. extra := #offsetNvarNarg. ^ 55]. |
0 | 1337 |
(aSymbol == #zeroJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 56]. |
1338 |
(aSymbol == #notZeroJump) ifTrue:[stackDelta := -1. extra := #offset. ^ 57]. |
|
1339 |
(aSymbol == #eqJump) ifTrue:[stackDelta := -2. extra := #offset. ^ 58]. |
|
1340 |
(aSymbol == #notEqJump) ifTrue:[stackDelta := -2. extra := #offset. ^ 59]. |
|
1341 |
||
54 | 1342 |
(aSymbol == #lineno) ifTrue:[lineno := true. ^ 8]. |
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
1343 |
(aSymbol == #lineno16) ifTrue:[lineno := true. ^ 9]. |
54 | 1344 |
|
106 | 1345 |
(aSymbol == #send) ifTrue:[lineno := true. extra := #special. ^ 19]. |
1346 |
(aSymbol == #superSend) ifTrue:[lineno := true. extra := #special. ^ 20]. |
|
1347 |
(aSymbol == #hereSend) ifTrue:[lineno := true. extra := #special. ^ 20]. |
|
117 | 1348 |
(aSymbol == #sendSelf) ifTrue:[lineno := true. extra := #special. ^ 13]. |
0 | 1349 |
|
1350 |
(aSymbol == #drop) ifTrue:[stackDelta := -1. ^ 18]. |
|
1351 |
(aSymbol == #dup) ifTrue:[stackDelta := 1. ^ 47]. |
|
1352 |
||
117 | 1353 |
(aSymbol == #storeMethodVar) ifTrue:[extra := #index. stackDelta := -1. ^ 37]. |
1354 |
(aSymbol == #storeBlockVar) ifTrue:[extra := #index. stackDelta := -1. ^ 38]. |
|
1355 |
(aSymbol == #storeInstVar) ifTrue:[extra := #index. stackDelta := -1. ^ 39]. |
|
0 | 1356 |
|
117 | 1357 |
(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
|
1358 |
(aSymbol == #pushGlobalS) ifTrue:[stackDelta := 1. extra := #speciallitS. ^ 36]. |
117 | 1359 |
|
1360 |
(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
|
1361 |
(aSymbol == #storeGlobalS) ifTrue:[extra := #speciallitS. stackDelta := -1. ^ 41]. |
247 | 1362 |
(aSymbol == #pushSpecialGlobal) ifTrue:[stackDelta := 1. extra := #index. ^ 200]. |
117 | 1363 |
|
1 | 1364 |
(aSymbol == #storeOuterBlockVar) ifTrue:[stackDelta := -1. extra := #indexLevel. ^ 129]. |
0 | 1365 |
|
117 | 1366 |
(aSymbol == #pushClassInstVar) ifTrue:[stackDelta := 1. extra := #index. ^ 176]. |
1367 |
(aSymbol == #storeClassInstVar) ifTrue:[extra := #index.stackDelta := -1. ^ 177]. |
|
105 | 1368 |
|
0 | 1369 |
"optimized bytecodes" |
1370 |
||
1371 |
(aSymbol == #retNil) ifTrue:[^ 1]. |
|
1372 |
(aSymbol == #retTrue) ifTrue:[^ 2]. |
|
1373 |
(aSymbol == #retFalse) ifTrue:[^ 3]. |
|
1374 |
(aSymbol == #ret0) ifTrue:[^ 4]. |
|
1375 |
(aSymbol == #retNum) ifTrue:[extra := #number. ^ 127]. |
|
25 | 1376 |
(aSymbol == #homeRetTop) ifTrue:[^ 7]. |
0 | 1377 |
|
46 | 1378 |
(aSymbol == #pushNum16) ifTrue:[stackDelta := 1. extra := #number16. ^ 17]. |
0 | 1379 |
(aSymbol == #push0) ifTrue:[stackDelta := 1. ^120]. |
1380 |
(aSymbol == #push1) ifTrue:[stackDelta := 1. ^121]. |
|
3 | 1381 |
(aSymbol == #push2) ifTrue:[stackDelta := 1. ^139]. |
0 | 1382 |
(aSymbol == #pushMinus1) ifTrue:[stackDelta := 1. ^122]. |
1383 |
||
106 | 1384 |
(aSymbol == #send0) ifTrue:[lineno := true. extra := #index. ^21]. |
1385 |
(aSymbol == #send1) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^22]. |
|
1386 |
(aSymbol == #send2) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^23]. |
|
1387 |
(aSymbol == #send3) ifTrue:[lineno := true. extra := #index. stackDelta := -3. ^24]. |
|
0 | 1388 |
|
106 | 1389 |
(aSymbol == #sendSelf0) ifTrue:[lineno := true. extra := #index. stackDelta := 1. ^180]. |
1390 |
(aSymbol == #sendSelf1) ifTrue:[lineno := true. extra := #index. ^181]. |
|
1391 |
(aSymbol == #sendSelf2) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^182]. |
|
1392 |
(aSymbol == #sendSelf3) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^183]. |
|
1393 |
(aSymbol == #sendSelfDrop0) ifTrue:[lineno := true. extra := #index. ^184]. |
|
1394 |
(aSymbol == #sendSelfDrop1) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^185]. |
|
1395 |
(aSymbol == #sendSelfDrop2) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^186]. |
|
1396 |
(aSymbol == #sendSelfDrop3) ifTrue:[lineno := true. extra := #index. stackDelta := -3. ^187]. |
|
0 | 1397 |
|
106 | 1398 |
(aSymbol == #sendDrop) ifTrue:[lineno := true. extra := #special. ^25]. |
1399 |
(aSymbol == #sendDrop0) ifTrue:[lineno := true. extra := #index. stackDelta := -1. ^26]. |
|
1400 |
(aSymbol == #sendDrop1) ifTrue:[lineno := true. extra := #index. stackDelta := -2. ^27]. |
|
1401 |
(aSymbol == #sendDrop2) ifTrue:[lineno := true. extra := #index. stackDelta := -3. ^28]. |
|
1402 |
(aSymbol == #sendDrop3) ifTrue:[lineno := true. extra := #index. stackDelta := -4. ^29]. |
|
0 | 1403 |
|
1404 |
(aSymbol == #pushMethodVar1) ifTrue:[stackDelta := 1. ^80]. |
|
1405 |
(aSymbol == #pushMethodVar2) ifTrue:[stackDelta := 1. ^81]. |
|
1406 |
(aSymbol == #pushMethodVar3) ifTrue:[stackDelta := 1. ^82]. |
|
1407 |
(aSymbol == #pushMethodVar4) ifTrue:[stackDelta := 1. ^83]. |
|
1408 |
(aSymbol == #pushMethodVar5) ifTrue:[stackDelta := 1. ^84]. |
|
1409 |
(aSymbol == #pushMethodVar6) ifTrue:[stackDelta := 1. ^85]. |
|
1410 |
||
1411 |
(aSymbol == #pushMethodArg1) ifTrue:[stackDelta := 1. ^86]. |
|
1412 |
(aSymbol == #pushMethodArg2) ifTrue:[stackDelta := 1. ^87]. |
|
1413 |
(aSymbol == #pushMethodArg3) ifTrue:[stackDelta := 1. ^88]. |
|
1414 |
(aSymbol == #pushMethodArg4) ifTrue:[stackDelta := 1. ^89]. |
|
1415 |
||
1416 |
(aSymbol == #pushInstVar1) ifTrue:[stackDelta := 1. ^90]. |
|
1417 |
(aSymbol == #pushInstVar2) ifTrue:[stackDelta := 1. ^91]. |
|
1418 |
(aSymbol == #pushInstVar3) ifTrue:[stackDelta := 1. ^92]. |
|
1419 |
(aSymbol == #pushInstVar4) ifTrue:[stackDelta := 1. ^93]. |
|
1420 |
(aSymbol == #pushInstVar5) ifTrue:[stackDelta := 1. ^94]. |
|
1421 |
(aSymbol == #pushInstVar6) ifTrue:[stackDelta := 1. ^95]. |
|
1422 |
(aSymbol == #pushInstVar7) ifTrue:[stackDelta := 1. ^96]. |
|
1423 |
(aSymbol == #pushInstVar8) ifTrue:[stackDelta := 1. ^97]. |
|
1424 |
(aSymbol == #pushInstVar9) ifTrue:[stackDelta := 1. ^98]. |
|
1425 |
(aSymbol == #pushInstVar10) ifTrue:[stackDelta := 1. ^99]. |
|
1426 |
||
1427 |
(aSymbol == #storeMethodVar1) ifTrue:[stackDelta := -1. ^100]. |
|
1428 |
(aSymbol == #storeMethodVar2) ifTrue:[stackDelta := -1. ^101]. |
|
1429 |
(aSymbol == #storeMethodVar3) ifTrue:[stackDelta := -1. ^102]. |
|
1430 |
(aSymbol == #storeMethodVar4) ifTrue:[stackDelta := -1. ^103]. |
|
1431 |
(aSymbol == #storeMethodVar5) ifTrue:[stackDelta := -1. ^104]. |
|
1432 |
(aSymbol == #storeMethodVar6) ifTrue:[stackDelta := -1. ^105]. |
|
1433 |
||
1434 |
(aSymbol == #storeInstVar1) ifTrue:[stackDelta := -1. ^110]. |
|
1435 |
(aSymbol == #storeInstVar2) ifTrue:[stackDelta := -1. ^111]. |
|
1436 |
(aSymbol == #storeInstVar3) ifTrue:[stackDelta := -1. ^112]. |
|
1437 |
(aSymbol == #storeInstVar4) ifTrue:[stackDelta := -1. ^113]. |
|
1438 |
(aSymbol == #storeInstVar5) ifTrue:[stackDelta := -1. ^114]. |
|
1439 |
(aSymbol == #storeInstVar6) ifTrue:[stackDelta := -1. ^115]. |
|
1440 |
(aSymbol == #storeInstVar7) ifTrue:[stackDelta := -1. ^116]. |
|
1441 |
(aSymbol == #storeInstVar8) ifTrue:[stackDelta := -1. ^117]. |
|
1442 |
(aSymbol == #storeInstVar9) ifTrue:[stackDelta := -1. ^118]. |
|
1443 |
(aSymbol == #storeInstVar10) ifTrue:[stackDelta := -1. ^119]. |
|
1444 |
||
103 | 1445 |
(aSymbol == #pushLit1) ifTrue:[stackDelta := 1. ^ 222]. |
1446 |
(aSymbol == #pushLit2) ifTrue:[stackDelta := 1. ^ 223]. |
|
1447 |
(aSymbol == #pushLit3) ifTrue:[stackDelta := 1. ^ 224]. |
|
1448 |
(aSymbol == #pushLit4) ifTrue:[stackDelta := 1. ^ 225]. |
|
1449 |
(aSymbol == #pushLit5) ifTrue:[stackDelta := 1. ^ 226]. |
|
1450 |
(aSymbol == #pushLit6) ifTrue:[stackDelta := 1. ^ 227]. |
|
1451 |
(aSymbol == #pushLit7) ifTrue:[stackDelta := 1. ^ 228]. |
|
1452 |
(aSymbol == #pushLit8) ifTrue:[stackDelta := 1. ^ 229]. |
|
1453 |
||
0 | 1454 |
(aSymbol == #retMethodVar1) ifTrue:[^160]. |
1455 |
(aSymbol == #retMethodVar2) ifTrue:[^161]. |
|
1456 |
(aSymbol == #retMethodVar3) ifTrue:[^162]. |
|
1457 |
(aSymbol == #retMethodVar4) ifTrue:[^163]. |
|
1458 |
(aSymbol == #retMethodVar5) ifTrue:[^164]. |
|
1459 |
(aSymbol == #retMethodVar6) ifTrue:[^165]. |
|
1460 |
||
1461 |
(aSymbol == #retInstVar1) ifTrue:[^166]. |
|
1462 |
(aSymbol == #retInstVar2) ifTrue:[^167]. |
|
1463 |
(aSymbol == #retInstVar3) ifTrue:[^168]. |
|
1464 |
(aSymbol == #retInstVar4) ifTrue:[^169]. |
|
1465 |
(aSymbol == #retInstVar5) ifTrue:[^170]. |
|
1466 |
(aSymbol == #retInstVar6) ifTrue:[^171]. |
|
1467 |
(aSymbol == #retInstVar7) ifTrue:[^172]. |
|
1468 |
(aSymbol == #retInstVar8) ifTrue:[^173]. |
|
1469 |
||
1470 |
(aSymbol == #retMethodArg1) ifTrue:[^174]. |
|
1471 |
(aSymbol == #retMethodArg2) ifTrue:[^175]. |
|
1472 |
||
1473 |
(aSymbol == #pushBlockArg1) ifTrue:[stackDelta := 1. ^140]. |
|
1474 |
(aSymbol == #pushBlockArg2) ifTrue:[stackDelta := 1. ^141]. |
|
1475 |
(aSymbol == #pushBlockArg3) ifTrue:[stackDelta := 1. ^142]. |
|
1476 |
(aSymbol == #pushBlockArg4) ifTrue:[stackDelta := 1. ^143]. |
|
1477 |
||
1 | 1478 |
(aSymbol == #pushOuter1BlockArg) ifTrue:[stackDelta := 1. extra := #index. ^ 43]. |
1479 |
(aSymbol == #pushOuter2BlockArg) ifTrue:[stackDelta := 1. extra := #index. ^ 44]. |
|
0 | 1480 |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1481 |
(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
|
1482 |
(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
|
1483 |
(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
|
1484 |
(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
|
1485 |
(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
|
1486 |
(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
|
1487 |
"/ (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
|
1488 |
"/ (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
|
1489 |
"/ (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
|
1490 |
"/ (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
|
1491 |
"/ (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
|
1492 |
"/ (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
|
1493 |
(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
|
1494 |
(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
|
1495 |
(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
|
1496 |
(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
|
1497 |
(aSymbol == #plus1) ifTrue:[lineno := true. extraLiteral := #+. ^123]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1498 |
(aSymbol == #minus1) ifTrue:[lineno := true. extraLiteral := #-. ^124]. |
0 | 1499 |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1500 |
(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
|
1501 |
(aSymbol == #decMethodVar) ifTrue:[lineno := true. extraLiteral := #-. extra := #index. ^126]. |
0 | 1502 |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1503 |
(aSymbol == #eq0) ifTrue:[extraLiteral := #==. ^48]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1504 |
(aSymbol == #ne0) ifTrue:[extraLiteral := #~~. ^49]. |
0 | 1505 |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1506 |
(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
|
1507 |
(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
|
1508 |
(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
|
1509 |
(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
|
1510 |
"/ (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
|
1511 |
"/ (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
|
1512 |
(aSymbol == #value) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 151]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1513 |
(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
|
1514 |
(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
|
1515 |
(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
|
1516 |
"/ (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
|
1517 |
"/ (aSymbol == #rounded) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 159]. |
0 | 1518 |
(aSymbol == #mk0Block) ifTrue:[^ 156]. |
1519 |
(aSymbol == #mkNilBlock) ifTrue:[^ 157]. |
|
1520 |
||
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1521 |
(aSymbol == #gt0) ifTrue:[lineno := true. extraLiteral := #>. ^ 212]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1522 |
(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
|
1523 |
(aSymbol == #basicNew) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 211]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1524 |
(aSymbol == #new) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 213]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1525 |
(aSymbol == #basicNew:) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 214]. |
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1526 |
(aSymbol == #new:) ifTrue:[lineno := true. extraLiteral := aSymbol. ^ 215]. |
103 | 1527 |
|
217 | 1528 |
(aSymbol == #pushBlockVar1) ifTrue:[stackDelta := 1. ^ 232]. |
1529 |
(aSymbol == #pushBlockVar2) ifTrue:[stackDelta := 1. ^ 233]. |
|
1530 |
(aSymbol == #pushBlockVar3) ifTrue:[stackDelta := 1. ^ 234]. |
|
1531 |
(aSymbol == #storeBlockVar1) ifTrue:[stackDelta := -1. ^ 235]. |
|
1532 |
(aSymbol == #storeBlockVar2) ifTrue:[stackDelta := -1. ^ 236]. |
|
1533 |
(aSymbol == #storeBlockVar3) ifTrue:[stackDelta := -1. ^ 237]. |
|
1534 |
||
0 | 1535 |
(aSymbol == #falseJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 190]. |
1536 |
(aSymbol == #trueJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 191]. |
|
1537 |
(aSymbol == #nilJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 192]. |
|
1538 |
(aSymbol == #notNilJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 193]. |
|
1539 |
(aSymbol == #jumpabs) ifTrue:[extra := #absoffset. ^ 194]. |
|
1 | 1540 |
(aSymbol == #makeBlockabs) ifTrue:[stackDelta := 1. extra := #absoffsetNvarNarg. ^ 195]. |
0 | 1541 |
(aSymbol == #zeroJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 196]. |
1542 |
(aSymbol == #notZeroJumpabs) ifTrue:[stackDelta := -1. extra := #absoffset. ^ 197]. |
|
1 | 1543 |
(aSymbol == #eqJumpabs) ifTrue:[stackDelta := -2. extra := #absoffset. ^ 198]. |
1544 |
(aSymbol == #notEqJumpabs) ifTrue:[stackDelta := -2. extra := #absoffset. ^ 199]. |
|
0 | 1545 |
|
1546 |
(aSymbol == #pushThisContext) ifTrue:[stackDelta := 1. ^ 144]. |
|
1547 |
||
1466 | 1548 |
(aSymbol == #isNil) ifTrue:["extraLiteral := aSymbol. -- could be synthetic" ^ 188]. |
1549 |
(aSymbol == #notNil) ifTrue:["extraLiteral := aSymbol. -- could be synthetic" ^ 189]. |
|
425
b046a32edb08
remember &, | and not in literal array
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1550 |
(aSymbol == #not) ifTrue:[extraLiteral := aSymbol. lineno := true. ^ 179]. |
b046a32edb08
remember &, | and not in literal array
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1551 |
(aSymbol == #&) ifTrue:[extraLiteral := aSymbol. lineno := true. ^ 216]. |
b046a32edb08
remember &, | and not in literal array
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1552 |
(aSymbol == #|) ifTrue:[extraLiteral := aSymbol. lineno := true. ^ 217]. |
76 | 1553 |
|
117 | 1554 |
(aSymbol == #pushClassVarL) ifTrue:[stackDelta := 1. extra := #speciallitL. ^ 218]. |
1555 |
(aSymbol == #pushGlobalL) ifTrue:[stackDelta := 1. extra := #speciallitL. ^ 218]. |
|
1556 |
(aSymbol == #storeClassVarL) ifTrue:[extra := #speciallitL.stackDelta := -1. ^ 219]. |
|
1557 |
(aSymbol == #storeGlobalL) ifTrue:[extra := #speciallitL. stackDelta := -1. ^ 219]. |
|
1558 |
(aSymbol == #pushLitL) ifTrue:[stackDelta := 1. extra := #unsigned16. ^ 201]. |
|
1559 |
||
1560 |
(aSymbol == #sendL) ifTrue:[lineno := true. extra := #specialL. ^ 205]. |
|
1561 |
(aSymbol == #sendSelfL) ifTrue:[lineno := true. extra := #specialL. ^ 207]. |
|
1562 |
(aSymbol == #sendDropL) ifTrue:[lineno := true. extra := #specialL. ^ 204]. |
|
1563 |
(aSymbol == #superSendL) ifTrue:[lineno := true. extra := #specialL. ^ 206]. |
|
1564 |
(aSymbol == #hereSendL) ifTrue:[lineno := true. extra := #specialL. ^ 206]. |
|
106 | 1565 |
|
246
abf09d4821fe
new code for faster global pushes
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
1566 |
(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
|
1567 |
(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
|
1568 |
(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
|
1569 |
(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
|
1570 |
|
400
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
1571 |
(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
|
1572 |
(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
|
1573 |
(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
|
1574 |
(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
|
1575 |
(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
|
1576 |
(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
|
1577 |
(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
|
1578 |
(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
|
1579 |
(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
|
1580 |
(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
|
1581 |
|
217 | 1582 |
(aSymbol == #blockRef) ifTrue:[stackDelta := 0. ^ 238]. |
549 | 1583 |
(aSymbol == #over) ifTrue:[stackDelta := 1. ^ 6]. |
217 | 1584 |
|
0 | 1585 |
self error:'invalid code symbol'. |
1586 |
errorFlag := #Error |
|
117 | 1587 |
|
1588 |
"Modified: 3.9.1995 / 12:58:47 / claus" |
|
549 | 1589 |
"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
|
1590 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
1591 |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1592 |
checkForCommonCode:symbolicCodeArray |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1593 |
"hook to return the code for common code sequences. |
212
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1594 |
This reduces the in-memory number of byteArrays somewhat. |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1595 |
|
1095 | 1596 |
Not yet fully implemented - just an idea ... there is certainly more to do here |
212
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
1597 |
(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
|
1598 |
automatically in the background - or upon request ?)" |
199
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1599 |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1600 |
|sz insn1| |
199
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1601 |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1602 |
(sz := symbolicCodeArray size) == 2 ifTrue:[ |
933 | 1603 |
"/ |
1604 |
"/ a very common sequence: return the first literal |
|
1605 |
"/ |
|
1606 |
(insn1 := symbolicCodeArray at:1) == #pushLit1 ifTrue:[ |
|
1607 |
(symbolicCodeArray at:2) == #retTop ifTrue:[ |
|
1608 |
^ #[222 0] |
|
1609 |
] |
|
1610 |
] |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1611 |
]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1612 |
sz == 1 ifTrue:[ |
933 | 1613 |
"/ |
1095 | 1614 |
"/ other common sequences: return the receiver, nil, true or false |
933 | 1615 |
"/ |
1616 |
(insn1 := symbolicCodeArray at:1) == #retSelf ifTrue:[ |
|
1617 |
^ #[5] |
|
1618 |
]. |
|
1619 |
insn1 == #retNil ifTrue:[ |
|
1620 |
^ #[1] |
|
1621 |
]. |
|
1622 |
insn1 == #retTrue ifTrue:[ |
|
1623 |
^ #[2] |
|
1624 |
]. |
|
1625 |
insn1 == #retFalse ifTrue:[ |
|
1626 |
^ #[3] |
|
1627 |
]. |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1628 |
]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
1629 |
^ nil |
199
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1630 |
! |
1b3b350a3f59
moved bytecode query methods into compiler;
Claus Gittinger <cg@exept.de>
parents:
197
diff
changeset
|
1631 |
|
141 | 1632 |
checkForPrimitiveCode:nr |
1633 |
"return the code for an ST-80 primitive method. |
|
1634 |
Since many primitives available on ST-80 should also be available |
|
1635 |
somewhere in ST/X, this may work for many primitive numbers. |
|
1636 |
However, more information is needed and more things to be added below. |
|
1637 |
||
1638 |
This was added to allow emulation of (some) ST-80 |
|
1639 |
primitives (to fileIn RemoteInvocation & Monitor41 packages)" |
|
1640 |
||
1641 |
|cls sel| |
|
1642 |
||
1643 |
(nr == 75) ifTrue:[ cls := Object. sel := #identityHash ]. |
|
1644 |
(nr == 110) ifTrue:[ cls := Object. sel := #== ]. |
|
1645 |
(nr == 111) ifTrue:[ cls := Object. sel := #class ]. |
|
1228 | 1646 |
|
141 | 1647 |
" |
1228 | 1648 |
should add more here, to be able to fileIn ST-80 and Squeak methods |
141 | 1649 |
containing primitive calls (who gives me the numbers ... ?) |
512 | 1650 |
mhmh - got some ..." |
1228 | 1651 |
|
1652 |
"/ ST80 and Squeak common: |
|
1653 |
"/ 18 Number @ |
|
1654 |
"/ 41 Float + |
|
1655 |
"/ 42 Float - |
|
1656 |
"/ 49 Float * |
|
1657 |
"/ 50 Float / |
|
1658 |
"/ 52 Float fractionPart |
|
1659 |
"/ 54 Float timesTwoPower: |
|
1660 |
||
907 | 1661 |
"/ ST80: |
1662 |
"/ |
|
1228 | 1663 |
"/ 18 Number @ |
1664 |
"/ 21 LargePositiveInteger + |
|
1665 |
"/ 22 LargePositiveInteger - |
|
1666 |
"/ 29 LargePositiveInteger * |
|
1667 |
"/ 30 LargePositiveInteger / |
|
1668 |
"/ 31 LargePositiveInteger \\ |
|
1669 |
"/ 32 LargePositiveInteger // |
|
1670 |
"/ 34 LargePositiveInteger bitAnd: |
|
1671 |
"/ 35 LargePositiveInteger bitOr: |
|
1672 |
"/ 36 LargePositiveInteger bitXor: |
|
1673 |
"/ 37 LargePositiveInteger bitShift: |
|
1674 |
"/ 40 SmallInteger asFloat |
|
1675 |
"/ 41 Float + |
|
1676 |
"/ 42 Float - |
|
1677 |
"/ 49 Float * |
|
1678 |
"/ 50 Float / |
|
1679 |
"/ 52 Float fractionPart |
|
1680 |
"/ 54 Float timesTwoPower: |
|
1681 |
"/ 70 Behavior basicNew |
|
1682 |
"/ 71 Behavior basicNew: |
|
1683 |
"/ 89 Behavior flushVMmethodCache |
|
1684 |
"/ 91 InputState primCursorLocPut: |
|
512 | 1685 |
"/ 105 ByteArray replaceElementsFrom:to:withByteArray:startingAt: |
1686 |
"/ 223 ByteString = |
|
1687 |
"/ 306 ObjectMemory class sizesAtStartup |
|
1688 |
"/ 307 ObjectMemory class defaultSizesAtStartup |
|
1689 |
"/ 309 ObjectMemory class defaultThresholds |
|
1690 |
"/ 326 ObjectMemory class getMemoryUsageAndZeroFragmentationStatisticsIf: |
|
1691 |
"/ 395 ExternalInterface ??? |
|
1692 |
"/ 400 FormBitmap class newWidth:height: |
|
1693 |
"/ 414 TwoByteString replaceElementsFrom:to:withTwoByteString:startingAt: |
|
1694 |
"/ 415 TwoByteString = |
|
1695 |
"/ 417 String trueCompare: |
|
1696 |
"/ 418 ByteString nextIndexOf:from:to: |
|
1697 |
"/ 419 ByteString prevIndexOf:from:to: |
|
1698 |
"/ 422 WeakArray indexOf:replaceWith:startingAt:stoppingAt: |
|
1699 |
"/ 522 Behavior flushVMmethodCacheEntriesFor: |
|
1700 |
"/ 524 Context nFromVPC: |
|
1701 |
"/ 525 Context vFromNPC: |
|
1702 |
"/ 532 Object shallowCopy |
|
1703 |
"/ 536 Behavior atomicAllInstances |
|
1704 |
"/ 537 Object allOwners |
|
1705 |
"/ 538 ObjectMemory class allObjects |
|
1706 |
"/ 546 UninterpretedBytes longAt: |
|
1707 |
"/ 548 UninterpretedBytes floatAt: |
|
1708 |
"/ 550 UninterpretedBytes longFloatAt: |
|
1709 |
"/ 544 UninterpretedBytes unsignedLongAt: |
|
1710 |
"/ 559 ByteArray replaceBytesFrom:to:with:startingAt: |
|
1711 |
"/ 560 Double class fromNumber: |
|
1712 |
"/ 561 Double + |
|
1713 |
"/ 562 Double - |
|
1714 |
"/ 569 Double * |
|
1715 |
"/ 570 Double / |
|
1716 |
"/ 572 Double fractionPart |
|
1717 |
"/ 574 Double timesTwoPower: |
|
1718 |
"/ 576 Double sin |
|
1719 |
"/ 577 Double cos |
|
1720 |
"/ 578 Double tan |
|
1721 |
"/ 579 Double arcSin |
|
1722 |
"/ 580 Double arcCos |
|
1723 |
"/ 581 Double arcTan |
|
1724 |
"/ 582 Double sqrt |
|
1725 |
"/ 583 Double ln |
|
1726 |
"/ 584 Double exp |
|
1727 |
"/ 585 Double raisedTo: |
|
1728 |
"/ 587 Double floorLog10 |
|
1729 |
"/ 588 Double asFloat |
|
1730 |
"/ 591 Float cos |
|
1731 |
"/ 592 Float arcSin |
|
1732 |
"/ 593 Float arcCos |
|
1733 |
"/ 600 Float sin |
|
1734 |
"/ 601 Float tan |
|
1735 |
"/ 602 Float arcTan |
|
1736 |
"/ 603 Float sqrt |
|
1737 |
"/ 604 Float ln |
|
1738 |
"/ 605 Float exp |
|
1739 |
"/ 606 Float raisedTo: |
|
1740 |
"/ 609 Float floorLog10 |
|
1741 |
"/ 610 Filename getDatesErrInto: |
|
1742 |
"/ 614 DosFilename class getVolumes |
|
1743 |
"/ 615 UnixFilename primSetProtection:errInto: |
|
1744 |
"/ 616 UnixFilename class primSetCreationMask:errInto: |
|
1745 |
"/ 617 UnixFilename primGetProtectionErrInto: |
|
1746 |
"/ 620 Filename listDirectoryErrInto: |
|
1747 |
"/ 621 Filename deleteErrInto: |
|
1748 |
"/ 622 Filename isDirectoryErrInto: |
|
1749 |
"/ 623 Filename renameTo:errInto: |
|
1750 |
"/ 624 Filename makeDirectoryErrInto: |
|
1751 |
"/ 625 Filename class defaultDirectoryErrInto: |
|
1752 |
"/ 626 Filename fileSizeErrInto: |
|
1753 |
"/ 627 Filename isWritableErrInto: |
|
1754 |
"/ 628 Filename setWritable:errInto: |
|
1755 |
"/ 629 Filename existsErrInto: |
|
1756 |
"/ 630 SocketAccessor setOptionsLevel:name:value: |
|
1757 |
"/ 631 SocketAccessor getOptionsLevel:name: |
|
1758 |
"/ 632 SocketAccessor primGetName |
|
1759 |
"/ 633 SocketAccessor primGetPeer |
|
1760 |
"/ 634 SocketAccessor atMark |
|
1761 |
"/ 637 UnixTtyAccessor primGetOptions |
|
1762 |
"/ 638 UnixTtyAccessor setOptions: |
|
1763 |
"/ 639 UnixRealTtyAccessor modemBits:mask:sendBreak: |
|
1764 |
"/ 640 IPSocketAddress class primHostAddressByName: |
|
1765 |
"/ 641 IPSocketAddress class netAddressByName: |
|
1766 |
"/ 642 IPSocketAddress class protocolNumberByName: |
|
1767 |
"/ 643 IPSocketAddress class servicePortByName: |
|
1768 |
"/ 645 IPSocketAddress class primHostNameByAddress: |
|
1769 |
"/ 646 IPSocketAddress class netNameByAddress: |
|
1770 |
"/ 647 IPSocketAddress class protocolNameByNumber: |
|
1771 |
"/ 648 IPSocketAddress class serviceNameByPort: |
|
1772 |
"/ 649 SocketAccessor class getHostname |
|
1773 |
"/ 650 Filename primOpenFileNamed:direction:creation:errorInto: |
|
1774 |
"/ 651 IOAccessor primClose |
|
1775 |
"/ 652 UnixPipeAccessor class primPipeErrorInto: |
|
1776 |
"/ 653 UnixPseudoTtyAccessor class primPtyErrorInto: |
|
1777 |
"/ 654 SocketAccessor class primPairErrorInto: |
|
1778 |
"/ 655 UnixRealTtyAccessor class primOpen:errInto: |
|
1779 |
"/ 660 IOAccessor primReadInto:startingAt:for: |
|
1780 |
"/ 661 IOAccessor primWriteFrom:startingAt:for: |
|
1781 |
"/ 662 IOAccessor primSeekTo: |
|
1782 |
"/ 664 IOAccessor truncateTo: |
|
1783 |
"/ 665 DosDiskFileAccessor commit |
|
1784 |
"/ 666 IOAccessor primGetSize |
|
1785 |
"/ 667 MacDiskFileAccessor lock:for: |
|
1786 |
"/ 669 UnixIOAccessor bytesForRead |
|
1787 |
"/ 670 SocketAccessor class primFamily:type:protocol:errInto: |
|
1788 |
"/ 671 SocketAccessor primAccept |
|
1789 |
"/ 672 SocketAccessor bindTo: |
|
1790 |
"/ 673 SocketAccessor listenFor: |
|
1791 |
"/ 674 SocketAccessor primConnectTo: |
|
1792 |
"/ 675 SocketAccessor primReceiveFrom:buffer:start:for:flags: |
|
1793 |
"/ 676 SocketAccessor sendTo:buffer:start:for:flags: |
|
1794 |
"/ 677 SocketAccessor shutdown: |
|
1795 |
"/ 681 UnixProcess class primFork:arguments:environment:descriptors:errorTo: |
|
1796 |
"/ 682 UnixProcess class reapOne |
|
1797 |
"/ 683 UnixProcess kill: |
|
1798 |
"/ 690 CEnvironment class primEnvironment |
|
1799 |
"/ 697 OSErrorHolder class errorDescriptionFor: |
|
1800 |
"/ 697 ErrorHolder class errorDescriptionFor: |
|
1801 |
"/ 698 SocketAccessor class primInit: |
|
1802 |
"/ 700 ParagraphEditor class getExternalSelectionOrNil: |
|
1803 |
"/ 701 ParagraphEditor class putExternalSelection:with: |
|
1804 |
"/ 705 Screen ringBell |
|
1805 |
"/ 706 Cursor class primOpenImage:mask:hotSpotX:hotSpotY:background:foreground: |
|
1806 |
"/ 707 Cursor primBeCursor |
|
1807 |
"/ 708 Cursor primFreeCursor |
|
1808 |
"/ 772 SoundManager enumerateSoundsFrom: |
|
1809 |
"/ 773 SoundManager playSoundFrom:sound: |
|
1810 |
"/ 774 SoundManager simpleBeep: |
|
1811 |
"/ 775 Pixmap primFromClipboard |
|
1812 |
"/ 776 Pixmap toClipboard |
|
1813 |
"/ 808 Context findNextMarkedUpTo: |
|
1814 |
"/ 809 Context terminateTo: |
|
1815 |
"/ 710 DosTtyAccessor class primOpen:errInto: |
|
1816 |
"/ 711 DosTtyAccessor primClose |
|
1817 |
"/ 712 DosTtyAccessor primReadInto:startingAt:for: |
|
1818 |
"/ 713 DosTtyAccessor primWriteFrom:startingAt:for: |
|
1819 |
"/ 714 DosTtyAccessor primGetOptions |
|
1820 |
"/ 715 DosTtyAccessor primSetOptions: |
|
1821 |
"/ 716 DosTtyAccessor setSem:forWrite: |
|
1822 |
"/ 717 DosTtyAccessor modemBits:mask:sendBreak: |
|
1823 |
"/ 750 MacFilename class getVolumes |
|
1824 |
"/ 752 MacFilename primSetCreator:type:errInto: |
|
1825 |
"/ 754 MacIOAccessor class getAccessories |
|
1826 |
"/ 755 MacIOAccessor class runAccessory: |
|
1827 |
"/ 756 MacOSFilename class getFileTypes:errInto: |
|
1828 |
"/ 757 MacOSFilename putFileWithPrompt:errInto: |
|
1829 |
"/ 758 MacOSFilename getFileInfoErrInto: |
|
1830 |
"/ 759 MacOSFilename stringFromVRefErrInto: |
|
1831 |
"/ 761 MacOSFilename class getStartupFilesErrInto: |
|
1832 |
"/ 770 DosFilename printPSFileErrInto: |
|
1833 |
"/ 771 DosFilename printTextFileErrInto: |
|
1834 |
"/ 780 MacTtyAccessor class primOpen:errInto: |
|
1835 |
"/ 781 MacTtyAccessor primClose |
|
1836 |
"/ 782 MacTtyAccessor primReadInto:startingAt:for: |
|
1837 |
"/ 783 MacTtyAccessor primWriteFrom:startingAt:for: |
|
1838 |
"/ 786 MacTtyAccessor primGetOptions |
|
1839 |
"/ 787 MacTtyAccessor setOptions: |
|
1840 |
"/ 788 MacTtyAccessor primBreak: |
|
1841 |
"/ 790 MacTtyAccessor primGetStatus |
|
1842 |
"/ 792 MacTtyAccessor setSem:forWrite: |
|
1843 |
"/ 793 MacTtyAccessor primAssertDTR: |
|
1844 |
"/ 794 MacTtyAccessor primGetSize |
|
1845 |
"/ 933 ByteArray copyBitsClippedStride:... |
|
1846 |
"/ 934 ByteArray tileBits32By32Stride:... |
|
1847 |
"/ 935 Screen dragShape:... |
|
1848 |
"/ 936 Screen resizeRectangle... |
|
1849 |
"/ 937 Screen displayShape:... |
|
1850 |
"/ 938 Window resizeFromUserWithMinimum:maximum: |
|
1851 |
"/ 940 Window primClose |
|
1852 |
"/ 942 Window getDimensions |
|
1853 |
"/ 943 Window moveTo:resize: |
|
1854 |
"/ 944 Window primMap |
|
1855 |
"/ 945 Window class primNewAt:extent:min:max:windowType: |
|
1856 |
"/ 946 Screen flush |
|
1857 |
"/ 947 Screen getScreenDimensions |
|
1858 |
"/ 948 Window unmap |
|
1859 |
"/ 950 Screen sync |
|
1860 |
"/ 951 Window setIconMask: |
|
1861 |
"/ 952 Window label:iconLabel: |
|
1862 |
"/ 953 Window raise |
|
1863 |
"/ 954 Window lower |
|
1864 |
"/ 955 Screen queryStackingOrder |
|
1865 |
"/ 956 TextMeasurer primScanCharactersFrom:... |
|
1866 |
"/ 957 GraphicsContext displayMappedString:from:to:at:withMap: |
|
1867 |
"/ 959 Window setBackgroundPixel: |
|
1868 |
"/ 960 Screen class primOpen: |
|
1869 |
"/ 965 UnmappableSurface contentsOfAreaOriginX:y:width:height: |
|
1870 |
"/ 966 Window contentsOfAreaOriginX:y:width:height: |
|
1871 |
"/ 967 Screen contentsOfAreaOriginX:y:width:height: |
|
1872 |
"/ 970 Mask class primExtent:depth: |
|
1873 |
"/ 971 Mask privateClose |
|
1874 |
"/ 976 GraphicsContext displayCharacterOfIndex:at: |
|
1875 |
"/ 978 DeviceFont class listFonts |
|
1876 |
"/ 979 DeviceFont primLoadFont |
|
1877 |
"/ 980 DeviceFont primUnLoadFont |
|
1878 |
"/ 985 GraphicsContext displayLineFrom:to: |
|
1879 |
"/ 986 GraphicsContext displayPolyline:at: |
|
1880 |
"/ 987 GraphicsContext displayPolygon:at: |
|
1881 |
"/ 988 GraphicsContext primDisplayRectangleOrigin:extent: |
|
1882 |
"/ 989 GraphicsContext primDisplayRectangularBorderOrigin:extent: |
|
1883 |
"/ 990 GraphicsContext primDisplayArcBBoxOrigin:extent:startAngle:sweepAngle: |
|
1884 |
"/ 991 GraphicsContext primDisplayWedgeBBoxOrigin:extent:startAngle:sweepAngle: |
|
1885 |
"/ 992 GraphicsContext displayMask:at:" |
|
1886 |
"/ 993 GraphicsContext displayUninterpretedImageBits:at: |
|
1887 |
"/ 994 GraphicsContext primCopyRectangularAreaExtent:from:sourceOffset:destinationOffset: |
|
1888 |
"/ 995 GraphicsContext primCopyMaskedArea:from:sourceOffset:destinationOffset: |
|
1889 |
"/ 996 Screen deviceColormap |
|
1890 |
"/ 998 GraphicsContext displayUninterpretedMonoImageBits:foreground:background:at: |
|
1891 |
||
907 | 1892 |
"/ Squeak: |
1893 |
"/ |
|
1894 |
"/ 1 + |
|
1895 |
"/ 2 - |
|
1896 |
"/ 3 < |
|
1897 |
"/ 4 > |
|
1898 |
"/ 5 <= |
|
1899 |
"/ 6 >= |
|
1900 |
"/ 7 = |
|
1901 |
"/ 8 ~= |
|
1902 |
"/ 9 * |
|
1903 |
"/ 10 / |
|
1904 |
"/ 11 mod: |
|
1905 |
"/ 12 div: |
|
1906 |
"/ 13 quo: |
|
1907 |
"/ 14 bitAnd: |
|
1908 |
"/ 15 bitOr: |
|
1909 |
"/ 16 bitXor: |
|
1910 |
"/ 17 bitShift: |
|
1911 |
"/ 18 @ |
|
1912 |
"/ 19 |
|
1913 |
"/ ... |
|
1914 |
"/ 39 fail - reserved/unimplemented |
|
1915 |
"/ 40 asFloat |
|
1916 |
"/ 41 Float + |
|
1917 |
"/ 42 Float - |
|
1918 |
"/ 43 Float < |
|
1919 |
"/ 44 Float > |
|
1920 |
"/ 45 Float <= |
|
1921 |
"/ 46 Float >= |
|
1922 |
"/ 47 Float = |
|
1923 |
"/ 48 Float ~= |
|
1924 |
"/ 49 Float * |
|
1925 |
"/ 50 Float / |
|
1926 |
"/ 51 Float truncated |
|
1927 |
"/ 52 Float fractionalPart |
|
1928 |
"/ 53 Float exponent |
|
1929 |
"/ 54 Float timeTwoPower |
|
1930 |
"/ 55 Float sqrt |
|
1931 |
"/ 56 Float sine |
|
1932 |
"/ 57 Float arcTan |
|
1933 |
"/ 58 Float logN |
|
1934 |
"/ 59 Float exp |
|
1935 |
"/ 60 at: |
|
1936 |
"/ 61 at:put: |
|
1937 |
"/ 62 size |
|
1938 |
"/ 63 stringAt: |
|
1939 |
"/ 64 stringAt:put: |
|
1940 |
"/ 65 next |
|
1941 |
"/ 66 nextPut: |
|
1942 |
"/ 67 atEnd |
|
1943 |
"/ 68 objectAt: |
|
1944 |
"/ 69 objectAt:put: |
|
1945 |
"/ 70 new |
|
1946 |
"/ 71 new: |
|
1947 |
"/ 72 becomeOneWay |
|
1948 |
"/ 73 instVarAt: |
|
1949 |
"/ 74 instVarAtPut: |
|
1950 |
"/ 75 asOop |
|
1951 |
"/ 76 storeStackP |
|
1952 |
"/ 77 someInstance |
|
1953 |
"/ 78 nextInstance |
|
1954 |
"/ 79 newMethod |
|
1955 |
"/ 80 blockCopy |
|
1956 |
"/ 81 value |
|
1957 |
"/ 82 valueWithArgs |
|
1958 |
"/ 83 perform |
|
1959 |
"/ 84 performWithArgs |
|
1960 |
"/ 85 signal |
|
1961 |
"/ 86 wait |
|
1962 |
"/ 87 resume |
|
1963 |
"/ 88 suspend |
|
1964 |
"/ 89 flushCache |
|
1965 |
"/ 90 mousePoint |
|
1966 |
"/ 91 fail/unimplemented/reserved |
|
1967 |
"/ 92 fail/unimplemented/reserved |
|
1968 |
"/ 93 inputSemaphore |
|
1969 |
"/ 94 fail/unimplemented/reserved |
|
1970 |
"/ 95 inputWord |
|
1971 |
"/ 96 copyBits |
|
1972 |
"/ 97 snapShot |
|
1973 |
"/ 98 fail/unimplemented/reserved |
|
1974 |
"/ 99 fail/unimplemented/reserved |
|
1975 |
"/ 100 fail/unimplemented/reserved |
|
1976 |
"/ 101 beCursor |
|
1977 |
"/ 102 beDisplay |
|
1978 |
"/ 103 scanCharacters |
|
1979 |
"/ 104 drawLoop |
|
1980 |
"/ 105 stringReplace |
|
1981 |
"/ 106 screenSize |
|
1982 |
"/ 107 mouseButtons |
|
1983 |
"/ 108 kbdNext |
|
1984 |
"/ 109 kbdPeek |
|
1985 |
"/ 110 equivalent |
|
1986 |
"/ 111 class |
|
1987 |
"/ 112 bytesLeft |
|
1988 |
"/ 113 quit |
|
1989 |
"/ 114 exitToDebugger |
|
1990 |
"/ 115 fail/unimplemented/reserved |
|
1991 |
"/ 116 flushCacheByMethod |
|
1992 |
"/ 117 externalCall |
|
1993 |
"/ 118 doPrimitiveWithArg |
|
1994 |
"/ 119 flushCacheSelective |
|
1995 |
"/ 120 fail/unimplemented/reserved |
|
1996 |
"/ 121 imageName |
|
1997 |
"/ 122 noop |
|
1998 |
"/ 123 fail/unimplemented/reserved |
|
1999 |
"/ 124 lowSpaceSemaphore |
|
2000 |
"/ 125 signalAtBytesLeft |
|
2001 |
"/ 126 deferDisplayUpdate |
|
2002 |
"/ 127 showDisplayRect |
|
2003 |
"/ 128 arrayBecome |
|
2004 |
"/ 129 specialObjectsOop |
|
2005 |
"/ 130 fullGC |
|
2006 |
"/ 131 incrementalGC |
|
2007 |
"/ 132 objectPointsTo |
|
2008 |
"/ 133 setInterruptKey |
|
2009 |
"/ 134 interruptSemaphore |
|
2010 |
"/ 135 millisecondClock |
|
2011 |
"/ 136 signalAtMilliseconds |
|
2012 |
"/ 137 secondsClock |
|
2013 |
"/ 138 someObject |
|
2014 |
"/ 139 nextObject |
|
2015 |
"/ 140 beep |
|
2016 |
"/ 141 clipboardText |
|
2017 |
"/ 142 vmPath |
|
2018 |
"/ 143 shortAt |
|
2019 |
"/ 144 shortAtPut |
|
2020 |
"/ 145 constantFill |
|
2021 |
"/ 146 readJoystick |
|
2022 |
"/ 147 warpBits |
|
2023 |
"/ 148 clone |
|
2024 |
"/ 149 getAttribute |
|
2025 |
"/ 150 fileAtEnd |
|
2026 |
"/ 151 fileClose |
|
2027 |
"/ 152 fileGetPosition |
|
2028 |
"/ 153 fileOpen |
|
2029 |
"/ 154 fileRead |
|
2030 |
"/ 155 fileSetPosition |
|
2031 |
"/ 156 fileDelete |
|
2032 |
"/ 157 fileSize |
|
2033 |
"/ 158 fileWrite |
|
2034 |
"/ 159 fileRename |
|
2035 |
"/ 160 directoryCreate |
|
2036 |
"/ 161 directoryDelimiter |
|
2037 |
"/ 162 directoryLookup |
|
2038 |
"/ 163 fail |
|
2039 |
"/ 164 fail |
|
2040 |
"/ 165 fail |
|
2041 |
"/ 166 fail |
|
2042 |
"/ 167 fail |
|
2043 |
"/ 168 fail |
|
2044 |
"/ 169 directorySetMacType |
|
2045 |
"/ 170 soundStart |
|
2046 |
"/ 171 soundStartWithSemaphore |
|
2047 |
"/ 172 soundStop |
|
2048 |
"/ 173 soundAvailableSpace |
|
2049 |
"/ 174 soundPlaySamples |
|
2050 |
"/ 175 soundPlaySilence |
|
2051 |
"/ 176 waveTableSoundmixSampleCountIntoStarrtingAtpan |
|
2052 |
"/ 177 fmSoundmixSampleCountintostartingAtpan |
|
2053 |
"/ 178 pluckedSoundmixSampleCountintostartingAtpan |
|
2054 |
"/ 179 sampledSoundmixSampleCountintostartingAtpan |
|
2055 |
"/ 180 fmSoundmixSampleCountintostartingAtleftVolrightVol |
|
2056 |
"/ 181 pluckedSoundmixSampleCountintostartingAtleftVolrightVol |
|
2057 |
"/ 182 sampledSoundmixSampleCountintostartingAtleftVolrightVol |
|
2058 |
"/ 183 reverbSoundapplyReverbTostartingAtcount |
|
2059 |
"/ 184 loopedSampledSoundmixSampleCountintostartingAtleftVolrightVol |
|
2060 |
"/ 185 fail |
|
2061 |
"/ 186 fail |
|
2062 |
"/ 187 fail |
|
2063 |
"/ 188 fail |
|
2064 |
"/ 189 soundInsertSamples |
|
2065 |
"/ 190 soundStartRecording |
|
2066 |
"/ 191 soundStopRecording |
|
2067 |
"/ 192 soundGetRecordingSampleRate |
|
2068 |
"/ 193 soundRecordSamples |
|
2069 |
"/ 194 soundSetRecordLevel |
|
2070 |
"/ 195 fail |
|
2071 |
"/ 196 fail |
|
2072 |
"/ 197 fail |
|
2073 |
"/ 198 fail |
|
2074 |
"/ 199 fail |
|
2075 |
"/ 200 initializeNetwork |
|
2076 |
"/ 201 resolverStartNameLookup |
|
2077 |
"/ 202 resolverNameLookupResult |
|
2078 |
"/ 203 resolverStartAddressLookup |
|
2079 |
"/ 204 resolverAddressLookupResult |
|
2080 |
"/ 205 resolverAbortLookup |
|
2081 |
"/ 206 resolverLocalAddress |
|
2082 |
"/ 207 resolverStatus |
|
2083 |
"/ 208 resolverError |
|
2084 |
"/ 209 socketCreate |
|
2085 |
"/ 210 socketDestroy |
|
2086 |
"/ 211 socketConnectionStatus |
|
2087 |
"/ 212 socketError |
|
2088 |
"/ 213 socketLocalAddress |
|
2089 |
"/ 214 socketLocalPort |
|
2090 |
"/ 215 socketRemoteAddress |
|
2091 |
"/ 216 socketRemotePort |
|
2092 |
"/ 217 socketConnectToPort |
|
2093 |
"/ 218 socketListenOnPort |
|
2094 |
"/ 219 socketCloseConnection |
|
2095 |
"/ 220 socketAbortConnection |
|
2096 |
"/ 221 socketReceiveDataBufCount |
|
2097 |
"/ 222 socketReceiveDataAvailable |
|
2098 |
"/ 223 socketSendDataBufCount |
|
2099 |
"/ 224 socketSendDone |
|
2100 |
"/ 225 fail |
|
2101 |
"/ 226 fail |
|
2102 |
"/ 227 fail |
|
2103 |
"/ 228 fail |
|
2104 |
"/ 229 fail |
|
2105 |
"/ 230 relinquishProcessor |
|
2106 |
"/ 231 forceDisplayUpdate |
|
2107 |
"/ 232 formPrint |
|
2108 |
"/ 233 setFullScreen |
|
2109 |
"/ 234 bitmapdecompressfromByteArrayat |
|
2110 |
"/ 235 stringcomparewithcollated |
|
2111 |
"/ 236 sampledSoundconvert8bitSignedFromto16Bit |
|
2112 |
"/ 237 bitmapcompresstoByteArray |
|
2113 |
"/ 238 serialPortOpen |
|
2114 |
"/ 239 serialPortClose |
|
2115 |
"/ 240 serialPortWrite |
|
2116 |
"/ 241 serialPortRead |
|
2117 |
"/ 242 fail |
|
2118 |
"/ 243 stringtranslatefromtotable |
|
2119 |
"/ 244 stringfindFirstInStringinSetstartingAt |
|
2120 |
"/ 245 stringindexOfAsciiinStringstartingAt |
|
2121 |
"/ 246 stringfindSubstringinstartingAtmatchTable |
|
2122 |
"/ 247 fail |
|
2123 |
"/ 248 fail |
|
2124 |
"/ 249 fail |
|
2125 |
"/ 250 clearProfile |
|
2126 |
"/ 251 dumpProfile |
|
2127 |
"/ 252 startProfiling |
|
2128 |
"/ 253 stopProfiling |
|
2129 |
"/ 254 vmParameter |
|
2130 |
"/ 255 instVarsPutFromStack |
|
2131 |
"/ 256 pushSelf |
|
2132 |
"/ 257 pushTrue |
|
2133 |
"/ 258 pushFalse |
|
2134 |
"/ 259 pushNil |
|
2135 |
"/ 260 pushMinusOne |
|
2136 |
"/ 261 pushZero |
|
2137 |
"/ 262 pushOne |
|
2138 |
"/ 263 pushTwo |
|
2139 |
"/ 264 loadInstVar |
|
2140 |
"/ .. loadInstVar |
|
2141 |
"/ 519 loadInstVar |
|
2142 |
"/ 520 fail |
|
2143 |
"/ 521 MIDIClosePort |
|
2144 |
"/ 522 MIDIGetClock |
|
2145 |
"/ 523 MIDIGetPortCount |
|
2146 |
"/ 524 MIDIGetPortDirectionality |
|
2147 |
"/ 525 MIDIGetPortName |
|
2148 |
"/ 526 MIDIOpenPort |
|
2149 |
"/ 527 MIDIParameterGetOrSet |
|
2150 |
"/ 528 MIDIRead |
|
2151 |
"/ 529 MIDIWrite |
|
2152 |
"/ 530 fail |
|
2153 |
"/ .. fail |
|
2154 |
"/ 539 fail |
|
2155 |
"/ 540 asyncFileClose |
|
2156 |
"/ 541 asyncFileOpen |
|
2157 |
"/ 542 asyncFileReadResult |
|
2158 |
"/ 543 asyncFileReadStart |
|
2159 |
"/ 544 asyncFileWriteResult |
|
2160 |
"/ 545 asyncFileWriteStart |
|
2161 |
"/ 546 fail |
|
2162 |
"/ .. |
|
2163 |
"/ 700 fail |
|
2164 |
||
141 | 2165 |
cls notNil ifTrue:[ |
907 | 2166 |
^ (cls compiledMethodAt:sel) code |
141 | 2167 |
]. |
2168 |
^ nil |
|
2169 |
! |
|
2170 |
||
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2171 |
createMethod |
429 | 2172 |
|newMethod| |
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2173 |
|
1094
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
2174 |
newMethod := self methodClass new:(litArray size). |
292
163651658aee
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
287
diff
changeset
|
2175 |
litArray notNil ifTrue:[ |
1094
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
2176 |
"/ fixup CheapBlocks method-field in literal array, |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
2177 |
litArray do:[:aLiteral | |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
2178 |
(aLiteral isMemberOf:CheapBlock) ifTrue:[ |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
2179 |
aLiteral setMethod:newMethod. |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
2180 |
] |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
2181 |
]. |
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
2182 |
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
|
2183 |
]. |
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2184 |
|
594
11ae33ac9b34
finally replaced all sends of #numberOfMethodVars with #numerOfVars
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2185 |
newMethod numberOfVars:(self numberOfMethodVars + (maxNumTemp ? 0)). |
11ae33ac9b34
finally replaced all sends of #numberOfMethodVars with #numerOfVars
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2186 |
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
|
2187 |
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
|
2188 |
|
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2189 |
primitiveResource notNil ifTrue:[ |
1094
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
2190 |
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
|
2191 |
]. |
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2192 |
|
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2193 |
^ newMethod |
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2194 |
|
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2195 |
"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
|
2196 |
"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
|
2197 |
"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
|
2198 |
! |
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
2199 |
|
141 | 2200 |
genByteCodeFrom:symbolicCodeArray |
2201 |
"convert symbolicCode into bytecodes" |
|
2202 |
||
2203 |
|symIndex "{Class: SmallInteger }" |
|
2204 |
codeSize "{Class: SmallInteger }" |
|
2205 |
symCodeSize "{Class: SmallInteger }" |
|
429 | 2206 |
index nextSym addr |
141 | 2207 |
codeSymbol nargs needRetry |
429 | 2208 |
stackDepth relocInfo level nvars round| |
141 | 2209 |
|
2210 |
symbolicCodeArray isNil ifTrue:[^ self]. |
|
2211 |
||
2212 |
round := 0. |
|
2213 |
needRetry := true. |
|
2214 |
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
|
2215 |
ShareCode ifTrue:[ |
1133 | 2216 |
codeBytes := self checkForCommonCode:symbolicCodeArray. |
2217 |
codeBytes notNil ifTrue:[ |
|
2218 |
^ self |
|
2219 |
]. |
|
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
|
2220 |
]. |
141 | 2221 |
codeSize := symCodeSize. |
2222 |
||
2223 |
[needRetry] whileTrue:[ |
|
1133 | 2224 |
stackDepth := 0. |
2225 |
maxStackDepth := 0. |
|
2226 |
||
2227 |
codeBytes := ByteArray uninitializedNew:codeSize. |
|
2228 |
relocInfo := Array basicNew:(codeSize + 1). |
|
2229 |
symIndex := 1. |
|
2230 |
codeIndex := 1. |
|
2231 |
||
2232 |
needRetry := false. |
|
2233 |
round := round + 1. |
|
2234 |
||
2235 |
[symIndex <= symCodeSize] whileTrue:[ |
|
2236 |
relocInfo at:symIndex put:codeIndex. |
|
2237 |
||
2238 |
codeSymbol := symbolicCodeArray at:symIndex. |
|
2239 |
symIndex := symIndex + 1. |
|
2240 |
stackDelta := 0. |
|
2241 |
extra := extraLiteral := nil. |
|
2242 |
lineno := false. |
|
2243 |
||
2244 |
self appendByteCodeFor:codeSymbol. |
|
2245 |
||
2246 |
extraLiteral notNil ifTrue:[ |
|
2247 |
self addLiteral:extraLiteral |
|
2248 |
]. |
|
2249 |
||
2250 |
lineno ifTrue:[ |
|
2251 |
self appendByte:((symbolicCodeArray at:symIndex) min:255). |
|
2252 |
symIndex := symIndex + 1. |
|
2253 |
codeSymbol == #lineno16 ifTrue:[ |
|
2254 |
self appendByte:((symbolicCodeArray at:symIndex) min:255). |
|
2255 |
symIndex := symIndex + 1 |
|
2256 |
] |
|
2257 |
]. |
|
2258 |
||
2259 |
extra notNil ifTrue:[ |
|
2260 |
nextSym := symbolicCodeArray at:symIndex. |
|
2261 |
||
2262 |
(extra == #number) ifTrue:[ |
|
2263 |
index := nextSym. |
|
2264 |
symIndex := symIndex + 1. |
|
2265 |
self appendSignedByte:index |
|
2266 |
||
2267 |
] ifFalse:[ (extra == #number16) ifTrue:[ |
|
2268 |
index := nextSym. |
|
2269 |
symIndex := symIndex + 2. |
|
2270 |
self appendSignedWord:index |
|
2271 |
||
2272 |
] ifFalse:[ (extra == #unsigned16) ifTrue:[ |
|
2273 |
index := nextSym. |
|
2274 |
symIndex := symIndex + 2. |
|
2275 |
self appendWord:index |
|
2276 |
||
2277 |
] ifFalse:[ (extra == #index) ifTrue:[ |
|
2278 |
index := nextSym. |
|
2279 |
symIndex := symIndex + 1. |
|
2280 |
self appendByte:index |
|
2281 |
||
2282 |
] ifFalse:[ (extra == #lit) ifTrue:[ |
|
2283 |
index := self addLiteral:nextSym. |
|
2284 |
symIndex := symIndex + 1. |
|
2285 |
self appendByte:index |
|
2286 |
||
2287 |
] ifFalse:[ (extra == #speciallit) ifTrue:[ |
|
2288 |
index := self addLiteral:nextSym. |
|
2289 |
index > 255 ifTrue:[ |
|
2290 |
self parseError:'too many globals (' , |
|
2291 |
(symbolicCodeArray at:symIndex) , |
|
2292 |
' index=' , index printString , |
|
2293 |
') in method - please simplify'. |
|
2294 |
^ #Error |
|
2295 |
]. |
|
2296 |
symIndex := symIndex + 1. |
|
2297 |
self appendByte:index. |
|
2298 |
||
2299 |
] ifFalse:[ (extra == #speciallitS) ifTrue:[ |
|
2300 |
index := nextSym. |
|
2301 |
symIndex := symIndex + 1. |
|
2302 |
self appendByte:index. |
|
2303 |
||
2304 |
] ifFalse:[ (extra == #speciallitL) ifTrue:[ |
|
2305 |
index := nextSym. |
|
2306 |
symIndex := symIndex + 2. |
|
2307 |
self appendWord:index. |
|
2308 |
||
2309 |
] ifFalse:[ (extra == #offset) ifTrue:[ |
|
2310 |
relocInfo at:symIndex put:codeIndex. |
|
2311 |
self addReloc:symIndex. |
|
2312 |
symIndex := symIndex + 1. |
|
2313 |
self appendByte:0 |
|
2314 |
||
2315 |
] ifFalse:[ (extra == #indexLevel) ifTrue:[ |
|
2316 |
index := nextSym. |
|
2317 |
symIndex := symIndex + 1. |
|
2318 |
self appendByte:index. |
|
2319 |
level := symbolicCodeArray at:symIndex. |
|
2320 |
symIndex := symIndex + 1. |
|
2321 |
self appendByte:level |
|
2322 |
||
2323 |
] ifFalse:[ (extra == #offsetNvarNarg) ifTrue:[ |
|
2324 |
relocInfo at:symIndex put:codeIndex. |
|
2325 |
self addReloc:symIndex. |
|
2326 |
symIndex := symIndex + 1. |
|
2327 |
self appendEmptyByte. |
|
2328 |
nvars := symbolicCodeArray at:symIndex. |
|
2329 |
symIndex := symIndex + 1. |
|
2330 |
self appendByte:nvars. |
|
2331 |
level := symbolicCodeArray at:symIndex. |
|
2332 |
symIndex := symIndex + 1. |
|
2333 |
self appendByte:level |
|
2334 |
||
2335 |
] ifFalse:[ (extra == #absoffset) ifTrue:[ |
|
2336 |
relocInfo at:symIndex put:codeIndex. |
|
2337 |
self addReloc:symIndex. |
|
2338 |
addr := symbolicCodeArray at:symIndex. |
|
2339 |
symIndex := symIndex + 1. |
|
2340 |
self appendByte:(addr bitAnd:16rFF). |
|
2341 |
self appendByte:((addr bitShift:-8) bitAnd:16rFF). |
|
2342 |
||
2343 |
] ifFalse:[ (extra == #absoffsetNvarNarg) ifTrue:[ |
|
2344 |
relocInfo at:symIndex put:codeIndex. |
|
2345 |
self addReloc:symIndex. |
|
2346 |
addr := symbolicCodeArray at:symIndex. |
|
2347 |
symIndex := symIndex + 1. |
|
2348 |
self appendByte:(addr bitAnd:16rFF). |
|
2349 |
self appendByte:((addr bitShift:-8) bitAnd:16rFF). |
|
2350 |
nvars := symbolicCodeArray at:symIndex. |
|
2351 |
symIndex := symIndex + 1. |
|
2352 |
self appendByte:nvars. |
|
2353 |
level := symbolicCodeArray at:symIndex. |
|
2354 |
symIndex := symIndex + 1. |
|
2355 |
self appendByte:level |
|
2356 |
||
2357 |
] ifFalse:[ (extra == #special) ifTrue:[ |
|
2358 |
((codeSymbol == #send) |
|
2359 |
or:[codeSymbol == #sendSelf |
|
2360 |
or:[codeSymbol == #superSend |
|
2361 |
or:[codeSymbol == #hereSend]]]) ifTrue:[ |
|
2362 |
index := nextSym. |
|
2363 |
symIndex := symIndex + 1. |
|
2364 |
nargs := symbolicCodeArray at:symIndex. |
|
2365 |
symIndex := symIndex + 1. |
|
2366 |
self appendByte:nargs. |
|
2367 |
self appendByte:index. |
|
2368 |
||
2369 |
(codeSymbol == #superSend |
|
2370 |
or:[codeSymbol == #hereSend]) ifTrue:[ |
|
2371 |
index := symbolicCodeArray at:symIndex. |
|
2372 |
symIndex := symIndex + 1. |
|
2373 |
self appendByte:index |
|
2374 |
]. |
|
2375 |
stackDelta := nargs negated. |
|
2376 |
codeSymbol == #sendSelf ifTrue:[ |
|
2377 |
stackDelta := stackDelta + 1 |
|
2378 |
] |
|
2379 |
] ifFalse:[ (codeSymbol == #sendDrop) ifTrue:[ |
|
2380 |
index := nextSym. |
|
2381 |
symIndex := symIndex + 1. |
|
2382 |
nargs := symbolicCodeArray at:symIndex. |
|
2383 |
symIndex := symIndex + 1. |
|
2384 |
self appendByte:nargs. |
|
2385 |
self appendByte:index. |
|
2386 |
stackDelta := (nargs + 1) negated |
|
2387 |
]] |
|
2388 |
||
2389 |
] ifFalse:[ (extra == #specialL) ifTrue:[ |
|
2390 |
((codeSymbol == #sendL) |
|
2391 |
or:[codeSymbol == #sendDropL |
|
2392 |
or:[codeSymbol == #sendSelfL |
|
2393 |
or:[codeSymbol == #superSendL |
|
2394 |
or:[codeSymbol == #hereSendL]]]]) ifTrue:[ |
|
2395 |
index := nextSym. |
|
2396 |
symIndex := symIndex + 2. |
|
2397 |
nargs := symbolicCodeArray at:symIndex. |
|
2398 |
symIndex := symIndex + 1. |
|
2399 |
self appendByte:nargs. |
|
2400 |
self appendWord:index. |
|
2401 |
(codeSymbol == #superSendL |
|
2402 |
or:[codeSymbol == #hereSendL]) ifTrue:[ |
|
2403 |
index := symbolicCodeArray at:symIndex. |
|
2404 |
symIndex := symIndex + 2. |
|
2405 |
self appendWord:index. |
|
2406 |
]. |
|
2407 |
stackDelta := nargs negated. |
|
2408 |
codeSymbol == #sendSelfL ifTrue:[ |
|
2409 |
stackDelta := stackDelta + 1 |
|
2410 |
] |
|
2411 |
] |
|
2412 |
] ifFalse:[ (extra == #specialSend) ifTrue:[ |
|
2413 |
index := nextSym. |
|
2414 |
symIndex := symIndex + 1. |
|
2415 |
self appendByte:index. |
|
2416 |
||
2417 |
] ifFalse:[ |
|
2418 |
"/ self halt:'internal error' |
|
475 | 2419 |
|
1133 | 2420 |
]]]]]]]]]]]]]]]] |
2421 |
]. |
|
2422 |
||
2423 |
stackDepth := stackDepth + stackDelta. |
|
2424 |
(stackDepth > maxStackDepth) ifTrue:[ |
|
2425 |
maxStackDepth := stackDepth |
|
2426 |
] |
|
2427 |
]. |
|
2428 |
relocInfo at:symIndex put:codeIndex. |
|
2429 |
||
2430 |
needRetry ifFalse:[ |
|
2431 |
" |
|
2432 |
now relocate - returns true if ok, false if we have to do it again |
|
2433 |
(when short jumps have been changed to long jumps) |
|
2434 |
" |
|
2435 |
relocList notNil ifTrue:[ |
|
2436 |
needRetry := (self relocateWith:symbolicCodeArray relocInfo:relocInfo) not. |
|
2437 |
" |
|
2438 |
if returned with false, a relative jump was made into |
|
2439 |
an absolute jump - need to start over with one more byte space |
|
2440 |
" |
|
2441 |
needRetry ifTrue:[ |
|
2442 |
relocList := nil. |
|
2443 |
codeSize := codeSize + 1. |
|
2444 |
] |
|
2445 |
] |
|
2446 |
] ifTrue:[ |
|
2447 |
'Compiler [info]: compiling again ...' infoPrintCR. |
|
2448 |
] |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2449 |
]. |
141 | 2450 |
"code printNL." |
2451 |
^ errorFlag |
|
2452 |
||
2453 |
"Modified: 3.9.1995 / 12:59:43 / claus" |
|
475 | 2454 |
"Modified: 10.1.1997 / 15:17:51 / cg" |
141 | 2455 |
! |
2456 |
||
937
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2457 |
genSpecialStatement:selector on:codeStream |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2458 |
"/ generate: thisContext selector. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2459 |
(StatementNode |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2460 |
expression:(UnaryNode receiver:(VariableNode type:#ThisContext context:contextToEvaluateIn) |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2461 |
selector:selector)) |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2462 |
codeForSideEffectOn:codeStream inBlock:nil for:self. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2463 |
! |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2464 |
|
141 | 2465 |
genSymbolicCode |
2466 |
"traverse the parse-tree producing symbolicCode - return the codeArray" |
|
2467 |
||
2468 |
|codeStream code thisStatement lastStatement| |
|
2469 |
||
2470 |
litArray := nil. |
|
2471 |
codeStream := WriteStream on:(OrderedCollection new:100). |
|
2472 |
||
937
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2473 |
primitiveContextInfo notNil ifTrue:[ |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2474 |
(primitiveContextInfo includes:('exception:' -> #unwind)) ifTrue:[ |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2475 |
self genSpecialStatement:#markForUnwind on:codeStream |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2476 |
]. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2477 |
(primitiveContextInfo includes:('exception:' -> #handle)) ifTrue:[ |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2478 |
self genSpecialStatement:#markForHandle on:codeStream |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2479 |
]. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2480 |
(primitiveContextInfo includes:('exception:' -> #raise)) ifTrue:[ |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2481 |
self genSpecialStatement:#markForRaise on:codeStream |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2482 |
]. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2483 |
]. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2484 |
|
1312 | 2485 |
self generateVariables:methodVars on:codeStream. |
2486 |
||
141 | 2487 |
thisStatement := tree. |
2488 |
[thisStatement notNil] whileTrue:[ |
|
937
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2489 |
lastStatement := thisStatement. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2490 |
thisStatement codeForSideEffectOn:codeStream inBlock:nil for:self. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2491 |
thisStatement := thisStatement nextStatement |
141 | 2492 |
]. |
2493 |
(lastStatement isNil or:[lastStatement isReturnNode not]) |
|
2494 |
ifTrue:[ |
|
937
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2495 |
"not a return - add retSelf" |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2496 |
" |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2497 |
if the last statement was a send for side-effect, |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2498 |
replace the previous drop by a retSelf. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2499 |
In this case we have to keep an extra retSelf bacause |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2500 |
it could be a jump target. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2501 |
" |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2502 |
(lastStatement notNil |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2503 |
and:[(code := codeStream contents) notNil |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2504 |
and:[code size > 0 |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2505 |
and:[code last == #drop]]]) ifTrue:[ |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2506 |
codeStream backStep. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2507 |
codeStream nextPut:#retSelf |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2508 |
]. |
21ca5ab983b7
support exception handle/raise/unwind pragmas
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
2509 |
codeStream nextPut:#retSelf |
141 | 2510 |
]. |
2511 |
^ codeStream contents |
|
328 | 2512 |
|
330
9b9a1ff67ba3
Bad change in previous version. Need extra bytecode as jump target.
Stefan Vogel <sv@exept.de>
parents:
328
diff
changeset
|
2513 |
"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
|
2514 |
! |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2515 |
|
1312 | 2516 |
generateVariables:varCollection on:codeStream |
2517 |
varCollection isNil ifTrue:[^ self]. |
|
2518 |
||
2519 |
varCollection do:[:eachVar | |
|
2520 |
eachVar type notNil ifTrue:[ |
|
2521 |
"/ generate code to set it up. |
|
2522 |
||
2523 |
(AssignmentNode |
|
2524 |
variable:(self nodeForMethodVariable:eachVar name) |
|
2525 |
expression:(eachVar expressionForSetup)) |
|
2526 |
codeForSideEffectOn:codeStream inBlock:nil for:self. |
|
2527 |
] |
|
2528 |
] |
|
2529 |
! |
|
2530 |
||
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2531 |
hasLineNumber:sel |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2532 |
"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
|
2533 |
|
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2534 |
(sel == #==) ifTrue:[^ false]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2535 |
(sel == #~~) ifTrue:[^ false]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2536 |
(sel == #class) ifTrue:[^ false]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2537 |
(sel == #isNil) ifTrue:[^ false]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2538 |
(sel == #notNil) ifTrue:[^ false]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2539 |
^ true |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2540 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2541 |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2542 |
isBuiltIn1ArgSelector:sel forReceiver:receiver |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2543 |
"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
|
2544 |
(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
|
2545 |
|
530 | 2546 |
(sel == #at:) ifTrue:[^ true]. |
2547 |
(sel == #value:) ifTrue:[^ true]. |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2548 |
(sel == #bitAnd:) ifTrue:[^ true]. |
530 | 2549 |
(sel == #bitOr:) ifTrue:[^ true]. |
2550 |
(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
|
2551 |
(sel == #basicNew:) ifTrue:[ |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2552 |
"/ this one is critical - some redefine it |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2553 |
receiver isGlobal ifTrue:[ |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2554 |
(#('String' 'ByteArray' 'Array' |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2555 |
'Point' 'Rectangle' 'Object') |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2556 |
includes:receiver name) ifTrue:[^ true]. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2557 |
]. |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2558 |
]. |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2559 |
^ false |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2560 |
|
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2561 |
"Created: 17.4.1996 / 22:33:13 / cg" |
530 | 2562 |
"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
|
2563 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2564 |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2565 |
isBuiltIn2ArgSelector:sel forReceiver:receiver |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2566 |
"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
|
2567 |
(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
|
2568 |
|
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2569 |
(sel == #at:put:) ifTrue:[^ true]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2570 |
^ false |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2571 |
|
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2572 |
"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
|
2573 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2574 |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2575 |
isBuiltInBinarySelector:sel forReceiver:receiver |
530 | 2576 |
"return true, if binary selector sel is built-in. |
2577 |
(i.e. there is a single bytecode for it)" |
|
2578 |
||
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2579 |
sel == #== ifTrue:[^ true]. |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2580 |
sel == #~~ ifTrue:[^ true]. |
530 | 2581 |
sel == #= ifTrue:[^ true]. |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2582 |
sel == #~= ifTrue:[^ true]. |
530 | 2583 |
sel == #+ ifTrue:[^ true]. |
2584 |
sel == #- ifTrue:[^ true]. |
|
2585 |
sel == #< ifTrue:[^ true]. |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2586 |
sel == #<= ifTrue:[^ true]. |
530 | 2587 |
sel == #> ifTrue:[^ true]. |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2588 |
sel == #>= ifTrue:[^ true]. |
530 | 2589 |
sel == #* ifTrue:[^ true]. |
2590 |
sel == #& ifTrue:[^ true]. |
|
2591 |
sel == #| ifTrue:[^ true]. |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2592 |
^ false |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2593 |
|
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2594 |
"Created: 17.4.1996 / 22:34:27 / cg" |
530 | 2595 |
"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
|
2596 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2597 |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2598 |
isBuiltInUnarySelector:sel forReceiver:receiver |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2599 |
"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
|
2600 |
(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
|
2601 |
|
530 | 2602 |
(sel == #value) ifTrue:[^ true]. |
2603 |
(sel == #class) ifTrue:[^ true]. |
|
2604 |
(sel == #size) ifTrue:[^ true]. |
|
2605 |
(sel == #isNil) ifTrue:[^ true]. |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2606 |
(sel == #notNil) ifTrue:[^ true]. |
530 | 2607 |
(sel == #not) ifTrue:[^ true]. |
2608 |
||
2609 |
(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
|
2610 |
(sel == #basicNew) ifTrue:[ |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2611 |
"/ this one is critical - some redefine it |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2612 |
receiver isGlobal ifTrue:[ |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2613 |
(#('String' 'ByteArray' 'Array' |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2614 |
'Point' 'Rectangle' 'Object') |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2615 |
includes:receiver name) ifTrue:[^ true]. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2616 |
]. |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2617 |
]. |
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2618 |
^ false |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2619 |
|
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
2620 |
"Created: 17.4.1996 / 22:32:16 / cg" |
530 | 2621 |
"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
|
2622 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2623 |
|
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2624 |
moveGlobalsToFront |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2625 |
"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
|
2626 |
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
|
2627 |
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
|
2628 |
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
|
2629 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2630 |
litArray isNil ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2631 |
^ 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
|
2632 |
]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2633 |
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
|
2634 |
(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
|
2635 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2636 |
(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
|
2637 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2638 |
(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
|
2639 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2640 |
(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
|
2641 |
ifTrue:[a < b]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2642 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2643 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2644 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2645 |
]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2646 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2647 |
" |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2648 |
#(#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
|
2649 |
sort:[:a :b | |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2650 |
(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
|
2651 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2652 |
(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
|
2653 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2654 |
(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
|
2655 |
ifTrue:[ |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2656 |
(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
|
2657 |
ifTrue:[(a < b)]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2658 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2659 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2660 |
] |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2661 |
]. |
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2662 |
|
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
2663 |
" |
141 | 2664 |
! |
2665 |
||
2666 |
relocateWith:symbolicCodeArray relocInfo:relocInfo |
|
2667 |
"helper for genByteCodeFrom - relocate code using relocInfo. |
|
2668 |
if relocation fails badly (due to long relative jumps) patch |
|
2669 |
symbolicCode to use absolute jumps instead and return false |
|
2670 |
(genByteCodeFrom will then try again). Otherwise return true. |
|
2671 |
Also, on the fly, jumps to jumps and jumps to return are handled." |
|
2672 |
||
2673 |
|delta "{Class: SmallInteger }" |
|
2674 |
codePos "{Class: SmallInteger }" |
|
2675 |
opCodePos "{Class: SmallInteger }" |
|
2676 |
codeOffset "{Class: SmallInteger }" |
|
2677 |
symOffset |
|
2678 |
opcode "{Class: SmallInteger }" |
|
2679 |
dstOpcode jumpTarget |
|
2680 |
jumpCode deleteSet| |
|
2681 |
||
2682 |
deleteSet := OrderedCollection new. |
|
2683 |
relocList do:[:sIndex | |
|
1050 | 2684 |
"have to relocate symCode at sIndex ..." |
2685 |
symOffset := symbolicCodeArray at:sIndex. "the target in the symbolic code" |
|
2686 |
codePos := relocInfo at:sIndex. "position of the offet in byte code" |
|
2687 |
codeOffset := relocInfo at:symOffset. "position of the target in byte code" |
|
2688 |
delta := codeOffset - codePos - 1. |
|
2689 |
opCodePos := codePos - 1. |
|
2690 |
opcode := codeBytes at:opCodePos. |
|
2691 |
||
2692 |
(opcode between:190 and:199) ifTrue:[ |
|
2693 |
"an absolute jump/makeBlock" |
|
2694 |
||
2695 |
codeBytes at:codePos put:(codeOffset bitAnd:16rFF). |
|
2696 |
codeBytes at:(codePos + 1) put:(codeOffset bitShift:-8) |
|
2697 |
] ifFalse:[ |
|
2698 |
"get jump-code from long and vlong codes" |
|
2699 |
(opcode between:50 and:59) ifFalse:[ |
|
2700 |
(opcode between:60 and:69) ifTrue:[ |
|
2701 |
opcode := opcode - 10 |
|
2702 |
] ifFalse:[ |
|
2703 |
(opcode between:70 and:79) ifTrue:[ |
|
2704 |
opcode := opcode - 20 |
|
2705 |
] ifFalse:[ |
|
2706 |
self error:'invalid code to relocate' |
|
2707 |
] |
|
2708 |
]. |
|
2709 |
]. |
|
2710 |
||
2711 |
"optimize jump to return and jump to jump" |
|
2712 |
||
2713 |
(opcode == 54) ifTrue:[ |
|
2714 |
"a jump" |
|
2715 |
dstOpcode := symbolicCodeArray at:symOffset. |
|
2716 |
||
2717 |
(#(retSelf retTop retNil retTrue retFalse ret0 "blockRetTop") includes:dstOpcode) ifTrue:[ |
|
2718 |
"a jump to a return - put in the return instead jump" |
|
2719 |
||
2720 |
symbolicCodeArray at:(sIndex - 1) put:dstOpcode. |
|
2721 |
symbolicCodeArray at:sIndex put:dstOpcode. |
|
2722 |
codeBytes at:opCodePos put:(self byteCodeFor:dstOpcode). |
|
2723 |
delta := 0. |
|
2724 |
deleteSet add:sIndex. |
|
141 | 2725 |
|
2726 |
" |
|
2727 |
'jump to return at: ' print. (sIndex - 1) printNL. |
|
2728 |
" |
|
1050 | 2729 |
] ifFalse:[ |
2730 |
(dstOpcode == #jump) ifTrue:[ |
|
2731 |
"jump to jump to be done soon" |
|
2732 |
jumpTarget := symbolicCodeArray at:(symOffset + 1). |
|
141 | 2733 |
" |
2734 |
'jump to jump at: ' print. (sIndex - 1) print. |
|
2735 |
' newTarget:' print. jumpTarget printNL. |
|
2736 |
" |
|
2737 |
||
1050 | 2738 |
symbolicCodeArray at:sIndex put:jumpTarget. |
2739 |
symOffset := jumpTarget. |
|
2740 |
codeOffset := relocInfo at:symOffset. |
|
2741 |
delta := codeOffset - codePos - 1. |
|
2742 |
||
2743 |
"continue with new delta" |
|
2744 |
] |
|
2745 |
] |
|
2746 |
]. |
|
2747 |
(#(50 51 52 53 56 57 58 59) includes:opcode) ifTrue:[ |
|
2748 |
"a conditional jump" |
|
2749 |
||
2750 |
dstOpcode := symbolicCodeArray at:symOffset. |
|
2751 |
(dstOpcode == #jump) ifTrue:[ |
|
2752 |
"conditional jump to unconditional jump" |
|
2753 |
jumpTarget := symbolicCodeArray at:(symOffset + 1). |
|
141 | 2754 |
" |
2755 |
'cond jump to jump at: ' print. (sIndex - 1) print. |
|
2756 |
' newTarget:' print. jumpTarget printNL. |
|
2757 |
" |
|
2758 |
||
1050 | 2759 |
symbolicCodeArray at:sIndex put:jumpTarget. |
2760 |
symOffset := jumpTarget. |
|
2761 |
codeOffset := relocInfo at:symOffset. |
|
2762 |
delta := codeOffset - codePos - 1. |
|
2763 |
||
2764 |
"continue with new delta" |
|
2765 |
]. |
|
2766 |
]. |
|
2767 |
||
2768 |
(delta >= 0) ifTrue:[ |
|
2769 |
(delta > 127) ifTrue:[ |
|
2770 |
(opcode between:50 and:59) ifFalse:[ |
|
2771 |
self error:'invalid code to relocate' |
|
2772 |
] ifTrue:[ |
|
2773 |
(delta > 255) ifTrue:[ |
|
2774 |
"change jmp into vljmp ..." |
|
2775 |
codeBytes at:opCodePos put:(opcode + 20). |
|
2776 |
delta := delta - 256 |
|
2777 |
] ifFalse:[ |
|
2778 |
"change jmp into ljmp ..." |
|
2779 |
codeBytes at:opCodePos put:(opcode + 10). |
|
2780 |
delta := delta - 128 |
|
2781 |
]. |
|
2782 |
(delta > 127) ifTrue:[ |
|
2783 |
"change symbolic into a jump absolute and fail" |
|
2784 |
jumpCode := symbolicCodeArray at:(sIndex - 1). |
|
2785 |
symbolicCodeArray at:(sIndex - 1) put:(self absJumpFromJump:jumpCode). |
|
2786 |
symbolicCodeArray at:sIndex put:symOffset. |
|
141 | 2787 |
" |
2788 |
'change short into abs jump' printNL. |
|
2789 |
" |
|
1050 | 2790 |
deleteSet do:[:d | relocList remove:d]. |
2791 |
^ false |
|
2792 |
] |
|
2793 |
]. |
|
2794 |
]. |
|
2795 |
codeBytes at:codePos put:delta |
|
2796 |
] ifFalse:[ |
|
2797 |
(delta < -128) ifTrue:[ |
|
2798 |
(opcode between:50 and:59) ifFalse:[ |
|
2799 |
self error:'invalid code to relocate' |
|
2800 |
] ifTrue:[ |
|
2801 |
(delta < -256) ifTrue:[ |
|
2802 |
"change jmp into vljmp ..." |
|
2803 |
codeBytes at:opCodePos put:(opcode + 20). |
|
2804 |
delta := delta + 256 |
|
2805 |
] ifFalse:[ |
|
2806 |
"change jmp into ljmp ..." |
|
2807 |
codeBytes at:opCodePos put:(opcode + 10). |
|
2808 |
delta := delta + 128 |
|
2809 |
]. |
|
2810 |
(delta < -128) ifTrue:[ |
|
2811 |
"change symbolic into a jump absolute and fail" |
|
2812 |
jumpCode := symbolicCodeArray at:(sIndex - 1). |
|
2813 |
symbolicCodeArray at:(sIndex - 1) put:(self absJumpFromJump:jumpCode). |
|
2814 |
symbolicCodeArray at:sIndex put:symOffset. |
|
141 | 2815 |
" |
2816 |
'change short into abs jump' printNL. |
|
2817 |
" |
|
1050 | 2818 |
deleteSet do:[:d | relocList remove:d]. |
2819 |
^ false |
|
2820 |
] |
|
2821 |
] |
|
2822 |
]. |
|
2823 |
codeBytes at:codePos put:(256 + delta) |
|
2824 |
] |
|
2825 |
] |
|
141 | 2826 |
]. |
2827 |
(errorFlag == #Error) ifTrue:[ |
|
1050 | 2828 |
self error:'relocation range error' |
141 | 2829 |
]. |
2830 |
^ true |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2831 |
! |
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
2832 |
|
247 | 2833 |
specialGlobalCodeFor:aSymbol |
530 | 2834 |
"codeExtension for globals, |
2835 |
which can be accessed by specialGlobal opCode" |
|
2836 |
||
2837 |
|idx| |
|
2838 |
||
2839 |
idx := self specialGlobals identityIndexOf:aSymbol ifAbsent:nil. |
|
2840 |
idx isNil ifTrue:[^ idx]. |
|
2841 |
^ idx - 1. |
|
2842 |
||
2843 |
"Modified: 4.6.1997 / 12:31:22 / cg" |
|
2844 |
! |
|
2845 |
||
2846 |
specialGlobals |
|
2847 |
"list of globals which can be accessed by specialGlobal opCode; |
|
2848 |
adding any here requires a new VM (i.e. you cannot change it)" |
|
2849 |
||
2850 |
^ #( |
|
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2851 |
#Array "/ 0 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2852 |
#String "/ 1 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2853 |
#FloatArray "/ 2 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2854 |
#DoubleArray "/ 3 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2855 |
#Point "/ 4 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2856 |
#Symbol "/ 5 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2857 |
#Smalltalk "/ 6 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2858 |
#Processor "/ 7 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2859 |
#SmallInteger "/ 8 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2860 |
#Character "/ 9 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2861 |
#Float "/ 10 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2862 |
#Process "/ 11 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2863 |
#Set "/ 12 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2864 |
#IdentitySet "/ 13 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2865 |
#Dictionary "/ 14 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2866 |
#IdentityDictionary "/ 15 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2867 |
#Sempahore "/ 16 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2868 |
#OrderedCollection "/ 17 |
530 | 2869 |
) |
2870 |
||
2871 |
"Created: 4.6.1997 / 12:17:47 / cg" |
|
2872 |
"Modified: 4.6.1997 / 12:31:35 / cg" |
|
247 | 2873 |
! |
2874 |
||
400
e5cfc008be47
bytecode changes - some more are now special-send codes
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
2875 |
specialSendCodeFor:sel |
530 | 2876 |
"return the codeExtension for sends, |
2877 |
which can be performed by specialSend opCode" |
|
2878 |
||
2879 |
|idx| |
|
2880 |
||
2881 |
idx := self specialSends identityIndexOf:sel ifAbsent:nil. |
|
2882 |
idx isNil ifTrue:[^ idx]. |
|
2883 |
^ idx - 1. |
|
2884 |
||
2885 |
"Modified: 4.6.1997 / 12:31:08 / cg" |
|
2886 |
! |
|
2887 |
||
2888 |
specialSends |
|
2889 |
"list of selectors which can be sent by specialSend opCode; |
|
2890 |
adding any here requires a new VM (i.e. you cannot change it)" |
|
2891 |
||
2892 |
^ #( |
|
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2893 |
#top "/ 0 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2894 |
#bottom "/ 1 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2895 |
#left "/ 2 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2896 |
#right "/ 3 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2897 |
#x "/ 4 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2898 |
#y "/ 5 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2899 |
#width "/ 6 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2900 |
#height "/ 7 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2901 |
#origin "/ 8 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2902 |
#extent "/ 9 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2903 |
#asInteger "/ 10 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2904 |
#rounded "/ 11 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2905 |
#next "/ 12 |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2906 |
#peek "/ 13 |
530 | 2907 |
) |
2908 |
||
2909 |
"Created: 4.6.1997 / 12:20:28 / cg" |
|
2910 |
"Modified: 4.6.1997 / 12:31:56 / cg" |
|
0 | 2911 |
! ! |
49 | 2912 |
|
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2913 |
!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
|
2914 |
|
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2915 |
addTempVar |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2916 |
"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
|
2917 |
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
|
2918 |
|
558
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
2919 |
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
|
2920 |
numTemp := numTemp + 1. |
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
2921 |
maxNumTemp := maxNumTemp max:numTemp. |
560
9311c79529d4
inline blocks withs args/vars
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
2922 |
^ numTemp + methodVars size |
9311c79529d4
inline blocks withs args/vars
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
2923 |
|
9311c79529d4
inline blocks withs args/vars
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
2924 |
"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
|
2925 |
! |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2926 |
|
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2927 |
removeTempVar |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2928 |
"remove a temporary variable" |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2929 |
|
558
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
2930 |
numTemp := numTemp - 1 |
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2931 |
|
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2932 |
"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
|
2933 |
"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
|
2934 |
! ! |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
2935 |
|
1363 | 2936 |
!ByteCodeCompiler methodsFor:'compilation'! |
2937 |
||
2938 |
compile:aStringArg forClass:aClassArg inCategory:cat notifying:requestor |
|
2939 |
install:install skipIfSame:skipIfSame silent:silent foldConstants:fold |
|
2940 |
||
1459 | 2941 |
^ self |
2942 |
compile:aStringArg forClass:aClassArg inCategory:cat notifying:requestor |
|
2943 |
install:install skipIfSame:skipIfSame silent:silent foldConstants:fold |
|
2944 |
ifFail:[ #Error ] |
|
2945 |
! |
|
2946 |
||
2947 |
compile:aStringArg forClass:aClassArg inCategory:cat notifying:requestor |
|
2948 |
install:install skipIfSame:skipIfSame silent:silent foldConstants:fold |
|
2949 |
ifFail:failBlock |
|
2950 |
||
1363 | 2951 |
"the basic workhorse method for compiling: |
2952 |
compile a source-string for a method in classToCompileFor. |
|
2953 |
errors are forwarded to requestor |
|
1459 | 2954 |
(report on Transcript and return the value of failBlock, if requestor is nil). |
1363 | 2955 |
|
2956 |
The new method will get cat as category. |
|
2957 |
If install is true, the method will go into the classes method-table, |
|
2958 |
otherwise the method is simply returned (for anonymous methods). |
|
2959 |
If skipIsSame is true, and the source is the same as an existing |
|
2960 |
methods source, this is a noop (for fast fileIn). |
|
2961 |
The argument, silent controls if errors are to be reported. |
|
2962 |
Returns the method, #Error or nil." |
|
2963 |
||
2964 |
|newMethod tree symbolicCodeArray oldMethod lazy silencio |
|
2965 |
sourceFile sourceStream newSource primNr pos keptOldCode answer |
|
2966 |
pkg aClass aString errorOccurred oldCategory newCategory| |
|
2967 |
||
2968 |
aClass := aClassArg. |
|
2969 |
aString := aStringArg. |
|
2970 |
||
2971 |
aString isNil ifTrue:[^ nil]. |
|
2972 |
silencio := silent |
|
2973 |
or:[Smalltalk silentLoading == true |
|
2974 |
or:[ListCompiledMethods == false]]. |
|
2975 |
||
2976 |
"lazy compilation is EXPERIMENTAL" |
|
2977 |
lazy := (LazyCompilation == true) and:[install]. |
|
2978 |
"/ no longer ... |
|
2979 |
lazy := false. |
|
2980 |
||
2981 |
RestartCompilationSignal handle:[:ex | |
|
2982 |
"/ class could have changed ... |
|
2983 |
aClass := self classToCompileFor. |
|
2984 |
aString := self correctedSource ? aStringArg. |
|
1369
2304dd8c3173
recompilation after correct-by-deleting unused local
Claus Gittinger <cg@exept.de>
parents:
1367
diff
changeset
|
2985 |
methodArgs := methodArgNames := methodVars := methodVarNames := nil. |
2304dd8c3173
recompilation after correct-by-deleting unused local
Claus Gittinger <cg@exept.de>
parents:
1367
diff
changeset
|
2986 |
usedInstVars := usedClassVars := usedVars := nil. |
2304dd8c3173
recompilation after correct-by-deleting unused local
Claus Gittinger <cg@exept.de>
parents:
1367
diff
changeset
|
2987 |
modifiedInstVars := modifiedClassVars := modifiedGlobals := nil. |
2304dd8c3173
recompilation after correct-by-deleting unused local
Claus Gittinger <cg@exept.de>
parents:
1367
diff
changeset
|
2988 |
currentBlock := nil. |
1363 | 2989 |
ex restart |
2990 |
] do:[ |
|
2991 |
"create a compiler, let it parse and create the parsetree" |
|
2992 |
||
1369
2304dd8c3173
recompilation after correct-by-deleting unused local
Claus Gittinger <cg@exept.de>
parents:
1367
diff
changeset
|
2993 |
self source:(ReadStream on:aString string). |
2304dd8c3173
recompilation after correct-by-deleting unused local
Claus Gittinger <cg@exept.de>
parents:
1367
diff
changeset
|
2994 |
self nextToken. |
2304dd8c3173
recompilation after correct-by-deleting unused local
Claus Gittinger <cg@exept.de>
parents:
1367
diff
changeset
|
2995 |
|
1363 | 2996 |
self setClassToCompileFor:aClass. |
2997 |
||
2998 |
self parseForCode. |
|
2999 |
fold ifFalse:[self foldConstants:nil]. |
|
3000 |
self notifying:requestor. |
|
3001 |
silent ifTrue:[ |
|
1365 | 3002 |
"/ self ignoreErrors:true. |
3003 |
self ignoreWarnings:true. |
|
1363 | 3004 |
self warnUndeclared:false. |
3005 |
]. |
|
3006 |
||
3007 |
(errorOccurred := (self parseMethodSpec == #Error)) ifTrue:[ |
|
3008 |
self parseError:'syntax error in method specification'. |
|
3009 |
tree := #Error. |
|
3010 |
] ifFalse:[ |
|
3011 |
tree := self parseMethodBody. |
|
3012 |
self checkForEndOfInput. |
|
3013 |
self tree:tree. |
|
3014 |
]. |
|
3015 |
]. |
|
3016 |
||
1378
01bd44f4360c
allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
3017 |
(aClass notNil and:[selector notNil]) ifTrue:[ |
1363 | 3018 |
oldMethod := aClass compiledMethodAt:selector. |
3019 |
oldMethod notNil ifTrue:[ |
|
3020 |
oldCategory := oldMethod category. |
|
3021 |
]. |
|
3022 |
]. |
|
3023 |
newCategory := cat. |
|
3024 |
newCategory isNil ifTrue:[ |
|
3025 |
newCategory := oldCategory ? '* As yet uncategorized *'. |
|
3026 |
]. |
|
3027 |
||
3028 |
errorOccurred ifFalse:[ |
|
3029 |
(aClass isNil or:[AllowExtensionsToPrivateClasses or:[aClass owningClass isNil]]) ifTrue:[ |
|
3030 |
(requestor respondsTo:#packageToInstall) ifFalse:[ |
|
3031 |
pkg := Class packageQuerySignal query. |
|
3032 |
] ifTrue:[ |
|
3033 |
pkg := requestor packageToInstall |
|
3034 |
]. |
|
3035 |
] ifFalse:[ |
|
3036 |
pkg := aClass owningClass package |
|
3037 |
]. |
|
3038 |
||
3039 |
lazy ifTrue:[ |
|
3040 |
"/ |
|
3041 |
"/ that one method IS required |
|
3042 |
"/ |
|
3043 |
(aClass isMeta and:[selector == #version]) ifTrue:[ |
|
3044 |
lazy := false |
|
3045 |
]. |
|
3046 |
"/ |
|
3047 |
"/ primitives also |
|
3048 |
"/ |
|
3049 |
(self hasNonOptionalPrimitiveCode |
|
3050 |
or:[self hasPrimitiveCode and:[self class canCreateMachineCode]]) |
|
3051 |
ifTrue:[ |
|
3052 |
lazy := false |
|
3053 |
]. |
|
3054 |
]. |
|
3055 |
||
3056 |
lazy ifFalse:[ |
|
3057 |
"check if same source" |
|
3058 |
skipIfSame ifTrue:[ |
|
3059 |
oldMethod notNil ifTrue:[ |
|
3060 |
oldMethod source = aString ifTrue:[ |
|
3061 |
oldMethod isInvalid ifFalse:[ |
|
3062 |
silencio ifFalse:[ |
|
3063 |
Transcript showCR:(' unchanged: ',aClass name,' ',selector) |
|
3064 |
]. |
|
3065 |
" |
|
3066 |
same. however, category may be different |
|
3067 |
" |
|
3068 |
(newCategory ~= oldCategory) ifTrue:[ |
|
3069 |
oldMethod category:newCategory. |
|
3070 |
"/ aClass updateRevisionString. |
|
3071 |
aClass addChangeRecordForMethodCategory:oldMethod category:newCategory. |
|
3072 |
silencio ifFalse:[ |
|
3073 |
Transcript showCR:(' (category change only)') |
|
3074 |
]. |
|
3075 |
]. |
|
3076 |
" |
|
3077 |
and package may be too. |
|
3078 |
" |
|
3079 |
(pkg notNil and:[pkg ~~ oldMethod package]) ifTrue:[ |
|
3080 |
oldMethod package:pkg. |
|
3081 |
silencio ifFalse:[ |
|
3082 |
Transcript showCR:(' (package-id change only)') |
|
3083 |
]. |
|
3084 |
]. |
|
3085 |
^ oldMethod |
|
3086 |
] |
|
3087 |
] |
|
3088 |
] |
|
3089 |
]. |
|
3090 |
] |
|
3091 |
]. |
|
3092 |
||
3093 |
(self errorFlag or:[tree == #Error]) ifTrue:[ |
|
3094 |
self showErrorMessageForClass:aClass. |
|
1459 | 3095 |
^ failBlock value |
1363 | 3096 |
]. |
3097 |
||
3098 |
"if no error and also no selector ..." |
|
3099 |
selector isNil ifTrue:[ |
|
3100 |
"... it was just a comment or other empty stuff" |
|
3101 |
^ nil |
|
3102 |
]. |
|
3103 |
||
3104 |
" |
|
3105 |
freak-out support for inline C-code... |
|
3106 |
" |
|
3107 |
((self hasNonOptionalPrimitiveCode |
|
3108 |
or:[(self hasPrimitiveCode and:[self class canCreateMachineCode]) |
|
3109 |
or:[STCCompilation == #always and:[selector ~~ #doIt]]]) |
|
3110 |
and:[(STCCompilation ~~ #never) |
|
3111 |
and:[NewPrimitives ~~ true]]) ifTrue:[ |
|
3112 |
||
3113 |
newMethod := self |
|
3114 |
compileToMachineCode:aString |
|
3115 |
forClass:aClass |
|
3116 |
inCategory:newCategory |
|
3117 |
notifying:requestor |
|
3118 |
install:install |
|
3119 |
skipIfSame:skipIfSame |
|
3120 |
silent:silent. |
|
3121 |
||
3122 |
newMethod == #Error ifTrue:[ |
|
3123 |
self showErrorMessageForClass:aClass. |
|
1459 | 3124 |
^ failBlock value |
1363 | 3125 |
]. |
3126 |
||
3127 |
(newMethod == #CannotLoad) ifTrue:[ |
|
3128 |
newMethod := self trappingStubMethodFor:aString inCategory:newCategory. |
|
3129 |
newMethod setPackage:pkg. |
|
3130 |
keptOldCode := false. |
|
3131 |
install ifTrue:[ |
|
3132 |
"/ |
|
3133 |
"/ be very careful with existing methods |
|
3134 |
"/ (otherwise, you could easily make your system unusable in systems which cannot load) |
|
3135 |
"/ |
|
3136 |
selector notNil ifTrue:[ |
|
3137 |
oldMethod := aClass compiledMethodAt:selector |
|
3138 |
]. |
|
3139 |
(oldMethod notNil and:[oldMethod code ~= newMethod code]) ifTrue:[ |
|
3140 |
answer := Dialog |
|
3141 |
confirm: |
|
3142 |
'installation of binary code for ''' , aClass name , '>>' , selector , ''' |
|
3143 |
is not possible or disabled. |
|
3144 |
||
3145 |
Shall I use the old methods functionality |
|
3146 |
or instead create a dummy trap method for it ? |
|
3147 |
||
3148 |
Hint: |
|
3149 |
if that method is needed by the system, you better leave the |
|
3150 |
original functionality in the system. |
|
3151 |
||
3152 |
Close this warnBox to abort the compilation. |
|
3153 |
' |
|
3154 |
yesLabel:'trap code' |
|
3155 |
noLabel:'keep old'. |
|
3156 |
answer isNil ifTrue:[ |
|
1459 | 3157 |
^ failBlock value |
1363 | 3158 |
]. |
3159 |
answer == false ifTrue:[ |
|
3160 |
newMethod code:(oldMethod code). |
|
3161 |
keptOldCode := true. |
|
3162 |
]. |
|
3163 |
]. |
|
3164 |
aClass addSelector:selector withMethod:newMethod |
|
3165 |
]. |
|
3166 |
self showErrorNotification:(keptOldCode |
|
3167 |
ifTrue:'not really compiled - method still shows previous behavior' |
|
3168 |
ifFalse:'not compiled to machine code - created a stub instead.') |
|
3169 |
]. |
|
3170 |
^ newMethod |
|
3171 |
]. |
|
3172 |
||
3173 |
self hasNonOptionalPrimitiveCode ifTrue:[ |
|
3174 |
"/ |
|
3175 |
"/ generate a trapping method, if primitive code is present |
|
3176 |
"/ |
|
3177 |
NewPrimitives ~~ true ifTrue:[ |
|
3178 |
newMethod := self trappingStubMethodFor:aString inCategory:newCategory. |
|
3179 |
install ifTrue:[ |
|
3180 |
aClass addSelector:selector withMethod:newMethod. |
|
3181 |
]. |
|
3182 |
self showErrorNotification:'not compiled to machine code - created a stub instead.'. |
|
3183 |
^ newMethod |
|
3184 |
]. |
|
3185 |
]. |
|
3186 |
||
3187 |
" |
|
3188 |
EXPERIMENTAL: quick loading |
|
3189 |
only create a lazyMethod, which has no byteCode and will |
|
3190 |
compile itself when first called. |
|
3191 |
" |
|
3192 |
lazy ifTrue:[ |
|
3193 |
newMethod := LazyMethod new. |
|
3194 |
(ClassCategoryReader sourceMode == #sourceReference) ifTrue:[ |
|
3195 |
sourceFile := ObjectMemory nameForSources. |
|
3196 |
sourceFile notNil ifTrue:[ |
|
3197 |
sourceStream := sourceFile asFilename appendingWriteStream. |
|
3198 |
] |
|
3199 |
]. |
|
3200 |
sourceStream isNil ifTrue:[ |
|
3201 |
newMethod source:aString string. |
|
3202 |
] ifFalse:[ |
|
3203 |
sourceStream setToEnd. |
|
1372
3aef25b07d7a
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
1369
diff
changeset
|
3204 |
pos := sourceStream position1Based. |
1363 | 3205 |
sourceStream nextChunkPut:aString. |
3206 |
sourceStream close. |
|
3207 |
newMethod sourceFilename:sourceFile position:pos. |
|
3208 |
]. |
|
3209 |
newMethod setCategory:newCategory. |
|
3210 |
pkg := aClass package. |
|
3211 |
"/ aClass owningClass isNil ifTrue:[ |
|
3212 |
"/ pkg := Class packageQuerySignal query. |
|
3213 |
"/ ] ifFalse:[ |
|
3214 |
"/ pkg := aClass owningClass package |
|
3215 |
"/ ]. |
|
3216 |
newMethod setPackage:pkg. |
|
3217 |
"/ Project notNil ifTrue:[ |
|
3218 |
"/ newMethod package:(Project currentPackageName) |
|
3219 |
"/ ]. |
|
3220 |
newMethod numberOfArgs:selector numArgs. |
|
3221 |
aClass addSelector:selector withLazyMethod:newMethod. |
|
3222 |
^ newMethod |
|
3223 |
]. |
|
3224 |
||
3225 |
primNr := self primitiveNumber. |
|
3226 |
((NewPrimitives == true) or:[primNr isNil]) ifTrue:[ |
|
3227 |
" |
|
3228 |
produce symbolic code first |
|
3229 |
" |
|
3230 |
symbolicCodeArray := self genSymbolicCode. |
|
3231 |
||
3232 |
(symbolicCodeArray == #Error) ifTrue:[ |
|
3233 |
self showErrorNotification:'translation error'. |
|
1459 | 3234 |
^ failBlock value |
1363 | 3235 |
]. |
3236 |
||
3237 |
" |
|
3238 |
take this, producing bytecode |
|
3239 |
(someone willin' to make machine code :-) |
|
3240 |
" |
|
3241 |
((self genByteCodeFrom:symbolicCodeArray) == #Error) ifTrue:[ |
|
3242 |
self showErrorNotification:'relocation error - code must be simplified'. |
|
1459 | 3243 |
^ failBlock value |
1363 | 3244 |
]. |
3245 |
]. |
|
3246 |
||
3247 |
" |
|
3248 |
finally create the new method-object |
|
3249 |
" |
|
3250 |
newMethod := self createMethod. |
|
3251 |
NewPrimitives == true ifTrue:[ |
|
3252 |
newMethod byteCode:(self code). |
|
3253 |
primNr isNil ifTrue:[ |
|
3254 |
self hasNonOptionalPrimitiveCode ifTrue:[ |
|
3255 |
primNr := 0. |
|
3256 |
] |
|
3257 |
]. |
|
3258 |
primNr notNil ifTrue:[ |
|
3259 |
newMethod setPrimitiveNumber:primNr |
|
3260 |
] |
|
3261 |
] ifFalse:[ |
|
3262 |
primNr notNil ifTrue:[ |
|
3263 |
newMethod code:(self checkForPrimitiveCode:primNr). |
|
3264 |
] ifFalse:[ |
|
3265 |
newMethod byteCode:(self code). |
|
3266 |
]. |
|
3267 |
]. |
|
3268 |
||
3269 |
" |
|
3270 |
if there where any corrections, install the updated source |
|
3271 |
" |
|
3272 |
(newSource := self correctedSource) isNil ifTrue:[ |
|
3273 |
newSource := aString string. |
|
3274 |
]. |
|
3275 |
(newSource includes:Character return) ifTrue:[ |
|
3276 |
"/ see if it contains crlf's or only cr's |
|
3277 |
newSource := self class stringWithSimpleCRs:newSource |
|
3278 |
]. |
|
3279 |
newMethod source:newSource. |
|
3280 |
newMethod setCategory:newCategory. |
|
3281 |
||
1378
01bd44f4360c
allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
3282 |
aClass notNil ifTrue:[ |
01bd44f4360c
allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
3283 |
(install not |
01bd44f4360c
allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
3284 |
and:[(oldMethod := aClass compiledMethodAt:selector) notNil]) ifTrue:[ |
01bd44f4360c
allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
3285 |
pkg := oldMethod package |
1363 | 3286 |
] ifFalse:[ |
1378
01bd44f4360c
allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
3287 |
(AllowExtensionsToPrivateClasses or:[aClass owningClass isNil]) ifTrue:[ |
01bd44f4360c
allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
3288 |
pkg := Class packageQuerySignal query. |
01bd44f4360c
allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
3289 |
] ifFalse:[ |
01bd44f4360c
allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
3290 |
pkg := aClass owningClass package |
01bd44f4360c
allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
3291 |
]. |
1363 | 3292 |
]. |
1378
01bd44f4360c
allow compiling a method for a nil class
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
3293 |
newMethod setPackage:pkg. |
1363 | 3294 |
]. |
3295 |
(self contextMustBeReturnable) ifTrue:[ |
|
3296 |
newMethod contextMustBeReturnable:true |
|
3297 |
]. |
|
3298 |
install ifTrue:[ |
|
3299 |
aClass addSelector:selector withMethod:newMethod |
|
3300 |
]. |
|
3301 |
||
3302 |
silencio ifFalse:[ |
|
3303 |
Transcript showCR:(' compiled: ', aClass name,' ', selector) |
|
3304 |
]. |
|
3305 |
||
3306 |
^ newMethod |
|
3307 |
||
3308 |
"Created: / 29.10.1995 / 19:59:36 / cg" |
|
3309 |
"Modified: / 19.3.1999 / 08:31:09 / stefan" |
|
3310 |
"Modified: / 17.11.2001 / 21:27:08 / cg" |
|
3311 |
! |
|
3312 |
||
3313 |
showErrorNotification:message |
|
3314 |
Transcript show:'***'. |
|
3315 |
selector notNil ifTrue:[ |
|
3316 |
Transcript show:(selector ,' ') |
|
3317 |
]. |
|
3318 |
Transcript showCR:message. |
|
3319 |
! ! |
|
3320 |
||
49 | 3321 |
!ByteCodeCompiler methodsFor:'machine code generation'! |
3322 |
||
3323 |
compileToMachineCode:aString forClass:aClass inCategory:cat |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3324 |
notifying:requestor install:install skipIfSame:skipIfSame silent:silent |
49 | 3325 |
"this is called to compile primitive code. |
3326 |
This is EXPERIMENTAL and going to be changed to raise an error, |
|
3327 |
an redefined in subclasses which can do it (either by direct compilation, or by calling |
|
3328 |
the external stc do do it. |
|
3329 |
For a description of the arguments, see compile:forClass....." |
|
3330 |
||
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3331 |
|stFileName stream handle stcFlags cFlags def |
429 | 3332 |
command oFileName cFileName |
1071
b721f58d0cd0
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
1055
diff
changeset
|
3333 |
initName oldMethod newMethod ok status className sep class stcPath ccPath |
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3334 |
errorStream errorMessages eMsg supers mP moduleFileName |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3335 |
mapFileName libFileName pkg t s| |
301
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
3336 |
|
1127
2b8f55a5eced
cannot load machine-code without installing
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
3337 |
install ifFalse:[ |
2b8f55a5eced
cannot load machine-code without installing
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
3338 |
"/ cannot do it uninstalled. reason: |
2b8f55a5eced
cannot load machine-code without installing
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
3339 |
"/ if it is loaded twice, the first version could be unloaded by |
2b8f55a5eced
cannot load machine-code without installing
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
3340 |
"/ finalization, which would also unload the second version |
2b8f55a5eced
cannot load machine-code without installing
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
3341 |
"/ (because the first unload would unload the second version too) |
2b8f55a5eced
cannot load machine-code without installing
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
3342 |
^ #CannotLoad |
2b8f55a5eced
cannot load machine-code without installing
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
3343 |
]. |
2b8f55a5eced
cannot load machine-code without installing
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
3344 |
|
301
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
3345 |
(mP := STCModulePath asFilename) exists ifFalse:[ |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
3346 |
mP makeDirectory |
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
3347 |
]. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3348 |
(mP isDirectory and:[mP isReadable and:[mP isWritable]]) ifFalse:[ |
959 | 3349 |
self parseError:('no access to temporary module directory: ' , mP pathName) position:1. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3350 |
^ #CannotLoad |
301
5c0add6f00e2
create temporary method object files in an extra directory;
Claus Gittinger <cg@exept.de>
parents:
298
diff
changeset
|
3351 |
]. |
959 | 3352 |
"/ create a small README there ... |
3353 |
(t := mP construct:'README') exists ifFalse:[ |
|
3354 |
s := t writeStream. |
|
960 | 3355 |
s nextPutAll: |
3356 |
'This temporary ST/X directory contains machine code for |
|
3357 |
accepted methods with embedded C-code |
|
3358 |
(i.e. dynamic compiled code for inline-C methods). |
|
3359 |
||
3360 |
Files here are not automatically removed, since ST/X |
|
3361 |
cannot determine if any (other) snapshot image still |
|
3362 |
requires a file here. |
|
3363 |
||
3364 |
Please be careful when removing files here - a snapshot |
|
3365 |
image which was saved with accepted embedded C-code |
|
3366 |
may not be able to restart correctly if you remove a |
|
3367 |
required file. |
|
3368 |
Also, when you export a snapshot image for execution |
|
3369 |
on another machine, make certain that the required |
|
3370 |
module-files are also present there. |
|
3371 |
||
3372 |
You should periodically clean dead entries here. |
|
3373 |
i.e. remove files, when you are certain that none |
|
3374 |
of your snapshot images refers to any module here. |
|
3375 |
||
3376 |
See the launchers File-Modules dialog for a list of |
|
3377 |
modules which are still required by your running image. |
|
3378 |
||
3379 |
With kind regards - your ST/X. |
|
3380 |
'. |
|
959 | 3381 |
s close. |
3382 |
]. |
|
96 | 3383 |
|
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
|
3384 |
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
|
3385 |
STCCompilation == #never ifTrue:[^ #CannotLoad]. |
120 | 3386 |
(stcPath := self class incrementalStcPath) isNil ifTrue:[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3387 |
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
|
3388 |
^ #CannotLoad |
120 | 3389 |
]. |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
3390 |
(ccPath := self class ccPath) isNil ifTrue:[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3391 |
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
|
3392 |
^ #CannotLoad |
742
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3393 |
]. |
73b6a9c187f3
ask ObjectFileLoader for objectFile extension
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3394 |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3395 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3396 |
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
|
3397 |
^ #CannotLoad |
411
d4ca24ab1f4c
more control over cc command;
Claus Gittinger <cg@exept.de>
parents:
410
diff
changeset
|
3398 |
]. |
54 | 3399 |
|
298
118648c3b590
include the processID in the dynamic modules name;
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
3400 |
"/ 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
|
3401 |
"/ 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
|
3402 |
"/ lifes |
118648c3b590
include the processID in the dynamic modules name;
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
3403 |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3404 |
SequenceNumber isNil ifTrue:[SequenceNumber := 0]. |
54 | 3405 |
SequenceNumber := SequenceNumber + 1. |
49 | 3406 |
|
298
118648c3b590
include the processID in the dynamic modules name;
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
3407 |
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
|
3408 |
|
751 | 3409 |
stFileName := (Filename currentDirectory construct:(initName , '.st')) name. |
1376
5e77b236f347
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
1374
diff
changeset
|
3410 |
[ |
5e77b236f347
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
1374
diff
changeset
|
3411 |
stream := stFileName asFilename writeStream. |
5e77b236f347
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
1374
diff
changeset
|
3412 |
] on:FileStream openErrorSignal do:[:ex| |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3413 |
self parseError:'cannot create temporary sourcefile for compilation'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3414 |
^ #CannotLoad |
187 | 3415 |
]. |
49 | 3416 |
|
407 | 3417 |
[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3418 |
|definedClasses| |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3419 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3420 |
definedClasses := IdentitySet new. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3421 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3422 |
sep := stream class chunkSeparator. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3423 |
|
1213
7914609d026d
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3424 |
class := aClass theNonMetaclass. |
792
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3425 |
|
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3426 |
Class fileOutNameSpaceQuerySignal answer:true |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3427 |
do:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3428 |
supers := class allSuperclasses. |
925 | 3429 |
supers reverseDo:[:cls| |
3430 |
true "cls ~~ Object" ifTrue:[ |
|
3431 |
cls isLoaded ifFalse:[ |
|
3432 |
stream close. |
|
3433 |
^ #CannotLoad |
|
3434 |
]. |
|
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3435 |
"/ cls fileOutDefinitionOn:stream. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3436 |
cls basicFileOutDefinitionOn:stream withNameSpace:false withPackage:false. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3437 |
|
925 | 3438 |
stream nextPut:sep; cr. |
3439 |
definedClasses add:cls. |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3440 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3441 |
]. |
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3442 |
"/ class fileOutDefinitionOn:stream. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3443 |
class basicFileOutDefinitionOn:stream withNameSpace:false withPackage:false. |
792
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3444 |
stream nextPut:sep; cr. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3445 |
definedClasses add:class. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3446 |
|
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3447 |
class privateClassesSorted do:[:aPrivateClass | |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3448 |
supers := aPrivateClass allSuperclasses. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3449 |
supers notNil ifTrue:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3450 |
supers reverseDo:[:cls| |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3451 |
(definedClasses includes:cls) ifFalse:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3452 |
true "cls ~~ Object" ifTrue:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3453 |
cls isLoaded ifFalse:[ |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3454 |
stream close. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3455 |
^ #CannotLoad |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3456 |
]. |
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3457 |
"/ cls fileOutDefinitionOn:stream. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3458 |
cls basicFileOutDefinitionOn:stream withNameSpace:false withPackage:false. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3459 |
|
792
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3460 |
stream nextPut:sep; cr. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3461 |
definedClasses add:cls. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3462 |
] |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3463 |
] |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3464 |
] |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3465 |
]. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3466 |
(definedClasses includes:aPrivateClass) ifFalse:[ |
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3467 |
"/ aPrivateClass fileOutDefinitionOn:stream. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3468 |
aPrivateClass basicFileOutDefinitionOn:stream withNameSpace:false withPackage:false. |
792
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3469 |
stream nextPut:sep; cr. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3470 |
definedClasses add:aPrivateClass. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3471 |
] |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3472 |
]. |
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3473 |
|
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3474 |
class fileOutPrimitiveDefinitionsOn:stream. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3475 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3476 |
|
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3477 |
(aClass isNil or:[AllowExtensionsToPrivateClasses or:[aClass owningClass isNil]]) ifTrue:[ |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3478 |
(requestor respondsTo:#packageToInstall) ifFalse:[ |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3479 |
pkg := Class packageQuerySignal query. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3480 |
] ifTrue:[ |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3481 |
pkg := requestor packageToInstall |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3482 |
]. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3483 |
] ifFalse:[ |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3484 |
pkg := aClass owningClass package |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3485 |
]. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3486 |
false ifTrue:[ |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3487 |
stream cr. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3488 |
stream nextPutLine:'"{ Package: ''' , pkg , ''' }"'. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3489 |
stream cr. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3490 |
]. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3491 |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3492 |
stream nextPut:sep. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3493 |
className := class name. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3494 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3495 |
stream nextPutAll:className. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3496 |
aClass isMeta ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3497 |
stream nextPutAll:' class'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3498 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3499 |
stream nextPutAll:' methodsFor:'''; nextPutAll:cat; nextPutAll:''''. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3500 |
stream nextPut:sep; cr. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3501 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3502 |
stream nextPutLine:'"{ Line: 0 }"'; |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3503 |
nextChunkPut:aString; |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3504 |
space; nextPut:sep. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3505 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3506 |
stream close. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3507 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3508 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3509 |
call stc to compile it |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3510 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3511 |
oFileName := stFileName asFilename withoutSuffix name , (ObjectFileLoader objectFileExtension). |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3512 |
cFileName := (stFileName asFilename withSuffix:'c') name. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3513 |
mapFileName := (stFileName asFilename withSuffix:'map') name. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3514 |
libFileName := (stFileName asFilename withSuffix:'lib') name. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3515 |
oFileName asFilename delete. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3516 |
cFileName asFilename delete. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3517 |
|
781
7de50bbbf651
no need to set stcFlags to -commonSymbols and +sharedLibCode
Claus Gittinger <cg@exept.de>
parents:
773
diff
changeset
|
3518 |
"/ 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
|
3519 |
stcFlags := '+newIncremental -E:errorOutput -N' , initName . |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3520 |
cFlags := OperatingSystem getOSDefine. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3521 |
cFlags isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3522 |
cFlags := '' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3523 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3524 |
(def := OperatingSystem getCPUDefine) notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3525 |
cFlags := cFlags , ' ' , def |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3526 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3527 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3528 |
STCCompilationDefines notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3529 |
cFlags := cFlags , ' ' , STCCompilationDefines |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3530 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3531 |
STCCompilationIncludes notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3532 |
stcFlags := STCCompilationIncludes , ' ' , stcFlags. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3533 |
cFlags := cFlags , ' ' , STCCompilationIncludes. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3534 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3535 |
STCCompilationOptions notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3536 |
stcFlags := STCCompilationOptions , ' ' , stcFlags |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3537 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3538 |
CCCompilationOptions notNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3539 |
cFlags := cFlags , ' ' , CCCompilationOptions |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3540 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3541 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3542 |
command := stcPath , ' ' , stcFlags , ' -C ' , stFileName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3543 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3544 |
Verbose == true ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3545 |
'executing: ' infoPrint. command infoPrintCR. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3546 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3547 |
errorStream := 'errorOutput' asFilename writeStream. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3548 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3549 |
self activityNotification:'compiling (stc)'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3550 |
ok := OperatingSystem |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3551 |
executeCommand:command |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3552 |
inputFrom:nil |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3553 |
outputTo:errorStream |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3554 |
errorTo:errorStream |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3555 |
onError:[:stat| |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3556 |
status := stat. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3557 |
false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3558 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3559 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3560 |
cFileName asFilename exists ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3561 |
ok ifFalse:[ |
810 | 3562 |
'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
|
3563 |
ok := true |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3564 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3565 |
] ifFalse:[ |
810 | 3566 |
ok ifTrue:[ |
3567 |
'Compiler [info]: oops - system says stc ok - but no c-file is there ...' infoPrintCR. |
|
3568 |
]. |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3569 |
ok := false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3570 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3571 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3572 |
ok ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3573 |
"/ now compile to machine code |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3574 |
|
1479 | 3575 |
command := ccPath , ' ' , cFlags , ' -D__INCREMENTAL_COMPILE__ -c ' , cFileName. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3576 |
Verbose == true ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3577 |
'executing: ' infoPrint. command infoPrintCR. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3578 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3579 |
self activityNotification:'compiling (' , ccPath , ')'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3580 |
ok := OperatingSystem |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3581 |
executeCommand:command |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3582 |
inputFrom:nil |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3583 |
outputTo:errorStream |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3584 |
errorTo:errorStream |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3585 |
onError:[:stat| |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3586 |
status := stat. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3587 |
false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3588 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3589 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3590 |
oFileName asFilename exists ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3591 |
ok ifFalse:[ |
810 | 3592 |
'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
|
3593 |
ok := true |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3594 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3595 |
] ifFalse:[ |
810 | 3596 |
ok ifTrue:[ |
3597 |
'Compiler [info]: system says compile ok - but no o-file is there ...' infoPrintCR. |
|
3598 |
]. |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3599 |
ok := false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3600 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3601 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3602 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3603 |
ok ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3604 |
(status notNil and:[status couldNotExecute]) ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3605 |
eMsg := 'oops, no STC - cannot create machine code' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3606 |
] ifFalse:[ |
1263
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3607 |
errorMessages := 'errorOutput' asFilename contents. |
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3608 |
errorMessages notNil ifTrue:[ |
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3609 |
errorMessages size > 20 ifTrue:[ |
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3610 |
errorMessages := (errorMessages copyTo:20) copyWith:'... more messages skipped' |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3611 |
]. |
1263
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3612 |
"/ errorMessages := errorMessages collect:[:line | |
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3613 |
"/ (line startsWith:(stFileName , ':')) ifTrue:[ |
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3614 |
"/ 'Line: ' , (line copyFrom:(stFileName size + 2)) |
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3615 |
"/ ] ifFalse:[ |
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3616 |
"/ line |
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3617 |
"/ ] |
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3618 |
"/ ]. |
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3619 |
errorMessages := errorMessages asString |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3620 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3621 |
errorMessages isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3622 |
errorMessages := '' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3623 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3624 |
errorMessages isEmpty ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3625 |
eMsg := 'STC / CC error during compilation:\\unspecified error' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3626 |
] ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3627 |
eMsg := 'STC / CC error during compilation:\\',errorMessages |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3628 |
]. |
1229 | 3629 |
"/ eMsg := eMsg withCRs |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3630 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3631 |
self activityNotification:'compilation failed'. |
1263
59adc52a4449
better code to get errorMessages
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
3632 |
self parseError:eMsg withCRs position:1. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3633 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3634 |
self activityNotification:''. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3635 |
^ #Error |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3636 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3637 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3638 |
self activityNotification:''. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3639 |
OperatingSystem removeFile:'errorOutput'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3640 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3641 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3642 |
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
|
3643 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3644 |
self activityNotification:'linking'. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3645 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3646 |
oFileName := ObjectFileLoader createLoadableObjectFor:initName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3647 |
oFileName isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3648 |
"/ something went wrong |
1216 | 3649 |
self parseError:('link error: ' , ObjectFileLoader lastError) position:1. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3650 |
^ #CannotLoad |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3651 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3652 |
oFileName asFilename exists ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3653 |
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
|
3654 |
^ #CannotLoad |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3655 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3656 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3657 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3658 |
move it into the modules directory |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3659 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3660 |
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
|
3661 |
oFileName asFilename moveTo:moduleFileName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3662 |
(moduleFileName asFilename exists |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3663 |
and:[moduleFileName asFilename isReadable]) ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3664 |
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
|
3665 |
^ #CannotLoad |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3666 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3667 |
|
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3668 |
oldMethod := aClass compiledMethodAt:selector. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3669 |
oldMethod notNil ifTrue:[pkg := oldMethod package]. |
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3670 |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3671 |
" |
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3672 |
load the method objectfile |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3673 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3674 |
self activityNotification:'loading'. |
781
7de50bbbf651
no need to set stcFlags to -commonSymbols and +sharedLibCode
Claus Gittinger <cg@exept.de>
parents:
773
diff
changeset
|
3675 |
|
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3676 |
handle := ObjectFileLoader loadMethodObjectFile:moduleFileName. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3677 |
handle isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3678 |
OperatingSystem removeFile:moduleFileName. |
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3679 |
self parseError:'dynamic load of machine code failed' position:1. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3680 |
^ #CannotLoad |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3681 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3682 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3683 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3684 |
did it work ? |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3685 |
" |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3686 |
newMethod := aClass compiledMethodAt:selector. |
1123 | 3687 |
|
3688 |
"/ if install is false, we have to undo the install (which is always done, when loading machine code) |
|
3689 |
install ifFalse:[ |
|
3690 |
oldMethod isNil ifTrue:[ |
|
3691 |
aClass removeSelector:selector |
|
3692 |
] ifFalse:[ |
|
1125 | 3693 |
newMethod setPackage:oldMethod package. |
1123 | 3694 |
aClass addSelector:selector withMethod:oldMethod. |
1124 | 3695 |
oldMethod setPackage:pkg. |
1123 | 3696 |
] |
3697 |
]. |
|
3698 |
||
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3699 |
newMethod notNil ifTrue:[ |
1255
76ed89aa23dd
refactored to invoke loadMethodObject, instead
Claus Gittinger <cg@exept.de>
parents:
1253
diff
changeset
|
3700 |
handle method ~~ newMethod ifTrue:[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3701 |
'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
|
3702 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3703 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3704 |
newMethod source:aString string. |
1118
01e9dcf336e5
method category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
1117
diff
changeset
|
3705 |
newMethod setPackage:pkg. |
415 | 3706 |
"/ Project notNil ifTrue:[ |
3707 |
"/ newMethod package:(Project currentPackageName) |
|
3708 |
"/ ]. |
|
407 | 3709 |
|
3710 |
"/ aClass updateRevisionString. |
|
1126 | 3711 |
install ifTrue:[ |
1123 | 3712 |
aClass addChangeRecordForMethod:newMethod fromOld:oldMethod. |
3713 |
||
3714 |
"/ kludge-sigh: must send change messages manually here (stc-loaded code does not do it) |
|
3715 |
"/ see addMethod:... in ClassDescription |
|
3716 |
aClass changed:#methodDictionary with:(Array with:selector with:oldMethod). |
|
3717 |
Smalltalk changed:#methodInClass with:(Array with:aClass with:selector with:oldMethod). |
|
3718 |
]. |
|
1113
f258bb0b394e
when compiling machine code: must send a change notification
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
3719 |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3720 |
(silent or:[Smalltalk silentLoading == true]) ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3721 |
Transcript showCR:(' compiled: ', className,' ',selector,' - machine code') |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3722 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3723 |
ObjectMemory flushCaches. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3724 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3725 |
handle method:newMethod. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3726 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3727 |
"/ check for obsolete loaded objects and unload them |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3728 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3729 |
ObjectFileLoader loadedObjectHandlesDo:[:anotherHandle | |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3730 |
anotherHandle isMethodHandle ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3731 |
anotherHandle method isNil ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3732 |
ObjectFileLoader unloadObjectFile:anotherHandle pathName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3733 |
OperatingSystem removeFile:anotherHandle pathName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3734 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3735 |
] |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3736 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3737 |
^ newMethod. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3738 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3739 |
|
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3740 |
OperatingSystem removeFile:moduleFileName. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3741 |
self parseError:'dynamic load failed' position:1. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3742 |
^ #CannotLoad |
1253
93bdb3e41f6f
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
3743 |
] ensure:[ |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3744 |
STCKeepSTIntermediate ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3745 |
OperatingSystem removeFile:stFileName. |
792
481f2cdc1fb1
when generating code for stc-compiled methods,
Claus Gittinger <cg@exept.de>
parents:
781
diff
changeset
|
3746 |
OperatingSystem removeFile:'errorOutput'. |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3747 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3748 |
STCKeepOIntermediate == true ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3749 |
(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
|
3750 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3751 |
STCKeepCIntermediate == true ifFalse:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3752 |
(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
|
3753 |
]. |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3754 |
OperatingSystem isMSDOSlike ifTrue:[ |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3755 |
"/ (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
|
3756 |
"/ (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
|
3757 |
]. |
407 | 3758 |
]. |
49 | 3759 |
|
3760 |
" |
|
3761 |
|m| |
|
3762 |
||
3763 |
Object subclass:#Test |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3764 |
instanceVariableNames:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3765 |
classVariableNames:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3766 |
poolDictionaries:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3767 |
category:'tests'. |
49 | 3768 |
m := ByteCodeCompiler |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3769 |
compile:'foo ^ ''hello''' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3770 |
forClass:Test |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3771 |
inCategory:'tests' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3772 |
notifying:nil |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3773 |
install:false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3774 |
skipIfSame:false. |
49 | 3775 |
m inspect |
3776 |
" |
|
3777 |
" |
|
3778 |
|m| |
|
3779 |
||
3780 |
Object subclass:#Test |
|
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3781 |
instanceVariableNames:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3782 |
classVariableNames:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3783 |
poolDictionaries:'' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3784 |
category:'tests'. |
49 | 3785 |
m := ByteCodeCompiler |
769
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3786 |
compileToMachineCode:'foo %{ RETURN (_MKSMALLINT(1)); %}' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3787 |
forClass:Test |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3788 |
inCategory:'tests' |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3789 |
notifying:nil |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3790 |
install:false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3791 |
skipIfSame:false |
cabe7bdb46ec
changes for WIN32 machineCode generation & loading
Claus Gittinger <cg@exept.de>
parents:
768
diff
changeset
|
3792 |
silent:false. |
49 | 3793 |
m inspect |
3794 |
" |
|
120 | 3795 |
|
723
188be048b0b2
when generating machine code,
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
3796 |
"Modified: / 14.9.1995 / 22:33:04 / claus" |
833
740fd0e90414
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
831
diff
changeset
|
3797 |
"Modified: / 19.3.1999 / 08:31:42 / stefan" |
1216 | 3798 |
"Modified: / 10.11.2001 / 01:46:00 / cg" |
182
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
3799 |
! |
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
3800 |
|
97 | 3801 |
trappingStubMethodFor:aString inCategory:cat |
3802 |
"return a stub method which traps and reports an error whenever |
|
3803 |
called." |
|
3804 |
||
292
163651658aee
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
287
diff
changeset
|
3805 |
|newMethod| |
97 | 3806 |
|
1094
745ec90c42c9
allow parametrizing the method class
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
3807 |
newMethod := self methodClass new:(litArray size). |
292
163651658aee
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
287
diff
changeset
|
3808 |
litArray notNil ifTrue:[ |
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
3809 |
newMethod literals:litArray |
97 | 3810 |
]. |
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
3811 |
|
124 | 3812 |
newMethod makeUncompiled. |
594
11ae33ac9b34
finally replaced all sends of #numberOfMethodVars with #numerOfVars
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3813 |
newMethod numberOfVars:(self numberOfMethodVars). |
11ae33ac9b34
finally replaced all sends of #numberOfMethodVars with #numerOfVars
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3814 |
newMethod numberOfArgs:(self numberOfMethodArgs). |
682 | 3815 |
newMethod source:aString string. |
1117
f03c007dadc6
methods send category-change notifications themself
Claus Gittinger <cg@exept.de>
parents:
1113
diff
changeset
|
3816 |
newMethod setCategory:cat. |
97 | 3817 |
^ newMethod |
277
0b599e23a936
set resourceFlag if method has a <resource> definition (prepare for fast search)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
3818 |
|
831
9ad749e60f55
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
810
diff
changeset
|
3819 |
"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
|
3820 |
"Modified: / 18.3.1999 / 18:12:33 / stefan" |
49 | 3821 |
! ! |
128
61eb0b356b89
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
3822 |
|
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3823 |
!ByteCodeCompiler methodsFor:'queries'! |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3824 |
|
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3825 |
numberOfTempVars |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3826 |
"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
|
3827 |
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
|
3828 |
|
558
e7ecd861b86f
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
556
diff
changeset
|
3829 |
^ maxNumTemp ? 0 |
556
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3830 |
|
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3831 |
"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
|
3832 |
"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
|
3833 |
! ! |
4a3775ada5d2
preps to move variables of inlined blocks into outer context
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
3834 |
|
372
98da4d230a8d
prepare support for 16-bit lineNumbers
Claus Gittinger <cg@exept.de>
parents:
357
diff
changeset
|
3835 |
!ByteCodeCompiler class methodsFor:'documentation'! |
148 | 3836 |
|
3837 |
version |
|
1508 | 3838 |
^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.223 2004-04-07 19:22:53 werner Exp $' |
148 | 3839 |
! ! |
1324 | 3840 |
|
209
b858b6a6880f
compare categoryStrings equal before writing a change record
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
3841 |
ByteCodeCompiler initialize! |