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