749
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
3 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
4 |
SWING Research Group, Czech Technical University in Prague
|
|
5 |
|
|
6 |
Parts of the code written by Claus Gittinger are under following
|
|
7 |
license:
|
|
8 |
|
|
9 |
This software is furnished under a license and may be used
|
|
10 |
only in accordance with the terms of that license and with the
|
|
11 |
inclusion of the above copyright notice. This software may not
|
|
12 |
be provided or otherwise made available to, or used by, any
|
|
13 |
other person. No title to or ownership of the software is
|
|
14 |
hereby transferred.
|
|
15 |
|
|
16 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
|
|
17 |
|
|
18 |
Permission is hereby granted, free of charge, to any person
|
|
19 |
obtaining a copy of this software and associated documentation
|
|
20 |
files (the 'Software'), to deal in the Software without
|
|
21 |
restriction, including without limitation the rights to use,
|
|
22 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23 |
copies of the Software, and to permit persons to whom the
|
|
24 |
Software is furnished to do so, subject to the following
|
|
25 |
conditions:
|
|
26 |
|
|
27 |
The above copyright notice and this permission notice shall be
|
|
28 |
included in all copies or substantial portions of the Software.
|
|
29 |
|
|
30 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
31 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
32 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
33 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
34 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
35 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
36 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
37 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
38 |
|
|
39 |
[1] Code written at SWING Research Group contain a signature
|
|
40 |
of one of the above copright owners.
|
|
41 |
"
|
|
42 |
"{ Package: 'stx:libjava' }"
|
|
43 |
|
|
44 |
JavaByteCodeInterpreter subclass:#JavaByteCodeSteppableInterpreter
|
|
45 |
instanceVariableNames:'interpretInnerHook'
|
|
46 |
classVariableNames:''
|
|
47 |
poolDictionaries:''
|
|
48 |
category:'Languages-Java-Bytecode'
|
|
49 |
!
|
|
50 |
|
|
51 |
!JavaByteCodeSteppableInterpreter class methodsFor:'documentation'!
|
|
52 |
|
|
53 |
copyright
|
|
54 |
"
|
|
55 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
56 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
57 |
SWING Research Group, Czech Technical University in Prague
|
|
58 |
|
|
59 |
Parts of the code written by Claus Gittinger are under following
|
|
60 |
license:
|
|
61 |
|
|
62 |
This software is furnished under a license and may be used
|
|
63 |
only in accordance with the terms of that license and with the
|
|
64 |
inclusion of the above copyright notice. This software may not
|
|
65 |
be provided or otherwise made available to, or used by, any
|
|
66 |
other person. No title to or ownership of the software is
|
|
67 |
hereby transferred.
|
|
68 |
|
|
69 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
|
|
70 |
|
|
71 |
Permission is hereby granted, free of charge, to any person
|
|
72 |
obtaining a copy of this software and associated documentation
|
|
73 |
files (the 'Software'), to deal in the Software without
|
|
74 |
restriction, including without limitation the rights to use,
|
|
75 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
76 |
copies of the Software, and to permit persons to whom the
|
|
77 |
Software is furnished to do so, subject to the following
|
|
78 |
conditions:
|
|
79 |
|
|
80 |
The above copyright notice and this permission notice shall be
|
|
81 |
included in all copies or substantial portions of the Software.
|
|
82 |
|
|
83 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
84 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
85 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
86 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
87 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
88 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
89 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
90 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
91 |
|
|
92 |
[1] Code written at SWING Research Group contain a signature
|
|
93 |
of one of the above copright owners.
|
|
94 |
|
|
95 |
"
|
|
96 |
! !
|
|
97 |
|
|
98 |
!JavaByteCodeSteppableInterpreter methodsFor:'accessing'!
|
|
99 |
|
|
100 |
byteCode
|
|
101 |
^ byteCode.
|
|
102 |
|
|
103 |
"Created: / 01-04-2011 / 16:18:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
104 |
!
|
|
105 |
|
|
106 |
constantPool
|
|
107 |
^constantPool.
|
|
108 |
|
|
109 |
"Created: / 01-04-2011 / 16:20:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
110 |
!
|
|
111 |
|
|
112 |
context
|
|
113 |
^ context.
|
|
114 |
|
|
115 |
"Created: / 01-04-2011 / 16:20:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
116 |
!
|
|
117 |
|
|
118 |
currentOp
|
|
119 |
^ op.
|
|
120 |
|
|
121 |
"Created: / 01-04-2011 / 16:18:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
122 |
!
|
|
123 |
|
|
124 |
instructionPointer
|
|
125 |
^ instrPointer.
|
|
126 |
|
|
127 |
"Created: / 01-04-2011 / 16:19:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
128 |
!
|
|
129 |
|
|
130 |
method
|
|
131 |
^ method.
|
|
132 |
|
|
133 |
"Created: / 01-04-2011 / 16:20:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
134 |
!
|
|
135 |
|
|
136 |
numArgs
|
|
137 |
^ numArgs.
|
|
138 |
|
|
139 |
"Created: / 01-04-2011 / 16:19:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
140 |
!
|
|
141 |
|
|
142 |
numVars
|
|
143 |
^numVars.
|
|
144 |
|
|
145 |
"Created: / 01-04-2011 / 16:19:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
146 |
!
|
|
147 |
|
|
148 |
programCounter
|
|
149 |
^pc.
|
|
150 |
|
|
151 |
"Created: / 01-04-2011 / 16:20:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
152 |
!
|
|
153 |
|
|
154 |
receiver
|
|
155 |
^ receiver.
|
|
156 |
|
|
157 |
"Created: / 01-04-2011 / 16:19:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
158 |
!
|
|
159 |
|
|
160 |
stackPointer
|
|
161 |
^ sp.
|
|
162 |
|
|
163 |
"Created: / 01-04-2011 / 16:18:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
164 |
!
|
|
165 |
|
|
166 |
wide
|
|
167 |
^ wide.
|
|
168 |
|
|
169 |
"Created: / 01-04-2011 / 16:19:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
170 |
! !
|
|
171 |
|
|
172 |
!JavaByteCodeSteppableInterpreter methodsFor:'interpretation'!
|
|
173 |
|
|
174 |
enterProcessingLoop
|
|
175 |
"nothing done here (yet?), call interpretNext"
|
|
176 |
|
|
177 |
"Created: / 31-03-2011 / 16:40:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
178 |
"Modified: / 01-04-2011 / 16:13:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
179 |
!
|
|
180 |
|
|
181 |
hasFinished
|
|
182 |
^ leaveProcessor.
|
|
183 |
|
|
184 |
"Created: / 31-03-2011 / 22:53:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
185 |
!
|
|
186 |
|
|
187 |
interpret: aMethod receiver: aReceiver arguments: args
|
|
188 |
self
|
|
189 |
log: ('Invoking method ' , aMethod name , ' on ' , aReceiver printString
|
|
190 |
, ' with ' , args printString).
|
|
191 |
super
|
|
192 |
interpret: aMethod
|
|
193 |
receiver: aReceiver
|
|
194 |
arguments: args.
|
|
195 |
^ self.
|
|
196 |
|
|
197 |
"Created: / 17-03-2011 / 17:25:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
198 |
"Modified: / 01-04-2011 / 16:10:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
199 |
!
|
|
200 |
|
|
201 |
interpretInner: aJavaMethod receiver: aReceiver arguments: arguments
|
|
202 |
|
|
203 |
interpretInnerHook ifNil:
|
|
204 |
[ ^ super
|
|
205 |
interpretInner: aJavaMethod
|
|
206 |
receiver: aReceiver
|
|
207 |
arguments: arguments ]
|
|
208 |
ifNotNil:
|
|
209 |
[ ^ interpretInnerHook
|
|
210 |
with: aJavaMethod
|
|
211 |
with: aReceiver
|
|
212 |
with: arguments ].
|
|
213 |
|
|
214 |
"Created: / 31-03-2011 / 16:41:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
215 |
"Modified: / 01-04-2011 / 16:15:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
216 |
!
|
|
217 |
|
|
218 |
interpretInnerHook: threeArgBlock
|
|
219 |
"args: method receiver arguments"
|
|
220 |
|
|
221 |
interpretInnerHook := threeArgBlock.
|
|
222 |
|
|
223 |
"Created: / 31-03-2011 / 22:50:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
224 |
"Modified: / 08-04-2011 / 14:49:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
225 |
!
|
|
226 |
|
|
227 |
interpretNext
|
|
228 |
leaveProcessor ifTrue: [ ^ self interpretationFinished ].
|
|
229 |
Context cannotReturnSignal handle: [:ex | ^ ex parameter ]
|
|
230 |
do:
|
|
231 |
[ instrPointer := pc.
|
|
232 |
op := byteCode at: pc.
|
|
233 |
pc := pc + 1.
|
|
234 |
self switch: op. ].
|
|
235 |
|
|
236 |
"Created: / 31-03-2011 / 16:41:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
237 |
!
|
|
238 |
|
|
239 |
returnValue
|
|
240 |
^ retVal.
|
|
241 |
|
|
242 |
"Created: / 31-03-2011 / 22:53:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
243 |
! !
|
|
244 |
|
|
245 |
!JavaByteCodeSteppableInterpreter class methodsFor:'documentation'!
|
|
246 |
|
|
247 |
version_SVN
|
|
248 |
^ '$Id$'
|
|
249 |
! ! |