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