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