author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 16 Jan 2013 21:31:50 +0000 | |
branch | refactoring-vmdata |
changeset 1973 | 617e6a088dd1 |
parent 1880 | 27b932afa4a7 |
child 2069 | 75d40b7b986f |
permissions | -rw-r--r-- |
1462 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
3 |
||
4 |
New code and modifications done at SWING Research Group [1]: |
|
5 |
||
6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
7 |
SWING Research Group, Czech Technical University in Prague |
|
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 |
[1] Code written at SWING Research Group contains a signature |
|
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
19 |
as of 1.9.2010 |
|
20 |
" |
|
21 |
"{ Package: 'stx:libjava/experiments' }" |
|
22 |
||
23 |
JavaByteCodeInterpreter subclass:#JavaByteCodeSteppableInterpreter |
|
24 |
instanceVariableNames:'interpretInnerHook' |
|
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Bytecode' |
|
28 |
! |
|
29 |
||
30 |
!JavaByteCodeSteppableInterpreter class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
35 |
||
36 |
New code and modifications done at SWING Research Group [1]: |
|
37 |
||
38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
48 |
[1] Code written at SWING Research Group contains a signature |
|
49 |
of one of the above copright owners. For exact set of such code, |
|
50 |
see the differences between this version and version stx:libjava |
|
51 |
as of 1.9.2010 |
|
52 |
||
53 |
" |
|
54 |
! ! |
|
55 |
||
56 |
!JavaByteCodeSteppableInterpreter methodsFor:'accessing'! |
|
57 |
||
58 |
byteCode |
|
59 |
^ byteCode. |
|
60 |
||
61 |
"Created: / 01-04-2011 / 16:18:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
62 |
! |
|
63 |
||
64 |
constantPool |
|
65 |
^constantPool. |
|
66 |
||
67 |
"Created: / 01-04-2011 / 16:20:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
68 |
! |
|
69 |
||
70 |
context |
|
71 |
^ context. |
|
72 |
||
73 |
"Created: / 01-04-2011 / 16:20:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
74 |
! |
|
75 |
||
76 |
currentOp |
|
77 |
^ op. |
|
78 |
||
79 |
"Created: / 01-04-2011 / 16:18:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
80 |
! |
|
81 |
||
82 |
instructionPointer |
|
83 |
^ instrPointer. |
|
84 |
||
85 |
"Created: / 01-04-2011 / 16:19:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
86 |
! |
|
87 |
||
88 |
method |
|
89 |
^ method. |
|
90 |
||
91 |
"Created: / 01-04-2011 / 16:20:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
92 |
! |
|
93 |
||
94 |
numArgs |
|
95 |
^ numArgs. |
|
96 |
||
97 |
"Created: / 01-04-2011 / 16:19:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
98 |
! |
|
99 |
||
100 |
numVars |
|
101 |
^numVars. |
|
102 |
||
103 |
"Created: / 01-04-2011 / 16:19:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
104 |
! |
|
105 |
||
106 |
programCounter |
|
107 |
^pc. |
|
108 |
||
109 |
"Created: / 01-04-2011 / 16:20:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
110 |
! |
|
111 |
||
112 |
receiver |
|
113 |
^ receiver. |
|
114 |
||
115 |
"Created: / 01-04-2011 / 16:19:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
116 |
! |
|
117 |
||
118 |
stackPointer |
|
119 |
^ sp. |
|
120 |
||
121 |
"Created: / 01-04-2011 / 16:18:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
122 |
! |
|
123 |
||
124 |
wide |
|
125 |
^ wide. |
|
126 |
||
127 |
"Created: / 01-04-2011 / 16:19:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
128 |
! ! |
|
129 |
||
130 |
!JavaByteCodeSteppableInterpreter methodsFor:'interpretation'! |
|
131 |
||
132 |
enterProcessingLoop |
|
133 |
"nothing done here (yet?), call interpretNext" |
|
134 |
||
135 |
"Created: / 31-03-2011 / 16:40:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
136 |
"Modified: / 01-04-2011 / 16:13:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
137 |
! |
|
138 |
||
139 |
hasFinished |
|
140 |
^ leaveProcessor. |
|
141 |
||
142 |
"Created: / 31-03-2011 / 22:53:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
143 |
! |
|
144 |
||
145 |
interpret: aMethod receiver: aReceiver arguments: args |
|
146 |
self |
|
147 |
log: ('Invoking method ' , aMethod name , ' on ' , aReceiver printString |
|
148 |
, ' with ' , args printString). |
|
149 |
super |
|
150 |
interpret: aMethod |
|
151 |
receiver: aReceiver |
|
152 |
arguments: args. |
|
153 |
^ self. |
|
154 |
||
155 |
"Created: / 17-03-2011 / 17:25:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
156 |
"Modified: / 01-04-2011 / 16:10:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
157 |
! |
|
158 |
||
159 |
interpretInner: aJavaMethod receiver: aReceiver arguments: arguments |
|
160 |
||
161 |
interpretInnerHook ifNil: |
|
162 |
[ ^ super |
|
163 |
interpretInner: aJavaMethod |
|
164 |
receiver: aReceiver |
|
165 |
arguments: arguments ] |
|
166 |
ifNotNil: |
|
167 |
[ ^ interpretInnerHook |
|
168 |
with: aJavaMethod |
|
169 |
with: aReceiver |
|
170 |
with: arguments ]. |
|
171 |
||
172 |
"Created: / 31-03-2011 / 16:41:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
173 |
"Modified: / 01-04-2011 / 16:15:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
174 |
! |
|
175 |
||
176 |
interpretInnerHook: threeArgBlock |
|
177 |
"args: method receiver arguments" |
|
178 |
||
179 |
interpretInnerHook := threeArgBlock. |
|
180 |
||
181 |
"Created: / 31-03-2011 / 22:50:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
182 |
"Modified: / 08-04-2011 / 14:49:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
183 |
! |
|
184 |
||
185 |
interpretNext |
|
186 |
leaveProcessor ifTrue: [ ^ self interpretationFinished ]. |
|
187 |
Context cannotReturnSignal handle: [:ex | ^ ex parameter ] |
|
188 |
do: |
|
189 |
[ instrPointer := pc. |
|
190 |
op := byteCode at: pc. |
|
191 |
pc := pc + 1. |
|
192 |
self switch: op. ]. |
|
193 |
||
194 |
"Created: / 31-03-2011 / 16:41:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
195 |
! |
|
196 |
||
197 |
returnValue |
|
198 |
^ retVal. |
|
199 |
||
200 |
"Created: / 31-03-2011 / 22:53:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
201 |
! ! |
|
202 |
||
203 |
!JavaByteCodeSteppableInterpreter class methodsFor:'documentation'! |
|
204 |
||
1880
27b932afa4a7
Refactored JavaCompiler (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
205 |
version_HG |
27b932afa4a7
Refactored JavaCompiler (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
206 |
|
27b932afa4a7
Refactored JavaCompiler (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
207 |
^ '$Changeset: <not expanded> $' |
27b932afa4a7
Refactored JavaCompiler (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
208 |
! |
27b932afa4a7
Refactored JavaCompiler (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
209 |
|
1462 | 210 |
version_SVN |
1880
27b932afa4a7
Refactored JavaCompiler (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
211 |
^ '§Id§' |
1462 | 212 |
! ! |