equal
deleted
inserted
replaced
21 |
21 |
22 CompiledCode comment:' |
22 CompiledCode comment:' |
23 COPYRIGHT (c) 1994 by Claus Gittinger |
23 COPYRIGHT (c) 1994 by Claus Gittinger |
24 All Rights Reserved |
24 All Rights Reserved |
25 |
25 |
26 $Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.11 1995-04-11 14:48:52 claus Exp $ |
26 $Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.12 1995-05-01 21:29:03 claus Exp $ |
27 '! |
27 '! |
28 |
28 |
29 !CompiledCode class methodsFor:'documentation'! |
29 !CompiledCode class methodsFor:'documentation'! |
30 |
30 |
31 copyright |
31 copyright |
42 " |
42 " |
43 ! |
43 ! |
44 |
44 |
45 version |
45 version |
46 " |
46 " |
47 $Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.11 1995-04-11 14:48:52 claus Exp $ |
47 $Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.12 1995-05-01 21:29:03 claus Exp $ |
48 " |
48 " |
49 ! |
49 ! |
50 |
50 |
51 documentation |
51 documentation |
52 " |
52 " |
53 This is an abstract class, to merge common attributes of Blocks and |
53 This is an abstract class, to merge common attributes of Blocks and |
54 Methods i.e. describe all objects consisting of compiled or interpreted code. |
54 Methods i.e. describe all objects consisting of either compiled or |
|
55 interpreted code. |
55 |
56 |
56 Instance variables: |
57 Instance variables: |
57 |
58 |
58 byteCode <ByteArray> bytecode if its an interpreted codeobject |
59 byteCode <ByteArray> bytecode if its an interpreted codeobject |
59 literals <Array> the block/methods literal array |
60 literals <Array> the block/methods literal array |
140 "return the literal array" |
141 "return the literal array" |
141 |
142 |
142 ^ literals |
143 ^ literals |
143 ! ! |
144 ! ! |
144 |
145 |
|
146 !CompiledCode methodsFor:'queries'! |
|
147 |
|
148 messages |
|
149 "return a Set of all symbols referenced by this thingy. |
|
150 (this is more than the message selectors, since also global names |
|
151 and symbols found in immediate arrays are included)." |
|
152 |
|
153 |symbolSet| |
|
154 |
|
155 symbolSet := IdentitySet new. |
|
156 literals notNil ifTrue:[ |
|
157 literals do: [ :lit | |
|
158 (lit isSymbol) ifTrue: [ |
|
159 symbolSet add: lit |
|
160 ] ifFalse: [ |
|
161 (lit isKindOf:Array) ifTrue: [ |
|
162 lit traverse: [ :el | |
|
163 (el isSymbol) ifTrue: [symbolSet add: el] |
|
164 ] |
|
165 ] |
|
166 ] |
|
167 ] |
|
168 ]. |
|
169 ^ symbolSet |
|
170 |
|
171 " |
|
172 (CompiledCode compiledMethodAt:#messages) messages |
|
173 " |
|
174 ! ! |
|
175 |
145 !CompiledCode methodsFor:'private accessing'! |
176 !CompiledCode methodsFor:'private accessing'! |
146 |
177 |
147 byteCode:aByteArray |
178 byteCode:aByteArray |
148 "set the bytecode field - DANGER ALERT" |
179 "set the bytecode field - DANGER ALERT" |
149 |
180 |
160 |
191 |
161 noByteCode |
192 noByteCode |
162 "this error is triggered when the interpreter tries to execute a |
193 "this error is triggered when the interpreter tries to execute a |
163 code object, where the byteCode is nil. |
194 code object, where the byteCode is nil. |
164 Can only happen when Compiler/runtime system is broken or |
195 Can only happen when Compiler/runtime system is broken or |
165 someone played around with a block/method." |
196 someone played around with a block/method. |
|
197 (late news: also used for lazy compilation of methods)" |
166 |
198 |
167 ^ NoByteCodeSignal raise. |
199 ^ NoByteCodeSignal raise. |
168 ! |
200 ! |
169 |
201 |
170 invalidByteCode |
202 invalidByteCode |