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