author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 30 Jan 2013 14:47:53 +0000 | |
branch | refactoring-vmdata |
changeset 2010 | 9bacff8c53de |
parent 2008 | c348b894fbfe |
child 2023 | ce075b5d052f |
permissions | -rw-r--r-- |
752 | 1 |
" |
877 | 2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
877 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
752 | 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. |
|
877 | 15 |
|
1155 | 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 |
|
1152 | 19 |
as of 1.9.2010 |
752 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
Object subclass:#JavaVM |
|
24 |
instanceVariableNames:'' |
|
25 |
classVariableNames:'UnhandledJavaExceptionSignal JavaExceptionSignal |
|
26 |
UnimplementedInstructionSignal UnimplementedNativeMethodSignal |
|
1966
8a26e8ccbd7f
Class variables refactoring - JavaVMData now contains only those required by natives.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
27 |
BadMessageSignal InternalErrorSignal CallHandlerSignal LockTable |
1968
9ad4e27233cb
Cleanup: removed unused classvars from JavaVM
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1967
diff
changeset
|
28 |
LockTableAccess StackTrace EagerResolvingEnabled |
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
29 |
OldspaceIncreased PerfCounters MonitorTrace MonitorTraceId |
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
30 |
ExceptionTrace ExceptionDebug ExitDebug StandardThreadGroup |
1966
8a26e8ccbd7f
Class variables refactoring - JavaVMData now contains only those required by natives.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
31 |
AcquiredMonitorsPerProcess DUMMY_LONG_HIGHWORD |
8a26e8ccbd7f
Class variables refactoring - JavaVMData now contains only those required by natives.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
32 |
DUMMY_DOUBLE_HIGHWORD FirstWindowCreationSemaphore SimulatedOS |
8a26e8ccbd7f
Class variables refactoring - JavaVMData now contains only those required by natives.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
33 |
O_WGgraphics_originX O_WGgraphics_originY O_WGgraphics_pData |
8a26e8ccbd7f
Class variables refactoring - JavaVMData now contains only those required by natives.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
34 |
O_FramePeer_pNativeWidget O_FramePeer_pData LastGraphics LastGC |
1528 | 35 |
ExceptionDebugPatterns NullPointerExceptionDebug |
752 | 36 |
DivisionByZeroExceptionDebug IOExceptionDebug |
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
37 |
JavaPrivilegedAccessQuery SmalltalkClassLoader |
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
38 |
FinalizationEnabled FinalizationLobby ParkUnparkSemaphores |
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
39 |
ThreadInterrupts NativeMethodsImplementation' |
1966
8a26e8ccbd7f
Class variables refactoring - JavaVMData now contains only those required by natives.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
40 |
poolDictionaries:'JavaConstants JavaVMData' |
752 | 41 |
category:'Languages-Java-Support' |
42 |
! |
|
43 |
||
1597 | 44 |
Object subclass:#Performance |
45 |
instanceVariableNames:'vm' |
|
46 |
classVariableNames:'' |
|
47 |
poolDictionaries:'' |
|
48 |
privateIn:JavaVM |
|
49 |
! |
|
50 |
||
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
51 |
Object subclass:#ReflectionRegistry |
1217 | 52 |
instanceVariableNames:'vm constantPoolMapping javaClasses javaArrayClasses |
53 |
javaMethodsPerMethod returnNilIfMissing realMethods' |
|
752 | 54 |
classVariableNames:'' |
55 |
poolDictionaries:'' |
|
56 |
privateIn:JavaVM |
|
57 |
! |
|
58 |
||
59 |
!JavaVM class methodsFor:'documentation'! |
|
60 |
||
61 |
copyright |
|
62 |
" |
|
877 | 63 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
1152 | 64 |
|
1155 | 65 |
New code and modifications done at SWING Research Group [1]: |
1152 | 66 |
|
877 | 67 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
68 |
SWING Research Group, Czech Technical University in Prague |
|
69 |
||
752 | 70 |
This software is furnished under a license and may be used |
71 |
only in accordance with the terms of that license and with the |
|
72 |
inclusion of the above copyright notice. This software may not |
|
73 |
be provided or otherwise made available to, or used by, any |
|
74 |
other person. No title to or ownership of the software is |
|
75 |
hereby transferred. |
|
877 | 76 |
|
1155 | 77 |
[1] Code written at SWING Research Group contains a signature |
78 |
of one of the above copright owners. For exact set of such code, |
|
79 |
see the differences between this version and version stx:libjava |
|
1152 | 80 |
as of 1.9.2010 |
877 | 81 |
|
752 | 82 |
" |
83 |
! |
|
84 |
||
85 |
documentation |
|
1816 | 86 |
"Runtime support and environment for Java. |
87 |
You shouldn't communicate with JavaVM directly, |
|
752 | 88 |
use Java class instead. JavaVM is layer between |
89 |
the native interpret and the rest of the system. |
|
1816 | 90 |
JavaVM implements native java virtual machine |
91 |
methods called by interpret, hides java primitive |
|
92 |
types handling, and gives the ST world ways to |
|
752 | 93 |
control class loading and reflection" |
94 |
! |
|
95 |
||
96 |
nativeMethods |
|
97 |
" |
|
98 |
all native methods: |
|
99 |
||
100 |
JavaMethod allSubInstances select:[:m | |
|
1816 | 101 |
m isNative |
752 | 102 |
] |
103 |
||
104 |
implemented methods: |
|
105 |
||
106 |
JavaMethod allSubInstances select:[:m | |
|
107 |
|sel| |
|
108 |
||
109 |
m isNative ifTrue:[ |
|
110 |
sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol. |
|
111 |
JavaVM class implements:sel. |
|
112 |
] ifFalse:[ |
|
113 |
false |
|
114 |
] |
|
115 |
] |
|
116 |
||
117 |
unimplemented methods: |
|
118 |
||
119 |
JavaMethod allSubInstances select:[:m | |
|
120 |
|sel| |
|
121 |
||
122 |
m isNative ifTrue:[ |
|
123 |
sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol. |
|
124 |
(JavaVM class implements:sel) not |
|
125 |
] ifFalse:[ |
|
126 |
false |
|
127 |
] |
|
1816 | 128 |
] |
752 | 129 |
|
130 |
||
131 |
list of all native methods as in jdk1.1.3: |
|
132 |
||
133 |
X - implemented |
|
134 |
* - implemented to be validated |
|
135 |
x - implemented with limited functionality |
|
136 |
o - implemented as dummy (no functionality) |
|
137 |
||
138 |
X (Math::double sin (double)) |
|
139 |
X (Math::double cos (double)) |
|
140 |
X (Math::double tan (double)) |
|
141 |
X (Math::double asin (double)) |
|
142 |
X (Math::double acos (double)) |
|
143 |
X (Math::double atan (double)) |
|
144 |
X (Math::double exp (double)) |
|
145 |
X (Math::double log (double)) |
|
146 |
X (Math::double sqrt (double)) |
|
147 |
(Math::double IEEEremainder (double double)) |
|
148 |
X (Math::double ceil (double)) |
|
149 |
X (Math::double floor (double)) |
|
150 |
(Math::double rint (double)) |
|
151 |
(Math::double atan2 (double double)) |
|
152 |
X (Math::double pow (double double)) |
|
153 |
||
154 |
X (Class::java.lang.Class forName (java.lang.String)) |
|
155 |
X (Class::java.lang.Object newInstance ()) |
|
156 |
* (Class::boolean isInstance (java.lang.Object)) |
|
157 |
X (Class::boolean isAssignableFrom (java.lang.Class)) |
|
158 |
X (Class::boolean isInterface ()) |
|
159 |
(Class::boolean isArray ()) |
|
160 |
X (Class::boolean isPrimitive ()) |
|
161 |
X (Class::java.lang.String getName ()) |
|
162 |
X (Class::java.lang.ClassLoader getClassLoader ()) |
|
163 |
X (Class::java.lang.Class getSuperclass ()) |
|
164 |
(Class::java.lang.Class[] getInterfaces ()) |
|
165 |
(Class::java.lang.Class getComponentType ()) |
|
166 |
(Class::int getModifiers ()) |
|
167 |
(Class::java.lang.Object[] getSigners ()) |
|
168 |
(Class::void setSigners (java.lang.Object[])) |
|
169 |
X (Class::java.lang.Class getPrimitiveClass (java.lang.String)) |
|
170 |
(Class::java.lang.reflect.Field getField0 (java.lang.String int)) |
|
171 |
(Class::java.lang.reflect.Field[] getFields0 (int)) |
|
172 |
X (Class::java.lang.reflect.Method getMethod0 (java.lang.String java.lang.Class[] int)) |
|
173 |
X (Class::java.lang.reflect.Method[] getMethods0 (int)) |
|
174 |
(Class::java.lang.reflect.Constructor[] getConstructors0 (int)) |
|
175 |
(Class::java.lang.reflect.Constructor getConstructor0 (java.lang.Class[] int)) |
|
176 |
||
177 |
X (InetAddressImpl::java.lang.String getLocalHostName ()) |
|
178 |
X (InetAddressImpl::void makeAnyLocalAddress (java.net.InetAddress)) |
|
179 |
X (InetAddressImpl::byte[][] lookupAllHostAddr (java.lang.String)) |
|
180 |
(InetAddressImpl::java.lang.String getHostByAddr (int)) |
|
181 |
X (InetAddressImpl::int getInetFamily ()) |
|
182 |
||
183 |
X (ResourceBundle::java.lang.Class[] getClassContext ()) |
|
184 |
||
185 |
X (System::void setIn0 (java.io.InputStream)) |
|
186 |
X (System::void setOut0 (java.io.PrintStream)) |
|
187 |
X (System::void setErr0 (java.io.PrintStream)) |
|
188 |
X (System::long currentTimeMillis ()) |
|
189 |
X (System::void arraycopy (java.lang.Object int java.lang.Object int int)) |
|
190 |
X (System::int identityHashCode (java.lang.Object)) |
|
191 |
X (System::java.util.Properties initProperties (java.util.Properties)) |
|
192 |
||
193 |
X (Thread::java.lang.Thread currentThread ()) |
|
194 |
X (Thread::void yield ()) |
|
195 |
X (Thread::void sleep (long)) |
|
196 |
X (Thread::void start ()) |
|
197 |
X (Thread::boolean isInterrupted (boolean)) |
|
198 |
X (Thread::boolean isAlive ()) |
|
199 |
(Thread::int countStackFrames ()) |
|
200 |
X (Thread::void setPriority0 (int)) |
|
201 |
X (Thread::void stop0 (java.lang.Object)) |
|
202 |
X (Thread::void suspend0 ()) |
|
203 |
X (Thread::void resume0 ()) |
|
204 |
* (Thread::void interrupt0 ()) |
|
205 |
||
206 |
(String::java.lang.String intern ()) |
|
207 |
||
208 |
X (Float::int floatToIntBits (float)) |
|
209 |
X (Float::float intBitsToFloat (int)) |
|
210 |
||
211 |
(ObjectStreamClass::int getClassAccess (java.lang.Class)) |
|
212 |
(ObjectStreamClass::java.lang.String[] getMethodSignatures (java.lang.Class)) |
|
213 |
(ObjectStreamClass::int getMethodAccess (java.lang.Class java.lang.String)) |
|
214 |
(ObjectStreamClass::java.lang.String[] getFieldSignatures (java.lang.Class)) |
|
215 |
(ObjectStreamClass::int getFieldAccess (java.lang.Class java.lang.String)) |
|
216 |
(ObjectStreamClass::java.io.ObjectStreamField[] getFields0 (java.lang.Class)) |
|
217 |
(ObjectStreamClass::long getSerialVersionUID (java.lang.Class)) |
|
218 |
(ObjectStreamClass::boolean hasWriteObject (java.lang.Class)) |
|
219 |
(ObjectInputStream::java.lang.Class loadClass0 (java.lang.Class java.lang.String)) |
|
220 |
(ObjectInputStream::void inputClassFields (java.lang.Object java.lang.Class int[])) |
|
221 |
(ObjectInputStream::java.lang.Object allocateNewObject (java.lang.Class java.lang.Class)) |
|
222 |
(ObjectInputStream::java.lang.Object allocateNewArray (java.lang.Class int)) |
|
223 |
(ObjectInputStream::boolean invokeObjectReader (java.lang.Object java.lang.Class)) |
|
224 |
||
225 |
(SecurityManager::java.lang.Class[] getClassContext ()) |
|
226 |
X (SecurityManager::java.lang.ClassLoader currentClassLoader ()) |
|
227 |
(SecurityManager::int classDepth (java.lang.String)) |
|
228 |
X (SecurityManager::int classLoaderDepth ()) |
|
229 |
(SecurityManager::java.lang.Class currentLoadedClass0 ()) |
|
230 |
||
231 |
X (ClassLoader::void init ()) |
|
232 |
X (ClassLoader::java.lang.Class defineClass0 (java.lang.String byte[] int int)) |
|
233 |
X (ClassLoader::void resolveClass0 (java.lang.Class)) |
|
234 |
X (ClassLoader::java.lang.Class findSystemClass0 (java.lang.String)) |
|
235 |
X (ClassLoader::java.io.InputStream getSystemResourceAsStream0 (java.lang.String)) |
|
236 |
(ClassLoader::java.lang.String getSystemResourceAsName0 (java.lang.String)) |
|
237 |
||
238 |
X (FileDescriptor::boolean valid ()) |
|
239 |
(FileDescriptor::void sync ()) |
|
240 |
X (FileDescriptor::java.io.FileDescriptor initSystemFD (java.io.FileDescriptor int)) |
|
241 |
||
242 |
X (Object::java.lang.Class getClass ()) |
|
243 |
X (Object::int hashCode ()) |
|
244 |
X (Object::java.lang.Object clone ()) |
|
245 |
X (Object::void notify ()) |
|
246 |
X (Object::void notifyAll ()) |
|
247 |
X (Object::void wait (long)) |
|
248 |
||
249 |
X (FileOutputStream::void open (java.lang.String)) |
|
250 |
X (FileOutputStream::void openAppend (java.lang.String)) |
|
251 |
X (FileOutputStream::void write (int)) |
|
252 |
X (FileOutputStream::void writeBytes (byte[] int int)) |
|
253 |
X (FileOutputStream::void close ()) |
|
254 |
X (FileInputStream::void open (java.lang.String)) |
|
255 |
X (FileInputStream::int read ()) |
|
256 |
X (FileInputStream::int readBytes (byte[] int int)) |
|
257 |
(FileInputStream::long skip (long)) |
|
258 |
X (FileInputStream::int available ()) |
|
259 |
X (FileInputStream::void close ()) |
|
260 |
||
261 |
(VM::int getState ()) |
|
262 |
(VM::boolean threadsSuspended ()) |
|
263 |
(VM::void unsuspendThreads ()) |
|
264 |
(VM::void unsuspendSomeThreads ()) |
|
265 |
||
266 |
X (File::boolean exists0 ()) |
|
267 |
X (File::boolean canWrite0 ()) |
|
268 |
X (File::boolean canRead0 ()) |
|
269 |
X (File::boolean isFile0 ()) |
|
270 |
X (File::boolean isDirectory0 ()) |
|
271 |
X (File::long lastModified0 ()) |
|
272 |
X (File::long length0 ()) |
|
273 |
X (File::boolean mkdir0 ()) |
|
274 |
X (File::boolean renameTo0 (java.io.File)) |
|
275 |
X (File::boolean delete0 ()) |
|
276 |
(File::boolean rmdir0 ()) |
|
277 |
X (File::java.lang.String[] list0 ()) |
|
278 |
(File::java.lang.String canonPath (java.lang.String)) |
|
279 |
X (File::boolean isAbsolute ()) |
|
280 |
||
281 |
(ObjectOutputStream::void outputClassFields (java.lang.Object java.lang.Class int[])) |
|
282 |
(ObjectOutputStream::boolean invokeObjectWriter (java.lang.Object java.lang.Class)) |
|
283 |
||
284 |
X (Throwable::void printStackTrace0 (java.lang.Object)) |
|
285 |
X (Throwable::java.lang.Throwable fillInStackTrace ()) |
|
286 |
||
287 |
X (Double::long doubleToLongBits (double)) |
|
288 |
X (Double::double longBitsToDouble (long)) |
|
289 |
X (Double::double valueOf0 (java.lang.String)) |
|
290 |
||
291 |
X (Runtime::void exitInternal (int)) |
|
292 |
o (Runtime::void runFinalizersOnExit0 (boolean)) |
|
293 |
o (Runtime::java.lang.Process execInternal (java.lang.String[] java.lang.String[])) |
|
294 |
X (Runtime::long freeMemory ()) |
|
295 |
X (Runtime::long totalMemory ()) |
|
296 |
X (Runtime::void gc ()) |
|
297 |
(Runtime::void runFinalization ()) |
|
298 |
(Runtime::void traceInstructions (boolean)) |
|
299 |
(Runtime::void traceMethodCalls (boolean)) |
|
300 |
X (Runtime::java.lang.String initializeLinkerInternal ()) |
|
301 |
X (Runtime::java.lang.String buildLibName (java.lang.String java.lang.String)) |
|
302 |
X (Runtime::int loadFileInternal (java.lang.String)) |
|
303 |
||
304 |
(WDrawingSurfaceInfo::int lock ()) |
|
305 |
(WDrawingSurfaceInfo::void unlock ()) |
|
306 |
(WDrawingSurfaceInfo::int getHWnd ()) |
|
307 |
(WDrawingSurfaceInfo::int getHBitmap ()) |
|
308 |
(WDrawingSurfaceInfo::int getPBits ()) |
|
309 |
(WDrawingSurfaceInfo::int getHDC ()) |
|
310 |
(WDrawingSurfaceInfo::int getDepth ()) |
|
311 |
(WDrawingSurfaceInfo::int getHPalette ()) |
|
312 |
||
313 |
X (WDefaultFontCharset::boolean canConvert (char)) |
|
314 |
||
315 |
(ColorModel::void deletepData ()) |
|
316 |
X (WToolkit::void init (java.lang.Thread)) |
|
317 |
X (WToolkit::void eventLoop ()) |
|
318 |
(WToolkit::java.awt.image.ColorModel makeColorModel ()) |
|
319 |
X (WToolkit::int getScreenResolution ()) |
|
320 |
X (WToolkit::int getScreenWidth ()) |
|
321 |
X (WToolkit::int getScreenHeight ()) |
|
322 |
(WToolkit::void sync ()) |
|
323 |
* (WToolkit::void beep ()) |
|
324 |
X (WToolkit::void loadSystemColors (int[])) |
|
325 |
||
326 |
(WPrintJob::void end ()) |
|
327 |
||
328 |
X (WDialogPeer::void create (sun.awt.windows.WComponentPeer)) |
|
329 |
X (WDialogPeer::void _show ()) |
|
330 |
X (WDialogPeer::void _hide ()) |
|
331 |
||
332 |
X (WWindowPeer::void toFront ()) |
|
333 |
X (WWindowPeer::void toBack ()) |
|
334 |
X (WWindowPeer::void _setTitle (java.lang.String)) |
|
335 |
X (WWindowPeer::void _setResizable (boolean)) |
|
336 |
X (WWindowPeer::void create (sun.awt.windows.WComponentPeer)) |
|
337 |
o (WWindowPeer::void updateInsets (java.awt.Insets)) |
|
338 |
(WWindowPeer::java.awt.Component getContainerElement (java.awt.Container int)) |
|
339 |
||
340 |
X (WCanvasPeer::void create (sun.awt.windows.WComponentPeer)) |
|
341 |
||
342 |
X (WTextAreaPeer::void create (sun.awt.windows.WComponentPeer)) |
|
343 |
X (WTextAreaPeer::void insertText (java.lang.String int)) |
|
344 |
(WTextAreaPeer::void replaceText (java.lang.String int int)) |
|
345 |
||
346 |
X (WTextComponentPeer::java.lang.String getText ()) |
|
347 |
X (WTextComponentPeer::void setText (java.lang.String)) |
|
348 |
X (WTextComponentPeer::int getSelectionStart ()) |
|
349 |
X (WTextComponentPeer::int getSelectionEnd ()) |
|
350 |
X (WTextComponentPeer::void select (int int)) |
|
351 |
X (WTextComponentPeer::void enableEditing (boolean)) |
|
352 |
||
353 |
X (WComponentPeer::void show ()) |
|
354 |
X (WComponentPeer::void hide ()) |
|
355 |
X (WComponentPeer::void enable ()) |
|
356 |
X (WComponentPeer::void disable ()) |
|
357 |
X (WComponentPeer::java.awt.Point getLocationOnScreen ()) |
|
358 |
X (WComponentPeer::void reshape (int int int int)) |
|
359 |
o (WComponentPeer::void handleEvent (java.awt.AWTEvent)) |
|
360 |
o (WComponentPeer::void _dispose ()) |
|
361 |
X (WComponentPeer::void _setForeground (int)) |
|
362 |
X (WComponentPeer::void _setBackground (int)) |
|
363 |
o (WComponentPeer::void setFont (java.awt.Font)) |
|
364 |
o (WComponentPeer::void requestFocus ()) |
|
365 |
o (WComponentPeer::void setCursor (java.awt.Cursor)) |
|
366 |
o (WComponentPeer::void start ()) |
|
367 |
(WComponentPeer::void _beginValidate ()) |
|
368 |
(WComponentPeer::void endValidate ()) |
|
369 |
o (WComponentPeer::void setZOrderPosition (sun.awt.windows.WComponentPeer)) |
|
370 |
||
371 |
X (WFramePeer::void setMenuBar0 (sun.awt.windows.WMenuBarPeer)) |
|
372 |
X (WFramePeer::void create (sun.awt.windows.WComponentPeer)) |
|
373 |
X (WFramePeer::void _setIconImage (sun.awt.image.ImageRepresentation)) |
|
374 |
||
375 |
o (WFontMetrics::boolean needsConversion (java.awt.Font sun.awt.FontDescriptor)) |
|
376 |
o (WFontMetrics::int getMFCharSegmentWidth (java.awt.Font sun.awt.FontDescriptor boolean char[] int int byte[] int)) |
|
377 |
(WFontMetrics::int bytesWidth (byte[] int int)) |
|
378 |
(WFontMetrics::void init ()) |
|
379 |
||
380 |
o (WChoicePeer::void select (int)) |
|
381 |
o (WChoicePeer::void remove (int)) |
|
382 |
o (WChoicePeer::void addItem (java.lang.String int)) |
|
383 |
X (WChoicePeer::void reshape (int int int int)) |
|
384 |
X (WChoicePeer::void create (sun.awt.windows.WComponentPeer)) |
|
385 |
||
386 |
X (WLabelPeer::void setText (java.lang.String)) |
|
387 |
o (WLabelPeer::void setAlignment (int)) |
|
388 |
X (WLabelPeer::void create (sun.awt.windows.WComponentPeer)) |
|
389 |
||
390 |
X (WMenuItemPeer::void _setLabel (java.lang.String)) |
|
391 |
X (WMenuItemPeer::void create (sun.awt.windows.WMenuPeer)) |
|
392 |
X (WMenuItemPeer::void enable (boolean)) |
|
393 |
o (WMenuItemPeer::void _dispose ()) |
|
394 |
(WMenuPeer::void addSeparator ()) |
|
395 |
(WMenuPeer::void delItem (int)) |
|
396 |
X (WMenuPeer::void createMenu (sun.awt.windows.WMenuBarPeer)) |
|
397 |
(WMenuPeer::void createSubMenu (sun.awt.windows.WMenuPeer)) |
|
398 |
||
399 |
(WPopupMenuPeer::void createMenu (sun.awt.windows.WComponentPeer)) |
|
400 |
(WPopupMenuPeer::void _show (java.awt.Event)) |
|
401 |
(WMenuBarPeer::void addMenu (java.awt.Menu)) |
|
402 |
(WMenuBarPeer::void delMenu (int)) |
|
403 |
X (WMenuBarPeer::void create (sun.awt.windows.WFramePeer)) |
|
404 |
||
405 |
(WCheckboxMenuItemPeer::void setState (boolean)) |
|
406 |
||
407 |
X (WFileDialogPeer::void show ()) |
|
408 |
||
409 |
X (WCheckboxPeer::void setState (boolean)) |
|
410 |
X (WCheckboxPeer::void setCheckboxGroup (java.awt.CheckboxGroup)) |
|
411 |
(WCheckboxPeer::void setLabel (java.lang.String)) |
|
412 |
X (WCheckboxPeer::void create (sun.awt.windows.WComponentPeer)) |
|
413 |
||
414 |
X (WClipboard::void init ()) |
|
415 |
(WClipboard::void setClipboardText (java.awt.datatransfer.StringSelection)) |
|
416 |
(WClipboard::java.lang.String getClipboardText ()) |
|
417 |
||
418 |
X (WListPeer::void addItem (java.lang.String int)) |
|
419 |
X (WListPeer::void delItems (int int)) |
|
420 |
X (WListPeer::void select (int)) |
|
421 |
(WListPeer::void deselect (int)) |
|
422 |
(WListPeer::void makeVisible (int)) |
|
423 |
X (WListPeer::void setMultipleSelections (boolean)) |
|
424 |
X (WListPeer::void create (sun.awt.windows.WComponentPeer)) |
|
425 |
X (WListPeer::boolean isSelected (int)) |
|
426 |
||
427 |
x (WScrollbarPeer::void _setValues (int int int int)) |
|
428 |
x (WScrollbarPeer::void setLineIncrement (int)) |
|
429 |
x (WScrollbarPeer::void setPageIncrement (int)) |
|
430 |
x (WScrollbarPeer::void create (sun.awt.windows.WComponentPeer)) |
|
431 |
||
432 |
x (ImageRepresentation::void offscreenInit (java.awt.Color)) |
|
433 |
x (ImageRepresentation::boolean setBytePixels (int int int int java.awt.image.ColorModel byte[] int int)) |
|
434 |
x (ImageRepresentation::boolean setIntPixels (int int int int java.awt.image.ColorModel int[] int int)) |
|
435 |
x (ImageRepresentation::boolean finish (boolean)) |
|
436 |
X (ImageRepresentation::void imageDraw (java.awt.Graphics int int java.awt.Color)) |
|
437 |
x (ImageRepresentation::void imageStretch (java.awt.Graphics int int int int int int int int java.awt.Color)) |
|
438 |
x (ImageRepresentation::void disposeImage ()) |
|
439 |
||
440 |
X (WTextFieldPeer::void create (sun.awt.windows.WComponentPeer)) |
|
441 |
X (WTextFieldPeer::void setEchoCharacter (char)) |
|
442 |
||
443 |
X (WScrollPanePeer::void create (sun.awt.windows.WComponentPeer)) |
|
444 |
o (WScrollPanePeer::int getOffset (int)) |
|
445 |
(WScrollPanePeer::void setInsets ()) |
|
446 |
(WScrollPanePeer::void setScrollPosition (int int)) |
|
447 |
x (WScrollPanePeer::int _getHScrollbarHeight ()) |
|
448 |
x (WScrollPanePeer::int _getVScrollbarWidth ()) |
|
449 |
o (WScrollPanePeer::void setSpans (int int int int)) |
|
450 |
(WScrollPanePeer::java.awt.Component getScrollChild ()) |
|
451 |
||
452 |
(WEmbeddedFramePeer::void create (sun.awt.windows.WComponentPeer)) |
|
453 |
X (WButtonPeer::void setLabel (java.lang.String)) |
|
454 |
X (WButtonPeer::void create (sun.awt.windows.WComponentPeer)) |
|
455 |
||
456 |
x (WColor::java.awt.Color getDefaultColor (int)) |
|
457 |
||
458 |
x (GifImageDecoder::boolean parseImage (int int int int boolean int byte[] byte[] java.awt.image.IndexColorModel)) |
|
459 |
||
460 |
x (WGraphics::void createFromComponent (sun.awt.windows.WComponentPeer)) |
|
461 |
x (WGraphics::void createFromGraphics (sun.awt.windows.WGraphics)) |
|
462 |
(WGraphics::void createFromPrintJob (sun.awt.windows.WPrintJob)) |
|
463 |
(WGraphics::void createFromHDC (int)) |
|
464 |
x (WGraphics::void imageCreate (sun.awt.image.ImageRepresentation)) |
|
465 |
x (WGraphics::void pSetFont (java.awt.Font)) |
|
466 |
X (WGraphics::void pSetForeground (int)) |
|
467 |
(WGraphics::void _dispose ()) |
|
468 |
x (WGraphics::void dispose ()) |
|
469 |
x (WGraphics::void setPaintMode ()) |
|
470 |
x (WGraphics::void setXORMode (java.awt.Color)) |
|
471 |
o (WGraphics::java.awt.Rectangle getClipBounds ()) |
|
472 |
o (WGraphics::void changeClip (int int int int boolean)) |
|
473 |
(WGraphics::void removeClip ()) |
|
474 |
X (WGraphics::void clearRect (int int int int)) |
|
475 |
X (WGraphics::void fillRect (int int int int)) |
|
476 |
X (WGraphics::void drawRect (int int int int)) |
|
477 |
(WGraphics::void drawSFChars (char[] int int int int)) |
|
478 |
x (WGraphics::int drawMFCharsSegment (java.awt.Font sun.awt.FontDescriptor char[] int int int int)) |
|
479 |
(WGraphics::int drawMFCharsConvertedSegment (java.awt.Font sun.awt.FontDescriptor byte[] int int int)) |
|
480 |
(WGraphics::void drawBytes (byte[] int int int int)) |
|
481 |
X (WGraphics::void drawLine (int int int int)) |
|
482 |
X (WGraphics::void copyArea (int int int int int int)) |
|
483 |
o (WGraphics::void drawRoundRect (int int int int int int)) |
|
484 |
o (WGraphics::void fillRoundRect (int int int int int int)) |
|
485 |
X (WGraphics::void drawPolygon (int[] int[] int)) |
|
486 |
(WGraphics::void drawPolyline (int[] int[] int)) |
|
487 |
X (WGraphics::void fillPolygon (int[] int[] int)) |
|
488 |
x (WGraphics::void drawOval (int int int int)) |
|
489 |
x (WGraphics::void fillOval (int int int int)) |
|
490 |
x (WGraphics::void drawArc (int int int int int int)) |
|
491 |
x (WGraphics::void fillArc (int int int int int int)) |
|
492 |
(WGraphics::void print (sun.awt.windows.WComponentPeer)) |
|
493 |
(WGraphics::void close (sun.awt.windows.WPrintJob)) |
|
494 |
(JPEGImageDecoder::void readImage (java.io.InputStream byte[])) |
|
495 |
o (OffScreenImageSource::void sendPixels ()) |
|
496 |
||
497 |
||
498 |
additional native methods added by microsoft (sigh): |
|
499 |
||
500 |
X (java.lang.String::boolean equals (java.lang.String)) |
|
501 |
X (java.lang.String::int length (java.lang.String)) |
|
502 |
o (java.lang.Runtime::void setInputStreamLocalised (java.io.DataInputStream)) |
|
503 |
o (java.lang.Runtime::void setOutputStreamLocalised (java.io.DataOutputStream)) |
|
504 |
||
505 |
(java.lang.String::int compareTo (java.lang.String)) |
|
506 |
(java.lang.String::boolean equalsIgnoreCase (java.lang.String)) |
|
507 |
(java.lang.String::int indexOf (java.lang.String int)) |
|
508 |
(java.lang.String::boolean startsWith (java.lang.String int)) |
|
509 |
(java.lang.String::boolean regionMatches (int java.lang.String int int)) |
|
510 |
(java.lang.String::boolean regionMatches (boolean int java.lang.String int int)) |
|
511 |
(java.lang.String::int lastIndexOf (java.lang.String int)) |
|
512 |
(java.lang.ClassLoader::void resolveClass (java.lang.Class)) |
|
513 |
||
514 |
(java.lang.ClassLoader::java.lang.Class createArrayClass (java.lang.String java.lang.Class)) |
|
515 |
(java.io.PrintStream::boolean isOutputStreamLocalised (java.io.DataOutputStream)) |
|
516 |
(java.lang.Runtime::boolean isOutputStreamLocalised (java.io.DataOutputStream)) |
|
517 |
(java.lang.Runtime::boolean isInputStreamLocalised (java.io.DataInputStream)) |
|
518 |
(java.lang.ThreadGroup::void initMainThreadGroup0 (java.lang.ThreadGroup)) |
|
519 |
(java.lang.System::void validateSecurityManager (java.lang.SecurityManager)) |
|
520 |
(java.lang.Class::java.lang.reflect.Method getMethod2 (int java.lang.String java.lang.String)) |
|
521 |
(java.io.ObjectOutputStream::void invokeDefaultWriteObject (java.lang.Object java.lang.Class)) |
|
522 |
(java.io.ObjectOutputStream::void invokeWriteObject (java.lang.Object java.lang.Class)) |
|
523 |
(java.io.ObjectInputStream::void invokeDefaultReadObject (java.lang.Object java.lang.Class)) |
|
524 |
(java.io.ObjectInputStream::void invokeReadObject (java.lang.Object java.lang.Class)) |
|
525 |
(java.util.TimeZone::java.util.TimeZone getWin32TimeZone ()) |
|
526 |
(java.net.InetAddress::java.lang.Object[] lookupHostByName (java.lang.String)) |
|
527 |
(java.net.InetAddress::java.lang.Object[] lookupHostByAddr (int)) |
|
528 |
(java.io.ObjectStreamClass::void doMismatchedRead (java.io.ObjectInputStream java.lang.Object)) |
|
529 |
(java.io.ObjectStreamClass::long getClassDefinedUID (java.lang.Class)) |
|
530 |
(java.io.ObjectStreamClass::boolean findObjectMethod0 (java.lang.Class int)) |
|
531 |
(java.lang.reflect.Method::java.lang.String getDescriptor ()) |
|
532 |
(java.lang.reflect.Array::void setShort (java.lang.Object int unsigned short)) |
|
533 |
(java.lang.reflect.Array::char getChar (java.lang.Object int)) |
|
534 |
(java.lang.reflect.Array::void setChar (java.lang.Object int char)) |
|
535 |
(java.lang.reflect.Array::void setDouble (java.lang.Object int double)) |
|
536 |
(java.lang.reflect.Array::java.lang.Object get (java.lang.Object int)) |
|
537 |
(java.lang.reflect.Array::void set (java.lang.Object int java.lang.Object)) |
|
538 |
(java.lang.reflect.Array::int getInt (java.lang.Object int)) |
|
539 |
(java.lang.reflect.Array::void setInt (java.lang.Object int int)) |
|
540 |
(java.lang.reflect.Array::java.lang.Object multiNewArray (java.lang.Class int[])) |
|
541 |
(java.lang.reflect.Array::boolean getBoolean (java.lang.Object int)) |
|
542 |
(java.lang.reflect.Array::byte getByte (java.lang.Object int)) |
|
543 |
(java.lang.reflect.Array::float getFloat (java.lang.Object int)) |
|
544 |
(java.lang.reflect.Array::void setBoolean (java.lang.Object int boolean)) |
|
545 |
(java.lang.reflect.Array::long getLong (java.lang.Object int)) |
|
546 |
(java.lang.reflect.Array::void setByte (java.lang.Object int byte)) |
|
547 |
(java.lang.reflect.Array::void setLong (java.lang.Object int long)) |
|
548 |
(java.lang.reflect.Array::void setFloat (java.lang.Object int float)) |
|
549 |
(java.lang.reflect.Array::java.lang.Object newArray (java.lang.Class int)) |
|
550 |
(java.lang.reflect.Array::int getLength (java.lang.Object)) |
|
551 |
(java.lang.reflect.Array::unsigned short getShort (java.lang.Object int)) |
|
552 |
(java.lang.reflect.Array::double getDouble (java.lang.Object int)) |
|
553 |
(java.lang.reflect.Field::void setShort (java.lang.Object unsigned short)) |
|
554 |
(java.lang.reflect.Field::char getChar (java.lang.Object)) |
|
555 |
(java.lang.reflect.Field::void setChar (java.lang.Object char)) |
|
556 |
(java.lang.reflect.Field::void setDouble (java.lang.Object double)) |
|
557 |
(java.lang.reflect.Field::java.lang.Object get (java.lang.Object)) |
|
558 |
(java.lang.reflect.Field::void set (java.lang.Object java.lang.Object)) |
|
559 |
(java.lang.reflect.Field::int getInt (java.lang.Object)) |
|
560 |
(java.lang.reflect.Field::void setInt (java.lang.Object int)) |
|
561 |
(java.lang.reflect.Field::boolean getBoolean (java.lang.Object)) |
|
562 |
(java.lang.reflect.Field::byte getByte (java.lang.Object)) |
|
563 |
(java.lang.reflect.Field::float getFloat (java.lang.Object)) |
|
564 |
(java.lang.reflect.Field::long getLong (java.lang.Object)) |
|
565 |
(java.lang.reflect.Field::void setBoolean (java.lang.Object boolean)) |
|
566 |
(java.lang.reflect.Field::void setByte (java.lang.Object byte)) |
|
567 |
(java.lang.reflect.Field::void setLong (java.lang.Object long)) |
|
568 |
(java.lang.reflect.Field::void setFloat (java.lang.Object float)) |
|
569 |
(java.lang.reflect.Field::int getModifiers ()) |
|
570 |
(java.lang.reflect.Field::unsigned short getShort (java.lang.Object)) |
|
571 |
(java.lang.reflect.Field::double getDouble (java.lang.Object)) |
|
572 |
(java.lang.reflect.Constructor::java.lang.Object newInstance (java.lang.Object[])) |
|
573 |
(java.lang.reflect.Constructor::int getModifiers ()) |
|
574 |
(java.util.zip.Inflater::void setDictionary0 (byte[] int int)) |
|
575 |
(java.util.zip.Inflater::int getTotalIn0 ()) |
|
576 |
(java.util.zip.Inflater::void reset0 ()) |
|
577 |
(java.util.zip.Inflater::void end0 ()) |
|
578 |
(java.util.zip.Inflater::int inflate0 (byte[] int int)) |
|
579 |
(java.util.zip.Inflater::int getTotalOut0 ()) |
|
580 |
(java.util.zip.Inflater::int getAdler0 ()) |
|
581 |
(java.util.zip.CRC32::void update1 (int)) |
|
582 |
(java.util.zip.CRC32::void update (byte[] int int)) |
|
583 |
||
584 |
(com.ms.security.PolicyEngine::boolean isSystemClass (java.lang.String)) |
|
585 |
(com.ms.security.PolicyEngine::void denyPermission (com.ms.security.PermissionID)) |
|
586 |
(com.ms.security.PolicyEngine::void revertPermission (com.ms.security.PermissionID)) |
|
587 |
(com.ms.security.PolicyEngine::void initPolicyEngine ()) |
|
588 |
(com.ms.security.PolicyEngine::java.lang.Class _getClassOfCaller (java.lang.Class[])) |
|
589 |
(com.ms.security.PolicyEngine::void internalCheckClass (java.lang.Class com.ms.security.PermissionID java.lang.Object)) |
|
590 |
(com.ms.security.PolicyEngine::com.ms.security.PermissionDataSet getPermissionsOfClass (java.lang.Class)) |
|
591 |
(com.ms.security.PolicyEngine::void assertPermission (com.ms.security.PermissionID)) |
|
592 |
(com.ms.security.PolicyEngine::void deepCheck (com.ms.security.PermissionID java.lang.Object)) |
|
593 |
(com.ms.security.PolicyEngine::void shallowCheck (com.ms.security.PermissionID java.lang.Object java.lang.Class[] int)) |
|
594 |
(com.ms.security.PolicyEngine::java.security.Principal getPrincipalOfClass (java.lang.Class)) |
|
595 |
(com.ms.security.permissions.ThreadPermission::boolean pDecodeAsn (byte[])) |
|
596 |
(com.ms.security.permissions.ThreadPermission::byte[] pEncodeAsn ()) |
|
597 |
(com.ms.security.permissions.RegistryPermission::boolean pDecodeAsn (byte[])) |
|
598 |
(com.ms.security.permissions.RegistryPermission::byte[] pEncodeAsn ()) |
|
599 |
(com.ms.security.management.ZonePermissions::byte[] pEncodeAsn ()) |
|
600 |
(com.ms.security.management.ZonePermissions::boolean pDecodeAsn (byte[])) |
|
601 |
(com.ms.security.permissions.UIPermission::byte[] pEncodeAsn ()) |
|
602 |
(com.ms.security.permissions.UIPermission::boolean pDecodeAsn (byte[])) |
|
603 |
(com.ms.security.permissions.NetIOPermission::byte[] pEncodeAsn ()) |
|
604 |
(com.ms.security.permissions.NetIOPermission::boolean pDecodeAsn (byte[])) |
|
605 |
(com.ms.security.permissions.ReflectionPermission::byte[] pEncodeAsn ()) |
|
606 |
(com.ms.security.permissions.ReflectionPermission::boolean pDecodeAsn (byte[])) |
|
607 |
(com.ms.vm.WeakReference::void storeRef (int java.lang.Object)) |
|
608 |
(com.ms.vm.WeakReference::int allocRef (java.lang.Object)) |
|
609 |
(com.ms.vm.WeakReference::void freeRef (int)) |
|
610 |
(com.ms.vm.WeakReference::java.lang.Object fetchRef (int)) |
|
611 |
(com.ms.dll.DllLib::void CoTaskMemFree (int)) |
|
612 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int float[] int int)) |
|
613 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int double[] int int)) |
|
614 |
(com.ms.dll.DllLib::int numParamBytes0 (java.lang.reflect.Method)) |
|
615 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int java.lang.Object int int)) |
|
616 |
(com.ms.dll.DllLib::void write2 (java.lang.Object int unsigned short)) |
|
617 |
(com.ms.dll.DllLib::void write2 (int int unsigned short)) |
|
618 |
(com.ms.dll.DllLib::void write2 (java.lang.Object int char)) |
|
619 |
(com.ms.dll.DllLib::void write2 (int int char)) |
|
620 |
(com.ms.dll.DllLib::int GlobalAlloc (int int)) |
|
621 |
(com.ms.dll.DllLib::void resize (java.lang.Object int)) |
|
622 |
(com.ms.dll.DllLib::long read8 (java.lang.Object int)) |
|
623 |
(com.ms.dll.DllLib::long read8 (int int)) |
|
624 |
(com.ms.dll.DllLib::int lstrcpy (java.lang.StringBuffer int)) |
|
625 |
(com.ms.dll.DllLib::int lstrlenA (int)) |
|
626 |
(com.ms.dll.DllLib::int read4 (java.lang.Object int)) |
|
627 |
(com.ms.dll.DllLib::int CoTaskMemAlloc (int)) |
|
628 |
(com.ms.dll.DllLib::void write8 (java.lang.Object int long)) |
|
629 |
(com.ms.dll.DllLib::int sizeOf0 (java.lang.Class)) |
|
630 |
(com.ms.dll.DllLib::int getSystemDefaultCharSize ()) |
|
631 |
(com.ms.dll.DllLib::void write8 (int int long)) |
|
632 |
(com.ms.dll.DllLib::int read4 (int int)) |
|
633 |
(com.ms.dll.DllLib::byte read1 (java.lang.Object int)) |
|
634 |
(com.ms.dll.DllLib::byte read1 (int int)) |
|
635 |
(com.ms.dll.DllLib::int lstrlen (int)) |
|
636 |
(com.ms.dll.DllLib::void CopyMemoryAnsi (int java.lang.String int)) |
|
637 |
(com.ms.dll.DllLib::void CopyMemoryAnsi (java.lang.StringBuffer int int)) |
|
638 |
(com.ms.dll.DllLib::boolean isStruct (java.lang.reflect.Field)) |
|
639 |
(com.ms.dll.DllLib::boolean GlobalFree (int)) |
|
640 |
(com.ms.dll.DllLib::void internalAttemptCopyPtrToStruct (int java.lang.Object int int)) |
|
641 |
(com.ms.dll.DllLib::int getLastError ()) |
|
642 |
(com.ms.dll.DllLib::void write4 (java.lang.Object int int)) |
|
643 |
(com.ms.dll.DllLib::void write4 (int int int)) |
|
644 |
(com.ms.dll.DllLib::unsigned short read2 (java.lang.Object int)) |
|
645 |
(com.ms.dll.DllLib::unsigned short read2 (int int)) |
|
646 |
(com.ms.dll.DllLib::void release (java.lang.Object)) |
|
647 |
(com.ms.dll.DllLib::void write1 (java.lang.Object int byte)) |
|
648 |
(com.ms.dll.DllLib::void write1 (int int byte)) |
|
649 |
(com.ms.dll.DllLib::boolean isStructCls (java.lang.Class)) |
|
650 |
(com.ms.dll.DllLib::void prelink (java.lang.reflect.Method)) |
|
651 |
(com.ms.dll.DllLib::void CopyMemoryUni (int java.lang.String int)) |
|
652 |
(com.ms.dll.DllLib::void CopyMemoryUni (java.lang.StringBuffer int int)) |
|
653 |
(com.ms.dll.DllLib::void internalAttemptCopyStructToPtr (java.lang.Object int int int)) |
|
654 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (int int int int)) |
|
655 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (byte[] int int int)) |
|
656 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (char[] int int int)) |
|
657 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (unsigned short[] int int int)) |
|
658 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (int[] int int int)) |
|
659 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (long[] int int int)) |
|
660 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (float[] int int int)) |
|
661 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (double[] int int int)) |
|
662 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (java.lang.Object int int int)) |
|
663 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int int int int)) |
|
664 |
(com.ms.dll.DllLib::int lstrlenW (int)) |
|
665 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int byte[] int int)) |
|
666 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int char[] int int)) |
|
667 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int unsigned short[] int int)) |
|
668 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int int[] int int)) |
|
669 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int long[] int int)) |
|
670 |
(com.ms.dll.DllLib::int internalGetStructAddr (java.lang.Object)) |
|
671 |
(com.ms.dll.DllLib::int offsetOf (java.lang.reflect.Field)) |
|
672 |
(com.ms.dll.DllLib::int lstrcpy (int java.lang.String)) |
|
673 |
(com.ms.dll.DllLib::int sizeOf (java.lang.Object)) |
|
674 |
(com.ms.lang.RegKey::com.ms.lang.RegKeyEnumValue pRegEnumValue (int)) |
|
675 |
(com.ms.lang.RegKey::java.lang.String pRegQueryStringValue (java.lang.String)) |
|
676 |
(com.ms.lang.RegKey::byte[] pRegQueryBinaryValue (java.lang.String)) |
|
677 |
(com.ms.lang.RegKey::int pRegQueryIntValue (java.lang.String)) |
|
678 |
(com.ms.lang.RegKey::void pRegSetStringValue (java.lang.String java.lang.String)) |
|
679 |
(com.ms.lang.RegKey::void pRegSetIntValue (java.lang.String int)) |
|
680 |
(com.ms.lang.RegKey::void pRegSetBinaryValue (java.lang.String byte[])) |
|
681 |
(com.ms.lang.RegKey::void pRegDeleteValue (java.lang.String)) |
|
682 |
(com.ms.lang.RegKey::void pRegFlushKey ()) |
|
683 |
(com.ms.lang.RegKey::void pRegDeleteKey (java.lang.String)) |
|
684 |
(com.ms.lang.RegKey::void pRegOpenBaseKey (int)) |
|
685 |
(com.ms.lang.RegKey::void pRegOpenKey (com.ms.lang.RegKey java.lang.String int)) |
|
686 |
(com.ms.lang.RegKey::int pRegQueryInfoKey (com.ms.lang.RegQueryInfo)) |
|
687 |
(com.ms.lang.RegKey::void pRegUnLoadKey (java.lang.String)) |
|
688 |
(com.ms.lang.RegKey::void pRegCreateKey (com.ms.lang.RegKey java.lang.String)) |
|
689 |
(com.ms.lang.RegKey::void pRegRestoreKey (java.lang.String boolean)) |
|
690 |
(com.ms.lang.RegKey::void pRegLoadKey (java.lang.String java.lang.String)) |
|
691 |
(com.ms.lang.RegKey::void pRegCloseKey ()) |
|
692 |
(com.ms.lang.RegKey::java.lang.String pRegEnumKey (int)) |
|
693 |
(com.ms.lang.RegKey::void pRegReplaceKey (java.lang.String java.lang.String java.lang.String)) |
|
694 |
(com.ms.awt.peer.NativeServices::int pGetKeyboardLayouts (int[] int)) |
|
695 |
(com.ms.awt.peer.NativeServices::void jpegReadByte (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader byte[] int)) |
|
696 |
(com.ms.awt.peer.NativeServices::int getColourDataDepth ()) |
|
697 |
(com.ms.awt.peer.NativeServices::java.lang.String pGetFontEnumeratedFamily (int)) |
|
698 |
(com.ms.awt.peer.NativeServices::int pNewFontEnumeration ()) |
|
699 |
(com.ms.awt.peer.NativeServices::int getScreenClipRgn (int)) |
|
700 |
(com.ms.awt.peer.NativeServices::int pSetKeyboardLayout (int int)) |
|
701 |
(com.ms.awt.peer.NativeServices::void ClipboardInit (com.ms.awt.peer.IToolkit)) |
|
702 |
(com.ms.awt.peer.NativeServices::void getDeviceCaps (int int[] int)) |
|
703 |
(com.ms.awt.peer.NativeServices::void getAfcMetrics (int[])) |
|
704 |
(com.ms.awt.peer.NativeServices::void setUserLocale (int int)) |
|
705 |
(com.ms.awt.peer.NativeServices::void getDCDI (com.ms.awt.peer.DirectColourDataInfo)) |
|
706 |
(com.ms.awt.peer.NativeServices::int pGetNumKeyboardLayouts ()) |
|
707 |
(com.ms.awt.peer.NativeServices::void getIndexedColours (byte[] byte[] byte[])) |
|
708 |
(com.ms.awt.peer.NativeServices::int getNativeFont (java.lang.String int int int)) |
|
709 |
(com.ms.awt.peer.NativeServices::int pGetKeyboardLayout ()) |
|
710 |
(com.ms.awt.peer.NativeServices::int getSystemLCID ()) |
|
711 |
(com.ms.awt.peer.NativeServices::void caretSetPos (int int int)) |
|
712 |
(com.ms.awt.peer.NativeServices::java.lang.String getLogFontFromIUnknown (com.ms.com.IUnknown com.ms.awt.peer.LogFontX)) |
|
713 |
(com.ms.awt.peer.NativeServices::java.lang.String ClipboardGetText ()) |
|
714 |
(com.ms.awt.peer.NativeServices::int systemMetric (int)) |
|
715 |
(com.ms.awt.peer.NativeServices::void jpegInit (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader)) |
|
716 |
(com.ms.awt.peer.NativeServices::void caretHide (int)) |
|
717 |
(com.ms.awt.peer.NativeServices::int chooseColor (int int)) |
|
718 |
(com.ms.awt.peer.NativeServices::java.lang.String pGetKeyboardLayoutName (int)) |
|
719 |
(com.ms.awt.peer.NativeServices::int matchFontAndLanguage (int int)) |
|
720 |
(com.ms.awt.peer.NativeServices::java.lang.String chooseFont (com.ms.awt.peer.LogFontX java.lang.String int)) |
|
721 |
(com.ms.awt.peer.NativeServices::java.lang.String getSystemFont (int com.ms.awt.peer.LogFontX)) |
|
722 |
(com.ms.awt.peer.NativeServices::com.ms.com.IUnknown getIUnknownFromLogFont (java.lang.String com.ms.awt.peer.LogFontX)) |
|
723 |
(com.ms.awt.peer.NativeServices::void caretDispose (int)) |
|
724 |
(com.ms.awt.peer.NativeServices::void caretShow (int)) |
|
725 |
(com.ms.awt.peer.NativeServices::void deleteObject (int)) |
|
726 |
(com.ms.awt.peer.NativeServices::void setDebugOutput (com.ms.awt.peer.COMPrintCallback)) |
|
727 |
(com.ms.awt.peer.NativeServices::void jpegReadInt (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader int[] int)) |
|
728 |
(com.ms.awt.peer.NativeServices::int getSystemColourValue (int)) |
|
729 |
(com.ms.awt.peer.NativeServices::void caretCreate (int int int)) |
|
730 |
(com.ms.awt.peer.NativeServices::void ClipboardSetText (java.lang.String)) |
|
731 |
(com.ms.awt.peer.NativeServices::void println (java.lang.String)) |
|
732 |
(com.ms.security.SecurityClassLoader::boolean getSecureState ()) |
|
733 |
(com.ms.security.SecurityClassLoader::void setSecureState (java.lang.String java.lang.String)) |
|
734 |
(com.ms.security.SecurityClassLoader::java.lang.Class internalDefineClass (java.lang.String byte[] int int)) |
|
735 |
(com.ms.security.SecurityClassLoader::void markClass (java.lang.Class com.ms.security.PermissionSet java.security.Principal)) |
|
736 |
(com.ms.security.SecurityClassLoader::java.util.Hashtable getHashTable ()) |
|
737 |
(com.ms.security.auditing.SecurityAuditor::boolean isThreadAuditingEnabled ()) |
|
738 |
(com.ms.security.auditing.SecurityAuditor::void disableThreadAuditing ()) |
|
739 |
(com.ms.security.auditing.SecurityAuditor::void enableThreadAuditing ()) |
|
740 |
(com.ms.security.auditing.SecurityAuditor::void initSecurityAuditor ()) |
|
741 |
(com.ms.security.PermissionDataSet::byte[] pEncodeAsn ()) |
|
742 |
(com.ms.security.PermissionDataSet::boolean pDecodeAsn (byte[])) |
|
743 |
(com.ms.lang.SystemX::int pAnsiToUnicode (byte[] char[] int int int)) |
|
744 |
(com.ms.lang.SystemX::int pQueryUnicodeToAnsi (char[] int int int)) |
|
745 |
(com.ms.lang.SystemX::void gc ()) |
|
746 |
(com.ms.lang.SystemX::boolean arrayCompare (java.lang.Object[] int java.lang.Object[] int int)) |
|
747 |
(com.ms.lang.SystemX::int pUnicodeToAnsi (char[] byte[] int int int)) |
|
748 |
(com.ms.lang.SystemX::boolean isLocalCharDBCSLeadByte (byte)) |
|
749 |
(com.ms.lang.SystemX::int pQueryAnsiToUnicode (byte[] int int int)) |
|
750 |
(com.ms.lang.SystemX::boolean isBaseDBCS ()) |
|
751 |
(com.ms.lang.SystemX::java.lang.reflect.Method getMethod2 (java.lang.Class int java.lang.String java.lang.String)) |
|
752 |
(com.ms.packagemanager.JavaPackage::byte[] nativeGetSigner (java.lang.Object)) |
|
753 |
(com.ms.packagemanager.JavaPackage::byte[] nativeGetCapabilities (java.lang.Object)) |
|
754 |
(com.ms.com._Guid::void IIDFromString (java.lang.String com.ms.com._Guid)) |
|
755 |
(com.ms.com._Guid::java.lang.String StringFromIID (com.ms.com._Guid)) |
|
756 |
(com.ms.security.auditing.PrintStreamAuditor::int GetModuleHandle (java.lang.String)) |
|
757 |
(com.ms.security.auditing.PrintStreamAuditor::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
758 |
(com.ms.security.permissions.CustomPermission::byte[] pEncodeAsn ()) |
|
759 |
(com.ms.security.permissions.CustomPermission::boolean pDecodeAsn (byte[])) |
|
760 |
(com.ms.security.permissions.X509Signer::boolean pLoad (byte[])) |
|
761 |
(com.ms.packagemanager.PackageManager::java.lang.Class nativeFindClassInNamespace (java.lang.String java.lang.String java.lang.ClassLoader)) |
|
762 |
(com.ms.packagemanager.PackageManager::java.lang.Object nativeGetPackage (java.lang.String java.lang.String)) |
|
763 |
(com.ms.packagemanager.PackageManager::java.lang.String[] nativeGetBeansList ()) |
|
764 |
(com.ms.packagemanager.PackageManager::com.ms.com.IStream nativeGetFileIStream (java.lang.String java.lang.String)) |
|
765 |
(com.ms.packagemanager.PackageManager::java.lang.Class nativeFindClass (java.lang.String java.lang.String java.lang.ClassLoader)) |
|
766 |
(com.ms.security.permissions.UserFileIOPermission::byte[] pEncodeAsn ()) |
|
767 |
(com.ms.security.permissions.UserFileIOPermission::boolean pDecodeAsn (byte[])) |
|
768 |
(com.ms.security.permissions.PropertyPermission::byte[] pEncodeAsn ()) |
|
769 |
(com.ms.security.permissions.PropertyPermission::boolean pDecodeAsn (byte[])) |
|
770 |
(com.ms.security.permissions.ClientStoragePermission::byte[] pEncodeAsn ()) |
|
771 |
(com.ms.security.permissions.ClientStoragePermission::boolean pDecodeAsn (byte[])) |
|
772 |
(com.ms.security.permissions.ExecutionPermission::byte[] pEncodeAsn ()) |
|
773 |
(com.ms.security.permissions.ExecutionPermission::boolean pDecodeAsn (byte[])) |
|
774 |
(com.ms.util.EventLog::boolean DeregisterEventSource (int)) |
|
775 |
(com.ms.util.EventLog::void reportEvent0 (unsigned short unsigned short int java.lang.String[] byte[])) |
|
776 |
(com.ms.util.EventLog::int RegisterEventSource (java.lang.String java.lang.String)) |
|
777 |
(com.ms.applet.BrowserAppletFrame::void signalViewChange (int)) |
|
778 |
(com.ms.applet.BrowserAppletFrame::java.lang.Object newInstance (int java.lang.Class boolean com.ms.security.PermissionSet)) |
|
779 |
(com.ms.applet.BrowserAppletFrame::void showSystemStatus (int int boolean java.lang.String)) |
|
780 |
(com.ms.applet.BrowserAppletFrame::com.ms.security.management.SecurityPolicy getSecurityPolicy0 (int java.lang.String)) |
|
781 |
(com.ms.applet.BrowserAppletFrame::void setDownloadState (int boolean)) |
|
782 |
(com.ms.applet.BrowserAppletFrame::int GetSystemDefaultLCID ()) |
|
783 |
(com.ms.applet.BrowserAppletFrame::void requestResize (int int int)) |
|
784 |
(com.ms.applet.BrowserAppletFrame::void signalObjectLoadDone (int boolean)) |
|
785 |
(com.ms.applet.BrowserAppletFrame::com.ms.applet.BrowserAppletFrame findOfflineContext ()) |
|
786 |
(com.ms.applet.BrowserAppletFrame::void showStatus0 (int java.lang.String)) |
|
787 |
(com.ms.applet.BrowserAppletFrame::boolean checkGlobalOfflineMode0 ()) |
|
788 |
(com.ms.applet.BrowserAppletFrame::void showDocument0 (int java.lang.String java.lang.String)) |
|
789 |
(com.ms.security.permissions.SystemStreamsPermission::byte[] pEncodeAsn ()) |
|
790 |
(com.ms.security.permissions.SystemStreamsPermission::boolean pDecodeAsn (byte[])) |
|
791 |
(com.ms.security.permissions.FileIOPermission::byte[] pEncodeAsn ()) |
|
792 |
(com.ms.security.permissions.FileIOPermission::boolean pDecodeAsn (byte[])) |
|
793 |
(com.ms.com.ComLib::int newGCHandle (java.lang.Object)) |
|
794 |
(com.ms.com.ComLib::java.lang.Object derefGCHandle (int)) |
|
795 |
(com.ms.com.ComLib::void dprinthelper (char[])) |
|
796 |
(com.ms.com.ComLib::void release (java.lang.Object)) |
|
797 |
(com.ms.com.ComLib::int jcdwClassSizeOf (java.lang.Class)) |
|
798 |
(com.ms.com.ComLib::int jcdwOffsetOf (java.lang.Object java.lang.String)) |
|
799 |
(com.ms.com.ComLib::int jcdwClassOffsetOf (java.lang.Class java.lang.String)) |
|
800 |
(com.ms.com.ComLib::boolean isJavaOwned (java.lang.Object)) |
|
801 |
(com.ms.com.ComLib::void brk (java.lang.Object)) |
|
802 |
(com.ms.com.ComLib::void setDataWrapperSize (java.lang.Object int)) |
|
803 |
(com.ms.com.ComLib::void brk (int)) |
|
804 |
(com.ms.com.ComLib::void setJCDWHomeThread (java.lang.Object java.lang.Object)) |
|
805 |
(com.ms.com.ComLib::void propagateOwnership (java.lang.Object int)) |
|
806 |
(com.ms.com.ComLib::void threadStartMTA (java.lang.Thread)) |
|
807 |
(com.ms.com.ComLib::void IENVNextMarshalerJ2C (int)) |
|
808 |
(com.ms.com.ComLib::boolean supportsInterface (java.lang.Object com.ms.com._Guid)) |
|
809 |
(com.ms.com.ComLib::java.lang.Object ptrToStruct (java.lang.Class int)) |
|
810 |
(com.ms.com.ComLib::int jcdwSizeOf (java.lang.Object)) |
|
811 |
(com.ms.com.ComLib::void declareMessagePumpThread ()) |
|
812 |
(com.ms.com.ComLib::void IENVNextMarshalerC2J (int)) |
|
813 |
(com.ms.com.ComLib::void freeGCHandle (int)) |
|
814 |
(com.ms.com.ComLib::boolean isEqualUnknown (java.lang.Object java.lang.Object)) |
|
815 |
(com.ms.com.Dispatch::boolean NIsArray (java.lang.Object)) |
|
816 |
(com.ms.com.Dispatch::java.lang.String NInvokeReal (java.lang.Object com.ms.com._Guid java.lang.String int int int int com.ms.com.Variant[] com.ms.com.Variant[] int[])) |
|
817 |
(com.ms.com.Dispatch::void NGetIDsOfNamesReal (java.lang.Object com.ms.com._Guid int java.lang.String[] int[])) |
|
818 |
(com.ms.com.ComException::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
819 |
(com.ms.com.Variant::int toInt ()) |
|
820 |
(com.ms.com.Variant::double toDate ()) |
|
821 |
(com.ms.com.Variant::boolean toBoolean ()) |
|
822 |
(com.ms.com.Variant::double toDouble ()) |
|
823 |
(com.ms.com.Variant::long toCurrency ()) |
|
824 |
(com.ms.com.Variant::void putVariantArray (com.ms.com.Variant[])) |
|
825 |
(com.ms.com.Variant::com.ms.com.Variant[] getVariantArray ()) |
|
826 |
(com.ms.com.Variant::void putByteArray (java.lang.Object)) |
|
827 |
(com.ms.com.Variant::void putShortRef (unsigned short)) |
|
828 |
(com.ms.com.Variant::void putIntRef (int)) |
|
829 |
(com.ms.com.Variant::void putDoubleRef (double)) |
|
830 |
(com.ms.com.Variant::void putDateRef (double)) |
|
831 |
(com.ms.com.Variant::void putStringRef (java.lang.String)) |
|
832 |
(com.ms.com.Variant::unsigned short getShortRef ()) |
|
833 |
(com.ms.com.Variant::int getIntRef ()) |
|
834 |
(com.ms.com.Variant::double getDoubleRef ()) |
|
835 |
(com.ms.com.Variant::double getDateRef ()) |
|
836 |
(com.ms.com.Variant::java.lang.String getStringRef ()) |
|
837 |
(com.ms.com.Variant::java.lang.String internalToString ()) |
|
838 |
(com.ms.com.Variant::void initSafeArrayByRef (com.ms.com.SafeArray int)) |
|
839 |
(com.ms.com.Variant::java.lang.Object toCharArray ()) |
|
840 |
(com.ms.com.Variant::java.lang.Object toDispatch ()) |
|
841 |
(com.ms.com.Variant::byte toByte ()) |
|
842 |
(com.ms.com.Variant::java.lang.Object getDispatch ()) |
|
843 |
(com.ms.com.Variant::void putDispatch (java.lang.Object)) |
|
844 |
(com.ms.com.Variant::boolean getBoolean ()) |
|
845 |
(com.ms.com.Variant::int toError ()) |
|
846 |
(com.ms.com.Variant::java.lang.Object toObject ()) |
|
847 |
(com.ms.com.Variant::void initSafeArrayByVal (com.ms.com.SafeArray int)) |
|
848 |
(com.ms.com.Variant::java.lang.Object getObject ()) |
|
849 |
(com.ms.com.Variant::void putObject (java.lang.Object)) |
|
850 |
(com.ms.com.Variant::com.ms.com.SafeArray toSafeArrayHelper (java.lang.Class)) |
|
851 |
(com.ms.com.Variant::void putFloatRef (float)) |
|
852 |
(com.ms.com.Variant::void putCurrencyRef (long)) |
|
853 |
(com.ms.com.Variant::void putErrorRef (int)) |
|
854 |
(com.ms.com.Variant::void putBooleanRef (boolean)) |
|
855 |
(com.ms.com.Variant::void putObjectRef (java.lang.Object)) |
|
856 |
(com.ms.com.Variant::void putByteRef (byte)) |
|
857 |
(com.ms.com.Variant::java.lang.String getString ()) |
|
858 |
(com.ms.com.Variant::void putString (java.lang.String)) |
|
859 |
(com.ms.com.Variant::float getFloatRef ()) |
|
860 |
(com.ms.com.Variant::long getCurrencyRef ()) |
|
861 |
(com.ms.com.Variant::int getErrorRef ()) |
|
862 |
(com.ms.com.Variant::boolean getBooleanRef ()) |
|
863 |
(com.ms.com.Variant::java.lang.Object getObjectRef ()) |
|
864 |
(com.ms.com.Variant::byte getByteRef ()) |
|
865 |
(com.ms.com.Variant::float toFloat ()) |
|
866 |
(com.ms.com.Variant::void putCharArray (java.lang.Object)) |
|
867 |
(com.ms.com.Variant::void putDispatchRef (java.lang.Object)) |
|
868 |
(com.ms.com.Variant::java.lang.Object getDispatchRef ()) |
|
869 |
(com.ms.com.Variant::void putVariantArrayRef (com.ms.com.Variant[])) |
|
870 |
(com.ms.com.Variant::com.ms.com.Variant[] getVariantArrayRef ()) |
|
871 |
(com.ms.com.Variant::void changeType (unsigned short)) |
|
872 |
(com.ms.com.Variant::void ncloneIndirect (com.ms.com.Variant)) |
|
873 |
(com.ms.com.Variant::void nFinalize (boolean)) |
|
874 |
(com.ms.com.Variant::void nclone (com.ms.com.Variant)) |
|
875 |
(com.ms.com.Variant::unsigned short toShort ()) |
|
876 |
(com.ms.com.Variant::void putSafeArrayRefHelper (int)) |
|
877 |
(com.ms.com.Variant::com.ms.com.Variant[] toVariantArray ()) |
|
878 |
(com.ms.com.Variant::java.lang.Object toByteArray ()) |
|
879 |
(com.ms.com.Variant::void TrueVariantClear ()) |
|
880 |
(com.ms.awt.WToolkit::boolean MessageBeep (int)) |
|
881 |
(com.ms.applet.AppletPanel::boolean StartCodeDownload (int java.lang.String java.lang.String java.lang.String)) |
|
882 |
(com.ms.applet.AppletPanel::void securedCall0 (int java.lang.Object)) |
|
883 |
(com.ms.applet.AppletPanel::com.ms.security.PermissionSet getDefaultPermissionsFromLoader (com.ms.vm.loader.URLClassLoader)) |
|
884 |
(com.ms.dll.Win32Exception::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
885 |
(com.ms.awt.WGuiCallback::boolean SetEvent (int)) |
|
886 |
(com.ms.awt.WGuiCallback::int CreateSemaphore (int int int int)) |
|
887 |
(com.ms.awt.WGuiCallback::int ReleaseSemaphore (int int int)) |
|
888 |
(com.ms.awt.WGuiCallback::void userYield (boolean)) |
|
889 |
(com.ms.awt.WGuiCallback::int MsgWaitForMultipleObjects (int int[] boolean int int)) |
|
890 |
(com.ms.awt.WGuiCallback::int CreateEvent (int boolean boolean int)) |
|
891 |
(com.ms.activeX.ActiveXToolkit::int GetSysColor (int)) |
|
892 |
(com.ms.awt.peer.NativeGraphics::void setPageDimension (int int)) |
|
893 |
(com.ms.awt.peer.NativeGraphics::void setBkColour (int int)) |
|
894 |
(com.ms.awt.peer.NativeGraphics::void getClipBounds (com.ms.awt.peer.NativeRect int int)) |
|
895 |
(com.ms.awt.peer.NativeGraphics::void pGetCharOutline (int byte[])) |
|
896 |
(com.ms.awt.peer.NativeGraphics::void drawLine (int int int int)) |
|
897 |
(com.ms.awt.peer.NativeGraphics::void setXORMode (int int int int)) |
|
898 |
(com.ms.awt.peer.NativeGraphics::int drawString (java.lang.String int int int int int int int int[] int[])) |
|
899 |
(com.ms.awt.peer.NativeGraphics::int getCoClass ()) |
|
900 |
(com.ms.awt.peer.NativeGraphics::void drawArc (int int int int int int int)) |
|
901 |
(com.ms.awt.peer.NativeGraphics::void getInitialPageDimension (com.ms.awt.peer.NativeRect)) |
|
902 |
(com.ms.awt.peer.NativeGraphics::void setVisRgn (int)) |
|
903 |
(com.ms.awt.peer.NativeGraphics::void pSetForeground (int int)) |
|
904 |
(com.ms.awt.peer.NativeGraphics::int pGetDC ()) |
|
905 |
(com.ms.awt.peer.NativeGraphics::void drawPixels (int[] int int int)) |
|
906 |
(com.ms.awt.peer.NativeGraphics::void drawPolygon (int[] int[] int int int int)) |
|
907 |
(com.ms.awt.peer.NativeGraphics::void createFromImage (com.ms.awt.peer.INativeImage)) |
|
908 |
(com.ms.awt.peer.NativeGraphics::void endPage ()) |
|
909 |
(com.ms.awt.peer.NativeGraphics::int pGetCharOutlineSize (int)) |
|
910 |
(com.ms.awt.peer.NativeGraphics::void pDrawBezier (int int int[] int)) |
|
911 |
(com.ms.awt.peer.NativeGraphics::int drawBytes (byte[] int int int int int)) |
|
912 |
(com.ms.awt.peer.NativeGraphics::void changeClip (int int int int boolean)) |
|
913 |
(com.ms.awt.peer.NativeGraphics::int drawChars (char[] int int int int int int int int int int[] int[])) |
|
914 |
(com.ms.awt.peer.NativeGraphics::void drawT2Curve (float float float float float float int int)) |
|
915 |
(com.ms.awt.peer.NativeGraphics::void createFromPrintJob (java.lang.String com.ms.awt.peer.SPJData)) |
|
916 |
(com.ms.awt.peer.NativeGraphics::void endPrintJob ()) |
|
917 |
(com.ms.awt.peer.NativeGraphics::void pSetOrigin (int int)) |
|
918 |
(com.ms.awt.peer.NativeGraphics::void createFromHDC (int)) |
|
919 |
(com.ms.awt.peer.NativeGraphics::void drawOval (int int int int int)) |
|
920 |
(com.ms.awt.peer.NativeGraphics::int pSetFont (java.lang.String int int int)) |
|
921 |
(com.ms.awt.peer.NativeGraphics::void setPaintMode (int int)) |
|
922 |
(com.ms.awt.peer.NativeGraphics::void startPage ()) |
|
923 |
(com.ms.awt.peer.NativeGraphics::void clearClip ()) |
|
924 |
(com.ms.awt.peer.NativeGraphics::void createFromCopy (com.ms.awt.peer.INativeGraphics)) |
|
925 |
(com.ms.awt.peer.NativeGraphics::void scanLines (int int[] int int int int)) |
|
926 |
(com.ms.awt.peer.NativeGraphics::void drawRoundRect (int int int int int int int)) |
|
927 |
(com.ms.awt.peer.NativeGraphics::void dispose ()) |
|
928 |
(com.ms.awt.peer.NativeGraphics::void clearRect (int int int int int)) |
|
929 |
(com.ms.awt.peer.NativeGraphics::void copyArea (int int int int int int)) |
|
930 |
(com.ms.awt.peer.NativeGraphics::void createFromWindow (int)) |
|
931 |
(com.ms.awt.peer.NativeGraphics::void drawPolyline (int[] int[] int int int)) |
|
932 |
(com.ms.awt.peer.NativeGraphics::void drawRect (int int int int int)) |
|
933 |
(com.ms.awt.peer.CToolkit::void callbackEventLoop (com.ms.awt.peer.IToolkitCallback)) |
|
934 |
(com.ms.awt.peer.CToolkit::int getToolkitHwnd ()) |
|
935 |
(com.ms.awt.peer.CToolkit::int createCompHwnd (int int)) |
|
936 |
(com.ms.awt.peer.CNativeSystemIME::void setCompositionFont (int int)) |
|
937 |
(com.ms.awt.peer.CNativeSystemIME::void setCompositionPos (int int int)) |
|
938 |
(com.ms.awt.peer.CNativeSystemIME::void setOpenStatus (int int)) |
|
939 |
(com.ms.awt.peer.CNativeSystemIME::int getOpenStatus (int)) |
|
940 |
(com.ms.awt.peer.CNativeSystemIME::java.lang.String getCompositionString (int)) |
|
941 |
(com.ms.awt.peer.CNativeSystemIME::java.lang.String getCompositionResultString (int)) |
|
942 |
(com.ms.net.wininet.WininetStreamHandlerFactory::int initNative (java.lang.String)) |
|
943 |
(com.ms.com.SafeArray::void rawGetVariantAs (int com.ms.com.Variant)) |
|
944 |
(com.ms.com.SafeArray::void NSafeArrayInit (int)) |
|
945 |
(com.ms.com.SafeArray::float rawGetDouble (int)) |
|
946 |
(com.ms.com.SafeArray::void NRawBoolCopyToJavaArray (int int boolean[] int)) |
|
947 |
(com.ms.com.SafeArray::void validateArray (int)) |
|
948 |
(com.ms.com.SafeArray::void NSafeArrayCreateFromString (java.lang.String)) |
|
949 |
(com.ms.com.SafeArray::void rawSetString (int java.lang.String)) |
|
950 |
(com.ms.com.SafeArray::int getInt (int)) |
|
951 |
(com.ms.com.SafeArray::void setInt (int int)) |
|
952 |
(com.ms.com.SafeArray::boolean getBoolean (int)) |
|
953 |
(com.ms.com.SafeArray::void setBoolean (int boolean)) |
|
954 |
(com.ms.com.SafeArray::int computeOffset (int)) |
|
955 |
(com.ms.com.SafeArray::void NSafeArrayNullInit ()) |
|
956 |
(com.ms.com.SafeArray::void rawSetVariant (int com.ms.com.Variant)) |
|
957 |
(com.ms.com.SafeArray::float rawGetFloat (int)) |
|
958 |
(com.ms.com.SafeArray::float getFloat (int)) |
|
959 |
(com.ms.com.SafeArray::void setFloat (int float)) |
|
960 |
(com.ms.com.SafeArray::int computeOffset2 (int int)) |
|
961 |
(com.ms.com.SafeArray::void rawSetDouble (int double)) |
|
962 |
(com.ms.com.SafeArray::java.lang.String asString ()) |
|
963 |
(com.ms.com.SafeArray::void NRawCopyToJavaArray (int int java.lang.Object int)) |
|
964 |
(com.ms.com.SafeArray::void NSafeArrayCreate (int int int[] int[])) |
|
965 |
(com.ms.com.SafeArray::void NRawBoolCopyFromJavaArray (boolean[] int int int)) |
|
966 |
(com.ms.com.SafeArray::void NSafeArrayDestroy (boolean boolean)) |
|
967 |
(com.ms.com.SafeArray::int NSafeArrayCopy ()) |
|
968 |
(com.ms.com.SafeArray::int rawGetInt (int)) |
|
969 |
(com.ms.com.SafeArray::boolean rawGetBoolean (int)) |
|
970 |
(com.ms.com.SafeArray::void rawSetFloat (int float)) |
|
971 |
(com.ms.com.SafeArray::java.lang.String rawGetString (int)) |
|
972 |
(com.ms.com.SafeArray::int NTotalNumElems ()) |
|
973 |
(com.ms.com.SafeArray::double getDouble (int)) |
|
974 |
(com.ms.com.SafeArray::void setDouble (int double)) |
|
975 |
(com.ms.com.SafeArray::void Nreinit (com.ms.com.SafeArray)) |
|
976 |
(com.ms.com.SafeArray::int getPhysicalSafeArray ()) |
|
977 |
(com.ms.com.SafeArray::int NgetdwordAt (int)) |
|
978 |
(com.ms.com.SafeArray::void NRawCopyFromJavaArray (java.lang.Object int int int)) |
|
979 |
(com.ms.com.SafeArray::void rawSetBoolean (int boolean)) |
|
980 |
(com.ms.com.SafeArray::void rawSetInt (int int)) |
|
981 |
(com.ms.awt.peer.CNativeComponent::void invalidate (int int int int)) |
|
982 |
(com.ms.awt.peer.CNativeComponent::void hideModal ()) |
|
983 |
(com.ms.awt.peer.CNativeComponent::void hide ()) |
|
984 |
(com.ms.awt.peer.CNativeComponent::void setOnTop (int)) |
|
985 |
(com.ms.awt.peer.CNativeComponent::void registerDragDrop ()) |
|
986 |
(com.ms.awt.peer.CNativeComponent::void endValidate ()) |
|
987 |
(com.ms.awt.peer.CNativeComponent::void enable ()) |
|
988 |
(com.ms.awt.peer.CNativeComponent::void disable ()) |
|
989 |
(com.ms.awt.peer.CNativeComponent::void setTitle (java.lang.String)) |
|
990 |
(com.ms.awt.peer.CNativeComponent::void getBounds (com.ms.awt.peer.NativeRect)) |
|
991 |
(com.ms.awt.peer.CNativeComponent::int gethwnd ()) |
|
992 |
(com.ms.awt.peer.CNativeComponent::void showModal ()) |
|
993 |
(com.ms.awt.peer.CNativeComponent::void setCursor (int)) |
|
994 |
(com.ms.awt.peer.CNativeComponent::void reshape (int int int int)) |
|
995 |
(com.ms.awt.peer.CNativeComponent::void requestFocus ()) |
|
996 |
(com.ms.awt.peer.CNativeComponent::void callDefWindowProc (int int int int)) |
|
997 |
(com.ms.awt.peer.CNativeComponent::void registerCustomDropTarget (com.ms.com.IUnknown)) |
|
998 |
(com.ms.awt.peer.CNativeComponent::void setNoActivate (boolean)) |
|
999 |
(com.ms.awt.peer.CNativeComponent::void getPlaceOnScreen (com.ms.awt.peer.NativeRect)) |
|
1000 |
(com.ms.awt.peer.CNativeComponent::void beginValidate ()) |
|
1001 |
(com.ms.awt.peer.CNativeComponent::void clippedReshape (int int int int int)) |
|
1002 |
(com.ms.awt.peer.CNativeComponent::void setResizable (boolean)) |
|
1003 |
(com.ms.awt.peer.CNativeComponent::void setIcon (int)) |
|
1004 |
(com.ms.awt.peer.CNativeComponent::void toBack ()) |
|
1005 |
(com.ms.awt.peer.CNativeComponent::void setFrameHost (com.ms.awt.peer.IBrowserAppletFrameCallback)) |
|
1006 |
(com.ms.awt.peer.CNativeComponent::void toFront ()) |
|
1007 |
(com.ms.awt.peer.CNativeComponent::void show ()) |
|
1008 |
(com.ms.awt.peer.CNativeComponent::void updateInsets (com.ms.awt.peer.NativeInsets)) |
|
1009 |
(com.ms.awt.peer.CNativeComponent::void dispose ()) |
|
1010 |
(com.ms.awt.peer.CNativeComponent::void initFromJavaWindow (int com.ms.awt.peer.IComponentCallback com.ms.awt.peer.INativeComponent com.ms.awt.peer.IToolkit int)) |
|
1011 |
(com.ms.awt.peer.CNativeComponent::void init (int com.ms.awt.peer.IComponentCallback com.ms.awt.peer.INativeComponent com.ms.awt.peer.IToolkit)) |
|
1012 |
(com.ms.awt.peer.CNativeComponent::void beginDrag (com.ms.awt.peer.INativeDragCallback)) |
|
1013 |
(com.ms.fx.RegionConverter::int computeNativeRegion (int[])) |
|
1014 |
(com.ms.fx.RegionConverter::int[] computeJavaRegion (int)) |
|
1015 |
(com.ms.net.wininet.URLUtils::java.lang.String canonicalizeURL (java.lang.String int)) |
|
1016 |
(com.ms.net.wininet.URLUtils::java.lang.String combineURL (java.lang.String java.lang.String int)) |
|
1017 |
(com.ms.awt.peer.NativeFontMetrics::int bytesWidth (byte[] int int)) |
|
1018 |
(com.ms.awt.peer.NativeFontMetrics::int stringWidth (java.lang.String int int[])) |
|
1019 |
(com.ms.awt.peer.NativeFontMetrics::int charsWidth (char[] int int int int[])) |
|
1020 |
(com.ms.awt.peer.NativeFontMetrics::java.lang.String init (com.ms.awt.peer.INativeGraphics int[] java.lang.String int int int)) |
|
1021 |
(com.ms.io.console.Console::int MessageBox (int java.lang.String java.lang.String int)) |
|
1022 |
(com.ms.awt.peer.NativeFileDialog::void show (com.ms.awt.peer.IFileDialogCallback java.lang.String java.lang.String java.lang.String int com.ms.awt.peer.INativeComponent int int)) |
|
1023 |
(com.ms.security.management.SecurityZone::byte[] pLoadCustomPermissions (int int java.lang.String)) |
|
1024 |
(com.ms.awt.peer.NativeImage::int setBytePixelsDirected (int int int int com.ms.awt.peer.DirectColourModelData byte[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
1025 |
(com.ms.awt.peer.NativeImage::void create (int int int int)) |
|
1026 |
(com.ms.awt.peer.NativeImage::int setIntPixelsIndexed (int int int int int[] int int[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
1027 |
(com.ms.awt.peer.NativeImage::int getCoClass ()) |
|
1028 |
(com.ms.awt.peer.NativeImage::int getIcon (int int int)) |
|
1029 |
(com.ms.awt.peer.NativeImage::int setBytePixelsIndexed (int int int int int[] int byte[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
1030 |
(com.ms.awt.peer.NativeImage::void sendPixels (com.ms.awt.peer.SPData)) |
|
1031 |
(com.ms.awt.peer.NativeImage::void fillPixels (com.ms.awt.peer.SPData byte[])) |
|
1032 |
(com.ms.awt.peer.NativeImage::void dispose ()) |
|
1033 |
(com.ms.awt.peer.NativeImage::void init (int int int int int)) |
|
1034 |
(com.ms.awt.peer.NativeImage::int setIntPixelsDirected (int int int int com.ms.awt.peer.DirectColourModelData int[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
1035 |
(com.ms.awt.peer.NativeImage::void imageDrawStretched (com.ms.awt.peer.INativeGraphics int int int int int int int int int int)) |
|
1036 |
(com.ms.awt.peer.NativeImage::int finish (int)) |
|
1037 |
(com.ms.awt.peer.NativeImage::void imageDraw (int int int int int)) |
|
1038 |
(com.ms.awt.peer.NativeResource::java.lang.String loadString (int)) |
|
1039 |
(com.ms.awt.peer.NativeResource::int openDialogFromID (int)) |
|
1040 |
(com.ms.awt.peer.NativeResource::boolean attach (java.lang.String)) |
|
1041 |
(com.ms.awt.peer.NativeResource::void loadBytes (int int java.lang.String byte[] int)) |
|
1042 |
(com.ms.awt.peer.NativeResource::int getSize (int int java.lang.String)) |
|
1043 |
(com.ms.awt.peer.NativeResource::void detach ()) |
|
1044 |
(com.ms.awt.peer.NativeResource::int openDialogFromName (java.lang.String)) |
|
1045 |
(com.ms.net.wininet.WininetURLConnection::com.ms.applet.BrowserAppletFrame findOfflineContext ()) |
|
1046 |
(com.ms.com.DispatchProxy::void finalize ()) |
|
1047 |
(com.ms.com.DispatchProxy::void init (com.ms.com._Guid java.lang.reflect.Method[] int[])) |
|
1048 |
(com.ms.net.wininet.WininetInputStream::void close ()) |
|
1049 |
(com.ms.net.wininet.WininetInputStream::int read (byte[] int int)) |
|
1050 |
(com.ms.net.wininet.WininetInputStream::int available ()) |
|
1051 |
(com.ms.net.wininet.WininetInputStream::long skip (long)) |
|
1052 |
(com.ms.net.wininet.WininetInputStream::void connect (java.lang.String boolean boolean java.lang.SecurityManager)) |
|
1053 |
(com.ms.vm.loader.CabSignatureInfo::com.ms.vm.loader.CabSignatureInfo extractFromFile0 (java.lang.String com.ms.security.management.SecurityPolicy)) |
|
1054 |
(com.ms.net.wininet.http.HttpInputStream::byte[] getResponseHeaders ()) |
|
1055 |
(com.ms.net.wininet.http.HttpInputStream::void close0 ()) |
|
1056 |
(com.ms.net.wininet.http.HttpInputStream::void connect (java.lang.String int java.lang.String boolean boolean boolean boolean byte[] byte[] java.lang.SecurityManager)) |
|
1057 |
(com.ms.vm.loader.CabCracker::int GetTempFileName (java.lang.StringBuffer java.lang.String int java.lang.StringBuffer)) |
|
1058 |
(com.ms.vm.loader.CabCracker::void getBytes0 (int int byte[])) |
|
1059 |
(com.ms.vm.loader.CabCracker::void cleanup ()) |
|
1060 |
(com.ms.vm.loader.CabCracker::int GetTempPath (int java.lang.StringBuffer)) |
|
1061 |
(com.ms.vm.loader.CabCracker::void load0 ()) |
|
1062 |
||
1063 |
||
1064 |
" |
|
1065 |
! |
|
1066 |
||
1597 | 1067 |
performance1 |
752 | 1068 |
" |
1816 | 1069 |
JAVA::BenchMark new loopmark |
1070 |
JAVA::BenchMark new logicmark |
|
1071 |
JAVA::BenchMark new sievemark |
|
1072 |
JAVA::BenchMark new methodmark |
|
1073 |
JAVA::BenchMark new stringmark |
|
1074 |
JAVA::BenchMark new newstringmark |
|
1075 |
JAVA::BenchMark new neweststringmark |
|
752 | 1076 |
|
1077 |
||
1078 |
" |
|
1079 |
" |
|
1597 | 1080 |
caffmark loopmark logicmark sievemark methodmark stringmark float image graphic dialog newstringmark neweststringmark |
752 | 1081 |
linux: |
1082 |
P6/233 No JIT 84 87 90 40 22 17 10 |
|
1597 | 1083 |
103 133 142 137 28 73 109 167 18 140 |
752 | 1084 |
|
1085 |
P6/233 JIT 479 2459 393 649 28 21 12 |
|
1086 |
P6/233 JIT 473 1805 3046 439 986 28 21 12 |
|
1597 | 1087 |
533 1808 3382 613 1003 25 105 143 1 |
1088 |
668 3330 3644 740 |
|
1089 |
793 4116 3731 1243 1365 120 103 79 2 |
|
1090 |
914 4480 4061 2290 68 106 158 19 34 |
|
1091 |
941 4607 4149 1238 2434 75 101 152 18 32 |
|
1092 |
591 164 |
|
1093 |
1087 1836 800 110 35 |
|
1094 |
1102 4592 4270 1844 2381 841 109 169 21 35 |
|
1095 |
1177 4608 4309 1810 2432 895 532 182 20 35 |
|
752 | 1096 |
|
1097 |
||
1098 |
w95 |
|
1099 |
P5/200 JIT 90 95 90 95 686 18 60 54 7 |
|
1597 | 1100 |
428 1657 2385 684 957 21 61 62 9 |
1101 |
541 2886 2589 823 976 18 62 55 7 |
|
1102 |
583 3062 2635 842 861 223 65 57 8 |
|
1103 |
616 3075 2438 1081 1324 218 64 54 8 |
|
1104 |
718 3138 2755 1085 1200 816 63 48 9 7 |
|
1105 |
||
1106 |
caffmark loopmark logicmark sievemark methodmark stringmark float image graphic dialog newstringmark neweststringmark |
|
752 | 1107 |
" |
1108 |
! |
|
1109 |
||
1110 |
performance2 |
|
1111 |
" |
|
1112 |
symantec benchmarks |
|
1113 |
||
1114 |
||
1115 |
" |
|
1116 |
" |
|
1117 |
BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total |
|
1118 |
||
1816 | 1119 |
ST/X+J Linux |
752 | 1120 |
233Mhz P6 |
1121 |
No JIT 352767 354597 69585 43048 101638 28961 108839 48815 |
|
1122 |
||
1816 | 1123 |
ST/X+J Linux |
752 | 1124 |
233Mhz P6 |
1125 |
JIT 128724 116810 20259 39733 83160 27613 52093 33166 43996 545554 |
|
1126 |
124744 101428 17239 10052 8264 14004 38821 23252 33709 374660 |
|
1127 |
+IINC 120324 7265 |
|
1128 |
+IADD op2 100173 90737 18128 6996 7423 17093 48559 44209 57056 390374 |
|
1129 |
+ISUB op2 90460 17547 5921 57056 390461 |
|
1130 |
+ICMPEQ/NE 99785 90147 5792 43482 56486 388255 |
|
1131 |
+ICMP 87398 78214 15784 7574 5628 12812 38481 24654 32252 302797 |
|
1132 |
+IFICMPLE 84198 74928 13814 5650 11674 23241 293118 |
|
1133 |
+IFICMPxx 76867 69738 12208 37505 21973 32104 273569 |
|
1134 |
+IFICMPEQ/NE 5580 11202 21723 |
|
1135 |
const IFICMPxx 11856 5463 11032 37372 272726 |
|
1136 |
+lea for add/sub |
|
1137 |
+BALOAD 11700 4600 5015 9431 |
|
1138 |
+BASTORE 3279 |
|
1139 |
+CALOAD/CASTORE 8907 |
|
1140 |
regSave change 66119 60365 9997 4917 15386 37851 38202 50027 286497 |
|
1141 |
64858 58360 9476 4889 15001 37211 36288 48313 278478 |
|
1142 |
63146 55949 9302 14899 |
|
1143 |
62970 56085 9352 3226 4837 8779 37573 22815 33899 241297 |
|
1144 |
-O 43662 40292 7181 2530 4696 8170 34555 22116 32337 195539 |
|
1145 |
||
1146 |
+IALOAD 39162 36347 |
|
1147 |
+IASTORE 32461 30663 4299 3667 19556 30563 166868 |
|
1148 |
||
1149 |
-IALOAD/IASTORE |
|
1150 |
34167 19347 |
|
1816 | 1151 |
19232 29726 |
752 | 1152 |
18821 |
1153 |
+AALOAD/BALOAD |
|
1154 |
41490 39527 6776 3315 4077 8443 33895 19152 28018 184693 |
|
1155 |
41291 37034 6593 32682 |
|
1156 |
+ATHROW 6449 180079 |
|
1157 |
+IASTORE 38848 35601 6219 3796 6122 17869 30085 175106 |
|
1158 |
IINC delayed code |
|
1159 |
+ANEWARRAY 3263 |
|
1160 |
+LADD/LSUB const 38719 35256 6062 27071 172859 |
|
1161 |
||
1162 |
2837 22835 |
|
1163 |
+ISTORE into arg |
|
1164 |
3080 |
|
1165 |
quick L2I for ints 2774 21184 |
|
1166 |
+*ASTORE / *ALOAD |
|
1167 |
again 1621 3654 1525 |
|
1168 |
+CHECKCAST 3574 25810 |
|
1816 | 1169 |
|
752 | 1170 |
------------------------------------------------------------------------------------------------------------ |
1171 |
BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total |
|
1816 | 1172 |
ST/X+J Win95 |
752 | 1173 |
200Mhz P5 |
1174 |
JIT 78490 77060 15220 4840 6370 9180 73160 36080 351700 |
|
1175 |
76900 13560 5500 9010 35200 348600 |
|
1176 |
66080 69920 370750 |
|
1177 |
+IADD non consts 76620 73210 13180 3790 63550 58880 356900 |
|
1178 |
51740 |
|
1816 | 1179 |
77390 72450 12520 3900 6040 8950 62450 34330 57780 335810 |
752 | 1180 |
77220 71950 5270 8840 338650 |
1181 |
72390 70690 48010 327370 |
|
1182 |
74910 66740 11420 8620 61730 33340 47350 313940 |
|
1183 |
+xALOAD/JMP_ZERO |
|
1816 | 1184 |
71740 2800 |
752 | 1185 |
71460 65250 11540 2750 62180 33840 50750 311660 |
1186 |
+LCMP 59100 |
|
1187 |
better abs(I) |
|
1188 |
+xALOAD/IF_ICMPx 66130 61520 12080 3300 5280 8190 56510 33830 50310 297150 |
|
1189 |
elim dummy static 5210 48270 |
|
1190 |
methods 44160 |
|
1191 |
119020 112440 19330 3070 4560 2640 56960 37730 52790 408540 |
|
1192 |
------------------------------------------------------------------------------------------------------------ |
|
1193 |
BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total |
|
1194 |
||
1195 |
||
1196 |
Sun JDK 274625 244461 52676 50653 65183 26668 78133 28572 61608 882583 |
|
1816 | 1197 |
(90Mhz P5) |
752 | 1198 |
|
1199 |
Microsoft J++ 9684 8452 2874 1733 3535 3665 3836 4746 25717 64242 |
|
1816 | 1200 |
(90Mhz P5) |
752 | 1201 |
|
1202 |
Symantec Cafe 14541 12198 3686 1922 4527 3325 3425 12969 26829 83422 |
|
1203 |
JIT 1.02 |
|
1816 | 1204 |
(90Mhz P5) |
752 | 1205 |
|
1206 |
Symantec Cafe 8292 6970 2714 1613 3345 3235 2013 4516 13180 45878 |
|
1207 |
JIT 1.2 |
|
1208 |
(90Mhz P5) |
|
1209 |
" |
|
1210 |
||
1211 |
" |
|
1212 |
|b| |
|
1213 |
||
1214 |
b := JAVA::BubbleSortAlgorithm new. |
|
1215 |
b perform:#'setData(JJ)V' with:10000 with:0 with:0 with:0. |
|
1216 |
Time millisecondsToRun:[ |
|
1217 |
b performTest. |
|
1218 |
] |
|
1219 |
" |
|
1220 |
" |
|
1221 |
|b| |
|
1222 |
||
1223 |
b := JAVA::QSortAlgorithm new. |
|
1224 |
b perform:#'setData(JJ)V' with:500000 with:0 with:0 with:0. |
|
1225 |
Time millisecondsToRun:[ |
|
1226 |
b performTest. |
|
1227 |
] |
|
1228 |
" |
|
1229 |
" |
|
1230 |
|t| |
|
1231 |
||
1232 |
t := JAVA::Tree new. |
|
1233 |
t perform:#'setData(JJ)V' with:1000000 with:0 with:0 with:0. |
|
1234 |
Time millisecondsToRun:[ |
|
1235 |
t performTest. |
|
1236 |
] |
|
1237 |
" |
|
1238 |
" |
|
1239 |
|t| |
|
1240 |
||
1241 |
t := JAVA::Array new. |
|
1242 |
t perform:#'setData(JJ)V' with:1000000 with:0 with:0 with:0. |
|
1243 |
Time millisecondsToRun:[ |
|
1244 |
t performTest. |
|
1245 |
] |
|
1246 |
" |
|
1247 |
||
1248 |
! ! |
|
1249 |
||
1250 |
!JavaVM class methodsFor:'initialization'! |
|
1251 |
||
1374 | 1252 |
boot |
1253 |
||
1254 |
Java initialize. |
|
1255 |
self initializeVM. |
|
1256 |
||
1257 |
"Created: / 21-02-2012 / 18:09:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1258 |
! |
|
1259 |
||
752 | 1260 |
compile:source selector:smalltalkSelector asJavaMethod:javaSelector fakedSource:fakedSource in:aClass |
1261 |
"install additional java protocol in smalltalk classes, req'd for java programs" |
|
1262 |
||
1263 |
|cloneCode| |
|
1264 |
||
1265 |
(aClass implements:javaSelector) ifFalse:[ |
|
1266 |
Class packageQuerySignal answer:'__temporary__' |
|
1267 |
do:[ |
|
1268 |
aClass |
|
1269 |
compile:source |
|
1270 |
classified:'java support' |
|
1271 |
logged:false. |
|
1272 |
]. |
|
1273 |
||
1274 |
cloneCode := aClass compiledMethodAt:smalltalkSelector. |
|
1275 |
cloneCode source:fakedSource. |
|
1276 |
||
1277 |
Class withoutUpdatingChangesDo:[ |
|
1278 |
aClass removeSelector:smalltalkSelector. |
|
1279 |
aClass addSelector:javaSelector withMethod:cloneCode. |
|
1280 |
] |
|
1281 |
]. |
|
1282 |
||
1283 |
"Created: / 5.11.1998 / 19:30:22 / cg" |
|
1284 |
"Modified: / 5.11.1998 / 19:37:57 / cg" |
|
1285 |
! |
|
1286 |
||
1287 |
deinitialize |
|
1288 |
StandardThreadGroup := nil. |
|
1816 | 1289 |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1290 |
KnownWindows notNil ifTrue: [ |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1291 |
KnownWindows do: [:v | v isTopView ifTrue: [ v destroy ] ] |
752 | 1292 |
]. |
1293 |
JavaWindowGroup := nil. |
|
1294 |
KnownWindows := nil. |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1295 |
OpenFileTable := nil. |
752 | 1296 |
JavaMethods := nil. |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1297 |
SystemClassLoader := nil. |
752 | 1298 |
|
1299 |
" |
|
1300 |
JavaVM deinitialize" |
|
1301 |
||
1302 |
"Created: / 03-01-1998 / 21:28:14 / cg" |
|
1303 |
"Modified: / 03-12-1998 / 20:33:21 / cg" |
|
1304 |
"Modified: / 28-01-2011 / 14:11:35 / Marcel Hlopko <hlopik@gmail.com>" |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
1305 |
"Modified: / 16-11-2011 / 09:46:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 1306 |
! |
1307 |
||
1308 |
deinitializeAdditionalJavaProtocol |
|
1309 |
"deinstall additional java protocol in smalltalk classes, req'd for java programs" |
|
1310 |
||
1311 |
#( |
|
1312 |
#'clone()Ljava/lang/Object;' |
|
1313 |
#'equals(Ljava/lang/Object;)Z' |
|
1314 |
#'toString()Ljava/lang/String;' |
|
1315 |
#'getClass()Ljava/lang/Class;' |
|
1316 |
) do:[:sel | |
|
1317 |
(Object implements:sel) ifTrue:[ |
|
1318 |
Class withoutUpdatingChangesDo:[ |
|
1319 |
Object removeSelector:sel. |
|
1320 |
] |
|
1321 |
]. |
|
1322 |
]. |
|
1323 |
||
1324 |
" |
|
1325 |
self deinitializeAdditionalJavaProtocol |
|
1326 |
" |
|
1327 |
||
1328 |
"Created: / 4.2.1998 / 21:37:10 / cg" |
|
1329 |
"Modified: / 5.12.1998 / 15:27:39 / cg" |
|
1330 |
! |
|
1331 |
||
1060 | 1332 |
flushClasses |
1333 |
||
1334 |
ClassRegistry notNil ifTrue:[ |
|
1335 |
ClassRegistry flush |
|
1336 |
]. |
|
1337 |
||
1338 |
"Created: / 30-10-2011 / 16:09:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1339 |
! |
|
1340 |
||
752 | 1341 |
initialize |
1342 |
DUMMY_LONG_HIGHWORD := 1. |
|
1343 |
DUMMY_DOUBLE_HIGHWORD := 2. |
|
1344 |
StandardThreadGroup := nil. |
|
1345 |
NoAudio := true. |
|
1816 | 1346 |
|
752 | 1347 |
"/ NoAudio := false. |
1816 | 1348 |
|
1572 | 1349 |
JavaConsoleStream := "Transcript"Stdout. |
752 | 1350 |
FullExceptionTrace := StackTrace := false. |
1351 |
WindowOPTrace := DrawOPTrace := EventTrace := ThreadTrace := false. |
|
1352 |
MonitorTrace := ExceptionTrace := FileOpenTrace := FileIOTrace := false. |
|
1353 |
ExceptionDebug := ExitDebug := false. |
|
1354 |
ExceptionDebugPatterns := Set new. |
|
1355 |
WindowCreationTrace := false. |
|
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1356 |
FileOpenConfirmation := false. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1357 |
SocketConnectConfirmation := false. |
752 | 1358 |
WindowOPTrace := false. |
1359 |
MonitorTrace := false. |
|
1360 |
ThreadTrace := false. |
|
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1361 |
UnhandledJavaExceptionSignal := (Signal new) mayProceed: true. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1362 |
UnhandledJavaExceptionSignal nameClass: self |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1363 |
message: #unhandledJavaExceptionSignal. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1364 |
UnhandledJavaExceptionSignal notifierString: 'unhandled java exception'. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1365 |
JavaExceptionSignal := (Signal new) mayProceed: false. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1366 |
JavaExceptionSignal nameClass: self message: #javaExceptionSignal. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1367 |
JavaExceptionSignal notifierString: 'java exception'. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1368 |
UnimplementedInstructionSignal := (Signal new) mayProceed: false. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1369 |
UnimplementedInstructionSignal nameClass: self |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1370 |
message: #unimplementedInstructionSignal. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1371 |
UnimplementedInstructionSignal notifierString: 'unimplemented instruction'. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1372 |
UnimplementedNativeMethodSignal := (Signal new) mayProceed: false. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1373 |
UnimplementedNativeMethodSignal nameClass: self |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1374 |
message: #unimplementedNativeMethodSignal. |
1816 | 1375 |
UnimplementedNativeMethodSignal |
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1376 |
notifierString: 'unimplemented native method'. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1377 |
BadMessageSignal := (Signal new) mayProceed: false. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1378 |
BadMessageSignal nameClass: self message: #badMessageSignal. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1379 |
BadMessageSignal notifierString: 'invalid message to JAVA object'. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1380 |
InternalErrorSignal := (Signal new) mayProceed: false. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1381 |
InternalErrorSignal nameClass: self message: #internalErrorSignal. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1382 |
InternalErrorSignal notifierString: 'internal error'. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1383 |
CallHandlerSignal := (Signal new) mayProceed: false. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1384 |
CallHandlerSignal nameClass: self message: #callHandlerSignal. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1385 |
CallHandlerSignal notifierString: 'internal signal'. |
752 | 1386 |
StdinReplacementFileQuerySignal := QuerySignal new. |
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1387 |
StdinReplacementFileQuerySignal nameClass: self |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1388 |
message: #stdinReplacementFileQuerySignal. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1389 |
StdinReplacementFileQuerySignal notifierString: 'asking for stdin stream'. |
1016
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
1390 |
JavaPrivilegedAccessQuery := QuerySignal new. |
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1391 |
JavaPrivilegedAccessQuery defaultAnswer: false. |
752 | 1392 |
AssertionsEnabled := true. |
1069
d5d204ceb991
JavaVM: Added ClassRegistry initialization into JavaVM>>initialize
vranyj1
parents:
1063
diff
changeset
|
1393 |
ClassRegistry := JavaClassRegistry new. |
1109
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
1394 |
FinalizationEnabled := true. |
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1395 |
EagerResolvingEnabled := false. |
752 | 1396 |
|
1617 | 1397 |
ObjectMemory addDependent: self. |
1398 |
||
1399 |
||
752 | 1400 |
" |
1401 |
JavaVM initialize" |
|
1058
1db06119bf3e
Temporary commit (fixing class loaders - classes gets registered twice)
vranyj1
parents:
1053
diff
changeset
|
1402 |
|
752 | 1403 |
"Created: / 02-01-1998 / 18:02:34 / cg" |
1404 |
"Modified: / 02-12-1998 / 23:02:22 / cg" |
|
1016
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
1405 |
"Modified: / 09-10-2011 / 20:29:10 / Marcel Hlopko <hlopik@gmail.com>" |
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
1406 |
"Modified: / 08-12-2011 / 21:06:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1617 | 1407 |
"Modified: / 17-08-2012 / 11:16:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1408 |
! |
1409 |
||
1410 |
initializeAdditionalJavaProtocol |
|
1411 |
"install additional java protocol in smalltalk classes, req'd for java programs" |
|
1412 |
||
1413 |
"/ since we use smalltalk Arrays for JavaArray, some |
|
1414 |
"/ additional (java-) protocol is required. |
|
1415 |
"/ This is also useful, when Smalltalk objects are passed to |
|
1416 |
"/ java ... |
|
1417 |
"/ We should implement all of the java.lang.Object protocol in |
|
1418 |
"/ Object, to be on the bright side of life; more of this later ... |
|
1419 |
||
1420 |
self |
|
1421 |
compile:'__clone |
|
1422 |
"this is smalltalk code with a java selector ... |
|
1816 | 1423 |
(This source cannot be accepted in the browser, |
752 | 1424 |
since it has a funny selector.) |
1425 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1426 |
||
1427 |
^ self shallowCopy' |
|
1816 | 1428 |
selector:#'__clone' |
1429 |
asJavaMethod:#'clone()Ljava/lang/Object;' |
|
752 | 1430 |
fakedSource:'#''clone()Ljava/lang/Object;'' |
1431 |
"this is smalltalk code with a java selector ... |
|
1816 | 1432 |
(This source cannot be accepted in the browser, |
752 | 1433 |
since it has a funny selector.) |
1434 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1435 |
||
1436 |
^ self shallowCopy' |
|
1437 |
in:Object. |
|
1438 |
||
1439 |
"/ ------------------------------------------------------------ |
|
1440 |
||
1441 |
self |
|
1442 |
compile:'__equals:arg |
|
1443 |
"this is smalltalk code with a java selector ... |
|
1816 | 1444 |
(This source cannot be accepted in the browser, |
752 | 1445 |
since it has a funny selector.) |
1446 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1447 |
||
1448 |
^ (arg = self) ifTrue:[1] ifFalse:[0]' |
|
1816 | 1449 |
selector:#'__equals:' |
1450 |
asJavaMethod:#'equals(Ljava/lang/Object;)Z' |
|
752 | 1451 |
fakedSource:'#''equals(Ljava/lang/Object;)Z'' |
1452 |
"this is smalltalk code with a java selector ... |
|
1816 | 1453 |
(This source cannot be accepted in the browser, |
752 | 1454 |
since it has a funny selector.) |
1455 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1456 |
||
1457 |
^ (arg = self) ifTrue:[1] ifFalse:[0]' |
|
1458 |
in:Object. |
|
1459 |
||
1460 |
"/ ------------------------------------------------------------ |
|
1461 |
||
1462 |
self |
|
1463 |
compile:'__toString |
|
1464 |
"this is smalltalk code with a java selector ... |
|
1816 | 1465 |
(This source cannot be accepted in the browser, |
752 | 1466 |
since it has a funny selector.) |
1467 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1468 |
||
1469 |
^ Java as_String:(self displayString)' |
|
1816 | 1470 |
selector:#'__toString' |
1471 |
asJavaMethod:#'toString()Ljava/lang/String;' |
|
752 | 1472 |
fakedSource:'#''toString()Ljava/lang/String;'' |
1473 |
"this is smalltalk code with a java selector ... |
|
1816 | 1474 |
(This source cannot be accepted in the browser, |
752 | 1475 |
since it has a funny selector.) |
1476 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1477 |
||
1478 |
^ Java as_String:(self displayString)' |
|
1479 |
in:Object. |
|
1480 |
||
1481 |
"/ ------------------------------------------------------------ |
|
1482 |
||
1483 |
self |
|
1484 |
compile:'__getClass |
|
1485 |
"this is smalltalk code with a java selector ... |
|
1816 | 1486 |
(This source cannot be accepted in the browser, |
752 | 1487 |
since it has a funny selector.) |
1488 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1489 |
||
1490 |
^ JavaVM javaClassObjectForClass:self class' |
|
1816 | 1491 |
selector:#'__getClass' |
1492 |
asJavaMethod:#'getClass()Ljava/lang/Class;' |
|
752 | 1493 |
fakedSource:'#''getClass()Ljava/lang/Class;'' |
1494 |
"this is smalltalk code with a java selector ... |
|
1816 | 1495 |
(This source cannot be accepted in the browser, |
752 | 1496 |
since it has a funny selector.) |
1497 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1498 |
||
1499 |
^ JavaVM javaClassObjectForClass:self class' |
|
1500 |
in:Object. |
|
1501 |
||
1502 |
"/ ------------------------------------------------------------ |
|
1503 |
||
1504 |
self |
|
1505 |
compile:'__hashCode |
|
1506 |
"this is smalltalk code with a java selector ... |
|
1816 | 1507 |
(This source cannot be accepted in the browser, |
752 | 1508 |
since it has a funny selector.) |
1509 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1510 |
||
1511 |
^ self identityHash' |
|
1816 | 1512 |
selector:#'__hashCode' |
1513 |
asJavaMethod:#'hashCode()I' |
|
752 | 1514 |
fakedSource:'#''hashCode()I'' |
1515 |
"this is smalltalk code with a java selector ... |
|
1816 | 1516 |
(This source cannot be accepted in the browser, |
752 | 1517 |
since it has a funny selector.) |
1518 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1519 |
||
1520 |
^ self identityHash' |
|
1521 |
in:Object. |
|
1522 |
||
1523 |
||
1524 |
" |
|
1525 |
self initializeAdditionalJavaProtocol |
|
1526 |
" |
|
1527 |
||
1528 |
"Modified: / 28-01-1997 / 19:38:58 / stefan" |
|
1529 |
"Modified: / 22-01-1998 / 21:23:40 / av" |
|
1530 |
"Created: / 04-02-1998 / 21:35:46 / cg" |
|
1531 |
"Modified: / 30-12-1998 / 21:07:55 / cg" |
|
1532 |
"Modified: / 25-10-2010 / 16:26:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1533 |
! |
|
1534 |
||
1535 |
initializeBaseClasses |
|
1536 |
"load req'd base classes" |
|
1816 | 1537 |
|
1033 | 1538 |
#( 'java.lang.Object' |
1539 |
'java.lang.Class' |
|
1540 |
'java.lang.String' |
|
1816 | 1541 |
'java.lang.System' ) |
1033 | 1542 |
do: [ |
1816 | 1543 |
:cName | |
1033 | 1544 |
(self classForName: cName) isNil ifTrue: [ |
1816 | 1545 |
self |
1546 |
warn: ('JavaVM: could not find required class: ' , cName asText allBold |
|
1033 | 1547 |
, '\\Please check the Java settings (javaHome)') withCRs. |
1548 |
AbortSignal raise. |
|
1549 |
^ self |
|
1550 |
] |
|
1551 |
]. |
|
1552 |
||
1553 |
" |
|
1554 |
self initializeBaseClasses" |
|
752 | 1555 |
"Created: / 3.1.1998 / 21:13:28 / cg" |
1556 |
"Modified: / 23.12.1999 / 19:27:42 / cg" |
|
1557 |
! |
|
1558 |
||
1698
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1692
diff
changeset
|
1559 |
initializeClassReader |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1692
diff
changeset
|
1560 |
"/Nothing to do" |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1692
diff
changeset
|
1561 |
|
1708 | 1562 |
JavaClassReader initialize. |
1563 |
||
1698
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1692
diff
changeset
|
1564 |
"Created: / 06-09-2012 / 11:18:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1692
diff
changeset
|
1565 |
! |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1692
diff
changeset
|
1566 |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
1567 |
initializeJavaResources |
1617 | 1568 |
self initializeMonitorTable. |
1569 |
self initializePrimitiveClasses. |
|
1570 |
self initializeOpenFileTable. |
|
1571 |
||
1572 |
" |
|
1573 |
JavaVM releaseAllMonitors" |
|
1574 |
||
1575 |
"Created: / 02-01-1998 / 18:04:05 / cg" |
|
1576 |
"Modified: / 07-01-1998 / 22:58:10 / cg" |
|
1577 |
"Created: / 16-11-2011 / 14:23:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1578 |
"Modified: / 17-08-2012 / 11:30:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1579 |
! |
|
1580 |
||
1581 |
initializeMonitorTable |
|
1553
ee3e63c04778
JavaVM: increased initial old space allocation, create huge LockTable to prevent its realloction
vranyj1
parents:
1552
diff
changeset
|
1582 |
LockTable := WeakIdentityDictionary new:32000. |
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
1583 |
LockTableAccess := Semaphore "RecursionLock" forMutualExclusion. |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
1584 |
LockTableAccess name: 'JavaVM lock table access mutex'. |
1816 | 1585 |
Logger |
1119
0f4d4bc3d346
warning!! bug possibly fixed :) probably not but maybe ;)
hlopkmar
parents:
1118
diff
changeset
|
1586 |
log: 'Initializing EnteredMonitorsPerProcess' |
1122 | 1587 |
severity: #debug |
1119
0f4d4bc3d346
warning!! bug possibly fixed :) probably not but maybe ;)
hlopkmar
parents:
1118
diff
changeset
|
1588 |
facility: #JVM. |
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
1589 |
EnteredMonitorsPerProcess := IdentityDictionary new. |
1816 | 1590 |
Logger |
1617 | 1591 |
log: 'Initializing AcquiredMonitorsPerProcess' |
1592 |
severity: #debug |
|
1593 |
facility: #JVM. |
|
1594 |
AcquiredMonitorsPerProcess := IdentityDictionary new. |
|
1595 |
||
1596 |
" |
|
1597 |
JavaVM initializeMonitorTable" |
|
1598 |
||
1599 |
"Created: / 17-08-2012 / 11:30:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
1600 |
! |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
1601 |
|
752 | 1602 |
initializeOpenFileTable |
1816 | 1603 |
OpenFileTable := OrderedCollection |
1604 |
with:Stdin |
|
1570 | 1605 |
with:("JavaConsoleStream ?" Stdout) |
1606 |
with:("JavaConsoleStream ?" Stderr). |
|
1528 | 1607 |
OpenFileTableLock := RecursionLock new. |
752 | 1608 |
|
1609 |
" |
|
1610 |
JavaVM initializeOpenFileTable |
|
1611 |
" |
|
1612 |
||
1528 | 1613 |
"Modified: / 06-08-1997 / 00:40:19 / cg" |
1614 |
"Created: / 02-01-1998 / 18:04:32 / cg" |
|
1570 | 1615 |
"Modified: / 30-07-2012 / 18:12:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1616 |
! |
1617 |
||
1618 |
initializePrimitiveClasses |
|
1816 | 1619 |
|
752 | 1620 |
|
1621 |
"/ #( |
|
1622 |
"/ (#byte 'B' 1) |
|
1623 |
"/ (#short 'S' 2) |
|
1624 |
"/ (#int 'I' 4) |
|
1625 |
"/ (#long 'J' 8) |
|
1626 |
"/ (#boolean 'Z' 1) |
|
1627 |
"/ (#char 'C' 2) |
|
1628 |
"/ (#float 'F' 4) |
|
1629 |
"/ (#double 'D' 8) |
|
1630 |
"/ (#void 'V' 0) |
|
1631 |
"/ ) triplesDo:[:nm :sig :len | |
|
1632 |
"/ |jClass classInst| |
|
1633 |
"/ |
|
1634 |
"/ "/ |
|
1635 |
"/ "/ create a javaClass for it. |
|
1636 |
"/ "/ |
|
1637 |
"/ jClass := Java at:'java.lang.Class'. |
|
1638 |
"/ jClass notNil ifTrue:[ |
|
1639 |
"/ classInst := jClass new. |
|
1640 |
"/ JavaClasses at:nm put:classInst. |
|
1641 |
"/ JavaClasses at:classInst put:nm. |
|
1642 |
"/ ] |
|
1643 |
"/ ]. |
|
1644 |
" |
|
1645 |
self initializePrimitiveClasses" |
|
1646 |
||
1647 |
"Modified: / 22-10-1998 / 01:56:02 / cg" |
|
1648 |
"Modified: / 20-12-2010 / 23:39:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1649 |
"Modified: / 28-01-2011 / 14:57:38 / Marcel Hlopko <hlopik@gmail.com>" |
|
1650 |
! |
|
1651 |
||
1652 |
initializeReflection |
|
1653 |
||
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
1654 |
Reflection := ReflectionRegistry for: self. |
752 | 1655 |
|
1656 |
"Created: / 21-12-2010 / 19:48:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
1657 |
"Modified: / 16-01-2013 / 20:55:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1658 |
! |
1659 |
||
1660 |
initializeSimulatedLibs |
|
1816 | 1661 |
"return a collection of native libs which are considered |
752 | 1662 |
being already loaded. (used with jdk < 1.2)" |
1663 |
||
1664 |
LibPath := #( |
|
1816 | 1665 |
'__builtIn__' |
1666 |
'/usr/local/lib' |
|
752 | 1667 |
'/usr/local/lib/java' |
1668 |
). |
|
1669 |
||
1670 |
SimulatedLibs := #( |
|
1816 | 1671 |
'__builtIn__/net' |
1672 |
'__builtIn__/awt' |
|
1673 |
'__builtIn__/tawt' |
|
1674 |
'__builtIn__/winawt' |
|
752 | 1675 |
'__builtIn__/jpeg' |
1676 |
'__builtIn__/mmedia' |
|
1677 |
'__builtIn__/zip' |
|
1678 |
'__builtIn__/math' |
|
1679 |
'__builtIn__/sysresource' |
|
1680 |
||
1816 | 1681 |
"/ KAVA ... |
752 | 1682 |
'__builtIn__/agent' |
1683 |
||
1816 | 1684 |
"/ MS-java ... |
752 | 1685 |
'__builtIn__/msawt' |
1686 |
'__builtIn__/javart' |
|
1687 |
||
1688 |
"/ 1.1.8 |
|
1816 | 1689 |
'__builtIn__/jpeg_sun' |
752 | 1690 |
). |
1691 |
||
1692 |
" |
|
1693 |
self initializeSimulatedLibs |
|
1694 |
" |
|
1695 |
||
1696 |
"Created: / 4.1.1998 / 19:05:03 / cg" |
|
1697 |
"Modified: / 17.11.1998 / 23:53:02 / cg" |
|
1698 |
! |
|
1699 |
||
1700 |
initializeSimulatedNativeLibs |
|
1816 | 1701 |
"return a collection of native libs which are considered |
752 | 1702 |
being already loaded (used with jdk >= 1.2)" |
1816 | 1703 |
|
1079 | 1704 |
OperatingSystem isUNIXlike ifTrue: [ |
1493 | 1705 |
SimulatedNativeLibs := #( 'libawt.so' 'libnet.so' 'libcmm.so' 'libzip.so' 'libnio.so' |
1251 | 1706 |
'libmanagement.so' "/ Management Beans - req'd by Tomcat |
1707 |
'libjpeg.so' 'liblcms.so' "/ Some UI stuff - req'd by Tomcat !!?!! |
|
1493 | 1708 |
'libfontmanager.so' "/ req'd by java.text.Bidi |
1251 | 1709 |
). |
1079 | 1710 |
^ self. |
1711 |
]. |
|
1712 |
OperatingSystem isMSWINDOWSlike ifTrue: [ |
|
1493 | 1713 |
SimulatedNativeLibs := #( 'awt.dll' 'net.dll' 'cmm.dll' 'zip.dll' 'nio.so' |
1310 | 1714 |
'management.dll' "/ Management Beans - req'd by Tomcat |
1715 |
'fontmanager.dll' "/ req'd by java.text.Bidi |
|
1716 |
). |
|
1079 | 1717 |
^ self. |
752 | 1718 |
]. |
1719 |
SimulatedNativeLibs := #(). |
|
1079 | 1720 |
|
1721 |
" |
|
1722 |
self initializeSimulatedNativeLibs" |
|
752 | 1723 |
|
1724 |
"Modified: / 27-01-1998 / 18:43:10 / cg" |
|
1080 | 1725 |
"Modified: / 03-11-2011 / 19:00:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1310 | 1726 |
"Modified: / 21-12-2011 / 23:03:35 / jv" |
1493 | 1727 |
"Modified: / 12-05-2012 / 12:52:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1728 |
! |
1729 |
||
1730 |
initializeSimulatedNativeMemory |
|
1731 |
||
1732 |
SimulatedNativeMemory := JavaNativeMemory new. |
|
1733 |
||
1734 |
"Created: / 07-12-2010 / 21:07:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1735 |
"Modified: / 07-12-2010 / 23:45:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1736 |
! |
|
1737 |
||
1059 | 1738 |
initializeSystemClassLoader |
1739 |
||
1649
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
1740 |
| java_lang_ClassLoader stx_libjava_ClassLoader | |
1816 | 1741 |
|
1059 | 1742 |
java_lang_ClassLoader := JavaVM classForName: 'java.lang.ClassLoader'. |
1743 |
(SystemClassLoader := java_lang_ClassLoader instVarNamed:#scl) isNil ifTrue:[ |
|
1744 |
SystemClassLoader := java_lang_ClassLoader perform: #'getSystemClassLoader()Ljava/lang/ClassLoader;' |
|
1745 |
]. |
|
1746 |
||
1649
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
1747 |
stx_libjava_ClassLoader := JavaVM classForName: 'stx.libjava.ClassLoader'. |
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
1748 |
(SmalltalkClassLoader := stx_libjava_ClassLoader instVarNamed:#scl) isNil ifTrue:[ |
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
1749 |
SmalltalkClassLoader := stx_libjava_ClassLoader perform: #'getSmalltalkClassLoader()Ljava/lang/ClassLoader;' |
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
1750 |
]. |
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
1751 |
|
1059 | 1752 |
"Created: / 30-10-2011 / 12:04:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1753 |
! |
|
1754 |
||
1816 | 1755 |
initializeSystemPropertiesInto: props |
1706 | 1756 |
| cpu cpu2 os | |
752 | 1757 |
"/ use JAVA compatible cpu-name |
1758 |
cpu := OperatingSystem getCPUType. |
|
1269
c85f7de00e06
JavaVM: fix in initializeSystemProperties: (for ia32 machines)
vranyj1
parents:
1268
diff
changeset
|
1759 |
cpu2 := cpu. |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1760 |
cpu = 'i386' ifTrue: [ cpu := 'ix86' ]. |
1706 | 1761 |
(OperatingSystem getSystemInfo at: #machine) = 'x86_64' ifTrue: [ |
1762 |
cpu2 := 'amd64' |
|
1763 |
]. |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1764 |
SimulatedOS notNil ifTrue: [ os := SimulatedOS ] ifFalse: [ |
752 | 1765 |
os := OperatingSystem getOSType. |
1766 |
os := os asUppercaseFirst. |
|
1767 |
]. |
|
1706 | 1768 |
props addPairsFrom: { |
1769 |
'java.runtime.name'. |
|
1770 |
'OpenJDK Runtime Environment'. |
|
1771 |
'sun.boot.library.path'. |
|
1772 |
OperatingSystem isMSWINDOWSlike ifTrue: [ |
|
1773 |
(Java release jreHome / 'bin') asString |
|
1774 |
] ifFalse: [ (Java release jreHome / 'lib' / cpu2) asString ]. |
|
1775 |
'java.vm.version'. |
|
1776 |
Smalltalk versionString. |
|
1777 |
'java.vm.vendor'. |
|
1778 |
'eXept Software AG & SWING Research Group'. |
|
1779 |
'java.vendor.url'. |
|
1780 |
'http://www.exept.de & http://swing.fit.cvut.cz'. |
|
1781 |
'path.separator'. |
|
1782 |
OperatingSystem pathSeparator asString. |
|
1783 |
'java.vm.name'. |
|
1784 |
'Smalltalk/X'. |
|
1785 |
'file.encoding.pkg'. |
|
1786 |
'sun.io'. |
|
1787 |
'sun.java.launcher'. |
|
1788 |
'SUN_STANDARD'. |
|
1789 |
'user.country'. |
|
1790 |
'US'. |
|
1791 |
'sun.os.patch.level'. |
|
1792 |
'unknown'. |
|
1793 |
'java.vm.specification.name'. |
|
1794 |
'Java Virtual Machine Specification'. |
|
1795 |
'user.dir'. |
|
1796 |
Filename currentDirectory pathName. |
|
1797 |
'java.awt.graphicsenv'. |
|
1798 |
'sun.awt.X11GraphicsEnvironment'. |
|
1799 |
'java.endorsed.dirs'. |
|
1800 |
(Java release jreHome / 'lib' / 'endorsed') asString. |
|
1801 |
'os.arch'. |
|
1802 |
cpu. |
|
1803 |
'java.io.tmpdir'. |
|
1804 |
Filename tempDirectory pathName. |
|
1805 |
'line.separator'. |
|
1806 |
Character cr asString. |
|
1807 |
'java.vm.specification.vendor'. |
|
1808 |
'Sun Microsystems Inc.'. |
|
1809 |
'os.name'. |
|
1810 |
os. |
|
1811 |
'sun.jnu.encoding'. |
|
1812 |
'UTF-8'. |
|
1813 |
'java.library.path'. |
|
1814 |
self defaultJavaLibraryPath. |
|
1815 |
'java.specification.name'. |
|
1816 |
'Java Platform API Specification'. |
|
1817 |
'java.class.version'. |
|
1818 |
'50.0'. |
|
1819 |
'sun.management.compiler'. |
|
1820 |
'Smalltalk/X jinterpreter'. |
|
1821 |
'os.version'. |
|
1822 |
OperatingSystem isMSWINDOWSlike ifTrue: [ |
|
1823 |
OperatingSystem getSystemInfo at: #release |
|
1824 |
] ifFalse: [ OperatingSystem getSystemInfo at: #version ]. |
|
1825 |
'user.home'. |
|
1826 |
Filename homeDirectory pathName. |
|
1827 |
'user.timezone'. |
|
1828 |
''. |
|
1829 |
'java.awt.printerjob'. |
|
1830 |
'sun.print.PSPrinterJob'. |
|
1831 |
'file.encoding'. |
|
1832 |
'UTF-8'. |
|
1833 |
'java.specification.version'. |
|
1834 |
'1.6'. |
|
1835 |
'java.class.path'. |
|
1836 |
self defaultCLASSPATH. |
|
1837 |
'user.name'. |
|
1838 |
OperatingSystem getLoginName. |
|
1839 |
'java.vm.specification.version'. |
|
1840 |
'1.0'. |
|
1841 |
"'sun.java.command' . 'SystemProperties' ." |
|
1842 |
'java.home'. |
|
1927
007031278841
Bugfix: value of java.home property.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1926
diff
changeset
|
1843 |
Java release jreHome pathName. |
1706 | 1844 |
'sun.arch.data.model'. |
1845 |
'32'. |
|
1846 |
'user.language'. |
|
1847 |
Smalltalk language. |
|
1848 |
'java.specification.vendor'. |
|
1849 |
'Sun Microsystems Inc.'. |
|
1850 |
'java.vm.info'. |
|
1851 |
'Smalltalk/X 6.2.1'. |
|
1852 |
'java.version'. |
|
1853 |
'1.6'. |
|
1854 |
'java.ext.dirs'. |
|
1855 |
self defaultExtDirs. |
|
1856 |
'sun.boot.class.path'. |
|
1857 |
self defaultSunBootLibraryPath. |
|
1858 |
'java.vendor'. |
|
1859 |
'Sun Microsystems Inc.'. |
|
1860 |
'file.separator'. |
|
1861 |
Filename separatorString. |
|
1862 |
'java.vendor.url.bug'. |
|
1863 |
'https://swing.fit.cvut.cz/projects/stx-libjava/newticket'. |
|
1864 |
'sun.io.unicode.encoding'. |
|
1865 |
'UnicodeLittle'. |
|
1866 |
'sun.cpu.endian'. |
|
1867 |
'little'. |
|
1868 |
'sun.desktop'. |
|
1869 |
'gnome'. |
|
1870 |
'sun.cpu.isalist'. |
|
1871 |
'' |
|
1872 |
}. |
|
1816 | 1873 |
|
752 | 1874 |
"/ props at:'user.dir' put:(Filename currentDirectory pathName). |
1875 |
"/props at:'awt.toolkit' put:(self defaultWindowingToolKit). |
|
1816 | 1876 |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1877 |
props at: 'user.country' put: 'US'. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1878 |
props at: 'hotjava.home' put: (self defaultHotJavaHome). |
1816 | 1879 |
|
752 | 1880 |
"/ new with jdk 1.1.8 |
1881 |
"/ undocumented ? |
|
1882 |
"/ suppress copyright view in appletViewer ... |
|
1816 | 1883 |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1884 |
props at: 'appletviewer.version' put: '1.1'. |
1816 | 1885 |
|
752 | 1886 |
"/ new with jdk 1.2 |
1816 | 1887 |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1888 |
props at: 'java.awt.graphicsenv' put: 'sun.awt.X11GraphicsEnvironment'. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1889 |
props at: 'java.awt.fonts' put: '/usr/lib/X11/fonts'. |
1816 | 1890 |
|
752 | 1891 |
"/ jws |
1892 |
"/props at:'jws.home' put:(self defaultJWSHome). |
|
1893 |
"/ new with jws 2.0 ... |
|
1894 |
"/props at:'jws.startcmd' put:'jws.showwin.mainide'. |
|
1816 | 1895 |
"/ props at: 'sun.misc.URLClassPath.debug' put: 'true'. |
1896 |
||
1842 | 1897 |
"/ Java tests, sigh..." |
1898 |
||
1899 |
props at: 'libjava.tests.dir' put: ((Smalltalk getPackageDirectoryForPackage: self package) / 'tests') pathName. |
|
1900 |
||
752 | 1901 |
^ props |
1902 |
||
1903 |
" |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
1904 |
self initializeSystemPropertiesInto:(Dictionary new)" |
752 | 1905 |
|
1906 |
"Created: / 03-01-1998 / 14:26:39 / cg" |
|
1907 |
"Modified: / 27-01-2000 / 02:20:18 / cg" |
|
1078 | 1908 |
"Modified (format): / 03-11-2011 / 12:40:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1310 | 1909 |
"Modified: / 21-12-2011 / 23:05:11 / jv" |
1706 | 1910 |
"Modified: / 13-09-2012 / 20:33:56 / m" |
1927
007031278841
Bugfix: value of java.home property.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1926
diff
changeset
|
1911 |
"Modified: / 09-01-2013 / 17:11:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1912 |
! |
1913 |
||
1914 |
initializeVM |
|
1525 | 1915 |
|
1546 | 1916 |
OperatingSystem initResources. |
1917 |
||
1614
f7d4888fb1a2
- JavaClassReader: added check for VM stack-depth limit
vranyj1
parents:
1612
diff
changeset
|
1918 |
"Java requires a huge stack. Change default to 16 MB. |
f7d4888fb1a2
- JavaClassReader: added check for VM stack-depth limit
vranyj1
parents:
1612
diff
changeset
|
1919 |
Observations: |
f7d4888fb1a2
- JavaClassReader: added check for VM stack-depth limit
vranyj1
parents:
1612
diff
changeset
|
1920 |
- Groovy 'rnd = new java.security.SecureRandom()' requires > 4MB |
f7d4888fb1a2
- JavaClassReader: added check for VM stack-depth limit
vranyj1
parents:
1612
diff
changeset
|
1921 |
- ant run on Groovy 1.8.7 source requires > 8MB |
f7d4888fb1a2
- JavaClassReader: added check for VM stack-depth limit
vranyj1
parents:
1612
diff
changeset
|
1922 |
" |
1691 | 1923 |
"/Process defaultMaximumStackSize: ((1024 * 1024 * 16) max: Process defaultMaximumStackSize). |
1816 | 1924 |
|
1525 | 1925 |
"Java Classes are huge and there is a (unfixed) bug in 2-phase oldspace |
1926 |
compress, so try to avoid it by pre-allocating more oldspace." |
|
1927 |
OldspaceIncreased ~~ true ifTrue:[ |
|
1607 | 1928 |
ObjectMemory moreOldSpace: 64"MB"*(1024*1024). |
1525 | 1929 |
OldspaceIncreased := true. |
1930 |
]. |
|
1931 |
||
1059 | 1932 |
ClassRegistry := JavaClassRegistry for: self. |
1033 | 1933 |
ClassLoaderQuerySignal := Query new. |
752 | 1934 |
JavaObject autoload. |
1935 |
JavaContext autoload. |
|
1617 | 1936 |
MonitorTrace isNil ifTrue: [ self initialize ]. |
1468 | 1937 |
MonitorTraceId := 0. |
752 | 1938 |
self initializeAdditionalJavaProtocol. |
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
1939 |
self initializeJavaResources. |
752 | 1940 |
JavaConsoleStream := Transcript. |
1941 |
Java initAllStaticFields. |
|
1942 |
Java markAllClassesUninitialized. |
|
761 | 1943 |
ZipCache := OrderedCollection new. |
1944 |
ZipEntryCache := OrderedCollection new. |
|
1945 |
ZipInflaters := OrderedCollection new. |
|
1548 | 1946 |
FinalizationLobby := JavaFinalizationRegistry new. |
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
1947 |
NativeMethodsImplementation := Java release javaNativeMethodsImplementation. |
1816 | 1948 |
|
752 | 1949 |
"/ force re-resolving; |
1950 |
"/ otherwise, class-inits would not be called |
|
1951 |
"/ by resolver ... (sigh) |
|
1816 | 1952 |
|
752 | 1953 |
JavaNativeMethod flushAllCachedNativeMethods. |
1816 | 1954 |
JavaMethod |
1081
0c91ffb1ef21
few more natives.. pls review I have bad feelings about that
hlopkmar
parents:
1080
diff
changeset
|
1955 |
allSubInstancesDo: [ |
1816 | 1956 |
:m | |
1081
0c91ffb1ef21
few more natives.. pls review I have bad feelings about that
hlopkmar
parents:
1080
diff
changeset
|
1957 |
m checked: false. |
0c91ffb1ef21
few more natives.. pls review I have bad feelings about that
hlopkmar
parents:
1080
diff
changeset
|
1958 |
m code: nil. |
0c91ffb1ef21
few more natives.. pls review I have bad feelings about that
hlopkmar
parents:
1080
diff
changeset
|
1959 |
]. |
0c91ffb1ef21
few more natives.. pls review I have bad feelings about that
hlopkmar
parents:
1080
diff
changeset
|
1960 |
ObjectMemory flushCaches. |
1816 | 1961 |
|
752 | 1962 |
"/ sigh - must flush inline caches. |
1816 | 1963 |
|
752 | 1964 |
JavaClass startRememberingOrderOfClassInits. |
1965 |
self initializeSimulatedLibs. |
|
1816 | 1966 |
|
752 | 1967 |
"/ < jdk 1.2 |
1816 | 1968 |
|
752 | 1969 |
self initializeSimulatedNativeLibs. |
1816 | 1970 |
|
752 | 1971 |
"/ >= jdk 1.2 |
1816 | 1972 |
|
752 | 1973 |
self initializeSimulatedNativeMemory. |
1816 | 1974 |
|
752 | 1975 |
"/> jdk 6 |
1698
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1692
diff
changeset
|
1976 |
|
1953
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
1977 |
ThreadInterrupts := Dictionary new. |
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
1978 |
|
1698
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1692
diff
changeset
|
1979 |
self initializeClassReader. |
752 | 1980 |
self initializeOpenFileTable. |
907 | 1981 |
self initializeReflection. |
752 | 1982 |
self initializeBaseClasses. |
1983 |
self initializePrimitiveClasses. |
|
1984 |
Java initSystemClass. |
|
1250 | 1985 |
Java initializeCurrentThread. |
1059 | 1986 |
self initializeSystemClassLoader. |
1081
0c91ffb1ef21
few more natives.. pls review I have bad feelings about that
hlopkmar
parents:
1080
diff
changeset
|
1987 |
ObjectMemory addDependent: self. |
0c91ffb1ef21
few more natives.. pls review I have bad feelings about that
hlopkmar
parents:
1080
diff
changeset
|
1988 |
StartupTime := OperatingSystem getOSTime. |
1816 | 1989 |
FinalizationLobby startFinalizationProcessAt: 5. |
1597 | 1990 |
PerfCounters := Performance for: self. |
1953
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
1991 |
|
1548 | 1992 |
|
1754
b3cde0c1c2b1
- do not enforce Java native code optimization off
vranyj1
parents:
1749
diff
changeset
|
1993 |
JavaNativeMethod allInstancesDo:[:e|e nCallsReset ]. |
1548 | 1994 |
|
752 | 1995 |
" |
1996 |
JavaVM initialize. |
|
1997 |
JavaVM initializeVM." |
|
1059 | 1998 |
|
752 | 1999 |
"Created: / 03-01-1998 / 21:29:09 / cg" |
2000 |
"Modified: / 14-12-1999 / 18:58:56 / cg" |
|
2001 |
"Modified: / 15-10-2010 / 15:27:45 / Jan Kurs <kurs.jan@post.cz>" |
|
1381 | 2002 |
"Modified: / 24-02-2012 / 13:59:29 / Marcel Hlopko <hlopik@gmail.com>" |
1382 | 2003 |
"Modified: / 24-02-2012 / 14:37:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
2004 |
"Modified: / 16-01-2013 / 20:01:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2005 |
! |
2006 |
||
2007 |
initializeVMIfNoEventThreadRunning |
|
2008 |
|uClass updater p| |
|
2009 |
||
2010 |
uClass := JAVA::sun::awt::ScreenUpdater. |
|
2011 |
uClass notNil ifTrue:[ |
|
2012 |
updater := uClass instVarNamed:'updater'. |
|
2013 |
updater notNil ifTrue:[ |
|
2014 |
p := self stProcessForJavaThread:updater |
|
2015 |
]. |
|
2016 |
(updater isNil or:[p isNil or:[p isDead]]) isNil ifTrue:[ |
|
2017 |
self initializeVM. |
|
2018 |
^ self. |
|
2019 |
] |
|
2020 |
]. |
|
2021 |
||
2022 |
(JavaEventThread isNil or:[JavaEventThread isDead]) ifTrue:[ |
|
2023 |
self initializeVM |
|
2024 |
]. |
|
2025 |
||
2026 |
" |
|
2027 |
JavaVM initializeVMIfNoEventThreadRunning |
|
2028 |
" |
|
2029 |
||
2030 |
"Created: / 15.1.1998 / 17:32:27 / cg" |
|
2031 |
"Modified: / 24.12.1999 / 02:18:25 / cg" |
|
2032 |
! |
|
2033 |
||
1374 | 2034 |
reboot |
2035 |
||
2036 |
Java flushAllJavaResources. |
|
2037 |
self boot |
|
2038 |
||
2039 |
"Created: / 21-02-2012 / 18:10:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2040 |
! |
|
2041 |
||
1617 | 2042 |
reinitializeSockets |
2043 |
"Reopens all server-sockets (i.e., listening sockets bound to a port). |
|
2044 |
Called upon restarting from image" |
|
2045 |
||
1635 | 2046 |
OpenFileTable notNil ifTrue:[ |
2047 |
OpenFileTable do:[:each|each isSocket ifTrue:[each reOpenIfPossible]] |
|
2048 |
]. |
|
1617 | 2049 |
|
2050 |
"Created: / 17-08-2012 / 15:33:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2051 |
! |
|
2052 |
||
752 | 2053 |
reinitializeVM |
2054 |
|classesToInit| |
|
2055 |
||
2056 |
self releaseAllJavaResources. |
|
2057 |
||
2058 |
JavaConsoleStream := Transcript. |
|
2059 |
||
2060 |
Java initAllStaticFields. |
|
2061 |
Java markAllClassesUninitialized. |
|
2062 |
||
2063 |
self initializeOpenFileTable. |
|
2064 |
||
2065 |
classesToInit := JavaClass orderOfClassInits. |
|
2066 |
JavaClass startRememberingOrderOfClassInits. |
|
2067 |
||
2068 |
self initializePrimitiveClasses. |
|
2069 |
"/ Java initSystemClass. |
|
2070 |
||
2071 |
classesToInit do:[:jClass | |
|
1000 | 2072 |
jClass classInit |
752 | 2073 |
]. |
2074 |
Java initSystemClass. |
|
2075 |
||
1000 | 2076 |
"Created: / 12-11-1998 / 15:37:52 / cg" |
2077 |
"Modified: / 17-11-1998 / 16:10:11 / cg" |
|
2078 |
"Modified: / 14-09-2011 / 22:06:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 2079 |
! |
2080 |
||
2081 |
reinitializeVMIfNoEventThreadRunning |
|
2082 |
(JavaEventThread isNil or:[JavaEventThread isDead]) ifTrue:[ |
|
2083 |
^ self reinitializeVM |
|
2084 |
]. |
|
2085 |
(JavaEventQueueThread isNil or:[JavaEventQueueThread isDead]) ifTrue:[ |
|
2086 |
^ self reinitializeVM |
|
2087 |
]. |
|
2088 |
||
2089 |
" |
|
2090 |
JavaVM reinitializeVMIfNoEventThreadRunning |
|
2091 |
" |
|
2092 |
||
2093 |
"Created: / 24.11.1998 / 15:45:49 / cg" |
|
2094 |
"Modified: / 24.12.1999 / 02:36:41 / cg" |
|
2095 |
! |
|
2096 |
||
2097 |
releaseAllJavaResources |
|
2098 |
self deinitialize. |
|
2099 |
FirstWindowCreationSemaphore := Semaphore new. |
|
2100 |
JavaScreenUpdaterThread := JavaEventQueueThread := nil. |
|
1119
0f4d4bc3d346
warning!! bug possibly fixed :) probably not but maybe ;)
hlopkmar
parents:
1118
diff
changeset
|
2101 |
LoadedLibs := nil. |
0f4d4bc3d346
warning!! bug possibly fixed :) probably not but maybe ;)
hlopkmar
parents:
1118
diff
changeset
|
2102 |
LoadedNativeLibs := nil. |
752 | 2103 |
ImageStretchCache := nil. |
2104 |
LastGraphics := LastGC := nil. |
|
2105 |
SimulatedNativeMemory := nil. |
|
2106 |
self initializePrimitiveClasses. |
|
2107 |
self terminateAllThreads. |
|
1119
0f4d4bc3d346
warning!! bug possibly fixed :) probably not but maybe ;)
hlopkmar
parents:
1118
diff
changeset
|
2108 |
"/self releaseAllMonitors. |
752 | 2109 |
self releaseAllWindows. |
2110 |
self releaseAllStreams. |
|
2111 |
||
2112 |
" |
|
1119
0f4d4bc3d346
warning!! bug possibly fixed :) probably not but maybe ;)
hlopkmar
parents:
1118
diff
changeset
|
2113 |
JavaVM releaseAllJavaResources" |
752 | 2114 |
|
2115 |
"Created: / 07-01-1998 / 22:49:42 / cg" |
|
2116 |
"Modified: / 24-12-1999 / 02:33:11 / cg" |
|
2117 |
"Modified: / 17-12-2010 / 17:51:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1119
0f4d4bc3d346
warning!! bug possibly fixed :) probably not but maybe ;)
hlopkmar
parents:
1118
diff
changeset
|
2118 |
"Modified: / 16-11-2011 / 20:27:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 2119 |
! |
2120 |
||
2121 |
releaseAllMonitors |
|
2122 |
LockTable := WeakIdentityDictionary new. |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2123 |
LockTableAccess := Semaphore "RecursionLock" forMutualExclusion. |
752 | 2124 |
LockTableAccess name: 'JavaVM lock table access mutex'. |
1118 | 2125 |
EnteredMonitorsPerProcess notNil ifTrue: [ |
1816 | 2126 |
EnteredMonitorsPerProcess |
1118 | 2127 |
keysAndValuesDo: [:p :value | value size > 0 ifTrue: [ self breakPoint: #mh ] ] |
2128 |
]. |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2129 |
self releaseLeftOverMonitors. |
1816 | 2130 |
Logger |
1119
0f4d4bc3d346
warning!! bug possibly fixed :) probably not but maybe ;)
hlopkmar
parents:
1118
diff
changeset
|
2131 |
log: 'Clearing EnteredMonitorsPerProcess' |
1122 | 2132 |
severity: #debug |
1119
0f4d4bc3d346
warning!! bug possibly fixed :) probably not but maybe ;)
hlopkmar
parents:
1118
diff
changeset
|
2133 |
facility: #JVM. |
752 | 2134 |
EnteredMonitorsPerProcess := IdentityDictionary new. |
1816 | 2135 |
Logger |
1122 | 2136 |
log: 'Clearing AcquiredMonitorsPerProcess' |
2137 |
severity: #debug |
|
2138 |
facility: #JVM. |
|
2139 |
EnteredMonitorsPerProcess := IdentityDictionary new. |
|
752 | 2140 |
|
2141 |
" |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2142 |
JavaVM releaseAllMonitors" |
752 | 2143 |
|
2144 |
"Created: / 02-01-1998 / 18:04:05 / cg" |
|
2145 |
"Modified: / 07-01-1998 / 22:58:10 / cg" |
|
1122 | 2146 |
"Modified: / 17-11-2011 / 17:00:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1476 | 2147 |
"Modified: / 13-04-2012 / 00:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2148 |
! |
2149 |
||
2150 |
releaseAllStreams |
|
2151 |
OpenFileTable notNil ifTrue:[ |
|
2152 |
OpenFileTable do:[:aStream | |
|
2153 |
aStream notNil ifTrue:[ |
|
2154 |
aStream ~~ Stdin ifTrue:[ |
|
2155 |
aStream ~~ Stdout ifTrue:[ |
|
2156 |
aStream ~~ Stderr ifTrue:[ |
|
2157 |
aStream ~~ JavaConsoleStream ifTrue:[ |
|
2158 |
aStream isExternalStream ifTrue:[ |
|
2159 |
aStream shutDown |
|
2160 |
] |
|
2161 |
] |
|
2162 |
] |
|
2163 |
] |
|
2164 |
] |
|
2165 |
] |
|
2166 |
] |
|
2167 |
]. |
|
2168 |
self initializeOpenFileTable. |
|
2169 |
||
2170 |
" |
|
2171 |
JavaVM releaseAllStreams |
|
2172 |
" |
|
2173 |
||
2174 |
"Created: / 7.1.1998 / 22:57:04 / cg" |
|
2175 |
"Modified: / 4.2.1998 / 19:53:11 / cg" |
|
2176 |
! |
|
2177 |
||
2178 |
releaseAllWindows |
|
2179 |
KnownWindows notNil ifTrue:[ |
|
2180 |
KnownWindows do:[:aView | |
|
2181 |
aView destroy |
|
2182 |
]. |
|
2183 |
KnownWindows := nil. |
|
2184 |
] |
|
2185 |
||
2186 |
" |
|
2187 |
self releaseAllWindows |
|
2188 |
" |
|
2189 |
||
2190 |
"Created: / 7.1.1998 / 22:58:32 / cg" |
|
2191 |
! |
|
2192 |
||
2193 |
releaseLeftOverMonitors |
|
2194 |
"release monitors held by dead processes" |
|
1816 | 2195 |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2196 |
| deadProcesses | |
752 | 2197 |
deadProcesses := IdentitySet new. |
1117 | 2198 |
EnteredMonitorsPerProcess notNil ifTrue: [ |
2199 |
EnteredMonitorsPerProcess keysAndValuesDo: [ |
|
1816 | 2200 |
:p :monitors | |
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2201 |
p isDead ifTrue: [ |
1816 | 2202 |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2203 |
monitors do: [ |
1816 | 2204 |
:mon | |
2205 |
Logger |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2206 |
log: 'release leftover monitor ...' |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2207 |
severity: #info |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2208 |
facility: 'JVM'. |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2209 |
mon release |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2210 |
]. |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2211 |
deadProcesses add: p. |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2212 |
] |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2213 |
]. |
1117 | 2214 |
]. |
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2215 |
deadProcesses do: [:p | EnteredMonitorsPerProcess removeKey: p ]. |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2216 |
|
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2217 |
" |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1115
diff
changeset
|
2218 |
JavaVM releaseLeftOverMonitors" |
752 | 2219 |
|
1000 | 2220 |
"Created: / 08-01-1998 / 17:29:26 / cg" |
2221 |
"Modified: / 14-09-2011 / 22:06:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1177 | 2222 |
"Modified: / 29-11-2011 / 14:26:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 2223 |
! |
2224 |
||
1926
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
2225 |
releasehSmalltalkClassLoader |
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
2226 |
SmalltalkClassLoader := nil. |
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
2227 |
|
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
2228 |
"Created: / 09-01-2013 / 15:58:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
2229 |
! |
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
2230 |
|
1570 | 2231 |
releasehSystemClassLoader |
2232 |
SystemClassLoader := nil. |
|
2233 |
||
2234 |
"Created: / 30-07-2012 / 17:13:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2235 |
! |
|
2236 |
||
752 | 2237 |
systemProperties |
2238 |
|props| |
|
2239 |
||
2240 |
props := Dictionary new. |
|
2241 |
self initializeSystemPropertiesInto:props. |
|
2242 |
^ props |
|
2243 |
||
2244 |
"Created: / 3.1.1998 / 14:25:58 / cg" |
|
2245 |
"Modified: / 3.1.1998 / 14:32:38 / cg" |
|
2246 |
! |
|
2247 |
||
1617 | 2248 |
update:what with:aParameter from:changedObject |
2249 |
||
2250 |
" |
|
2251 |
#earlyRestart is send first, nothing has been setup yet. |
|
2252 |
(should be used to flush all device dependent entries) |
|
2253 |
" |
|
2254 |
what == #earlyRestart ifTrue:[ |
|
2255 |
self initializeMonitorTable. |
|
2256 |
||
2257 |
^self. |
|
2258 |
]. |
|
2259 |
||
1816 | 2260 |
"#returnFromSnapshot is sent last (should be used to restart processes, reOpen |
1617 | 2261 |
Streams which cannot be automatically be reopened (i.e. Sockets, Pipes) and so on. |
2262 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
2263 |
" |
|
2264 |
what == #returnFromSnapshot ifTrue:[ |
|
2265 |
self reinitializeSockets. |
|
2266 |
||
2267 |
^self |
|
2268 |
]. |
|
752 | 2269 |
" |
2270 |
JavaVM initializeVM |
|
2271 |
" |
|
2272 |
||
1617 | 2273 |
ObjectMemory dependents |
2274 |
||
2275 |
"Created: / 09-01-1998 / 10:30:13 / cg" |
|
2276 |
"Modified: / 06-11-1998 / 00:40:53 / cg" |
|
2277 |
"Modified: / 17-08-2012 / 15:35:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 2278 |
! ! |
2279 |
||
2280 |
!JavaVM class methodsFor:'Signal constants'! |
|
2281 |
||
2282 |
badMessageSignal |
|
2283 |
^ BadMessageSignal |
|
2284 |
||
2285 |
"Created: / 2.1.1998 / 18:06:52 / cg" |
|
2286 |
! |
|
2287 |
||
2288 |
callHandlerSignal |
|
2289 |
^ CallHandlerSignal |
|
2290 |
||
2291 |
"Created: / 2.1.1998 / 18:07:16 / cg" |
|
2292 |
! |
|
2293 |
||
1033 | 2294 |
classLoaderQuerySignal |
1058
1db06119bf3e
Temporary commit (fixing class loaders - classes gets registered twice)
vranyj1
parents:
1053
diff
changeset
|
2295 |
|
1db06119bf3e
Temporary commit (fixing class loaders - classes gets registered twice)
vranyj1
parents:
1053
diff
changeset
|
2296 |
<resource: #obsolete> |
1db06119bf3e
Temporary commit (fixing class loaders - classes gets registered twice)
vranyj1
parents:
1053
diff
changeset
|
2297 |
|
1db06119bf3e
Temporary commit (fixing class loaders - classes gets registered twice)
vranyj1
parents:
1053
diff
changeset
|
2298 |
self breakPoint: #jv. |
1db06119bf3e
Temporary commit (fixing class loaders - classes gets registered twice)
vranyj1
parents:
1053
diff
changeset
|
2299 |
|
1db06119bf3e
Temporary commit (fixing class loaders - classes gets registered twice)
vranyj1
parents:
1053
diff
changeset
|
2300 |
^JavaClassReader classLoaderQuerySignal |
1db06119bf3e
Temporary commit (fixing class loaders - classes gets registered twice)
vranyj1
parents:
1053
diff
changeset
|
2301 |
|
1db06119bf3e
Temporary commit (fixing class loaders - classes gets registered twice)
vranyj1
parents:
1053
diff
changeset
|
2302 |
"Modified: / 28-10-2011 / 22:11:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1033 | 2303 |
! |
2304 |
||
752 | 2305 |
internalErrorSignal |
2306 |
^ InternalErrorSignal |
|
2307 |
||
2308 |
"Created: / 2.1.1998 / 18:07:05 / cg" |
|
2309 |
! |
|
2310 |
||
2311 |
javaExceptionSignal |
|
2312 |
"^ JavaExceptionSignal" |
|
2313 |
^JavaError |
|
2314 |
||
2315 |
"Created: / 02-01-1998 / 18:05:58 / cg" |
|
2316 |
"Modified: / 01-03-2011 / 21:50:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2317 |
! |
|
2318 |
||
1016
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
2319 |
privilegedAccessQuery |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
2320 |
^ JavaPrivilegedAccessQuery. |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
2321 |
|
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
2322 |
"Created: / 09-10-2011 / 20:24:49 / Marcel Hlopko <hlopik@gmail.com>" |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
2323 |
! |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
2324 |
|
752 | 2325 |
stdinReplacementFileQuerySignal |
2326 |
^ StdinReplacementFileQuerySignal |
|
2327 |
||
2328 |
"Created: / 2.1.1998 / 18:06:52 / cg" |
|
2329 |
! |
|
2330 |
||
2331 |
unhandledJavaExceptionSignal |
|
2332 |
^ UnhandledJavaExceptionSignal |
|
2333 |
||
2334 |
"Created: / 2.1.1998 / 18:05:19 / cg" |
|
2335 |
! |
|
2336 |
||
2337 |
unimplementedInstructionSignal |
|
2338 |
^ UnimplementedInstructionSignal |
|
2339 |
||
2340 |
"Created: / 2.1.1998 / 18:06:15 / cg" |
|
2341 |
! |
|
2342 |
||
2343 |
unimplementedNativeMethodSignal |
|
2344 |
^ UnimplementedNativeMethodSignal |
|
2345 |
||
1966
8a26e8ccbd7f
Class variables refactoring - JavaVMData now contains only those required by natives.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
2346 |
"Created: / 02-01-1998 / 18:06:40 / cg" |
8a26e8ccbd7f
Class variables refactoring - JavaVMData now contains only those required by natives.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
2347 |
"Modified: / 15-01-2013 / 22:30:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2348 |
! ! |
2349 |
||
2350 |
!JavaVM class methodsFor:'accessing'! |
|
2351 |
||
1816 | 2352 |
addClass:aJavaClass definedBy:aJavaClassLoader |
1037 | 2353 |
|
2354 |
self assert: aJavaClass classLoader == aJavaClassLoader. |
|
2355 |
^ ClassRegistry registerClass:aJavaClass |
|
2356 |
||
2357 |
"Modified: / 23-10-2011 / 11:58:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1033 | 2358 |
! |
2359 |
||
1816 | 2360 |
addSelector:newSelector withMethod:newMethod |
752 | 2361 |
super addSelector:newSelector withMethod:newMethod. |
1816 | 2362 |
|
752 | 2363 |
"/JavaNativeMethod may not be loaded..." |
1816 | 2364 |
|
2365 |
(Smalltalk at:#JavaNativeMethod) |
|
752 | 2366 |
ifNotNil:[JavaNativeMethod flushAllCachedNativeMethods]. |
2367 |
||
2368 |
"Created: / 24-12-1999 / 03:12:05 / cg" |
|
2369 |
"Modified: / 02-02-2011 / 04:38:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2370 |
"Modified: / 02-02-2011 / 23:38:08 / Marcel Hlopko <hlopik@gmail.com>" |
|
2371 |
! |
|
2372 |
||
2373 |
assertionsEnabled: aBoolean |
|
2374 |
||
2375 |
AssertionsEnabled := aBoolean |
|
2376 |
||
2377 |
" |
|
2378 |
JavaVM assertionsEnabled: true. |
|
2379 |
JavaVM assertionsEnabled: false. |
|
2380 |
" |
|
2381 |
||
2382 |
"Created: / 24-11-2010 / 09:02:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2383 |
! |
|
2384 |
||
1035 | 2385 |
classRegistry |
2386 |
^ ClassRegistry. |
|
2387 |
||
2388 |
"Created: / 21-10-2011 / 11:12:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 2389 |
! |
2390 |
||
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2391 |
extClassLoader |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2392 |
^ self systemClassLoader instVarNamed:#'parent'. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2393 |
|
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2394 |
"Created: / 30-10-2011 / 12:08:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2395 |
"Created: / 02-11-2011 / 13:20:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2396 |
! |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2397 |
|
1109
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2398 |
finalizationEnabled |
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2399 |
|
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2400 |
^FinalizationEnabled |
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2401 |
|
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2402 |
"Created: / 14-11-2011 / 21:14:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2403 |
! |
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2404 |
|
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2405 |
finalizationLobby |
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2406 |
|
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2407 |
^FinalizationLobby |
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2408 |
|
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2409 |
"Created: / 14-11-2011 / 12:29:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2410 |
! |
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1108
diff
changeset
|
2411 |
|
752 | 2412 |
javaEventQueueThread |
2413 |
^ JavaEventQueueThread |
|
2414 |
||
2415 |
"Created: / 24.12.1999 / 02:34:35 / cg" |
|
2416 |
! |
|
2417 |
||
2418 |
javaEventThread |
|
2419 |
^ JavaEventThread |
|
2420 |
||
2421 |
"Created: / 8.1.1999 / 17:05:02 / cg" |
|
2422 |
! |
|
2423 |
||
2424 |
javaScreenUpdaterThread |
|
2425 |
^ JavaScreenUpdaterThread |
|
2426 |
||
2427 |
"Created: / 8.1.1999 / 17:06:52 / cg" |
|
2428 |
! |
|
2429 |
||
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
2430 |
natives |
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
2431 |
^ NativeMethodsImplementation |
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
2432 |
|
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
2433 |
"Created: / 16-01-2013 / 20:02:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
2434 |
! |
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
2435 |
|
1597 | 2436 |
performance |
2437 |
"Return an object keeping Java performance counters" |
|
2438 |
^ PerfCounters |
|
2439 |
||
2440 |
"Modified: / 14-08-2012 / 00:39:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2441 |
! |
|
2442 |
||
752 | 2443 |
reflection |
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
2444 |
^ Reflection |
752 | 2445 |
|
2446 |
"Created: / 28-01-2011 / 15:09:19 / Marcel Hlopko <hlopik@gmail.com>" |
|
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
2447 |
"Modified: / 16-01-2013 / 20:55:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2448 |
! |
2449 |
||
1033 | 2450 |
registry |
1035 | 2451 |
^ ClassRegistry. |
2452 |
||
2453 |
"Modified (format): / 21-10-2011 / 11:12:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1033 | 2454 |
! |
2455 |
||
1649
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
2456 |
smalltalkClassLoader |
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
2457 |
|
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
2458 |
^SmalltalkClassLoader |
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
2459 |
|
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
2460 |
"Created: / 22-08-2012 / 13:00:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
2461 |
! |
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
2462 |
|
1059 | 2463 |
systemClassLoader |
2464 |
||
2465 |
^SystemClassLoader |
|
2466 |
||
2467 |
"Created: / 30-10-2011 / 12:08:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2468 |
! |
|
2469 |
||
752 | 2470 |
useSmalltalkInterpreter |
2471 |
||
2472 |
JavaMethod makeMetaMethod |
|
2473 |
||
2474 |
"Created: / 23-02-2011 / 12:59:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2475 |
! |
|
2476 |
||
2477 |
useVMInterpreter |
|
2478 |
||
2479 |
JavaMethod makeJavaMethod |
|
2480 |
||
2481 |
"Created: / 23-02-2011 / 12:59:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2482 |
! ! |
|
2483 |
||
1733 | 2484 |
!JavaVM class methodsFor:'cache management'! |
2485 |
||
2486 |
flushCachesFor: aClass |
|
1816 | 2487 |
"Flush all caches for given class, including JIT-compiled code. |
1733 | 2488 |
Called for allow for dynamic recompilation when a reference |
2489 |
is resolved" |
|
2490 |
||
2491 |
aClass methodDictionary do:[:mthd| |
|
1735 | 2492 |
(mthd isJavaMethod and:[mthd isResolved not]) ifTrue:[ |
2493 |
"Stdout nextPutAll:'Flushing code for ' , mthd printString; cr." |
|
1733 | 2494 |
mthd code: nil. |
2495 |
mthd checked: false. |
|
2496 |
]. |
|
2497 |
]. |
|
2498 |
ObjectMemory flushCachesFor: aClass. |
|
2499 |
||
2500 |
"Created: / 17-10-2012 / 20:22:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2501 |
! ! |
|
2502 |
||
1036 | 2503 |
!JavaVM class methodsFor:'class access'! |
2504 |
||
1511 | 2505 |
arrayClassFor: javaClass ifAbsentPut: block |
2506 |
^self reflection arrayClassFor: javaClass ifAbsentPut: block |
|
2507 |
||
2508 |
"Created: / 05-07-2012 / 23:20:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2509 |
! |
|
2510 |
||
1816 | 2511 |
at: aString |
1037 | 2512 |
|
2513 |
^ ClassRegistry classNamed: aString asInternalJavaClassName. |
|
1036 | 2514 |
|
2515 |
"Modified (comment): / 21-10-2011 / 12:14:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1037 | 2516 |
"Modified: / 23-10-2011 / 12:25:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1036 | 2517 |
! |
2518 |
||
1816 | 2519 |
at: aString put: aJavaClass |
1036 | 2520 |
self breakPoint: #mh. |
1037 | 2521 |
self breakPoint: #jv. |
1036 | 2522 |
"dont use me anymore" |
1037 | 2523 |
^ ClassRegistry registerClass: aJavaClass |
1036 | 2524 |
|
2525 |
"Modified (comment): / 21-10-2011 / 12:14:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1037 | 2526 |
"Modified: / 23-10-2011 / 11:58:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1036 | 2527 |
! |
2528 |
||
1816 | 2529 |
classForName: className |
1036 | 2530 |
"load class from registry - load using classLoader from query or JavaClassReader if absent" |
1816 | 2531 |
|
2532 |
||
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2533 |
^ self classForName: className asSlashedJavaClassName |
1989
131b7459fdab
Value of class.path and sun.misc.boot.path refactored to match values used in Oracle JVM.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1953
diff
changeset
|
2534 |
definedBy: (JavaClassReader classLoaderQuerySignal query) "? SystemClassLoader." |
131b7459fdab
Value of class.path and sun.misc.boot.path refactored to match values used in Oracle JVM.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1953
diff
changeset
|
2535 |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2536 |
"Modified: / 02-11-2011 / 16:33:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1989
131b7459fdab
Value of class.path and sun.misc.boot.path refactored to match values used in Oracle JVM.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1953
diff
changeset
|
2537 |
"Modified: / 23-01-2013 / 16:13:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1036 | 2538 |
! |
2539 |
||
1816 | 2540 |
classForName: className definedBy: classLoader |
1036 | 2541 |
"load class from registry - load using given classLoader if not nil" |
1816 | 2542 |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2543 |
| result | |
1816 | 2544 |
result := self |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2545 |
classForName: className asSlashedJavaClassName |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2546 |
definedBy: classLoader |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2547 |
ifAbsentPut: [ |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2548 |
| class classLoaderEnsured | |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2549 |
self assert: (className includes: $.) not. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2550 |
self booted ifFalse: [ |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2551 |
"class loaders allowed after vm boot, until then, only primordial" |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2552 |
class := self usePrimordialCLToLoadClassNamed: className. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2553 |
self assert: (class notNil) |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2554 |
description: 'Couldnt load class ' , className , ' while booting Java VM'. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2555 |
class. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2556 |
] ifTrue: [ |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2557 |
self assert: (self booted) |
1816 | 2558 |
description: 'Java VM is not booted and we are not using primordial class loader to load: ' |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2559 |
, className. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2560 |
(Java release bootClassPathIncludesClassNamed: className) ifTrue: [ |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2561 |
"we will use primordial class loader for classes in rt.jar etc" |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2562 |
class := self usePrimordialCLToLoadClassNamed: className. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2563 |
self assert: (class notNil) |
1816 | 2564 |
description: 'Class ' , className |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2565 |
, ' is supposed to be in boot classpath, but we couldnt load it'. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2566 |
class. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2567 |
] ifFalse: [ |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2568 |
(Java release extDirsIncludesClassNamed: className) ifTrue: [ |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2569 |
class := self useExtCLToLoadClassNamed: className. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2570 |
self assert: (class notNil) |
1816 | 2571 |
description: 'Class ' , className |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2572 |
, ' is supposed to be in java.ext,dirs, but we couldnt load it'. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2573 |
class. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2574 |
] ifFalse: [ |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2575 |
"at this point, nil classLoader means use system class loader, |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2576 |
in other words, at this point, we shouldnt use primordial cl at all" |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2577 |
classLoader isNil ifTrue: [ |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2578 |
self assert: (self systemClassLoader notNil) |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2579 |
description: 'We needed system class loader, but its not loaded yet'. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2580 |
classLoaderEnsured := self systemClassLoader |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2581 |
] ifFalse: [ classLoaderEnsured := classLoader ]. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2582 |
class := self useUserDefinedCL: classLoaderEnsured |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2583 |
toLoadClassNamed: className. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2584 |
class isNil ifTrue: [ |
1816 | 2585 |
Logger |
2586 |
log: 'Even ' , classLoader printString , ' was not able to load class ' |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2587 |
, className |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2588 |
severity: #warn |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2589 |
facility: 'JVM'. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2590 |
nil |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2591 |
] ifFalse: [ class ]. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2592 |
] |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2593 |
] |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2594 |
] |
1059 | 2595 |
]. |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2596 |
result isNil ifTrue: [ |
1816 | 2597 |
Logger |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2598 |
log: 'Class ' , className , ' couldnt be loaded' |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2599 |
severity: #warn |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2600 |
facility: 'JVM' |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2601 |
] ifFalse: [ result := self makeArrayOf: result asDescribedBy: className. ]. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2602 |
^ result. |
1036 | 2603 |
|
2604 |
"Created: / 21-10-2011 / 12:01:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1059 | 2605 |
"Modified: / 30-10-2011 / 13:54:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2606 |
"Modified: / 02-11-2011 / 16:49:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1036 | 2607 |
! |
2608 |
||
1816 | 2609 |
classForName: className definedBy: classLoader ifAbsentPut: aBlock |
1036 | 2610 |
"load class from registry - if absent evaluate given block to get loaded class" |
1816 | 2611 |
|
1036 | 2612 |
| result | |
2613 |
className asJavaComponentClassName isJavaPrimitiveTypeDescriptor ifTrue: [ |
|
2614 |
^ (JavaDescriptor fromString: className) javaClass. |
|
2615 |
]. |
|
1816 | 2616 |
result := ClassRegistry |
1062
69aac7194016
Fixes in classloaders to make Groovy running (again)
vranyj1
parents:
1060
diff
changeset
|
2617 |
classForName: className asSlashedJavaClassName |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2618 |
loader: classLoader |
1036 | 2619 |
ifAbsentPut: aBlock. |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2620 |
result notNil ifTrue: [ |
1041 | 2621 |
result := self makeArrayOf: result asDescribedBy: className. |
2622 |
]. |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2623 |
^ result. |
1036 | 2624 |
|
2625 |
"Created: / 21-10-2011 / 12:13:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1062
69aac7194016
Fixes in classloaders to make Groovy running (again)
vranyj1
parents:
1060
diff
changeset
|
2626 |
"Modified: / 30-10-2011 / 22:04:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2627 |
"Modified (format): / 02-11-2011 / 16:09:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1036 | 2628 |
! |
2629 |
||
1816 | 2630 |
classNamed: className |
1036 | 2631 |
"Return class with given name loaded by current classloader or nil if class is not yet loaded" |
1816 | 2632 |
|
1058
1db06119bf3e
Temporary commit (fixing class loaders - classes gets registered twice)
vranyj1
parents:
1053
diff
changeset
|
2633 |
^ self classNamed: className definedBy: JavaClassReader classLoaderQuerySignal query. |
1036 | 2634 |
|
2635 |
"Modified: / 21-10-2011 / 12:09:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2636 |
"Modified (comment): / 21-10-2011 / 13:34:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1058
1db06119bf3e
Temporary commit (fixing class loaders - classes gets registered twice)
vranyj1
parents:
1053
diff
changeset
|
2637 |
"Modified: / 28-10-2011 / 22:12:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1036 | 2638 |
! |
2639 |
||
1816 | 2640 |
classNamed: className definedBy: classLoader |
1036 | 2641 |
"Return class with given name loaded by given classloader or nil if class is not yet loaded" |
1816 | 2642 |
|
1036 | 2643 |
| result | |
2644 |
className asJavaComponentClassName isJavaPrimitiveTypeDescriptor ifTrue: [ |
|
2645 |
^ (JavaDescriptor fromString: className) javaClass. |
|
2646 |
]. |
|
1816 | 2647 |
result := ClassRegistry |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2648 |
classForName: className asSlashedJavaClassName |
1037 | 2649 |
loader: classLoader |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2650 |
ifAbsent: [ ^ nil ]. |
1036 | 2651 |
^ self makeArrayOf: result asDescribedBy: className. |
2652 |
||
2653 |
"Created: / 21-10-2011 / 11:58:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1037 | 2654 |
"Modified: / 23-10-2011 / 12:01:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2655 |
"Modified: / 01-11-2011 / 15:36:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1036 | 2656 |
! |
2657 |
||
1816 | 2658 |
loadClassesIn: directory |
1036 | 2659 |
"load all classes (.class files, strictly speaking) found in given directory. |
2660 |
The argument is string containing the name of the directory. |
|
2661 |
||
2662 |
Returns a set of loaded classes." |
|
2663 |
||
2664 |
^ self loadClassesIn: directory matching: '*'. |
|
2665 |
||
2666 |
"Modified: / 11-06-2011 / 13:35:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2667 |
"Created: / 21-10-2011 / 12:40:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2668 |
! |
|
2669 |
||
1816 | 2670 |
loadClassesIn: directory matching: pattern |
1036 | 2671 |
"load all classes (.class files, strictly speaking) found in given directory. |
2672 |
The arguments are a string containing the name of the directory |
|
2673 |
and a class name pattern. Only classes matching the pattern are loaded. |
|
2674 |
class names are matched using String>>matches:. |
|
2675 |
ALL CLASSES ARE INSTALLED!! |
|
2676 |
Returns a set of loaded classes." |
|
1816 | 2677 |
|
1036 | 2678 |
| dir dirString className loadedClasses | |
2679 |
dir := directory asFilename asAbsoluteFilename. |
|
2680 |
loadedClasses := Set new. |
|
2681 |
Java addToClassPath: dir pathName. |
|
1059 | 2682 |
JavaClassReader classLoaderQuerySignal answer: SystemClassLoader do:[ |
1816 | 2683 |
|
2684 |
dir |
|
1036 | 2685 |
recursiveDirectoryContentsAsFilenamesDo: [ |
1816 | 2686 |
:filename | |
1036 | 2687 |
(filename isRegularFile and: [ filename suffix = #class ]) ifTrue: [ |
2688 |
dirString := dir pathName. |
|
2689 |
className := filename withoutSuffix pathName. |
|
2690 |
className := className subString: dirString size + 2 to: className size. |
|
2691 |
className := className copyReplaceAll: (Filename separator) with: $.. |
|
1059 | 2692 |
(className matches: pattern) ifTrue: [ |
2693 |
(self classNamed: className) isNil ifTrue:[ |
|
2694 |
loadedClasses add: (self classForName:className). |
|
2695 |
]. |
|
1036 | 2696 |
] |
2697 |
] |
|
2698 |
]. |
|
1059 | 2699 |
]. |
1036 | 2700 |
^ loadedClasses. |
2701 |
||
2702 |
"Modified: / 21-10-2011 / 12:52:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1059 | 2703 |
"Modified: / 30-10-2011 / 14:02:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1036 | 2704 |
! ! |
2705 |
||
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2706 |
!JavaVM class methodsFor:'class loading'! |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2707 |
|
1816 | 2708 |
useExtCLToLoadClassNamed: className |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2709 |
| ecl class | |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2710 |
ecl := self extClassLoader. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2711 |
self assert: (ecl notNil) |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2712 |
description: 'we want to use ExtClassLoader, but its not loaded yet'. |
1816 | 2713 |
class := ecl |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2714 |
perform: #'loadClassInternal(Ljava/lang/String;)Ljava/lang/Class;' |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2715 |
with: (Java as_String: (className asDottedJavaClassName)). |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2716 |
self assert: (class notNil) |
1816 | 2717 |
description: 'we tried to load class ' , className |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2718 |
, ' using ExtClassLoader and we failed:)'. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2719 |
class := JavaVM classForJavaClassObject: class. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2720 |
class classLoader: ecl. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2721 |
^ class. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2722 |
|
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2723 |
"Created: / 02-11-2011 / 13:48:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2724 |
! |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2725 |
|
1816 | 2726 |
usePrimordialCLToLoadClassNamed: className |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2727 |
| class | |
1989
131b7459fdab
Value of class.path and sun.misc.boot.path refactored to match values used in Oracle JVM.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1953
diff
changeset
|
2728 |
JavaClassReader classLoaderQuerySignal answer: nil do: [ |
131b7459fdab
Value of class.path and sun.misc.boot.path refactored to match values used in Oracle JVM.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1953
diff
changeset
|
2729 |
class := JavaClassReader readClass: className classPath: Java release bootClassPath |
131b7459fdab
Value of class.path and sun.misc.boot.path refactored to match values used in Oracle JVM.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1953
diff
changeset
|
2730 |
]. |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2731 |
^ class |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2732 |
|
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2733 |
"Modified: / 02-11-2011 / 17:28:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1989
131b7459fdab
Value of class.path and sun.misc.boot.path refactored to match values used in Oracle JVM.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1953
diff
changeset
|
2734 |
"Modified: / 23-01-2013 / 15:18:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2735 |
! |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2736 |
|
1816 | 2737 |
useUserDefinedCL: classLoader toLoadClassNamed: className |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2738 |
| classObject class | |
1816 | 2739 |
classObject := classLoader |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2740 |
perform: #'loadClassInternal(Ljava/lang/String;)Ljava/lang/Class;' |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2741 |
with: (Java as_String: (className asDottedJavaClassName)). |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2742 |
class := self classForJavaClassObject: classObject. |
1649
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
2743 |
class javaMirror getClassLoader isNil ifTrue: [self breakPoint:#mh]. |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2744 |
^ class. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2745 |
|
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2746 |
"Created: / 02-11-2011 / 16:20:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1649
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
2747 |
"Modified: / 22-08-2012 / 12:57:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2748 |
! ! |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
2749 |
|
752 | 2750 |
!JavaVM class methodsFor:'debugging support'! |
2751 |
||
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1142
diff
changeset
|
2752 |
disableMonitorTrace |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1142
diff
changeset
|
2753 |
MonitorTrace := false. |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1142
diff
changeset
|
2754 |
|
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1142
diff
changeset
|
2755 |
"Created: / 22-11-2011 / 10:29:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1142
diff
changeset
|
2756 |
! |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1142
diff
changeset
|
2757 |
|
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1142
diff
changeset
|
2758 |
enableMonitorTrace |
1459 | 2759 |
MonitorTrace := true. |
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1142
diff
changeset
|
2760 |
|
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1142
diff
changeset
|
2761 |
"Created: / 22-11-2011 / 10:29:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1459 | 2762 |
"Modified (format): / 07-04-2012 / 08:47:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1142
diff
changeset
|
2763 |
! |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1142
diff
changeset
|
2764 |
|
752 | 2765 |
exceptionDebug |
2766 |
^ ExceptionDebug |
|
2767 |
||
2768 |
"Created: / 27.1.1999 / 20:14:51 / cg" |
|
2769 |
! |
|
2770 |
||
2771 |
exceptionDebug:aBoolean |
|
2772 |
ExceptionDebug := aBoolean |
|
2773 |
||
2774 |
"Created: / 27.1.1999 / 20:15:00 / cg" |
|
2775 |
! |
|
2776 |
||
2777 |
exceptionDebugPatterns |
|
2778 |
||
2779 |
^ ExceptionDebugPatterns |
|
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
911
diff
changeset
|
2780 |
" |
1062
69aac7194016
Fixes in classloaders to make Groovy running (again)
vranyj1
parents:
1060
diff
changeset
|
2781 |
ExceptionDebug must be set in order to ExceptionDebugPatterns work |
69aac7194016
Fixes in classloaders to make Groovy running (again)
vranyj1
parents:
1060
diff
changeset
|
2782 |
|
69aac7194016
Fixes in classloaders to make Groovy running (again)
vranyj1
parents:
1060
diff
changeset
|
2783 |
ExceptionDebug := true. |
1377 | 2784 |
ExceptionDebug := false. |
1476 | 2785 |
ExceptionDebugPatterns removeAll. |
1268
cc67480dfa95
Fix in native Class.getConstantPool() - arrays/primitive types have null CP
vranyj1
parents:
1263
diff
changeset
|
2786 |
ExceptionDebugPatterns add: 'java/lang/SecurityException*'. |
cc67480dfa95
Fix in native Class.getConstantPool() - arrays/primitive types have null CP
vranyj1
parents:
1263
diff
changeset
|
2787 |
ExceptionDebugPatterns add: 'java/net/ConnectException*'. |
cc67480dfa95
Fix in native Class.getConstantPool() - arrays/primitive types have null CP
vranyj1
parents:
1263
diff
changeset
|
2788 |
ExceptionDebugPatterns add: 'java/lang/IllegalArgumentException'. |
1505 | 2789 |
ExceptionDebugPatterns add: 'java/lang/IllegalAccessException'. |
1268
cc67480dfa95
Fix in native Class.getConstantPool() - arrays/primitive types have null CP
vranyj1
parents:
1263
diff
changeset
|
2790 |
ExceptionDebugPatterns add: 'java/lang/ClassNotFoundException'. |
cc67480dfa95
Fix in native Class.getConstantPool() - arrays/primitive types have null CP
vranyj1
parents:
1263
diff
changeset
|
2791 |
ExceptionDebugPatterns add: 'java/io/IOException'. |
1387 | 2792 |
ExceptionDebugPatterns add: 'java/io/FileNotFoundException'. |
1513
58c59c580675
- JavaVM fixes in natives (RandomAccessFile, mostly)
vranyj1
parents:
1512
diff
changeset
|
2793 |
ExceptionDebugPatterns add: 'java/io/EOFException'. |
1268
cc67480dfa95
Fix in native Class.getConstantPool() - arrays/primitive types have null CP
vranyj1
parents:
1263
diff
changeset
|
2794 |
ExceptionDebugPatterns add: 'java/lang/NoSuchMethodException'. |
cc67480dfa95
Fix in native Class.getConstantPool() - arrays/primitive types have null CP
vranyj1
parents:
1263
diff
changeset
|
2795 |
ExceptionDebugPatterns add: 'java/lang/ArrayIndexOutOfBoundsException'. |
1513
58c59c580675
- JavaVM fixes in natives (RandomAccessFile, mostly)
vranyj1
parents:
1512
diff
changeset
|
2796 |
ExceptionDebugPatterns add: 'java/lang/IllegalMonitorStateException'. |
1518 | 2797 |
ExceptionDebugPatterns add: 'org/xml/sax/SAXParseException'. |
2798 |
ExceptionDebugPatterns add: 'org/apache/xerces/xni/parser/XMLParseException'. |
|
1581
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1579
diff
changeset
|
2799 |
ExceptionDebugPatterns add: 'java/lang/InstantiationException'. |
1649
0af82006c0b2
- some more support for calling Smalltalk from Groovy. Crashes VM now :-)
vranyj1
parents:
1648
diff
changeset
|
2800 |
ExceptionDebugPatterns add: 'java/lang/RuntimeException'. |
1709 | 2801 |
ExceptionDebugPatterns add: 'java/lang/ClassCastException'. |
2802 |
||
1518 | 2803 |
|
2804 |
ExceptionDebug := true. |
|
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
911
diff
changeset
|
2805 |
" |
752 | 2806 |
|
2807 |
"Created: / 25-02-2011 / 08:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2808 |
! ! |
|
2809 |
||
1544 | 2810 |
!JavaVM class methodsFor:'debugging-dumping'! |
2811 |
||
2812 |
dumpOpenExternalStream: stream on: output |
|
2813 |
output nextPutAll: stream class printString. |
|
2814 |
output space. |
|
2815 |
OpenFileTable notNil ifTrue:[ |
|
2816 |
| idx | |
|
2817 |
idx := OpenFileTable identityIndexOf: stream. |
|
2818 |
idx ~~ 0 ifTrue:[ |
|
2819 |
output nextPutAll:'JavaVM:OpenFileTable['; nextPutAll: idx printString; nextPut:$]; space. |
|
2820 |
] |
|
2821 |
]. |
|
2822 |
ZipCache notNil ifTrue:[ |
|
2823 |
| idx | |
|
2824 |
idx := ZipCache identityIndexOf: stream. |
|
2825 |
idx ~~ 0 ifTrue:[ |
|
2826 |
output nextPutAll:'JavaVM:ZipCache['; nextPutAll: idx printString; nextPut:$]; space. |
|
2827 |
] |
|
2828 |
]. |
|
2829 |
stream isFileStream ifTrue:[ |
|
2830 |
output nextPutAll: stream pathName ? '?' |
|
2831 |
] |
|
2832 |
||
2833 |
"Created: / 23-07-2012 / 16:40:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2834 |
! |
|
2835 |
||
2836 |
dumpOpenExternalStreams |
|
2837 |
^self dumpOpenExternalStreamsOn: Stdout. |
|
2838 |
||
2839 |
"Created: / 23-07-2012 / 16:32:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2840 |
! |
|
2841 |
||
2842 |
dumpOpenExternalStreamsOn: aStream |
|
2843 |
||
2844 |
| nOpenStreams | |
|
2845 |
||
2846 |
nOpenStreams := 0. |
|
2847 |
ExternalStream allSubInstancesDo:[:each| |
|
2848 |
each isOpen ifTrue:[ |
|
2849 |
nOpenStreams := nOpenStreams + 1. |
|
2850 |
self dumpOpenExternalStream: each on: aStream. |
|
2851 |
aStream cr. |
|
2852 |
] |
|
2853 |
]. |
|
1816 | 2854 |
aStream nextPutLine: |
1544 | 2855 |
('SUMMARY: open=%1, java.io=%2, java.util.zip=%3' |
2856 |
bindWith: nOpenStreams |
|
2857 |
with: ((OpenFileTable ? #()) inject:0 into:[:a :s|a + (s notNil ifTrue:[1] ifFalse:[0])]) |
|
2858 |
with: ((ZipCache ? #()) inject:0 into:[:a :s|a + (s notNil ifTrue:[1] ifFalse:[0])]) |
|
2859 |
) |
|
2860 |
||
2861 |
" |
|
2862 |
JavaVM dumpOpenExternalStreamsOn: Stdout |
|
2863 |
" |
|
2864 |
||
2865 |
"Created: / 23-07-2012 / 16:34:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2866 |
! ! |
|
2867 |
||
752 | 2868 |
!JavaVM class methodsFor:'defaults'! |
2869 |
||
2870 |
audioEnabled |
|
2871 |
^ NoAudio not |
|
2872 |
||
2873 |
"Created: / 18.7.1998 / 22:31:36 / cg" |
|
2874 |
! |
|
2875 |
||
2876 |
audioEnabled:aBoolean |
|
2877 |
NoAudio := aBoolean not |
|
2878 |
||
2879 |
"Created: / 18.7.1998 / 22:31:20 / cg" |
|
2880 |
! |
|
2881 |
||
2882 |
defaultCLASSPATH |
|
2883 |
|s| |
|
2884 |
||
2885 |
s := '' writeStream. |
|
1953
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
2886 |
Java effectiveClassPath |
1562 | 2887 |
do:[:p | s nextPutAll:p asString ] |
1062
69aac7194016
Fixes in classloaders to make Groovy running (again)
vranyj1
parents:
1060
diff
changeset
|
2888 |
separatedBy: [s nextPut: OperatingSystem pathSeparator]. |
752 | 2889 |
|
2890 |
^ s contents |
|
2891 |
||
2892 |
" |
|
1816 | 2893 |
self defaultCLASSPATH |
752 | 2894 |
" |
2895 |
||
2896 |
"Created: / 03-01-1998 / 14:27:21 / cg" |
|
1953
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1932
diff
changeset
|
2897 |
"Modified: / 16-01-2013 / 13:15:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2898 |
! |
2899 |
||
957 | 2900 |
defaultExtDirs |
2901 |
||
2902 |
^String streamContents:[:s| |
|
959 | 2903 |
Java javaExtDirs do:[:dir| |
957 | 2904 |
s nextPutAll: dir pathName. |
959 | 2905 |
] separatedBy:[ |
957 | 2906 |
s nextPut: OperatingSystem pathSeparator. |
959 | 2907 |
] |
957 | 2908 |
] |
2909 |
||
2910 |
" |
|
2911 |
JavaVM defaultExtDirs |
|
2912 |
" |
|
2913 |
||
2914 |
"Created: / 31-08-2011 / 20:03:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2915 |
! |
|
2916 |
||
752 | 2917 |
defaultHotJavaHome |
2918 |
^ '/usr/local/java/hotjava'. |
|
2919 |
||
2920 |
"Modified: / 5.8.1997 / 04:13:36 / cg" |
|
2921 |
"Created: / 3.1.1998 / 14:27:34 / cg" |
|
2922 |
! |
|
2923 |
||
2924 |
defaultJAVAHome |
|
2925 |
^ Java javaHome |
|
2926 |
||
2927 |
"Modified: / 6.8.1997 / 00:54:44 / cg" |
|
2928 |
"Created: / 3.1.1998 / 14:27:01 / cg" |
|
2929 |
! |
|
2930 |
||
2931 |
defaultJWSHome |
|
2932 |
'/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS' asFilename exists ifTrue:[ |
|
2933 |
^ '/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS' |
|
2934 |
]. |
|
2935 |
||
2936 |
^ '/usr/local/java/JWS'. |
|
2937 |
||
2938 |
"Created: / 3.1.1998 / 14:27:42 / cg" |
|
2939 |
"Modified: / 3.12.1998 / 14:54:08 / cg" |
|
2940 |
! |
|
2941 |
||
2942 |
defaultJavaLibraryPath |
|
2943 |
||
2944 |
| dirs | |
|
2945 |
dirs := OrderedCollection new |
|
2946 |
add: Java release javaHome asFilename / 'lib'; |
|
2947 |
add: Java release javaHome asFilename / 'lib' / 'amd64'; |
|
2948 |
add: Java release javaHome asFilename / 'lib' / 'i386'; |
|
2949 |
add: Java release javaHome asFilename / 'jre' / 'lib' ; |
|
2950 |
add: Java release javaHome asFilename / 'jre' / 'lib' / 'amd64' ; |
|
2951 |
add: Java release javaHome asFilename / 'jre' / 'lib' / 'i386' ; |
|
2952 |
add: Java release javaHome asFilename / 'jre' / 'bin' ; |
|
2953 |
yourself. |
|
919 | 2954 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
2955 |
dirs |
|
2956 |
add: Java release javaHome asFilename / 'bin'. |
|
2957 |
]. |
|
752 | 2958 |
|
2959 |
^String streamContents: |
|
2960 |
[:path| |
|
2961 |
(dirs select:[:d|d exists]) |
|
2962 |
do:[:d|path nextPutAll:d pathName] |
|
2963 |
separatedBy:[path nextPut: OperatingSystem pathSeparator]] |
|
2964 |
||
2965 |
" |
|
2966 |
JavaVM defaultJavaLibraryPath |
|
2967 |
" |
|
2968 |
||
2969 |
"Created: / 10-12-2010 / 14:09:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2970 |
"Modified: / 01-04-2011 / 18:21:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2971 |
! |
|
2972 |
||
2973 |
defaultSunBootLibraryPath |
|
2974 |
||
1251 | 2975 |
|s| |
2976 |
||
2977 |
s := '' writeStream. |
|
1989
131b7459fdab
Value of class.path and sun.misc.boot.path refactored to match values used in Oracle JVM.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1953
diff
changeset
|
2978 |
Java release bootClassPath |
1562 | 2979 |
do:[:p | s nextPutAll:p asString] |
1251 | 2980 |
separatedBy: [s nextPut: OperatingSystem pathSeparator]. |
2981 |
||
1816 | 2982 |
^ s contents |
2983 |
||
2984 |
" |
|
1251 | 2985 |
JavaVM defaultSunBootLibraryPath |
752 | 2986 |
" |
2987 |
||
2988 |
"Created: / 10-12-2010 / 14:37:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1989
131b7459fdab
Value of class.path and sun.misc.boot.path refactored to match values used in Oracle JVM.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1953
diff
changeset
|
2989 |
"Modified: / 23-01-2013 / 15:19:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2990 |
! |
2991 |
||
2992 |
defaultWindowingToolKit |
|
2993 |
"/ prefer the windows toolkit ... |
|
1816 | 2994 |
|
1033 | 2995 |
(self classForName: 'sun.awt.windows.WToolkit') notNil ifTrue: [ |
752 | 2996 |
^ 'sun.awt.windows.WToolkit'. |
2997 |
]. |
|
1033 | 2998 |
(Java classForName: 'sun.awt.motif.MToolkit') notNil ifTrue: [ |
2999 |
self halt: 'MotifToolKit: this is untested code'. |
|
752 | 3000 |
^ 'sun.awt.motif.MToolkit'. |
3001 |
]. |
|
1033 | 3002 |
self halt: 'TinyToolKit: this is untested code'. |
752 | 3003 |
^ 'sun.awt.tiny.TinyToolkit'. |
3004 |
||
1033 | 3005 |
"/ ^ 'sun.awt.win32.MToolkit'. |
3006 |
"/ ^ 'sun.awt.motif.MToolkit'. |
|
3007 |
" |
|
3008 |
self defaultWindowingToolKit" |
|
752 | 3009 |
"Created: / 3.1.1998 / 14:27:49 / cg" |
3010 |
"Modified: / 27.1.1998 / 21:52:52 / cg" |
|
3011 |
! |
|
3012 |
||
3013 |
fileAccessTrace |
|
3014 |
^ FileAccessTrace |
|
3015 |
||
3016 |
"Created: / 27.1.1999 / 18:55:40 / cg" |
|
3017 |
! |
|
3018 |
||
3019 |
fileAccessTrace:aBoolean |
|
3020 |
FileAccessTrace := aBoolean |
|
3021 |
||
3022 |
"Created: / 19.10.1998 / 16:01:44 / cg" |
|
3023 |
"Modified: / 27.1.1999 / 18:55:52 / cg" |
|
3024 |
! |
|
3025 |
||
3026 |
fileOpenConfirmation |
|
3027 |
^ FileOpenConfirmation |
|
3028 |
||
3029 |
"Created: / 19.10.1998 / 16:01:44 / cg" |
|
3030 |
! |
|
3031 |
||
3032 |
fileOpenConfirmation:aBoolean |
|
3033 |
FileOpenConfirmation := aBoolean |
|
3034 |
||
3035 |
"Created: / 19.10.1998 / 16:01:56 / cg" |
|
3036 |
! |
|
3037 |
||
3038 |
javaConsole:aStream |
|
3039 |
JavaConsoleStream := aStream |
|
3040 |
||
3041 |
" |
|
3042 |
JavaVM javaConsole:Transcript |
|
3043 |
" |
|
3044 |
||
3045 |
"Modified: / 6.8.1997 / 00:34:13 / cg" |
|
3046 |
"Created: / 3.1.1998 / 14:27:58 / cg" |
|
3047 |
! |
|
3048 |
||
3049 |
javaConsoleStream |
|
3050 |
^ JavaConsoleStream |
|
3051 |
||
3052 |
"Created: / 3.1.1998 / 14:32:16 / cg" |
|
3053 |
! |
|
3054 |
||
3055 |
nullPointerExceptionDebug |
|
3056 |
^ NullPointerExceptionDebug |
|
3057 |
||
3058 |
"Created: / 27.1.1999 / 20:14:51 / cg" |
|
3059 |
! |
|
3060 |
||
3061 |
nullPointerExceptionDebug:aBoolean |
|
3062 |
NullPointerExceptionDebug := aBoolean |
|
3063 |
||
3064 |
"Created: / 27.1.1999 / 20:15:00 / cg" |
|
3065 |
! |
|
3066 |
||
3067 |
socketConnectConfirmation |
|
3068 |
^ SocketConnectConfirmation |
|
3069 |
||
3070 |
"Created: / 19.10.1998 / 16:02:15 / cg" |
|
3071 |
! |
|
3072 |
||
3073 |
socketConnectConfirmation:aBoolean |
|
3074 |
SocketConnectConfirmation := aBoolean |
|
3075 |
||
3076 |
"Created: / 19.10.1998 / 16:02:06 / cg" |
|
3077 |
! ! |
|
3078 |
||
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3079 |
!JavaVM class methodsFor:'eager resolving'! |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3080 |
|
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3081 |
disableEagerResolving |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3082 |
EagerResolvingEnabled := false. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3083 |
|
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3084 |
"Created: / 08-12-2011 / 21:06:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3085 |
! |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3086 |
|
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3087 |
eagerResolvingEnabled |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3088 |
^ EagerResolvingEnabled. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3089 |
|
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3090 |
"Created: / 08-12-2011 / 21:05:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3091 |
! |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3092 |
|
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3093 |
enableEagerResolving |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3094 |
EagerResolvingEnabled := true. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3095 |
|
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3096 |
"Created: / 08-12-2011 / 21:06:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3097 |
! ! |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1242
diff
changeset
|
3098 |
|
752 | 3099 |
!JavaVM class methodsFor:'helpers'! |
3100 |
||
1816 | 3101 |
canCast: s to: t |
752 | 3102 |
"Helper for _CHECKCAST:_:" |
1816 | 3103 |
|
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3104 |
| sc tc | |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3105 |
|
1036 | 3106 |
"Not specified in JVM spec, sigh" |
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3107 |
s isJavaPrimitiveType ifTrue: [ |
914 | 3108 |
"FIXME" |
1263 | 3109 |
^ s == t or:[(s isSubclassOf: t) or:[t isSubclassOf: s]] |
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3110 |
]. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3111 |
" |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3112 |
Java VM Spec, 3rd edition, p 280: |
1816 | 3113 |
|
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3114 |
The following rules are used to determine whether an objectref that is not |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3115 |
null can be cast to the resolved type: if S is the class of the object |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3116 |
referred to by objectref and T is the resolved class, array, or interface type, |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3117 |
checkcast determines whether objectref can be cast to type T as follows: |
1816 | 3118 |
|
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3119 |
- If S is an ordinary (nonarray) class, then: |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3120 |
- If T is a class type, then S must be the same class as T, or a subclass |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3121 |
of T. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3122 |
- If T is an interface type, then S must implement interface T. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3123 |
" |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3124 |
(s isJavaArrayClass not and: [ s isInterface not ]) ifTrue: [ |
1036 | 3125 |
^ (s includesBehavior: t). |
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3126 |
]. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3127 |
" |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3128 |
- If S is an interface type, then: |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3129 |
- If T is a class type, then T must be Object. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3130 |
- If T is an interface type, then T must be the same interface as S or a |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3131 |
superinterface of S. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3132 |
" |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3133 |
s isInterface ifTrue: [ |
1816 | 3134 |
^ t isInterface not |
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3135 |
ifTrue: [ t == (self classForName: 'java.lang.Object') ] |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3136 |
ifFalse: [ s includesBehavior: t ] |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3137 |
]. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3138 |
" |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3139 |
- If S is a class representing the array type SC[], that is, an array of com- |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3140 |
ponents of type SC , then: |
752 | 3141 |
" |
3142 |
self assert: s isJavaArrayClass description: 'S should be array type'. |
|
3143 |
sc := s javaComponentClass. |
|
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3144 |
" |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3145 |
- If T is a class type, then T must be Object. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3146 |
" |
1384
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1382
diff
changeset
|
3147 |
t isJavaClassType ifTrue: [ ^ t == (self classForName: 'java.lang.Object') ]. |
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3148 |
" |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3149 |
- If T is an array type TC[], that is, an array of components of type TC , |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3150 |
then one of the following must be true: |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3151 |
- TC and SC are the same primitive type. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3152 |
- TC and SC are reference types, and type SC can be cast to TC by |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3153 |
recursive application of these rules. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3154 |
" |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3155 |
t isJavaArrayClass ifTrue: [ |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3156 |
tc := t javaComponentClass. |
1816 | 3157 |
^ tc isJavaPrimitiveType |
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3158 |
ifTrue: [ tc == sc ] |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3159 |
ifFalse: [ self canCast: sc to: tc ] |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3160 |
]. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3161 |
" |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3162 |
- If T is an interface type, T must be one of the interfaces implemented |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3163 |
by arrays (JLS3 4.10.3). |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3164 |
" |
1816 | 3165 |
((t name == #'java/lang/Cloneable') |
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3166 |
or: [ t name == #'java/lang/Serializable' ]) ifTrue: [ ^ true ]. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3167 |
^ false |
752 | 3168 |
|
3169 |
"Modified: / 09-01-1999 / 00:45:21 / cg" |
|
3170 |
"Created: / 11-02-2011 / 08:21:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1036 | 3171 |
"Modified: / 21-10-2011 / 13:50:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1384
d62dd4b29c22
Fixes in INSTANCE_OF + added missing method. SAXON-B now works again
vranyj1
parents:
1382
diff
changeset
|
3172 |
"Modified: / 24-02-2012 / 16:34:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 3173 |
! |
3174 |
||
1816 | 3175 |
javaStringObjectForString:string |
752 | 3176 |
self breakPoint:#mh info:'refactor my sender to use reflection directly'. |
3177 |
^ self reflection javaStringObjectForString:string interned:false |
|
3178 |
||
3179 |
"Created: / 22-11-2010 / 16:31:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3180 |
"Modified: / 09-02-2011 / 00:47:49 / Marcel Hlopko <hlopik@gmail.com>" |
|
3181 |
! |
|
3182 |
||
1816 | 3183 |
javaStringObjectForString:string interned:intern |
3184 |
||
752 | 3185 |
^self reflection javaStringObjectForString:string interned:intern. |
3186 |
||
3187 |
"Created: / 22-11-2010 / 16:28:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3188 |
"Modified: / 22-11-2010 / 17:57:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3189 |
"Modified: / 09-02-2011 / 01:04:21 / Marcel Hlopko <hlopik@gmail.com>" |
|
3190 |
! |
|
3191 |
||
1816 | 3192 |
javaThreadForSTProcess: stProcess |
1249 | 3193 |
| result | |
3194 |
result := Java threadForStProcess: stProcess ifAbsent: nil. |
|
3195 |
result == 0 ifTrue: [ self breakPoint: #mh. ^ nil]. |
|
3196 |
^ result. |
|
3197 |
||
3198 |
"Modified: / 26-08-1997 / 19:56:31 / cg" |
|
3199 |
"Created: / 03-01-1998 / 01:53:41 / cg" |
|
3200 |
"Modified: / 09-12-2011 / 13:12:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
752 | 3201 |
! |
3202 |
||
1816 | 3203 |
makeArrayOf: loadedJavaClass asDescribedBy: className |
1041 | 3204 |
| arrayClass dimensions | |
3205 |
||
3206 |
arrayClass := loadedJavaClass. |
|
3207 |
dimensions := className occurrencesOf: $[. |
|
3208 |
arrayClass isJavaArrayClass ifTrue: [ |
|
3209 |
"is already array (primitive arrays case, like ByteArray etc)" |
|
3210 |
dimensions := dimensions - 1. |
|
3211 |
]. |
|
3212 |
dimensions timesRepeat: [ arrayClass := arrayClass javaArrayClass. ]. |
|
3213 |
^ arrayClass. |
|
1036 | 3214 |
|
3215 |
"Created: / 21-10-2011 / 12:18:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1041 | 3216 |
"Modified (format): / 23-10-2011 / 22:30:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1036 | 3217 |
! |
3218 |
||
1816 | 3219 |
newThread: name |
1033 | 3220 |
| thread threadClass i | |
3221 |
threadClass := JavaVM classForName: 'java.lang.Thread'. |
|
3222 |
thread := threadClass basicNew. |
|
1691 | 3223 |
thread instVarNamed: '_lockWord_' put: 0. |
1533 | 3224 |
thread instVarNamed: 'name' put: name. "/NOT a Java string, name instvar is char[]!!!!!!" |
1033 | 3225 |
thread instVarNamed: 'priority' |
3226 |
put: (threadClass instVarNamed: 'NORM_PRIORITY'). |
|
3227 |
thread instVarNamed: 'single_step' put: 0. |
|
3228 |
thread instVarNamed: 'daemon' put: 0. |
|
3229 |
thread instVarNamed: 'stillborn' put: 0. |
|
1200 | 3230 |
thread instVarNamed: 'threadStatus' put: 0. |
1033 | 3231 |
thread instVarNamed: 'target' put: nil. |
1816 | 3232 |
thread instVarNamed: 'blockerLock' put: |
1708 | 3233 |
((JavaVM classForName: 'java.lang.Object') basicNew |
3234 |
instVarAt: 1 put: 0; |
|
3235 |
yourself). |
|
3236 |
||
752 | 3237 |
"/ |
3238 |
"/ that on was only temporarily present in JDK1.1.3 (sigh) |
|
3239 |
"/ |
|
1816 | 3240 |
|
1033 | 3241 |
(i := thread class instVarOffsetOf: 'initial_stack_memory') notNil ifTrue: [ |
3242 |
thread instVarAt: i put: 0. |
|
3243 |
]. |
|
3244 |
thread instVarNamed: 'group' put: (self standardThreadGroup). |
|
1200 | 3245 |
threadClass classLoader isNil ifTrue: [ |
3246 |
thread instVarNamed: 'contextClassLoader' put: self systemClassLoader |
|
3247 |
] ifFalse: [ |
|
3248 |
thread instVarNamed: 'contextClassLoader' put: threadClass classLoader |
|
3249 |
]. |
|
752 | 3250 |
^ thread |
3251 |
||
1151 | 3252 |
"Created: / 03-01-1998 / 01:47:30 / cg" |
3253 |
"Modified: / 27-01-1998 / 00:54:33 / cg" |
|
1200 | 3254 |
"Modified: / 01-12-2011 / 17:43:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1708 | 3255 |
"Modified: / 19-09-2012 / 16:06:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 3256 |
! |
3257 |
||
1816 | 3258 |
stProcessForJavaThread: jThread |
1249 | 3259 |
| result | |
3260 |
result := Java threadsAt: jThread ifAbsent: nil. |
|
3261 |
result == 0 ifTrue: [ self breakPoint: #mh. ^ nil ]. |
|
3262 |
^ result. |
|
752 | 3263 |
|
1201 | 3264 |
"Created: / 02-01-1998 / 21:48:27 / cg" |
3265 |
"Modified: / 03-01-1998 / 01:53:55 / cg" |
|
1249 | 3266 |
"Modified: / 09-12-2011 / 13:12:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 3267 |
! |
3268 |
||
3269 |
standardThreadGroup |
|
1033 | 3270 |
| standardGroup threadClass | |
3271 |
||
3272 |
StandardThreadGroup isNil ifTrue: [ |
|
3273 |
threadClass := JavaVM classForName: 'java.lang.Thread'. |
|
3274 |
standardGroup := (self classForName: 'java.lang.ThreadGroup') new. |
|
3275 |
standardGroup instVarNamed: 'parent' put: nil. |
|
3276 |
standardGroup instVarNamed: 'name' put: (Java as_String: 'main'). |
|
3277 |
standardGroup instVarNamed: 'maxPriority' |
|
3278 |
put: (threadClass instVarNamed: 'MAX_PRIORITY'). |
|
3279 |
standardGroup instVarNamed: 'destroyed' put: 0. |
|
3280 |
standardGroup instVarNamed: 'daemon' put: nil. |
|
3281 |
(standardGroup class instVarOffsetOf: 'vmAllowSuspension') notNil ifTrue: [ |
|
3282 |
standardGroup instVarNamed: 'vmAllowSuspension' put: 0. |
|
3283 |
]. |
|
3284 |
standardGroup instVarNamed: 'nthreads' put: 0. |
|
3285 |
standardGroup instVarNamed: 'ngroups' put: 0. |
|
3286 |
standardGroup instVarNamed: 'groups' put: nil. |
|
760
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3287 |
StandardThreadGroup := standardGroup. |
752 | 3288 |
]. |
3289 |
^ StandardThreadGroup |
|
3290 |
||
760
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3291 |
"Created: / 03-01-1998 / 01:41:54 / cg" |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3292 |
"Modified: / 17-11-1998 / 22:55:30 / cg" |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3293 |
"Modified: / 25-04-2011 / 20:27:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 3294 |
! ! |
3295 |
||
3296 |
!JavaVM class methodsFor:'helpers - exceptions'! |
|
3297 |
||
760
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3298 |
throwAbstractMethodError |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3299 |
^ self throwExceptionClassName: 'java.lang.AbstractMethodError' |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3300 |
withMessage: 'resolving a method ref failed'. |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3301 |
|
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3302 |
"Created: / 11-04-2011 / 20:32:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3303 |
! |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3304 |
|
1816 | 3305 |
throwArrayIndexOutOfBoundsException: badIndex |
1033 | 3306 |
| exClass ex | |
3307 |
||
3308 |
exClass := self classForName: 'java.lang.ArrayIndexOutOfBoundsException'. |
|
3309 |
ex := exClass newWith_int: badIndex. |
|
3310 |
^ self throwException: ex |
|
752 | 3311 |
|
3312 |
"Created: / 14.1.1998 / 21:36:05 / cg" |
|
3313 |
"Modified: / 20.11.1998 / 13:27:14 / cg" |
|
3314 |
! |
|
3315 |
||
1816 | 3316 |
throwArrayIndexOutOfBoundsException: theArray _: badIndex |
1033 | 3317 |
| exClass ex | |
3318 |
||
3319 |
exClass := self classForName: 'java.lang.ArrayIndexOutOfBoundsException'. |
|
3320 |
ex := exClass newWith_int: badIndex. |
|
3321 |
^ self throwException: ex |
|
752 | 3322 |
|
3323 |
"Modified: / 20.11.1998 / 13:27:14 / cg" |
|
3324 |
"Created: / 8.1.1999 / 15:03:59 / cg" |
|
3325 |
! |
|
3326 |
||
3327 |
throwArrayStoreException:badArray |
|
3328 |
^ self |
|
864
45d54ed8b273
JavaVM: improvements in java.lang.System.arraycopy native
vranyj1
parents:
859
diff
changeset
|
3329 |
throwExceptionClassName:'java.lang.ArrayStoreException' |
45d54ed8b273
JavaVM: improvements in java.lang.System.arraycopy native
vranyj1
parents:
859
diff
changeset
|
3330 |
withMessage:('bad array store: ' , badArray class printString) |
45d54ed8b273
JavaVM: improvements in java.lang.System.arraycopy native
vranyj1
parents:
859
diff
changeset
|
3331 |
|
45d54ed8b273
JavaVM: improvements in java.lang.System.arraycopy native
vranyj1
parents:
859
diff
changeset
|
3332 |
"Modified: / 23-06-2011 / 09:19:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 3333 |
! |
3334 |
||
3335 |
throwClassCastException |
|
1041 | 3336 |
|
1816 | 3337 |
|
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3338 |
^ self throwExceptionClassName: 'java.lang.ClassCastException' |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
3339 |
withMessage: 'cast failed' |
752 | 3340 |
|
1041 | 3341 |
"Modified: / 07-01-1998 / 15:25:35 / cg" |
3342 |
"Created: / 08-01-1999 / 18:55:31 / cg" |
|
3343 |
"Modified (format): / 23-10-2011 / 22:33:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 3344 |
! |
3345 |
||
892 | 3346 |
throwClassFormatError |
1053 | 3347 |
^ self throwClassFormatError: 'Invalid class format' |
892 | 3348 |
|
3349 |
"Created: / 04-01-1998 / 22:26:09 / cg" |
|
3350 |
"Modified: / 10-11-1998 / 13:20:31 / cg" |
|
3351 |
"Created: / 08-08-2011 / 17:57:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3352 |
! |
|
3353 |
||
1053 | 3354 |
throwClassFormatError: message |
1816 | 3355 |
^ self |
3356 |
throwExceptionClassName:'java.lang.ClassFormatError' |
|
1053 | 3357 |
withMessage: message |
3358 |
||
3359 |
"Created: / 04-01-1998 / 22:26:09 / cg" |
|
3360 |
"Modified: / 10-11-1998 / 13:20:31 / cg" |
|
3361 |
"Created: / 27-10-2011 / 16:20:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3362 |
! |
|
3363 |
||
752 | 3364 |
throwClassNotFoundException |
1816 | 3365 |
^ self |
3366 |
throwExceptionClassName:'java.lang.ClassNotFoundException' |
|
752 | 3367 |
withMessage:'no such class' |
3368 |
||
3369 |
"Created: / 4.1.1998 / 22:25:26 / cg" |
|
3370 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
3371 |
! |
|
3372 |
||
1816 | 3373 |
throwClassNotFoundException: className |
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1017
diff
changeset
|
3374 |
^ self throwExceptionClassName: 'java.lang.ClassNotFoundException' |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1017
diff
changeset
|
3375 |
withMessage: 'no such class: ' , className |
752 | 3376 |
|
3377 |
"Created: / 4.1.1998 / 22:26:09 / cg" |
|
3378 |
"Modified: / 10.11.1998 / 13:20:31 / cg" |
|
3379 |
! |
|
3380 |
||
1612 | 3381 |
throwDataFormatException: message |
1816 | 3382 |
^ self |
3383 |
throwExceptionClassName:'java.util.zip.DataFormatException' |
|
1612 | 3384 |
withMessage: message |
3385 |
||
3386 |
"Created: / 16-08-2012 / 17:55:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3387 |
! |
|
3388 |
||
752 | 3389 |
throwDivisionByZeroException |
3390 |
DivisionByZeroExceptionDebug == true ifTrue:[ |
|
3391 |
self halt:'division by zero'. |
|
3392 |
]. |
|
3393 |
^ self |
|
3394 |
throwExceptionClassName:'java.lang.ArithmeticException' |
|
3395 |
withMessage:'division by zero' |
|
3396 |
||
3397 |
"Created: / 8.1.1999 / 14:28:15 / cg" |
|
3398 |
! |
|
3399 |
||
1816 | 3400 |
throwException: aJavaException |
752 | 3401 |
<resource: #skipInDebuggersWalkBack> |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3402 |
| con jMsg msg exClass srchCon handlerContext handlerPC method pc hPC handler | |
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3403 |
ExceptionTrace ifTrue: [ |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3404 |
| tmpMessage | |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3405 |
tmpMessage := aJavaException instVarNamed: 'detailMessage'. |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3406 |
tmpMessage isNil ifTrue: [ tmpMessage := '' ] ifFalse: [ |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3407 |
tmpMessage := Java as_ST_String: tmpMessage |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3408 |
]. |
1816 | 3409 |
Logger |
3410 |
log: 'JAVA: exception: ' , aJavaException class fullName , ' (' |
|
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3411 |
, tmpMessage , ')' |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3412 |
severity: #debug |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3413 |
facility: 'JVM' |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3414 |
]. |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3415 |
ExceptionDebug ifTrue: [ |
1816 | 3416 |
"/ self internalError:('JAVA: exception: ' , aJavaException class fullName). |
3417 |
(ExceptionDebugPatterns isNilOrEmptyCollection |
|
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3418 |
or: [ |
1816 | 3419 |
ExceptionDebugPatterns |
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3420 |
anySatisfy: [:pattern | pattern match: aJavaException class fullName ] |
1816 | 3421 |
]) |
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3422 |
ifTrue: [ |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3423 |
self halt: ('JAVA: exceptionDebug: ' , aJavaException class fullName) |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3424 |
] |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3425 |
]. |
1816 | 3426 |
|
752 | 3427 |
"/ |
3428 |
"/ search stack for a javaContext which handles that exception |
|
3429 |
"/ |
|
1816 | 3430 |
|
1201 | 3431 |
|
752 | 3432 |
srchCon := thisContext sender. |
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3433 |
[ handlerContext isNil and: [ srchCon notNil ] ] whileTrue: [ |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3434 |
(srchCon isJavaContext) ifTrue: [ |
752 | 3435 |
method := srchCon method. |
3436 |
pc := srchCon pc. |
|
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3437 |
(hPC := method handlerFor: aJavaException at: pc) notNil ifTrue: [ |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3438 |
handlerPC := hPC. |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3439 |
handlerContext := srchCon |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3440 |
]. |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3441 |
] ifFalse:[ |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3442 |
srchCon isHandleContext ifTrue:[ |
1816 | 3443 |
handler := srchCon receiver |
1428
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3444 |
handlerForSignal: aJavaException class context: srchCon originator:thisContext sender. |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3445 |
handler notNil ifTrue:[ |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3446 |
"We have found a Smalltalk handler for Java exception here" |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3447 |
handlerContext := srchCon. |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3448 |
] |
1098 | 3449 |
]. |
752 | 3450 |
]. |
3451 |
srchCon := srchCon sender. |
|
3452 |
]. |
|
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3453 |
handlerContext isNil ifTrue: [ |
752 | 3454 |
"/ |
3455 |
"/ no JavaHandler ... let smalltalk handle it |
|
1816 | 3456 |
"/ |
752 | 3457 |
exClass := aJavaException class. |
1201 | 3458 |
exClass == (self classNamed: 'java/lang/ThreadDeath') ifTrue: [ |
3459 |
"/mh 1.12.11 uncaught threadDeaths are not delegated out.. Thread.stop javadoc |
|
3460 |
^ self |
|
3461 |
]. |
|
752 | 3462 |
msg := 'Java ' , exClass name. |
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3463 |
jMsg := aJavaException instVarNamed: 'detailMessage'. |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3464 |
jMsg notNil ifTrue: [ msg := msg , ': ' , (Java as_ST_String: jMsg). ]. |
1816 | 3465 |
|
3466 |
"/ for our convenience: skip ST contexts |
|
752 | 3467 |
"/ (i.e. the handler or debugger will see the javaContext first ) |
1816 | 3468 |
|
752 | 3469 |
con := thisContext sender. |
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3470 |
[ con isNil or: [ con isJavaContext ] ] whileFalse: [ con := con sender ]. |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3471 |
con isNil ifTrue: [ con := thisContext sender ]. |
1816 | 3472 |
JavaUnhandledExceptionError |
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3473 |
raiseWith: aJavaException |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3474 |
errorString: msg |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3475 |
in: con. |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3476 |
] ifFalse: [ |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3477 |
handlerContext isJavaContext ifTrue:[ |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3478 |
"/ |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3479 |
"/ found a Java exception handler |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3480 |
"/ |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3481 |
handlerContext setPC: handlerPC. |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3482 |
handlerContext exceptionArg: aJavaException pc: handlerPC. |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3483 |
handlerContext markForException. |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3484 |
handlerContext unwindAndRestartForJavaException. |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3485 |
self halt: 'should not be reached'. |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3486 |
] ifFalse:[ |
1816 | 3487 |
| val | |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3488 |
"/ |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3489 |
"/ found a Smalltalk exception handler |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3490 |
"/ |
1428
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3491 |
"/ First, call evaluate the handler (see GenericException>>doCallHandler: |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3492 |
val := handler valueWithOptionalArgument: aJavaException. |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3493 |
"handler fall through - is just like a #return:(aHandlerBlock value)" |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3494 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3495 |
"Java exceptions cannot be proceed (by design) but they might be |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3496 |
rejected (rethrown) - this is not supported yet - we need |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3497 |
to somehow indicate that (kind of reject token object returned |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3498 |
from handler?)" |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3499 |
thisContext evaluateUnwindActionsUpTo:handlerContext. |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3500 |
handlerContext return: val. |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1387
diff
changeset
|
3501 |
]. |
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3502 |
]. |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3503 |
Processor activeProcess == JavaScreenUpdaterThread ifTrue: [ self halt ]. |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3504 |
Processor activeProcess == JavaEventQueueThread ifTrue: [ self halt ]. |
752 | 3505 |
Processor activeProcess terminate. |
3506 |
||
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3507 |
" |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3508 |
ExceptionTrace := true" |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
3509 |
|
752 | 3510 |
"Created: / 07-01-1998 / 15:28:22 / cg" |
3511 |
"Modified: / 24-12-1999 / 02:33:25 / cg" |
|
1201 | 3512 |
"Modified: / 01-12-2011 / 18:32:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1428
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
3513 |
"Modified: / 18-03-2012 / 21:47:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 3514 |
! |
3515 |
||
1816 | 3516 |
throwExceptionClassName: aJavaExceptionClassName withMessage: someMessage |
1033 | 3517 |
| exClass ex | |
3518 |
||
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3519 |
exClass := self classForName: aJavaExceptionClassName asSlashedJavaClassName definedBy: nil. |
1033 | 3520 |
ex := exClass newWith_String: someMessage. |
3521 |
^ self throwException: ex |
|
752 | 3522 |
|
1060 | 3523 |
"Created: / 07-01-1998 / 15:25:09 / cg" |
3524 |
"Modified: / 14-01-1998 / 23:38:30 / cg" |
|
3525 |
"Modified: / 30-10-2011 / 17:44:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3526 |
"Modified: / 02-11-2011 / 16:54:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 3527 |
! |
3528 |
||
1816 | 3529 |
throwExceptionClassName: aJavaExceptionClassName withMessage: someMessage cause: cause |
1507 | 3530 |
| exClass ex | |
3531 |
||
3532 |
exClass := self classForName: aJavaExceptionClassName asSlashedJavaClassName definedBy: nil. |
|
3533 |
ex := exClass newWith_String: someMessage. |
|
3534 |
ex instVarNamed: #cause put: cause. |
|
3535 |
^ self throwException: ex |
|
3536 |
||
3537 |
"Created: / 05-07-2012 / 09:01:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3538 |
! |
|
3539 |
||
1452
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3540 |
throwExceptionForFinallyIn: context |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3541 |
"Evaluates a single finally block by fake-throwing |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3542 |
FinallyToken - only evaluates a finally handler in |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3543 |
given method, senders are not searched" |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3544 |
|
1455 | 3545 |
|method pc handlerPC token returnContext | |
1452
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3546 |
|
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3547 |
self assert: context isJavaContext. |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3548 |
|
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3549 |
method := context method. |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3550 |
pc := context pc. |
1455 | 3551 |
|
3552 |
token := JavaContext::FinallyToken new. |
|
3553 |
returnContext := thisContext sender sender sender. |
|
3554 |
returnContext selector == #return: ifTrue:[ |
|
1816 | 3555 |
token |
1455 | 3556 |
context: context; |
3557 |
selector: #return:; |
|
3558 |
exception: returnContext receiver; |
|
3559 |
value: (returnContext argAt:1). |
|
3560 |
] ifFalse:[ |
|
3561 |
returnContext selector == #return ifTrue:[ |
|
1816 | 3562 |
token |
1455 | 3563 |
context: context; |
3564 |
selector: #return; |
|
3565 |
exception: returnContext receiver; |
|
3566 |
value: nil. |
|
1816 | 3567 |
] ifFalse:[ |
1455 | 3568 |
self error:'Unhandled case, inform libjava developers (JV in particular)' . |
3569 |
]. |
|
3570 |
]. |
|
3571 |
||
1461 | 3572 |
|
1692 | 3573 |
handlerPC := method handlerFor: nil at: pc. |
1452
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3574 |
handlerPC isNil ifTrue:[ ^ self ]. |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3575 |
|
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3576 |
context setPC: handlerPC. |
1455 | 3577 |
context exceptionArg: token pc: handlerPC. |
1452
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3578 |
context markForException. |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3579 |
context restart. |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3580 |
|
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3581 |
self halt: 'should not be reached'. |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3582 |
|
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3583 |
"Created: / 03-04-2012 / 16:56:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3584 |
! |
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
3585 |
|
752 | 3586 |
throwExceptionInInitializerError:className |
1816 | 3587 |
^ self |
3588 |
throwExceptionClassName:'java.lang.ExceptionInInitializerError' |
|
752 | 3589 |
withMessage:'error when initializing class: ' , className |
3590 |
||
3591 |
"Created: / 24-11-2010 / 09:23:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3592 |
! |
|
3593 |
||
901 | 3594 |
throwFileNotFoundException: message |
1816 | 3595 |
^ self |
3596 |
throwExceptionClassName:'java.io.FileNotFoundException' |
|
901 | 3597 |
withMessage: message |
3598 |
||
3599 |
"Created: / 04-01-1998 / 22:26:09 / cg" |
|
3600 |
"Modified: / 10-11-1998 / 13:20:31 / cg" |
|
3601 |
"Created: / 10-08-2011 / 14:19:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3602 |
! |
|
3603 |
||
752 | 3604 |
throwIOExceptionWithMessage:message |
3605 |
IOExceptionDebug == true ifTrue:[ |
|
3606 |
self halt:'IO Exception'. |
|
3607 |
]. |
|
1816 | 3608 |
^ self |
3609 |
throwExceptionClassName:'java.io.IOException' |
|
752 | 3610 |
withMessage:message |
3611 |
||
3612 |
"Created: / 7.1.1998 / 10:34:24 / cg" |
|
3613 |
"Modified: / 7.1.1998 / 15:26:25 / cg" |
|
3614 |
! |
|
3615 |
||
760
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3616 |
throwIllegalAccessError |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3617 |
^ self throwExceptionClassName: 'java.lang.IllegalAccessError' |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3618 |
withMessage: 'illegal access' |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3619 |
|
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3620 |
"Created: / 13-04-2011 / 23:07:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3621 |
! |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3622 |
|
752 | 3623 |
throwIllegalAccessException |
1816 | 3624 |
^ self |
3625 |
throwExceptionClassName:'java.lang.IllegalAccessException' |
|
752 | 3626 |
withMessage:'illegal access' |
3627 |
||
3628 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
3629 |
"Created: / 14.1.1998 / 23:13:44 / cg" |
|
3630 |
! |
|
3631 |
||
985 | 3632 |
throwIllegalArgumentException: message |
1816 | 3633 |
^ self |
3634 |
throwExceptionClassName:'java.lang.IllegalArgumentException' |
|
1151 | 3635 |
withMessage: 'illegal argument: ', message |
985 | 3636 |
|
3637 |
"Modified: / 07-01-1998 / 15:25:35 / cg" |
|
3638 |
"Created: / 14-01-1998 / 23:13:44 / cg" |
|
3639 |
"Created: / 07-09-2011 / 14:18:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3640 |
! |
|
3641 |
||
1816 | 3642 |
throwIllegalMonitorStateException: message |
1177 | 3643 |
self throwExceptionClassName: 'java.lang.IllegalMonitorStateException' |
3644 |
withMessage: message. |
|
3645 |
||
3646 |
"Created: / 29-11-2011 / 14:21:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
3647 |
! |
|
3648 |
||
760
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3649 |
throwIncompatibleClassChangeError |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3650 |
^ self throwExceptionClassName: 'java.lang.IncompatibleClassChangeError' |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3651 |
withMessage: 'illegal change'. |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3652 |
|
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3653 |
"Created: / 11-04-2011 / 20:03:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3654 |
! |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3655 |
|
752 | 3656 |
throwInstantiationException |
1816 | 3657 |
^ self |
3658 |
throwExceptionClassName:'java.lang.InstantiationException' |
|
752 | 3659 |
withMessage:'cannot instantiate' |
3660 |
||
3661 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
3662 |
"Created: / 14.1.1998 / 23:15:01 / cg" |
|
3663 |
! |
|
3664 |
||
3665 |
throwInstantiationExceptionFor:aJavaClass |
|
1816 | 3666 |
^ self |
3667 |
throwExceptionClassName:'java.lang.InstantiationException' |
|
752 | 3668 |
withMessage:('cannot instantiate: ' , aJavaClass javaName) |
3669 |
||
3670 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
3671 |
"Created: / 14.1.1998 / 23:17:02 / cg" |
|
3672 |
! |
|
3673 |
||
1816 | 3674 |
throwInterruptedException: message |
1188 | 3675 |
^ self throwExceptionClassName: 'java.lang.InterruptedException' |
3676 |
withMessage:message |
|
3677 |
||
3678 |
"Created: / 30-11-2011 / 12:23:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
3679 |
! |
|
3680 |
||
1509 | 3681 |
throwInvocationTargetException: message target: target |
3682 |
| exClass ex | |
|
3683 |
||
3684 |
exClass := self classForName: #'java/lang/reflect/InvocationTargetException' definedBy: nil. |
|
3685 |
ex := exClass newWith_String: message. |
|
3686 |
ex instVarNamed: #target put: target. |
|
3687 |
^ self throwException: ex |
|
3688 |
||
3689 |
"Created: / 05-07-2012 / 17:48:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1507 | 3690 |
! |
3691 |
||
752 | 3692 |
throwLinkageError: message |
1816 | 3693 |
^ self |
3694 |
throwExceptionClassName:'java.lang.LinkageError' |
|
752 | 3695 |
withMessage: message |
3696 |
||
3697 |
"Modified: / 10-11-1998 / 13:20:31 / cg" |
|
3698 |
"Created: / 26-11-2010 / 11:26:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3699 |
! |
|
3700 |
||
1497 | 3701 |
throwNegativeArraySizeException: size |
1816 | 3702 |
^ self |
1497 | 3703 |
throwExceptionClassName: 'java.lang.NegativeArraySizeException' |
3704 |
withMessage: 'negative array size: ' , size printString |
|
3705 |
||
3706 |
"Created: / 13-05-2012 / 14:46:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3707 |
! |
|
3708 |
||
760
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3709 |
throwNoSuchFieldException |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3710 |
^ self throwExceptionClassName: 'java.lang.NoSuchFieldError' |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3711 |
withMessage: 'looking up a field failed'. |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3712 |
|
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3713 |
"Created: / 13-04-2011 / 12:16:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3714 |
! |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3715 |
|
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3716 |
throwNoSuchMethodError |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3717 |
^ self throwExceptionClassName: 'java.lang.NoSuchMethodError' |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3718 |
withMessage: 'looking up a method failed'. |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3719 |
|
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3720 |
"Created: / 11-04-2011 / 20:33:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3721 |
! |
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3722 |
|
752 | 3723 |
throwNullPointerException |
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
911
diff
changeset
|
3724 |
NullPointerExceptionDebug == true ifTrue:[ |
908
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
907
diff
changeset
|
3725 |
self halt:'Null Pointer exception'. |
752 | 3726 |
]. |
3727 |
||
1816 | 3728 |
^ self |
3729 |
throwExceptionClassName:'java.lang.NullPointerException' |
|
908
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
907
diff
changeset
|
3730 |
withMessage:'null pointer' |
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
907
diff
changeset
|
3731 |
|
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
907
diff
changeset
|
3732 |
"Created: / 09-01-1998 / 02:26:08 / cg" |
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
907
diff
changeset
|
3733 |
"Modified: / 28-01-1998 / 02:30:09 / cg" |
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
911
diff
changeset
|
3734 |
"Modified: / 13-08-2011 / 01:10:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 3735 |
! |
3736 |
||
1248 | 3737 |
throwNullPointerException:message |
3738 |
NullPointerExceptionDebug == true ifTrue: [ |
|
3739 |
self halt: 'Null Pointer exception'. |
|
3740 |
]. |
|
3741 |
^ self throwExceptionClassName: 'java.lang.NullPointerException' |
|
3742 |
withMessage: message |
|
3743 |
||
3744 |
"Created: / 09-01-1998 / 02:26:08 / cg" |
|
3745 |
"Modified: / 28-01-1998 / 02:30:09 / cg" |
|
3746 |
"Modified: / 13-08-2011 / 01:10:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3747 |
"Created: / 09-12-2011 / 11:13:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
3748 |
! |
|
3749 |
||
1816 | 3750 |
throwNumberFormatException |
3751 |
^ self |
|
3752 |
throwExceptionClassName:'java.lang.NumberFormatException' |
|
752 | 3753 |
withMessage:'bad number format' |
3754 |
||
3755 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
3756 |
"Created: / 11.1.1998 / 16:08:22 / cg" |
|
3757 |
! |
|
3758 |
||
943 | 3759 |
throwOutOfMemoryError |
1816 | 3760 |
^ self |
3761 |
throwExceptionClassName:'java.lang.OutOfMemoryError' |
|
943 | 3762 |
withMessage:'Oops, out of memory!!' |
3763 |
||
3764 |
"Created: / 04-01-1998 / 22:26:09 / cg" |
|
3765 |
"Modified: / 10-11-1998 / 13:20:31 / cg" |
|
3766 |
"Created: / 30-08-2011 / 09:23:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3767 |
! |
|
3768 |
||
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3769 |
throwSecurityException |
1816 | 3770 |
JavaClassReader classLoaderQuerySignal |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3771 |
answer: nil |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3772 |
do: [ |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3773 |
^ self throwExceptionClassName: 'java.lang.SecurityException' |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3774 |
withMessage: 'trying to load class from java.lang using different class loader?' |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3775 |
]. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3776 |
|
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3777 |
"Created: / 01-11-2011 / 15:55:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3778 |
! |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3779 |
|
1816 | 3780 |
throwSecurityExceptionWith: message |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3781 |
JavaClassReader classLoaderQuerySignal answer: nil |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3782 |
do: [ |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3783 |
^ self throwExceptionClassName: 'java.lang.SecurityException' |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3784 |
withMessage: 'trying to load class from java.lang: ' , message. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3785 |
]. |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3786 |
|
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3787 |
"Created: / 01-11-2011 / 16:28:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3788 |
! |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1070
diff
changeset
|
3789 |
|
1816 | 3790 |
throwSocketException: message |
1084 | 3791 |
JavaClassReader classLoaderQuerySignal answer: nil |
3792 |
do: [ |
|
3793 |
^ self throwExceptionClassName: 'java.net.SocketException' |
|
3794 |
withMessage: message |
|
3795 |
]. |
|
3796 |
||
3797 |
"Created: / 01-11-2011 / 16:28:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
3798 |
"Created: / 03-11-2011 / 23:31:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3799 |
! |
|
3800 |
||
752 | 3801 |
throwZipException |
1537
0072327ccc71
- JavaVM: some new natives for zip, mainly Deflater. No ZipFile finalization hack yet.
vranyj1
parents:
1533
diff
changeset
|
3802 |
^ self throwZipException:'error in opening zip file'. |
752 | 3803 |
|
3804 |
"Created: / 27-03-2011 / 16:25:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1537
0072327ccc71
- JavaVM: some new natives for zip, mainly Deflater. No ZipFile finalization hack yet.
vranyj1
parents:
1533
diff
changeset
|
3805 |
"Modified: / 20-07-2012 / 19:15:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0072327ccc71
- JavaVM: some new natives for zip, mainly Deflater. No ZipFile finalization hack yet.
vranyj1
parents:
1533
diff
changeset
|
3806 |
! |
0072327ccc71
- JavaVM: some new natives for zip, mainly Deflater. No ZipFile finalization hack yet.
vranyj1
parents:
1533
diff
changeset
|
3807 |
|
0072327ccc71
- JavaVM: some new natives for zip, mainly Deflater. No ZipFile finalization hack yet.
vranyj1
parents:
1533
diff
changeset
|
3808 |
throwZipException: message |
0072327ccc71
- JavaVM: some new natives for zip, mainly Deflater. No ZipFile finalization hack yet.
vranyj1
parents:
1533
diff
changeset
|
3809 |
^ self throwExceptionClassName: 'java.util.zip.ZipException' |
0072327ccc71
- JavaVM: some new natives for zip, mainly Deflater. No ZipFile finalization hack yet.
vranyj1
parents:
1533
diff
changeset
|
3810 |
withMessage: 'error in opening zip file'. |
0072327ccc71
- JavaVM: some new natives for zip, mainly Deflater. No ZipFile finalization hack yet.
vranyj1
parents:
1533
diff
changeset
|
3811 |
|
0072327ccc71
- JavaVM: some new natives for zip, mainly Deflater. No ZipFile finalization hack yet.
vranyj1
parents:
1533
diff
changeset
|
3812 |
"Created: / 20-07-2012 / 19:15:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 3813 |
! ! |
3814 |
||
3815 |
!JavaVM class methodsFor:'helpers - io'! |
|
3816 |
||
1545 | 3817 |
commonOpenStreamUsing: aBlock |
3818 |
"Helper for opening a stream. Catches 'too many files' open error |
|
3819 |
and tries to GC to cleanup if necessary" |
|
3820 |
||
3821 |
| stream retry | |
|
3822 |
||
3823 |
retry := false. |
|
3824 |
[ stream := aBlock value ] on:OpenError do:[:ex| |
|
3825 |
(ex errorCode) == (OperatingSystem errorNumberFor:#EMFILE) ifTrue:[ |
|
1552 | 3826 |
"Worst case, try to cleanup" |
1598 | 3827 |
Logger log: 'maximum number of open files reached, forcing finalization...' severity: #warn facility: #JVM. |
1551 | 3828 |
[ |
3829 |
FinalizationLobby finalizeNow. |
|
1552 | 3830 |
Delay waitForSeconds: 5. "/Give Java finalization thread a chance to clean up |
1551 | 3831 |
ObjectMemory garbageCollect. |
3832 |
retry := true. |
|
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
3833 |
JavaVM performance printOpenExternalStreamsOn: Stderr. |
1551 | 3834 |
] on: Error do:[:ex| |
1598 | 3835 |
Logger log: 'failed to force finalization: ', ex description severity: #error facility: #JVM |
1551 | 3836 |
]. |
1545 | 3837 |
] ifFalse:[ |
3838 |
ex pass. |
|
3839 |
]. |
|
3840 |
]. |
|
3841 |
retry ifTrue:[ |
|
1598 | 3842 |
stream := aBlock value. |
3843 |
Logger log: 'good, forced finalization solved the problem' severity: #info facility: #JVM |
|
1545 | 3844 |
]. |
3845 |
^stream |
|
3846 |
||
3847 |
"Created: / 23-07-2012 / 19:33:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1598 | 3848 |
"Modified: / 14-08-2012 / 02:25:06 / jv" |
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
3849 |
"Modified: / 16-01-2013 / 20:56:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 3850 |
! ! |
3851 |
||
3852 |
!JavaVM class methodsFor:'helpers - reflection'! |
|
3853 |
||
1816 | 3854 |
classForJavaClassObject:aJavaClassObject |
752 | 3855 |
"given java.lang.class instance, return the real class for it." |
1816 | 3856 |
|
752 | 3857 |
^ self reflection classForJavaClassObject:aJavaClassObject |
3858 |
||
3859 |
"Created: / 23-01-1998 / 17:44:09 / cg" |
|
3860 |
"Modified: / 03-02-2011 / 21:33:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3861 |
"Modified: / 09-02-2011 / 01:02:17 / Marcel Hlopko <hlopik@gmail.com>" |
|
3862 |
! |
|
3863 |
||
1816 | 3864 |
javaClassObjectForClass: aClass |
752 | 3865 |
"given a real class, return the corresponding java.lang.class |
3866 |
instance for it." |
|
1816 | 3867 |
|
1576 | 3868 |
"/ | class | |
3869 |
"/ |
|
3870 |
"/ "find reflection of StClass in the Java World" |
|
3871 |
"/ (JavaObjectDictionary new hasReflection: aClass name) ifTrue: [ |
|
3872 |
"/ class := JavaObjectDictionary new reflectionOf: aClass name |
|
3873 |
"/ ] ifFalse: [ class := aClass. ]. |
|
3874 |
^ self reflection javaClassObjectForClass: aClass. |
|
752 | 3875 |
|
3876 |
"Created: / 23-01-1998 / 17:43:38 / cg" |
|
3877 |
"Modified: / 05-12-1998 / 15:29:32 / cg" |
|
3878 |
"Modified: / 17-01-2011 / 19:24:22 / kursjan <kursjan@fit.cvut.cz>" |
|
3879 |
"Modified: / 28-01-2011 / 14:31:25 / Marcel Hlopko <hlopik@gmail.com>" |
|
1576 | 3880 |
"Modified: / 31-07-2012 / 00:49:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 3881 |
! |
3882 |
||
1816 | 3883 |
javaConstructorObjectForMethod:method |
752 | 3884 |
"given a real method, return the corresponding java.lang.reflect.Constructor |
3885 |
instance for it." |
|
3886 |
self breakPoint:#mh info:'refactor my sender to call reflection directly'. |
|
3887 |
^ self reflection javaConstructorObjectForMethod: method. |
|
3888 |
||
3889 |
"Modified: / 09-02-2011 / 00:58:09 / Marcel Hlopko <hlopik@gmail.com>" |
|
3890 |
! |
|
3891 |
||
1816 | 3892 |
javaFieldObjectForField: aJavaField in: aJavaLangClass |
752 | 3893 |
"given a java field, return the corresponding java.lang.Field |
3894 |
instance for it." |
|
3895 |
" |
|
3896 |
See OpenJDK7 source: |
|
3897 |
jdk7/hotspot/src/share/vm/runtime/reflection.cpp, |
|
3898 |
oop Reflection::new_field" |
|
1816 | 3899 |
|
752 | 3900 |
| field clazz name slot type modifiers | |
3901 |
||
3902 |
clazz := aJavaLangClass. |
|
3903 |
name := self reflection javaStringObjectForString: aJavaField name |
|
3904 |
interned: true. |
|
3905 |
slot := aJavaField index. |
|
3906 |
type := self javaClassObjectForClass: aJavaField typeClass. |
|
3907 |
modifiers := aJavaField accessFlags. |
|
1033 | 3908 |
field := (self classForName: 'java.lang.reflect.Field') new. |
752 | 3909 |
field |
3910 |
instVarNamed: #clazz put: clazz; |
|
3911 |
instVarNamed: #name put: name; |
|
3912 |
instVarNamed: #slot put: slot; |
|
3913 |
instVarNamed: #type put: type; |
|
1033 | 3914 |
instVarNamed: #modifiers put: modifiers; |
752 | 3915 |
yourself. |
1816 | 3916 |
aJavaField annotations |
1033 | 3917 |
ifNotNil: [ |
3918 |
field instVarNamed: #annotations |
|
3919 |
put: aJavaField annotations runtimeVisible rawAnnotations |
|
3920 |
]. |
|
752 | 3921 |
^ field. |
3922 |
||
3923 |
"Modified: / 05-12-1998 / 15:29:32 / cg" |
|
3924 |
"Created: / 22-11-2010 / 17:01:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3925 |
"Modified: / 09-02-2011 / 01:06:20 / Marcel Hlopko <hlopik@gmail.com>" |
|
3926 |
"Modified: / 01-04-2011 / 12:11:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
760
5f55da80009b
JavaVM: few fixes in VM callbacks (getting rid of all __jresolveMethod() in jinterpret.c)
vranyj1
parents:
758
diff
changeset
|
3927 |
"Modified: / 25-04-2011 / 20:23:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 3928 |
! |
3929 |
||
1816 | 3930 |
javaMethodObjectForMethod:method |
752 | 3931 |
"given a real method, return the corresponding java.lang.reflect.Constructor |
3932 |
instance for it." |
|
3933 |
||
3934 |
^ self reflection javaMethodObjectForMethod:method. |
|
3935 |
||
3936 |
"Modified: / 28-02-2011 / 17:08:36 / Marcel Hlopko <hlopik@gmail.com>" |
|
3937 |
! |
|
3938 |
||
1816 | 3939 |
methodForJavaConstructorObject:constructor |
752 | 3940 |
"given a java.lang.reflect.Constructor, return the corresponding method |
3941 |
it." |
|
3942 |
self breakPoint:#mh info: 'refactor my sender to call reflection directly'. |
|
3943 |
^ self reflection methodForJavaConstructorObject: constructor. |
|
3944 |
||
3945 |
"Modified: / 09-02-2011 / 00:59:43 / Marcel Hlopko <hlopik@gmail.com>" |
|
3946 |
! |
|
3947 |
||
1816 | 3948 |
methodForJavaMethodObject:aJavaMethodObject |
752 | 3949 |
" |
3950 |
Given an instance of java.lang.reflect.Method, answers |
|
3951 |
real method associated with it." |
|
3952 |
^ self reflection methodForJavaMethodObject:aJavaMethodObject. |
|
3953 |
||
3954 |
"Modified: / 07-02-2011 / 09:50:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3955 |
"Modified: / 28-02-2011 / 16:58:05 / Marcel Hlopko <hlopik@gmail.com>" |
|
3956 |
! ! |
|
3957 |
||
1476 | 3958 |
!JavaVM class methodsFor:'monitors'! |
3959 |
||
1816 | 3960 |
getJavaMonitorFor:someObject |
1691 | 3961 |
| mon | |
3962 |
||
3963 |
"/ JV@2012-04-13: Removed the critical section - this method should be called |
|
3964 |
"/ only when interrupts are blocked |
|
1816 | 3965 |
"/ LockTableAccess |
1691 | 3966 |
"/ critical: [ |
3967 |
mon := LockTable at:someObject ifAbsent:nil. |
|
3968 |
mon isNil ifTrue:[ |
|
3969 |
LockTable at:someObject put:(mon := JavaMonitor for:someObject) |
|
3970 |
]. |
|
1816 | 3971 |
|
1691 | 3972 |
"/ ]. |
1816 | 3973 |
|
1691 | 3974 |
^ mon |
3975 |
||
3976 |
"Created: / 02-01-1998 / 19:01:52 / cg" |
|
3977 |
"Modified: / 30-11-2011 / 20:40:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
3978 |
"Modified: / 13-04-2012 / 00:44:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3979 |
! |
|
3980 |
||
1816 | 3981 |
monitorEnter:someObject in:aJavaContext |
1691 | 3982 |
| thisProcess wasBlocked lockWordOrJavaMonitor | |
3983 |
||
3984 |
self assert:(aJavaContext isNil or:[ aJavaContext isJavaContext ]). |
|
3985 |
someObject isNil ifTrue:[ |
|
1476 | 3986 |
self throwNullPointerException. |
1691 | 3987 |
self breakPoint:#mh. |
1476 | 3988 |
^ self |
3989 |
]. |
|
3990 |
thisProcess := Processor activeProcess. |
|
1691 | 3991 |
MonitorTrace ifTrue:[ |
1816 | 3992 |
Logger |
3993 |
log:('MONENTER: entering monitor for %1 in %2' |
|
1691 | 3994 |
bindWith:(self monitorFriendlyPrintStringOf:someObject) |
3995 |
with:thisProcess name) |
|
3996 |
severity:#debug |
|
3997 |
facility:#JVM. |
|
3998 |
]. |
|
1476 | 3999 |
wasBlocked := OperatingSystem blockInterrupts. |
1691 | 4000 |
|
4001 |
"/ Fetch the lockword. If it is thinlock, iflate it |
|
4002 |
lockWordOrJavaMonitor := someObject getJavaLockWord. |
|
4003 |
lockWordOrJavaMonitor class == SmallInteger ifTrue:[ |
|
1816 | 4004 |
self inflateLockFor: someObject lockword: lockWordOrJavaMonitor |
1691 | 4005 |
] ifFalse:[ |
4006 |
lockWordOrJavaMonitor class ~~ JavaMonitor ifTrue:[ |
|
4007 |
self internalError: 'lockWord does not contain SmallIntefer nor JavaMonitor!!'. |
|
4008 |
] |
|
4009 |
]. |
|
4010 |
||
4011 |
"/ Now, we're sure that the lock is fat JavaMonitor, enter it |
|
4012 |
self enterMonitor:someObject ofProcess:thisProcess. |
|
4013 |
"/ aJavaContext notNil ifTrue:[aJavaContext addMonitor:someObject]. |
|
4014 |
||
4015 |
wasBlocked ifFalse:[ OperatingSystem unblockInterrupts ]. |
|
4016 |
||
4017 |
MonitorTrace ifTrue:[ |
|
1816 | 4018 |
Logger |
1691 | 4019 |
log:'MONENTER: monitor entered in ' , thisProcess name |
4020 |
severity:#debug |
|
4021 |
facility:#JVM. |
|
1476 | 4022 |
]. |
4023 |
||
4024 |
"Created: / 08-11-2011 / 15:15:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4025 |
"Modified: / 27-08-2012 / 11:49:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1476 | 4026 |
! |
4027 |
||
1816 | 4028 |
monitorExit: someObject in: aJavaContext |
1476 | 4029 |
| thisProcess wasBlocked| |
1691 | 4030 |
"/ self assert: (aJavaContext isJavaContext). |
1476 | 4031 |
someObject isNil ifTrue: [ |
4032 |
self throwNullPointerException. |
|
4033 |
self breakPoint: #mh. |
|
4034 |
^ self |
|
4035 |
]. |
|
4036 |
thisProcess := Processor activeProcess. |
|
4037 |
MonitorTrace ifTrue: [ |
|
1816 | 4038 |
Logger |
4039 |
log: ('MONEXIT: leaving monitor for %1 in %2' |
|
1476 | 4040 |
bindWith: (self monitorFriendlyPrintStringOf: someObject) |
4041 |
with: thisProcess name) , thisProcess name |
|
4042 |
severity: #info |
|
4043 |
facility: #JVM. |
|
4044 |
]. |
|
4045 |
||
4046 |
wasBlocked := OperatingSystem blockInterrupts. |
|
4047 |
self leaveMonitor: someObject ofProcess: thisProcess. |
|
1691 | 4048 |
"/ aJavaContext notNil ifTrue:[aJavaContext removeMonitor: someObject]. |
1476 | 4049 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
4050 |
||
4051 |
MonitorTrace ifTrue: [ |
|
1816 | 4052 |
Logger |
1476 | 4053 |
log: 'MONEXIT: monitor left in ' , thisProcess name |
4054 |
severity: #info |
|
4055 |
facility: #JVM. |
|
4056 |
]. |
|
4057 |
||
4058 |
"Created: / 08-11-2011 / 15:17:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4059 |
"Modified: / 27-08-2012 / 11:49:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4060 |
! |
|
4061 |
||
1816 | 4062 |
notify: obj |
1476 | 4063 |
| mon thisProcess wasBlocked| |
4064 |
||
4065 |
wasBlocked := OperatingSystem blockInterrupts. |
|
4066 |
thisProcess := Processor activeProcess. |
|
1691 | 4067 |
mon := obj getJavaMonitor. |
1476 | 4068 |
(mon isOwnedBy: thisProcess) ifFalse: [ |
4069 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
1816 | 4070 |
self |
1476 | 4071 |
throwIllegalMonitorStateException: 'monitor was not owned when called notify'. |
4072 |
^self. |
|
4073 |
]. |
|
4074 |
mon notify. |
|
4075 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
4076 |
||
4077 |
"Created: / 22-11-2011 / 13:26:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4078 |
"Modified: / 26-08-2012 / 18:39:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4079 |
! |
|
4080 |
||
1816 | 4081 |
notifyAll: obj |
1476 | 4082 |
| mon thisProcess wasBlocked| |
4083 |
||
4084 |
wasBlocked := OperatingSystem blockInterrupts. |
|
4085 |
thisProcess := Processor activeProcess. |
|
1691 | 4086 |
mon := obj getJavaMonitor. |
1476 | 4087 |
(mon isOwnedBy: thisProcess) ifFalse: [ |
4088 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
1816 | 4089 |
self |
1476 | 4090 |
throwIllegalMonitorStateException: 'monitor was not owned when called notify'. |
4091 |
^self |
|
4092 |
||
4093 |
]. |
|
4094 |
mon notifyAll. |
|
4095 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
4096 |
||
4097 |
"Created: / 22-11-2011 / 13:26:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4098 |
"Modified: / 26-08-2012 / 18:39:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1476 | 4099 |
! |
4100 |
||
4101 |
releaseMonitorsOfUnwindingContext: aJavaContext |
|
4102 |
"Forcibly releases all monitors acquired by given context. |
|
4103 |
Use by unwind handlers" |
|
4104 |
||
1691 | 4105 |
| thisProcess wasBlocked receiver lockWord | |
1478 | 4106 |
MonitorTrace ifTrue:[ |
1816 | 4107 |
Logger |
1486 | 4108 |
log: ('UNWIND HANDLER: force-leaving ',aJavaContext acquiredMonitors size printString,'monitors acquired by: ' , aJavaContext printString ) |
1478 | 4109 |
severity: #info |
4110 |
facility: #JVM. |
|
4111 |
]. |
|
1476 | 4112 |
thisProcess := Processor activeProcess. |
4113 |
||
4114 |
wasBlocked := OperatingSystem blockInterrupts. |
|
1691 | 4115 |
receiver := aJavaContext acquiredMonitors. |
4116 |
receiver notNil ifTrue:[ |
|
4117 |
lockWord := receiver getJavaLockWord. |
|
4118 |
] ifFalse:[ |
|
4119 |
lockWord := 0. |
|
4120 |
]. |
|
1816 | 4121 |
%{ |
1691 | 4122 |
if (lockWord != __MKINT(0)) { |
4123 |
__monitorExit(receiver); |
|
4124 |
} |
|
4125 |
%}. |
|
1476 | 4126 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
4127 |
||
1478 | 4128 |
MonitorTrace ifTrue:[ |
1816 | 4129 |
Logger |
1478 | 4130 |
log: ('UNWIND HANDLER: leftover monitors left for ' , aJavaContext printString ) |
4131 |
severity: #info |
|
4132 |
facility: #JVM. |
|
4133 |
]. |
|
1476 | 4134 |
|
4135 |
"Created: / 05-04-2012 / 11:35:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4136 |
! |
|
4137 |
||
1816 | 4138 |
sleepForTimeout: tmo state: state |
1476 | 4139 |
"wait" |
1816 | 4140 |
|
1476 | 4141 |
| thisProcess | |
1691 | 4142 |
|
1476 | 4143 |
thisProcess := Processor activeProcess. |
4144 |
thisProcess isInterrupted ifTrue: [ |
|
4145 |
thisProcess clearInterrupted. |
|
1691 | 4146 |
self throwInterruptedException: 'process was interrupted before/during sleep !!?' |
1476 | 4147 |
]. |
4148 |
thisProcess state: state. |
|
4149 |
(Delay forMilliseconds: tmo) waitWithState: state. |
|
4150 |
thisProcess isInterrupted ifTrue: [ |
|
4151 |
thisProcess clearInterrupted. |
|
1691 | 4152 |
self throwInterruptedException: 'process was interrupted before/during sleep !!?' |
1476 | 4153 |
]. |
4154 |
||
4155 |
"Created: / 30-12-1998 / 19:19:35 / cg" |
|
4156 |
"Modified: / 08-01-1999 / 17:29:24 / cg" |
|
4157 |
"Created: / 30-11-2011 / 11:04:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4158 |
"Modified (format): / 26-08-2012 / 18:40:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4159 |
! |
|
4160 |
||
1816 | 4161 |
waitOn: obj forTimeout: tmo state: state |
1476 | 4162 |
"wait" |
1816 | 4163 |
|
1476 | 4164 |
| wasBlocked thisProcess mon | |
4165 |
thisProcess := Processor activeProcess. |
|
4166 |
thisProcess isInterrupted ifTrue: [ |
|
4167 |
thisProcess clearInterrupted. |
|
1816 | 4168 |
self |
1476 | 4169 |
throwInterruptedException: 'process was interrupted before/during wait !!?' |
4170 |
]. |
|
4171 |
wasBlocked := OperatingSystem blockInterrupts. |
|
1691 | 4172 |
mon := obj getJavaMonitor. |
1476 | 4173 |
(mon isOwnedBy: thisProcess) ifFalse: [ |
4174 |
wasBlocked ifFalse: [ OperatingSystem unblockInterrupts ]. |
|
4175 |
self throwIllegalMonitorStateException: 'monitor was not owned on wait by ' , thisProcess printString. |
|
4176 |
^self. |
|
4177 |
]. |
|
4178 |
state notNil ifTrue: [ thisProcess state: state ]. |
|
4179 |
wasBlocked ifFalse: [ OperatingSystem unblockInterrupts ]. |
|
4180 |
mon waitForMilliseconds: tmo. |
|
4181 |
thisProcess isInterrupted ifTrue: [ |
|
4182 |
thisProcess clearInterrupted. |
|
1816 | 4183 |
self |
1476 | 4184 |
throwInterruptedException: 'process was interrupted before/during wait !!?' |
4185 |
]. |
|
4186 |
||
4187 |
"Created: / 30-12-1998 / 19:19:35 / cg" |
|
4188 |
"Modified: / 08-01-1999 / 17:29:24 / cg" |
|
4189 |
"Created: / 22-11-2011 / 13:20:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4190 |
"Modified: / 26-08-2012 / 18:40:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1476 | 4191 |
! ! |
4192 |
||
4193 |
!JavaVM class methodsFor:'monitors-internal'! |
|
4194 |
||
1816 | 4195 |
acquireMonitor: obj ofProcess: aProcess |
1476 | 4196 |
"Acquire* (stay in the queue and get it) monitor. |
4197 |
*leave is the word used by jvm spec" |
|
1816 | 4198 |
|
1476 | 4199 |
| mon | |
1691 | 4200 |
mon := obj getJavaMonitor. |
1476 | 4201 |
self assert: mon notNil. |
4202 |
MonitorTrace ifTrue: [ |
|
1816 | 4203 |
Logger |
4204 |
log: ('acquiring monitor %1 owned by thread: %2' |
|
1476 | 4205 |
bindWith: (self monitorFriendlyPrintStringOf: obj) |
4206 |
with: aProcess name) |
|
4207 |
severity: #debug |
|
4208 |
facility: #JVM. |
|
4209 |
]. |
|
4210 |
mon acquire. |
|
4211 |
self assert:(mon isOwnedBy: aProcess). |
|
1691 | 4212 |
"/ self acquiredMonitorsOf: aProcess add: obj. |
4213 |
"/ self assert: ((self enteredMonitorsOfProcessAt: aProcess) includes: obj). |
|
4214 |
"/ self assert: ((self acquiredMonitorsOfProcessAt: aProcess) includes: obj). |
|
1476 | 4215 |
|
4216 |
"Created: / 17-11-2011 / 19:01:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4217 |
"Modified: / 27-08-2012 / 23:24:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1476 | 4218 |
! |
4219 |
||
1816 | 4220 |
acquireMonitorAndNotifyAll: handle |
1476 | 4221 |
| mon | |
1691 | 4222 |
mon := handle getJavaMonitor. |
1476 | 4223 |
mon enter. |
4224 |
self notifyAll: handle. |
|
4225 |
mon exit. |
|
4226 |
||
4227 |
"Created: / 29-11-2011 / 14:24:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4228 |
"Modified: / 27-08-2012 / 01:06:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1476 | 4229 |
! |
4230 |
||
1816 | 4231 |
acquireMonitorsOfProcess: aProcess |
1476 | 4232 |
"will try to acquire all entered monitors of process" |
1816 | 4233 |
|
1476 | 4234 |
| enteredMonitors | |
4235 |
(self hasEnteredMonitorsOfProcess: aProcess) ifTrue: [ |
|
4236 |
enteredMonitors := self copyEnteredMonitorsOfProcessAt: aProcess. |
|
4237 |
self assert: enteredMonitors notNil. |
|
4238 |
enteredMonitors do: [:each | self acquireMonitor: each ofProcess: aProcess. ]. |
|
4239 |
]. |
|
4240 |
||
4241 |
"Created: / 17-11-2011 / 17:16:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4242 |
! |
|
4243 |
||
1816 | 4244 |
acquiredMonitorsOf: aProcess add: anyObject |
4245 |
||
1476 | 4246 |
^ (self acquiredMonitorsOfProcess: aProcess) add: anyObject. |
4247 |
||
4248 |
"Modified: / 08-01-1999 / 14:02:15 / cg" |
|
4249 |
"Created: / 17-11-2011 / 18:29:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4250 |
! |
|
4251 |
||
1816 | 4252 |
acquiredMonitorsOf: aProcess remove: anyObject |
1476 | 4253 |
"/ self assert: ((self acquiredMonitorsOfProcess: aProcess) includes: anyObject). |
4254 |
MonitorTrace ifTrue:[ |
|
4255 |
self assert: ((self acquiredMonitorsOfProcess: aProcess) last first == anyObject). |
|
4256 |
] ifFalse:[ |
|
4257 |
self assert: ((self acquiredMonitorsOfProcess: aProcess) last == anyObject). |
|
4258 |
]. |
|
4259 |
(self acquiredMonitorsOfProcess: aProcess) removeLast. |
|
4260 |
||
4261 |
"Modified: / 08-01-1999 / 14:02:15 / cg" |
|
4262 |
"Created: / 17-11-2011 / 18:40:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4263 |
"Modified: / 11-04-2012 / 23:37:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4264 |
! |
|
4265 |
||
1816 | 4266 |
acquiredMonitorsOfProcess: aProcess |
1476 | 4267 |
^ AcquiredMonitorsPerProcess at: aProcess |
4268 |
ifAbsent: [ |
|
4269 |
| monitors | |
|
4270 |
monitors := OrderedCollection new. |
|
4271 |
AcquiredMonitorsPerProcess at: aProcess put: monitors. |
|
4272 |
monitors |
|
1816 | 4273 |
] |
1476 | 4274 |
. |
4275 |
||
4276 |
"Created: / 17-11-2011 / 18:29:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4277 |
! |
|
4278 |
||
1816 | 4279 |
acquiredMonitorsOfProcessAt: aProcess |
4280 |
||
4281 |
||
1476 | 4282 |
^ AcquiredMonitorsPerProcess at: aProcess ifAbsent: nil. |
4283 |
||
4284 |
"Created: / 08-01-1999 / 14:02:02 / cg" |
|
4285 |
"Created: / 17-11-2011 / 17:03:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4286 |
! |
|
4287 |
||
1816 | 4288 |
copyAcquiredMonitorsOfProcessAt: aProcess |
1476 | 4289 |
"does not create empty collection like enteredMonitorsOfProcess" |
1816 | 4290 |
|
1476 | 4291 |
^ (AcquiredMonitorsPerProcess at: aProcess ifAbsent: nil) copy. |
4292 |
||
4293 |
"Created: / 08-01-1999 / 14:02:02 / cg" |
|
4294 |
"Created: / 17-11-2011 / 19:23:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4295 |
! |
|
4296 |
||
1816 | 4297 |
copyEnteredMonitorsOfProcessAt: aProcess |
1476 | 4298 |
"does not create empty collection like enteredMonitorsOfProcess" |
1816 | 4299 |
|
1476 | 4300 |
^ (EnteredMonitorsPerProcess at: aProcess ifAbsent: nil) copy. |
4301 |
||
4302 |
"Created: / 08-01-1999 / 14:02:02 / cg" |
|
4303 |
"Created: / 17-11-2011 / 19:22:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4304 |
! |
|
4305 |
||
1816 | 4306 |
countAcquiredMonitorsOfProcess: aProcess |
1476 | 4307 |
| acquiredMonitors | |
4308 |
acquiredMonitors := self acquiredMonitorsOfProcessAt: aProcess. |
|
4309 |
^ acquiredMonitors isNil ifTrue: [ 0 ] ifFalse: [ acquiredMonitors size ]. |
|
4310 |
||
4311 |
"Created: / 17-11-2011 / 18:23:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4312 |
! |
|
4313 |
||
1816 | 4314 |
countEnteredMonitorsOfProcess: aProcess |
1476 | 4315 |
| enteredMonitors | |
4316 |
enteredMonitors := self enteredMonitorsOfProcessAt: aProcess. |
|
4317 |
^ enteredMonitors isNil ifTrue: [ 0 ] ifFalse: [ enteredMonitors size ]. |
|
4318 |
||
4319 |
"Created: / 17-11-2011 / 17:14:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4320 |
! |
|
4321 |
||
1816 | 4322 |
enterMonitor: obj ofProcess: aProcess |
1476 | 4323 |
"registers itself as one of processes wanting monitor and then tries to acquire it." |
1816 | 4324 |
|
1476 | 4325 |
| mon objInLists | |
4326 |
MonitorTrace ifTrue:[ |
|
4327 |
MonitorTraceId := MonitorTraceId + 1. |
|
4328 |
objInLists := { obj . MonitorTraceId } |
|
4329 |
] ifFalse:[ |
|
4330 |
objInLists := obj |
|
4331 |
]. |
|
1691 | 4332 |
"/ self enteredMonitorsOf: aProcess add: objInLists. |
4333 |
mon := obj getJavaMonitor. |
|
1476 | 4334 |
self assert: mon notNil. |
4335 |
MonitorTrace ifTrue: [ |
|
4336 |
||
1816 | 4337 |
Logger |
4338 |
log: ('[trace id %3] Entering monitor %1 owned by thread: %2' |
|
1476 | 4339 |
bindWith: (self monitorFriendlyPrintStringOf: obj) |
4340 |
with: aProcess id |
|
4341 |
with: MonitorTraceId) |
|
4342 |
severity: #trace |
|
4343 |
facility: #JVM |
|
4344 |
originator: self |
|
4345 |
"/attachment: thisContext fullPrintAllString |
|
4346 |
]. |
|
4347 |
mon enter. |
|
4348 |
self assert: (mon isOwnedBy: aProcess). |
|
1691 | 4349 |
"/ self acquiredMonitorsOf: aProcess add: objInLists. |
4350 |
"/ self assert: ((self enteredMonitorsOfProcessAt: aProcess) includes: objInLists). |
|
4351 |
"/ self assert: ((self acquiredMonitorsOfProcessAt: aProcess) includes: objInLists). |
|
1476 | 4352 |
|
4353 |
"Created: / 17-11-2011 / 19:03:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4354 |
"Modified: / 27-08-2012 / 23:21:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1476 | 4355 |
! |
4356 |
||
1816 | 4357 |
enteredMonitorsOf: aProcess add: anyObject |
1476 | 4358 |
|
4359 |
^ (self enteredMonitorsOfProcess: aProcess) addLast: anyObject. |
|
4360 |
||
4361 |
"Modified: / 08-01-1999 / 14:02:15 / cg" |
|
4362 |
"Created: / 17-11-2011 / 16:25:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4363 |
"Modified: / 13-04-2012 / 01:05:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4364 |
! |
|
4365 |
||
1816 | 4366 |
enteredMonitorsOf: aProcess remove: anyObject |
1476 | 4367 |
"/ self assert: ((self enteredMonitorsOfProcess: aProcess) includes: anyObject). |
4368 |
"/ self assert: ((self enteredMonitorsOfProcess: aProcess) last == anyObject). |
|
4369 |
MonitorTrace ifTrue:[ |
|
4370 |
self assert: ((self enteredMonitorsOfProcess: aProcess) last first == anyObject). |
|
4371 |
] ifFalse:[ |
|
4372 |
self assert: ((self enteredMonitorsOfProcess: aProcess) last == anyObject). |
|
4373 |
]. |
|
4374 |
||
4375 |
||
4376 |
(self enteredMonitorsOfProcess: aProcess) removeLast. |
|
4377 |
||
4378 |
"Modified: / 08-01-1999 / 14:02:15 / cg" |
|
4379 |
"Created: / 17-11-2011 / 18:40:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4380 |
"Modified: / 11-04-2012 / 23:37:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4381 |
! |
|
4382 |
||
1816 | 4383 |
enteredMonitorsOfProcess: aProcess |
1476 | 4384 |
^ EnteredMonitorsPerProcess at: aProcess |
4385 |
ifAbsent: [ |
|
4386 |
| monitors | |
|
4387 |
monitors := OrderedCollection new. |
|
4388 |
EnteredMonitorsPerProcess at: aProcess put: monitors. |
|
4389 |
monitors |
|
4390 |
] |
|
4391 |
. |
|
4392 |
||
4393 |
"Created: / 08-01-1999 / 14:02:02 / cg" |
|
4394 |
"Modified: / 17-11-2011 / 19:22:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4395 |
! |
|
4396 |
||
1816 | 4397 |
enteredMonitorsOfProcessAt: aProcess |
1476 | 4398 |
"does not create empty collection like enteredMonitorsOfProcess" |
1816 | 4399 |
|
1476 | 4400 |
^ EnteredMonitorsPerProcess at: aProcess ifAbsent: nil. |
4401 |
||
4402 |
"Created: / 08-01-1999 / 14:02:02 / cg" |
|
4403 |
"Created: / 16-11-2011 / 15:37:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4404 |
! |
|
4405 |
||
4406 |
exitOwnedMonitorsOfProcess |
|
4407 |
|thisProcess monitors| |
|
4408 |
thisProcess := Processor activeProcess. |
|
4409 |
monitors := self acquiredMonitorsOfProcess: thisProcess. |
|
4410 |
monitors do: [:each | self assert: (each isOwnedBy:thisProcess). |
|
4411 |
each exit. |
|
4412 |
] |
|
4413 |
||
4414 |
"Created: / 05-12-2011 / 21:15:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4415 |
! |
|
4416 |
||
1816 | 4417 |
has: aProcess enteredMonitorFor: anyObject |
1476 | 4418 |
^ (self enteredMonitorsOfProcess: aProcess) includes: anyObject. |
4419 |
||
4420 |
"Created: / 17-11-2011 / 16:28:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4421 |
! |
|
4422 |
||
1816 | 4423 |
hasAcquiredMonitorsOfProcess: aProcess |
1476 | 4424 |
| acquiredMonitors | |
4425 |
acquiredMonitors := self acquiredMonitorsOfProcessAt: aProcess. |
|
1816 | 4426 |
^ acquiredMonitors isNil |
1476 | 4427 |
ifTrue: [ false ] |
4428 |
ifFalse: [ acquiredMonitors size > 0 ]. |
|
4429 |
||
4430 |
"Created: / 17-11-2011 / 17:07:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4431 |
! |
|
4432 |
||
1816 | 4433 |
hasEnteredMonitorsOfProcess: aProcess |
1476 | 4434 |
| enteredMonitors | |
4435 |
enteredMonitors := self enteredMonitorsOfProcessAt: aProcess. |
|
4436 |
^ enteredMonitors isNil ifTrue: [ false ] ifFalse: [ enteredMonitors size > 0]. |
|
4437 |
||
4438 |
"Created: / 17-11-2011 / 17:09:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4439 |
! |
|
4440 |
||
1691 | 4441 |
inflateLockFor: obj lockword: lw |
1816 | 4442 |
| threadId count mon | |
1691 | 4443 |
%{ |
4444 |
threadId = __MKINT(__LOCKWORD_TID_GET(lw)); |
|
4445 |
count = __MKINT(__LOCKWORD_CNT_GET(lw)); |
|
4446 |
%}. |
|
4447 |
^ JavaMonitor for: obj thread: threadId nestedLockCount: count. |
|
4448 |
||
4449 |
"Modified (format): / 27-08-2012 / 15:34:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4450 |
! |
|
4451 |
||
1816 | 4452 |
leaveMonitor: obj ofProcess: aProcess |
4453 |
"Leave* (release and never come back, exit) monitor owned by given project. |
|
1476 | 4454 |
*leave is the word used by jvm spec" |
1816 | 4455 |
|
1476 | 4456 |
| mon | |
1691 | 4457 |
mon := obj getJavaMonitor. |
1476 | 4458 |
self assert: mon notNil. |
4459 |
"/self assert: (mon isOwnedBy: aProcess). |
|
4460 |
MonitorTrace ifTrue: [ |
|
1816 | 4461 |
Logger |
4462 |
log: ('[trace id %3] leaving monitor %1 owned by thread: %2 ' |
|
1476 | 4463 |
bindWith: (self monitorFriendlyPrintStringOf: obj) |
4464 |
with: aProcess name |
|
4465 |
with: (self enteredMonitorsOfProcess: aProcess) last second) |
|
4466 |
severity: #trace |
|
4467 |
facility: #JVM |
|
4468 |
originator: self |
|
4469 |
"/attachment: thisContext fullPrintAllString |
|
4470 |
||
4471 |
]. |
|
4472 |
mon exit. |
|
1691 | 4473 |
"/ self acquiredMonitorsOf: aProcess remove: obj. |
4474 |
"/ self enteredMonitorsOf: aProcess remove: obj. |
|
1476 | 4475 |
|
4476 |
"Created: / 17-11-2011 / 18:46:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4477 |
"Modified: / 27-08-2012 / 23:22:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1476 | 4478 |
! |
4479 |
||
1816 | 4480 |
leaveMonitorsOfProcess: aProcess |
1476 | 4481 |
"Leave* (release and never come back, exit) all monitors owned by given project. |
4482 |
Called when cleaning up after process death or when handling smalltalk (non-java) exceptions |
|
4483 |
(such an exception in native method) |
|
4484 |
*leave is the word used by jvm spec" |
|
1816 | 4485 |
|
1476 | 4486 |
| monitors | |
4487 |
monitors := EnteredMonitorsPerProcess at: aProcess ifAbsent: nil. |
|
4488 |
monitors notNil ifTrue: [ |
|
1816 | 4489 |
monitors do: [:obj | |
1691 | 4490 |
|
1476 | 4491 |
| mon | |
1691 | 4492 |
mon := obj getJavaMonitor. |
1476 | 4493 |
mon notNil ifTrue: [ |
4494 |
(mon isOwnedBy: aProcess) ifTrue: [ |
|
1816 | 4495 |
Logger |
1476 | 4496 |
log: ('leaving monitor owned by dying thread: ' , aProcess name) |
4497 |
severity: #info |
|
4498 |
facility: #JVM. |
|
4499 |
self breakPoint: #jv. |
|
4500 |
mon exit |
|
4501 |
]. |
|
4502 |
]. |
|
4503 |
]. |
|
4504 |
EnteredMonitorsPerProcess removeKey: aProcess. |
|
4505 |
]. |
|
4506 |
||
4507 |
"Created: / 17-11-2011 / 16:51:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4508 |
"Modified (format): / 27-08-2012 / 11:37:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1476 | 4509 |
! |
4510 |
||
1816 | 4511 |
monitorExit: someObject in: aJavaContext ifOwnedBy: aProcess |
1476 | 4512 |
| monitor | |
1691 | 4513 |
monitor := someObject getJavaMonitor. |
1476 | 4514 |
(monitor isOwnedBy: aProcess) ifTrue: [ |
4515 |
self monitorExit: someObject in: aJavaContext |
|
4516 |
] ifFalse: [ |
|
4517 |
MonitorTrace ifTrue: [ |
|
1816 | 4518 |
Logger |
4519 |
log: ('%1 trying to exit monitor for %2, but it does not own it. Ignoring' |
|
1476 | 4520 |
bindWith: aProcess name |
4521 |
with: (self monitorFriendlyPrintStringOf: someObject)) |
|
4522 |
severity: #debug |
|
4523 |
facility: #JVM |
|
4524 |
] |
|
4525 |
]. |
|
4526 |
||
4527 |
"Created: / 17-11-2011 / 21:17:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4528 |
"Modified: / 26-08-2012 / 20:00:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1687 | 4529 |
! |
4530 |
||
1816 | 4531 |
monitorFriendlyPrintStringOf: someObject |
1476 | 4532 |
| objString | |
4533 |
someObject isJavaClass ifTrue: [ objString := someObject name ] ifFalse: [ |
|
1816 | 4534 |
objString := someObject class name , '@' |
1476 | 4535 |
, someObject identityHash printString. |
4536 |
]. |
|
4537 |
^ objString |
|
4538 |
! |
|
4539 |
||
1816 | 4540 |
releaseMonitor: obj ofProcess: aProcess |
4541 |
"Release* (let go and wait for it again) monitor owned by given project. |
|
1476 | 4542 |
*word used by jvm spec" |
1816 | 4543 |
|
1476 | 4544 |
| mon | |
1691 | 4545 |
mon := obj getJavaMonitor. |
1476 | 4546 |
self assert: mon notNil. |
4547 |
self assert: (mon isOwnedBy: aProcess). |
|
4548 |
MonitorTrace ifTrue: [ |
|
1816 | 4549 |
Logger |
4550 |
log: ('releasing monitor %1 owned by thread: %2' |
|
1476 | 4551 |
bindWith: (self monitorFriendlyPrintStringOf: obj) |
4552 |
with: aProcess name) |
|
4553 |
severity: #debug |
|
4554 |
facility: #JVM. |
|
4555 |
]. |
|
4556 |
mon release. |
|
4557 |
self acquiredMonitorsOf: aProcess remove: obj. |
|
1691 | 4558 |
"/ self assert: ((self enteredMonitorsOfProcessAt: aProcess) includes: obj). |
1476 | 4559 |
|
4560 |
"Created: / 17-11-2011 / 18:51:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 4561 |
"Modified: / 27-08-2012 / 23:24:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1476 | 4562 |
! |
4563 |
||
4564 |
releaseMonitorsOfProcess |
|
4565 |
||
4566 |
self releaseMonitorsOfProcess: Processor activeProcess |
|
4567 |
||
4568 |
"Created: / 04-11-2011 / 22:15:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4569 |
! |
|
4570 |
||
1816 | 4571 |
releaseMonitorsOfProcess: aProcess |
1476 | 4572 |
"Releases* all monitors owned by given project. |
4573 |
Monitor can be acquired again, (aProcess going into WAIT) |
|
4574 |
*word used by jvm spec" |
|
1816 | 4575 |
|
1476 | 4576 |
| monitors | |
4577 |
monitors := self copyAcquiredMonitorsOfProcessAt: aProcess. |
|
4578 |
monitors notNil ifTrue: [ |
|
4579 |
monitors do: [:obj | self releaseMonitor: obj ofProcess: aProcess. ]. |
|
4580 |
]. |
|
4581 |
||
4582 |
"Created: / 04-11-2011 / 22:15:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4583 |
"Modified: / 17-11-2011 / 21:29:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4584 |
"Modified (comment): / 05-12-2011 / 21:13:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4585 |
! |
|
4586 |
||
1816 | 4587 |
unwindHandlerForJavaContext: aJavaContext |
1476 | 4588 |
"given a context which has been marked for unwind, |
4589 |
retrieve the handler block. This method is called when ST |
|
4590 |
exception raises and stack is unwinding. JavaClass instance |
|
4591 |
has an opportunity to clean up monitors" |
|
1816 | 4592 |
|
1476 | 4593 |
^ [ |
4594 |
| thisProcess | |
|
4595 |
aJavaContext shouldExecuteFinallyOnUnwind ifTrue:[ |
|
4596 |
self throwExceptionForFinallyIn: aJavaContext |
|
4597 |
]. |
|
4598 |
self releaseMonitorsOfUnwindingContext: aJavaContext. |
|
4599 |
]. |
|
4600 |
||
4601 |
"Created: / 08-11-2011 / 12:30:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4602 |
"Modified: / 17-11-2011 / 21:33:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4603 |
"Modified: / 10-04-2012 / 11:08:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4604 |
! ! |
|
4605 |
||
1615 | 4606 |
!JavaVM class methodsFor:'monitors-obsolete'! |
4607 |
||
1816 | 4608 |
waitFor: sema state: pState timeOut: tmo |
1615 | 4609 |
"wait" |
1816 | 4610 |
|
1615 | 4611 |
| wasBlocked thisProcess releasedCount acquiredCount | |
4612 |
thisProcess := Processor activeProcess. |
|
4613 |
wasBlocked := OperatingSystem blockInterrupts. |
|
4614 |
releasedCount := self countAcquiredMonitorsOfProcess: thisProcess. |
|
4615 |
(self hasAcquiredMonitorsOfProcess: thisProcess) ifTrue: [ |
|
4616 |
MonitorTrace ifTrue: [ |
|
1816 | 4617 |
Logger |
4618 |
log: thisProcess name , ' going into WAIT - releasing ' |
|
4619 |
, (self countAcquiredMonitorsOfProcess: thisProcess) printString |
|
1615 | 4620 |
, ' monitors' |
4621 |
severity: #debug |
|
4622 |
facility: #JVM. |
|
4623 |
]. |
|
4624 |
self releaseMonitorsOfProcess: thisProcess. |
|
4625 |
]. |
|
4626 |
wasBlocked ifFalse: [ OperatingSystem unblockInterrupts ]. |
|
4627 |
pState notNil ifTrue: [ thisProcess state: pState ]. |
|
4628 |
sema isNil ifTrue: [ Delay waitForMilliseconds: tmo ] ifFalse: [ |
|
4629 |
(tmo isNil or: [ tmo = 0 ]) ifTrue: [ sema wait. ] ifFalse: [ |
|
4630 |
sema waitWithTimeout: tmo / 1000. |
|
4631 |
]. |
|
4632 |
]. |
|
1816 | 4633 |
|
1615 | 4634 |
"/ re-enter monitors. |
1816 | 4635 |
|
1615 | 4636 |
(self hasEnteredMonitorsOfProcess: thisProcess) ifTrue: [ |
4637 |
wasBlocked := OperatingSystem blockInterrupts. |
|
1816 | 4638 |
Logger |
4639 |
log: thisProcess name , ' has been notified - trying to acquire ' |
|
4640 |
, (self countEnteredMonitorsOfProcess: thisProcess) printString |
|
1615 | 4641 |
, ' monitors' |
4642 |
severity: #debug |
|
4643 |
facility: #JVM. |
|
4644 |
self acquireMonitorsOfProcess: thisProcess. |
|
4645 |
acquiredCount := self countAcquiredMonitorsOfProcess: thisProcess. |
|
4646 |
self assert: acquiredCount = releasedCount. |
|
4647 |
wasBlocked ifFalse: [ OperatingSystem unblockInterrupts ]. |
|
4648 |
]. |
|
4649 |
||
4650 |
"Created: / 30-12-1998 / 19:19:35 / cg" |
|
4651 |
"Modified: / 08-01-1999 / 17:29:24 / cg" |
|
4652 |
"Modified: / 20-11-2011 / 12:36:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
4653 |
! ! |
|
4654 |
||
761 | 4655 |
!JavaVM class methodsFor:'native - java.lang'! |
4656 |
||
1377 | 4657 |
_java_lang_System_arraycopy: nativeContext |
1974 | 4658 |
"Forward here as optimized code delegates to JavaVM" |
4659 |
||
2010
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2008
diff
changeset
|
4660 |
^ NativeMethodsImplementation _java_lang_System_arraycopy: nativeContext receiver _:(nativeContext argAt:1) _: (nativeContext argAt:2) _: (nativeContext argAt:3) _: (nativeContext argAt:4) _: (nativeContext argAt:5) |
1991
4969b4562cec
Removed OLD natives implementation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
4661 |
|
4969b4562cec
Removed OLD natives implementation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
4662 |
"Modified: / 21-01-2013 / 09:18:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
995 | 4663 |
! ! |
4664 |
||
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4665 |
!JavaVM class methodsFor:'queries'! |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4666 |
|
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4667 |
booted |
1209 | 4668 |
|
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4669 |
| jVM | |
1209 | 4670 |
|
4671 |
"/Slightly faster variant of the code below |
|
4672 |
^SystemClassLoader notNil and:[ |
|
4673 |
jVM := JavaVM classNamed: 'sun.misc.VM'. |
|
4674 |
jVM notNil and: [ (jVM instVarNamed: #booted) == 1 ] |
|
4675 |
]. |
|
4676 |
||
4677 |
"/ jVM := JavaVM classNamed: 'sun.misc.VM'. |
|
4678 |
"/ ^ jVM notNil and: [ (jVM instVarNamed: #booted) == 1 ] and: [self systemClassLoader notNil]. |
|
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4679 |
|
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4680 |
" |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4681 |
JavaVM booted" |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4682 |
|
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4683 |
"Created: / 08-08-2011 / 10:04:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4684 |
"Modified: / 02-11-2011 / 22:08:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1209 | 4685 |
"Modified: / 04-12-2011 / 10:32:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4686 |
! ! |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
4687 |
|
1615 | 4688 |
!JavaVM class methodsFor:'threads'! |
4689 |
||
4690 |
clearInterrupted: process |
|
4691 |
ThreadInterrupts removeKey: process ifAbsent: [] |
|
4692 |
||
4693 |
"Created: / 16-08-2012 / 22:03:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4694 |
! |
|
4695 |
||
4696 |
isInterrupted: process |
|
4697 |
^ThreadInterrupts at: process ifAbsent:[false]. |
|
4698 |
||
4699 |
"Created: / 16-08-2012 / 22:05:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4700 |
! |
|
4701 |
||
4702 |
park: process timeout: tout |
|
4703 |
"A helper for sun.misc.Unsafe.park()" |
|
4704 |
||
4705 |
| blocked sema | |
|
4706 |
||
4707 |
blocked := OperatingSystem blockInterrupts. |
|
4708 |
ParkUnparkSemaphores isNil ifTrue:[ |
|
4709 |
ParkUnparkSemaphores := Dictionary new. |
|
4710 |
]. |
|
4711 |
sema := ParkUnparkSemaphores at: process ifAbsentPut:[Semaphore new]. |
|
4712 |
blocked ifFalse:[ OperatingSystem unblockInterrupts ]. |
|
4713 |
||
4714 |
Logger log: 'parking thread ', process printString severity: #debug facility: #JVM. |
|
4715 |
sema parkWithTimeoutMs: tout. |
|
4716 |
Logger log: 'parked thread ', process printString , ' resumed' severity: #debug facility: #JVM. |
|
4717 |
||
4718 |
"Created: / 16-08-2012 / 21:51:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4719 |
! |
|
4720 |
||
4721 |
setInterrupted: process |
|
4722 |
ThreadInterrupts at: process put: true |
|
4723 |
||
4724 |
"Created: / 16-08-2012 / 22:03:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4725 |
! |
|
4726 |
||
4727 |
terminateAllThreads |
|
4728 |
Java terminateAllThreads. |
|
4729 |
JavaEventThread := nil. |
|
4730 |
JavaScreenUpdaterThread := JavaEventQueueThread := nil. |
|
4731 |
||
4732 |
"Created: / 8.1.1998 / 17:43:54 / cg" |
|
4733 |
"Modified: / 24.12.1999 / 02:33:16 / cg" |
|
4734 |
! |
|
4735 |
||
1816 | 4736 |
threadStart: nativeContext |
1615 | 4737 |
"start the thread" |
1816 | 4738 |
|
1615 | 4739 |
| jThread jName nm stProcess helper | |
4740 |
jThread := nativeContext receiver. |
|
4741 |
self assert: (jThread instVarNamed: 'priority') > 0. |
|
4742 |
stProcess := JavaProcess for: (helper := JavaProcess newHelper) |
|
4743 |
priority: (Processor activePriority). |
|
4744 |
helper javaThreadObject: jThread. |
|
4745 |
helper javaProcess: stProcess. |
|
4746 |
jName := jThread instVarNamed: 'name'. |
|
4747 |
jName isString ifFalse: [ nm := Java as_ST_String: jName. ] ifTrue: [ |
|
4748 |
nm := jName |
|
4749 |
]. |
|
1816 | 4750 |
|
1615 | 4751 |
"/ kludge - remember the ScreenUpdater ... |
1816 | 4752 |
|
1615 | 4753 |
nm = 'Screen Updater' ifTrue: [ JavaScreenUpdaterThread := stProcess. ] ifFalse: [ |
4754 |
nm = 'AWT-Windows' ifTrue: [ JavaEventThread := stProcess. ] ifFalse: [ |
|
4755 |
(nm startsWith: 'AWT-EventQueue') ifTrue: [ |
|
4756 |
JavaEventQueueThread := stProcess. |
|
4757 |
]. |
|
4758 |
] |
|
4759 |
]. |
|
1816 | 4760 |
|
1615 | 4761 |
"/ when that process terminates, wakup any waiters |
4762 |
"/mh 29.11.11 this makes join work |
|
4763 |
"/mh 30.11.11 disable wait is to ensure that join can be called on thread after its finished and dont wait forever" |
|
1816 | 4764 |
|
4765 |
stProcess |
|
1615 | 4766 |
addExitAction: [ |
1816 | 4767 |
Logger |
4768 |
log: ('%1 is going to die, notifying all waiters and disabling waiting on its monitor' |
|
1615 | 4769 |
bindWith: jThread printString) |
1129
085eb3d2d932
logging monitor stuff only if MonitorTrace = true
hlopkmar
parents:
1128
diff
changeset
|
4770 |
severity: #debug |
085eb3d2d932
logging monitor stuff only if MonitorTrace = true
hlopkmar
parents:
1128
diff
changeset
|
4771 |
facility: #JVM. |
1615 | 4772 |
jThread instVarNamed: 'threadStatus' put: 0. |
1691 | 4773 |
jThread getJavaMonitor disableWait. |
1615 | 4774 |
self acquireMonitorAndNotifyAll: jThread. |
1692 | 4775 |
ThreadInterrupts notNil ifTrue:[ |
4776 |
ThreadInterrupts removeKey: stProcess ifAbsent:[] |
|
4777 |
]. |
|
1615 | 4778 |
]. |
4779 |
stProcess name: 'JAVA-' , nm. |
|
4780 |
stProcess restartable: true. |
|
4781 |
jThread instVarNamed: 'threadStatus' put: 1. |
|
4782 |
Java addThread: jThread for: stProcess. |
|
1816 | 4783 |
stProcess resume. |
1615 | 4784 |
^ nil |
4785 |
||
4786 |
"Modified: / 24-12-1999 / 03:14:33 / cg" |
|
4787 |
"Created: / 14-12-2010 / 21:31:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4788 |
"Modified: / 09-12-2011 / 12:58:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1692 | 4789 |
"Modified: / 03-09-2012 / 18:42:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1615 | 4790 |
! |
4791 |
||
4792 |
unpark: process |
|
4793 |
"A helper for sun.misc.Unsafe.unpark()" |
|
4794 |
||
4795 |
| blocked sema | |
|
4796 |
||
4797 |
blocked := OperatingSystem blockInterrupts. |
|
4798 |
ParkUnparkSemaphores isNil ifTrue:[ParkUnparkSemaphores dictionary new]. |
|
4799 |
sema := ParkUnparkSemaphores at: process ifAbsentPut:[Semaphore new]. |
|
4800 |
blocked ifFalse:[ OperatingSystem unblockInterrupts ]. |
|
4801 |
||
4802 |
Logger log: 'unparking thread ', process printString severity: #debug facility: #JVM. |
|
4803 |
sema signal. |
|
4804 |
||
4805 |
"Created: / 16-08-2012 / 21:52:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 4806 |
! ! |
4807 |
||
4808 |
!JavaVM class methodsFor:'vm support'! |
|
4809 |
||
1816 | 4810 |
_ANEWARRAY:cls _:size |
1735 | 4811 |
"Returns a new array of elements of type class." |
1816 | 4812 |
|
1735 | 4813 |
self assert: cls isBehavior. |
1151 | 4814 |
size < 0 ifTrue:[ |
4815 |
self throwExceptionClassName:'java.lang.NegativeArraySizeException' |
|
4816 |
withMessage:'negative array size not allowed'. |
|
4817 |
^nil |
|
1816 | 4818 |
]. |
1735 | 4819 |
self assert:cls javaArrayClass isJavaArrayClass. |
4820 |
^ cls javaArrayClass new:size |
|
752 | 4821 |
|
4822 |
"Created: / 17-12-2010 / 14:28:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1151 | 4823 |
"Modified: / 22-11-2011 / 09:46:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 4824 |
! |
4825 |
||
4826 |
_ARRAYLENGTH:arr |
|
4827 |
arr isNil ifTrue:[ |
|
824 | 4828 |
"/self halt:'should not happen'. |
4829 |
self throwNullPointerException. |
|
752 | 4830 |
]. |
4831 |
^ arr size |
|
4832 |
||
824 | 4833 |
"Created: / 08-01-1999 / 14:38:27 / cg" |
4834 |
"Modified: / 31-05-2011 / 10:09:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 4835 |
! |
4836 |
||
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
4837 |
_ATHROW:aJavaException |
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
4838 |
|
752 | 4839 |
<resource: #skipInDebuggersWalkBack> |
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
4840 |
|
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
4841 |
aJavaException isNil ifTrue:[ |
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
4842 |
self halt:'cannot happen' |
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
4843 |
]. |
1452
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
4844 |
"When an exception is handled in Smalltalk code and the stack is |
1455 | 4845 |
being unwound, then all intermediate Java finally blocks are executed. |
1816 | 4846 |
This is done by fake-throwing special FinallyToken, as there must an |
1452
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
4847 |
exception instance for Java. A Java compiler compiles unconditional |
1455 | 4848 |
ATHROW at the end of finally block to pass execution to another handler. |
1452
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
4849 |
We don't want to do so, in case we're manually invoking finally blocks. |
1455 | 4850 |
Hence following hack: we teleport back to handler caller" |
1461 | 4851 |
aJavaException class == JavaContext::FinallyToken ifTrue:[ |
1455 | 4852 |
aJavaException pass. |
1459 | 4853 |
self halt:'Should never be reached'. |
1452
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1433
diff
changeset
|
4854 |
]. |
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
4855 |
self throwException:aJavaException |
752 | 4856 |
|
4857 |
"Created: / 08-01-1999 / 14:15:36 / cg" |
|
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
4858 |
"Modified: / 08-11-2011 / 16:32:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1461 | 4859 |
"Modified: / 09-04-2012 / 21:00:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 4860 |
! |
4861 |
||
1816 | 4862 |
_CHECKCAST2: object _: classRef |
4863 |
"Called by the VM (java bytecode interpreter) for unhandled cases. |
|
1714 | 4864 |
Unlike in _CHECKCAST:_: the second parameter is a class reference, |
4865 |
not the class itself!! Will wanish!!" |
|
1816 | 4866 |
|
802 | 4867 |
| class | |
4868 |
||
1714 | 4869 |
classRef isJavaRef ifTrue: [ class := classRef resolve ] ifFalse: [ |
4870 |
self error: 'I expected classRefs only - maybe I was wrong' |
|
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
4871 |
]. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
4872 |
(object isNil or: [ (self canCast: object class to: class) not ]) ifTrue: [ |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
4873 |
self breakPoint: #mh. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
4874 |
self throwClassCastException. |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
4875 |
^ false |
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
4876 |
]. |
1816 | 4877 |
|
802 | 4878 |
^ true. |
4879 |
||
4880 |
"Created: / 19-05-2011 / 10:12:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1714 | 4881 |
"Modified (comment): / 09-10-2012 / 11:56:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4882 |
! |
|
4883 |
||
4884 |
_CHECKCAST: object _: class |
|
1816 | 4885 |
"Called from the JIT-compiled code for unhandled cases. |
1714 | 4886 |
Unlike in _CHECKCAST2:_: the second parameter is a class,, |
1716
cd3a3a8a0fef
Added primitive to test patch/unpatch context. See XLOAD testcase.
vranyj1
parents:
1714
diff
changeset
|
4887 |
not a class class reference!! |
cd3a3a8a0fef
Added primitive to test patch/unpatch context. See XLOAD testcase.
vranyj1
parents:
1714
diff
changeset
|
4888 |
|
cd3a3a8a0fef
Added primitive to test patch/unpatch context. See XLOAD testcase.
vranyj1
parents:
1714
diff
changeset
|
4889 |
This method *MUST* return the object for this may lead |
cd3a3a8a0fef
Added primitive to test patch/unpatch context. See XLOAD testcase.
vranyj1
parents:
1714
diff
changeset
|
4890 |
into GC. See ___checkcast() VM function |
cd3a3a8a0fef
Added primitive to test patch/unpatch context. See XLOAD testcase.
vranyj1
parents:
1714
diff
changeset
|
4891 |
" |
1816 | 4892 |
|
1714 | 4893 |
(self canCast: object class to: class) ifFalse: [ |
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
4894 |
self throwClassCastException. |
1716
cd3a3a8a0fef
Added primitive to test patch/unpatch context. See XLOAD testcase.
vranyj1
parents:
1714
diff
changeset
|
4895 |
^ nil "Not reached" |
cd3a3a8a0fef
Added primitive to test patch/unpatch context. See XLOAD testcase.
vranyj1
parents:
1714
diff
changeset
|
4896 |
]. |
cd3a3a8a0fef
Added primitive to test patch/unpatch context. See XLOAD testcase.
vranyj1
parents:
1714
diff
changeset
|
4897 |
^ object |
752 | 4898 |
|
4899 |
"Created: / 08-01-1999 / 14:53:51 / cg" |
|
4900 |
"Modified: / 09-01-1999 / 00:45:21 / cg" |
|
1714 | 4901 |
"Modified: / 09-10-2012 / 11:53:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 4902 |
! |
4903 |
||
4904 |
_D2I:op1 |
|
4905 |
|v| |
|
4906 |
||
4907 |
v := op1 asInteger. |
|
4908 |
v > 16r7FFFFFFF ifTrue:[ |
|
4909 |
self halt. |
|
4910 |
v := 16r7FFFFFFF |
|
4911 |
] ifFalse:[ |
|
4912 |
v < 16r80000000 negated ifTrue:[ |
|
4913 |
self halt. |
|
4914 |
v := 16r80000000 negated |
|
4915 |
] |
|
4916 |
]. |
|
4917 |
^ v |
|
4918 |
||
4919 |
"Modified: / 17.10.1998 / 21:55:49 / cg" |
|
4920 |
"Created: / 8.1.1999 / 14:47:13 / cg" |
|
4921 |
! |
|
4922 |
||
4923 |
_D2L:op1 |
|
4924 |
|v| |
|
4925 |
||
4926 |
v := op1 asInteger. |
|
4927 |
v > 16r7FFFFFFFFFFFFFFF ifTrue:[ |
|
4928 |
self halt. |
|
4929 |
v := 16r7FFFFFFFFFFFFFFF |
|
4930 |
] ifFalse:[ |
|
4931 |
v < 16r8000000000000000 negated ifTrue:[ |
|
4932 |
self halt. |
|
4933 |
v := 16r8000000000000000 negated |
|
4934 |
] |
|
4935 |
]. |
|
4936 |
^ v |
|
4937 |
||
4938 |
"Modified: / 17.10.1998 / 21:55:49 / cg" |
|
4939 |
"Created: / 8.1.1999 / 14:46:44 / cg" |
|
4940 |
! |
|
4941 |
||
4942 |
_DADD:op1 _:op2 |
|
4943 |
^ op1 asFloat + op2 asFloat |
|
4944 |
||
4945 |
"Created: / 8.1.1999 / 15:11:59 / cg" |
|
4946 |
! |
|
4947 |
||
4948 |
_DDIV:op1 _:op2 |
|
981 | 4949 |
^ op1 asFloat uncheckedDivide: op2 asFloat. |
4950 |
||
4951 |
"Created: / 08-01-1999 / 15:09:10 / cg" |
|
4952 |
"Modified: / 06-09-2011 / 19:31:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 4953 |
! |
4954 |
||
4955 |
_DMUL:op1 _:op2 |
|
4956 |
^ op1 asFloat * op2 asFloat |
|
4957 |
||
4958 |
"Created: / 8.1.1999 / 14:49:52 / cg" |
|
4959 |
! |
|
4960 |
||
4961 |
_DNEG:op |
|
4962 |
^ op asFloat negated |
|
4963 |
||
4964 |
"Created: / 8.1.1999 / 15:06:15 / cg" |
|
4965 |
! |
|
4966 |
||
4967 |
_DSUB:op1 _:op2 |
|
4968 |
^ op1 asFloat - op2 asFloat |
|
4969 |
||
4970 |
"Created: / 8.1.1999 / 15:10:59 / cg" |
|
4971 |
! |
|
4972 |
||
4973 |
_F2I:op1 |
|
4974 |
^ self _D2I:op1 |
|
4975 |
||
4976 |
"Created: / 8.1.1999 / 14:47:42 / cg" |
|
4977 |
! |
|
4978 |
||
4979 |
_F2L:op1 |
|
4980 |
^ self _D2L:op1 |
|
4981 |
||
4982 |
"Created: / 8.1.1999 / 14:47:53 / cg" |
|
4983 |
! |
|
4984 |
||
4985 |
_FADD:op1 _:op2 |
|
4986 |
^ op1 asShortFloat + op2 asShortFloat |
|
4987 |
||
4988 |
"Created: / 8.1.1999 / 15:11:36 / cg" |
|
4989 |
! |
|
4990 |
||
4991 |
_FDIV:op1 _:op2 |
|
1514 | 4992 |
|
4993 |
op1 isZero ifTrue:[ |
|
4994 |
op2 isZero ifTrue:[ ^ Float NaN ] |
|
4995 |
]. |
|
4996 |
op2 isZero ifTrue:[ |
|
4997 |
^ Float infinity |
|
4998 |
]. |
|
752 | 4999 |
^ op1 asShortFloat / op2 asShortFloat. |
5000 |
||
1514 | 5001 |
"Created: / 08-01-1999 / 15:09:32 / cg" |
5002 |
"Modified: / 06-07-2012 / 13:12:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 5003 |
! |
5004 |
||
5005 |
_FMUL:op1 _:op2 |
|
5006 |
^ op1 asShortFloat * op2 asShortFloat |
|
5007 |
||
5008 |
"Created: / 8.1.1999 / 14:50:10 / cg" |
|
5009 |
! |
|
5010 |
||
5011 |
_FNEG:op |
|
5012 |
^ op asShortFloat negated |
|
5013 |
||
5014 |
"Created: / 8.1.1999 / 15:06:33 / cg" |
|
5015 |
! |
|
5016 |
||
5017 |
_FSUB:op1 _:op2 |
|
5018 |
^ op1 asShortFloat - op2 asShortFloat |
|
5019 |
||
5020 |
"Created: / 8.1.1999 / 15:08:17 / cg" |
|
5021 |
! |
|
5022 |
||
1727 | 5023 |
_INSTANCEOF:object _:class |
1816 | 5024 |
"Called from the jitted code for unhandled cases. |
1727 | 5025 |
Unlike in _INSTANCEOF_R:_: the second parameter is a class,, |
5026 |
not a class class reference!!" |
|
5027 |
||
5028 |
object isNil ifTrue:[^0]. |
|
5029 |
^(self canCast: object class to: class) |
|
5030 |
ifTrue:[1] |
|
5031 |
ifFalse:[0] |
|
5032 |
||
5033 |
"Created: / 08-01-1999 / 14:52:54 / cg" |
|
5034 |
"Modified: / 27-01-1999 / 20:56:25 / cg" |
|
5035 |
"Modified: / 09-10-2012 / 11:55:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5036 |
"Modified (comment): / 15-10-2012 / 21:51:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5037 |
! |
|
5038 |
||
1816 | 5039 |
_INSTANCEOF_R: object _: classRef |
5040 |
"Called by the VM (java bytecode interpreter) for unhandled cases. |
|
1714 | 5041 |
Unlike _INSTANCEOF:_: the second parameter is a class reference, |
5042 |
not the class itself!! Will wanish!!" |
|
5043 |
||
5044 |
| class | |
|
5045 |
||
5046 |
classRef isJavaRef ifFalse: [self error: 'expected only classRefs - maybe I was wrong']. |
|
802 | 5047 |
class := classRef resolve. |
1714 | 5048 |
object isNil ifTrue: [ ^ 0 ]. |
802 | 5049 |
^ (self canCast: object class to: class) ifTrue: [ 1 ] ifFalse: [ 0 ]. |
5050 |
||
1727 | 5051 |
"Created: / 15-10-2012 / 21:51:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 5052 |
! |
5053 |
||
5054 |
_L2D:op1 |
|
5055 |
^ op1 asFloat |
|
5056 |
||
5057 |
"Created: / 8.1.1999 / 14:46:09 / cg" |
|
5058 |
! |
|
5059 |
||
5060 |
_L2F:op1 |
|
5061 |
^ op1 asShortFloat |
|
5062 |
||
5063 |
"Created: / 8.1.1999 / 14:46:18 / cg" |
|
5064 |
"Modified: / 8.1.1999 / 14:50:18 / cg" |
|
5065 |
! |
|
5066 |
||
5067 |
_LADD:op1 _:op2 |
|
5068 |
|sum| |
|
5069 |
||
5070 |
sum := (op1 + op2) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
5071 |
^ sum |
|
5072 |
||
5073 |
"Created: / 8.1.1999 / 15:07:39 / cg" |
|
5074 |
! |
|
5075 |
||
5076 |
_LAND:op1 _:op2 |
|
5077 |
|rslt| |
|
5078 |
||
5079 |
(op1 < 0 or:[op2 < 0]) ifTrue:[ |
|
5080 |
self halt. |
|
5081 |
]. |
|
5082 |
rslt := op1 bitAnd: op2. |
|
5083 |
^ rslt |
|
5084 |
||
5085 |
"Modified: / 7.1.1998 / 21:21:53 / cg" |
|
5086 |
"Created: / 8.1.1999 / 14:54:22 / cg" |
|
5087 |
! |
|
5088 |
||
1729 | 5089 |
_LDC_R: ref |
5090 |
"Called by JIT-compiled code for non-constant |
|
5091 |
reference (StringRef or ClassRef" |
|
5092 |
||
5093 |
^ref isJavaClassRef ifTrue:[ |
|
5094 |
self javaClassObjectForClass: ref resolve |
|
5095 |
] ifFalse:[ |
|
5096 |
ref resolve |
|
5097 |
] |
|
5098 |
||
5099 |
"Created: / 16-10-2012 / 09:34:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5100 |
! |
|
5101 |
||
752 | 5102 |
_LDIV:op1 _:op2 |
5103 |
|quo| |
|
5104 |
||
5105 |
quo := op1 quo: op2. |
|
5106 |
^ quo |
|
5107 |
||
5108 |
"Created: / 8.1.1999 / 15:04:47 / cg" |
|
5109 |
! |
|
5110 |
||
5111 |
_LMUL:op1 _:op2 |
|
5112 |
|prod o1 o2 sign| |
|
5113 |
||
5114 |
"/ self halt. |
|
5115 |
"/ ST's largeIntegers compute a correct result; |
|
5116 |
"/ but here, we want the overflow to flow into the |
|
5117 |
"/ sign bit ... (sigh) |
|
5118 |
||
5119 |
sign := 1. |
|
5120 |
(o1 := op1) < 0 ifTrue:[ |
|
5121 |
sign := -1. |
|
5122 |
o1 := o1 negated. |
|
5123 |
]. |
|
5124 |
(o2 := op2) < 0 ifTrue:[ |
|
5125 |
sign := sign negated. |
|
5126 |
o2 := o2 negated. |
|
5127 |
]. |
|
5128 |
||
5129 |
prod := (o1 * o2) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
5130 |
(prod bitAnd:16r8000000000000000) ~~ 0 ifTrue:[ |
|
5131 |
]. |
|
5132 |
sign == -1 ifTrue:[ |
|
5133 |
prod := prod negated |
|
5134 |
]. |
|
5135 |
^ prod |
|
5136 |
||
5137 |
"Created: / 8.1.1999 / 15:10:04 / cg" |
|
5138 |
! |
|
5139 |
||
5140 |
_LNEG:op |
|
5141 |
^ op asInteger negated |
|
5142 |
||
5143 |
"Created: / 8.1.1999 / 15:06:59 / cg" |
|
5144 |
! |
|
5145 |
||
5146 |
_LOR:op1 _:op2 |
|
5147 |
|rslt| |
|
5148 |
||
5149 |
(op1 < 0 or:[op2 < 0]) ifTrue:[ |
|
5150 |
self halt. |
|
5151 |
]. |
|
5152 |
rslt := op1 bitOr: op2. |
|
5153 |
^ rslt |
|
5154 |
||
5155 |
"Created: / 8.1.1999 / 15:05:10 / cg" |
|
5156 |
! |
|
5157 |
||
5158 |
_LREM:op1 _:op2 |
|
5159 |
|rem| |
|
5160 |
||
5161 |
rem := op1 rem: op2. |
|
5162 |
^ rem |
|
5163 |
||
5164 |
"Modified: / 7.1.1998 / 00:23:11 / cg" |
|
5165 |
"Created: / 8.1.1999 / 15:04:23 / cg" |
|
5166 |
! |
|
5167 |
||
5168 |
_LSHL:op1 _:op2 |
|
5169 |
|rslt| |
|
5170 |
||
5171 |
(op1 < 0) ifTrue:[ |
|
5172 |
self halt. |
|
5173 |
]. |
|
5174 |
rslt := (op1 bitShift:op2) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
5175 |
^ rslt |
|
5176 |
||
5177 |
"Created: / 8.1.1999 / 14:51:08 / cg" |
|
5178 |
! |
|
5179 |
||
5180 |
_LSHR:op1 _:op2 |
|
5181 |
|rslt| |
|
5182 |
||
5183 |
op1 < 0 ifTrue:[ |
|
5184 |
self halt |
|
5185 |
]. |
|
5186 |
||
5187 |
(op1 < 0) ifTrue:[ |
|
5188 |
self halt. |
|
5189 |
]. |
|
5190 |
rslt := (op1 bitShift:op2 negated) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
5191 |
^ rslt |
|
5192 |
||
5193 |
"Created: / 8.1.1999 / 14:51:57 / cg" |
|
5194 |
! |
|
5195 |
||
5196 |
_LSUB:op1 _:op2 |
|
5197 |
|diff| |
|
5198 |
||
5199 |
diff := (op1 - op2) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
5200 |
^ diff |
|
5201 |
||
5202 |
"Created: / 8.1.1999 / 15:10:33 / cg" |
|
5203 |
! |
|
5204 |
||
5205 |
_LUSHR:op1 _:op2 |
|
5206 |
|rslt| |
|
5207 |
||
5208 |
op1 < 0 ifTrue:[ |
|
5209 |
self halt |
|
5210 |
]. |
|
5211 |
||
5212 |
(op1 < 0) ifTrue:[ |
|
5213 |
self halt. |
|
5214 |
]. |
|
5215 |
rslt := (op1 bitShift:op2 negated) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
5216 |
^ rslt |
|
5217 |
||
5218 |
"Modified: / 7.1.1998 / 21:22:17 / cg" |
|
5219 |
"Created: / 8.1.1999 / 14:51:32 / cg" |
|
5220 |
! |
|
5221 |
||
5222 |
_LXOR:op1 _:op2 |
|
5223 |
|rslt| |
|
5224 |
||
5225 |
(op1 < 0 or:[op2 < 0]) ifTrue:[ |
|
5226 |
self halt. |
|
5227 |
]. |
|
5228 |
rslt := op1 bitXor: op2. |
|
5229 |
^ rslt |
|
5230 |
||
5231 |
"Created: / 8.1.1999 / 15:12:28 / cg" |
|
5232 |
! |
|
5233 |
||
1816 | 5234 |
_MONITORENTER: someObject |
1103 | 5235 |
self assert: (thisContext sender isJavaContext). |
5236 |
self assert: (thisContext sender isMarkedForUnwind). |
|
1691 | 5237 |
|
1100 | 5238 |
self monitorEnter: someObject in: thisContext sender. |
752 | 5239 |
|
905 | 5240 |
"Created: / 08-01-1999 / 14:23:10 / cg" |
5241 |
"Modified: / 08-01-1999 / 18:47:26 / cg" |
|
5242 |
"Modified: / 10-08-2011 / 20:19:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1103 | 5243 |
"Modified: / 09-11-2011 / 19:23:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1691 | 5244 |
"Modified (format): / 26-08-2012 / 15:20:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5245 |
! |
|
5246 |
||
5247 |
_MONITOREXIT: someObject |
|
1100 | 5248 |
self monitorExit: someObject in: thisContext sender. |
752 | 5249 |
|
905 | 5250 |
"Created: / 08-01-1999 / 14:23:19 / cg" |
5251 |
"Modified: / 08-01-1999 / 18:47:08 / cg" |
|
1100 | 5252 |
"Modified: / 09-11-2011 / 12:42:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1691 | 5253 |
"Modified: / 26-08-2012 / 23:51:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 5254 |
! |
5255 |
||
1816 | 5256 |
_MULTINEW2: classRef _: dim1 |
927 | 5257 |
|
5258 |
| arrCls arr | |
|
5259 |
||
1151 | 5260 |
dim1 < 0 ifTrue:[ |
5261 |
self throwExceptionClassName:'java.lang.NegativeArraySizeException' |
|
5262 |
withMessage:'negative array size not allowed'. |
|
5263 |
^nil |
|
5264 |
]. |
|
927 | 5265 |
self assert: classRef isJavaClassRef. |
5266 |
arrCls := classRef resolve. |
|
5267 |
arr := arrCls new: dim1. |
|
804 | 5268 |
^ arr. |
5269 |
||
5270 |
"Created: / 19-05-2011 / 10:46:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1151 | 5271 |
"Modified: / 22-11-2011 / 09:45:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
927 | 5272 |
! |
5273 |
||
5274 |
_MULTINEW2: classRef _: dim1 _: dim2 |
|
5275 |
||
5276 |
| arrCls arr | |
|
5277 |
||
1151 | 5278 |
dim1 < 0 ifTrue:[ |
5279 |
self throwExceptionClassName:'java.lang.NegativeArraySizeException' |
|
5280 |
withMessage:'negative array size not allowed'. |
|
5281 |
^nil |
|
5282 |
]. |
|
5283 |
dim2 < 0 ifTrue:[ |
|
5284 |
self throwExceptionClassName:'java.lang.NegativeArraySizeException' |
|
5285 |
withMessage:'negative array size not allowed'. |
|
5286 |
^nil |
|
5287 |
]. |
|
5288 |
||
5289 |
||
927 | 5290 |
self assert: classRef isJavaClassRef. |
5291 |
arrCls := classRef resolve. |
|
928 | 5292 |
arr := arrCls new: dim2. |
5293 |
1 to: dim2 do:[:i| |
|
5294 |
arr at: i put: (arrCls javaComponentClass new: dim1) |
|
927 | 5295 |
]. |
804 | 5296 |
^ arr. |
5297 |
||
5298 |
"Created: / 19-05-2011 / 10:47:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1151 | 5299 |
"Modified: / 22-11-2011 / 09:45:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
927 | 5300 |
! |
5301 |
||
5302 |
_MULTINEW2: classRef _: dim1 _: dim2 _: dim3 |
|
5303 |
||
5304 |
| arrCls arr | |
|
5305 |
||
1151 | 5306 |
dim1 < 0 ifTrue:[ |
5307 |
self throwExceptionClassName:'java.lang.NegativeArraySizeException' |
|
5308 |
withMessage:'negative array size not allowed'. |
|
5309 |
^nil |
|
5310 |
]. |
|
5311 |
dim2 < 0 ifTrue:[ |
|
5312 |
self throwExceptionClassName:'java.lang.NegativeArraySizeException' |
|
5313 |
withMessage:'negative array size not allowed'. |
|
5314 |
^nil |
|
5315 |
]. |
|
5316 |
dim3 < 0 ifTrue:[ |
|
5317 |
self throwExceptionClassName:'java.lang.NegativeArraySizeException' |
|
5318 |
withMessage:'negative array size not allowed'. |
|
5319 |
^nil |
|
5320 |
]. |
|
5321 |
||
5322 |
||
927 | 5323 |
self assert: classRef isJavaClassRef. |
5324 |
arrCls := classRef resolve. |
|
928 | 5325 |
arr := arrCls new: dim3. |
5326 |
1 to: dim3 do:[:i| |
|
927 | 5327 |
| arr2 | |
5328 |
arr2 := arrCls javaComponentClass new: dim2. |
|
5329 |
1 to: dim2 do:[:j| |
|
928 | 5330 |
arr2 at: j put: (arrCls javaComponentClass javaComponentClass new: dim1). |
927 | 5331 |
]. |
5332 |
arr at: i put: arr2. |
|
5333 |
]. |
|
804 | 5334 |
^ arr. |
5335 |
||
5336 |
"Created: / 19-05-2011 / 10:47:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1151 | 5337 |
"Modified: / 22-11-2011 / 09:45:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
804 | 5338 |
! |
5339 |
||
1816 | 5340 |
_MULTINEW:typeRef _:dim1 |
752 | 5341 |
|
5342 |
|arr| |
|
5343 |
||
5344 |
arr := typeRef new:dim1. |
|
5345 |
||
5346 |
^ arr |
|
5347 |
||
5348 |
"Created: / 08-01-1999 / 14:15:42 / cg" |
|
5349 |
"Modified: / 08-01-1999 / 18:03:05 / cg" |
|
5350 |
"Modified: / 16-03-2011 / 16:20:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5351 |
! |
|
5352 |
||
1816 | 5353 |
_MULTINEW: typeRef _: dim1 _: dim2 |
752 | 5354 |
| arr | |
5355 |
||
804 | 5356 |
arr := typeRef new: dim2. |
5357 |
1 to: dim2 |
|
5358 |
do: [:idx | arr at: idx put: (self _MULTINEW: typeRef javaComponentClass _: dim1) ]. |
|
752 | 5359 |
^ arr |
5360 |
||
5361 |
"Created: / 08-01-1999 / 14:15:46 / cg" |
|
5362 |
"Modified: / 08-01-1999 / 17:58:11 / cg" |
|
5363 |
"Modified: / 16-03-2011 / 16:19:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5364 |
! |
|
5365 |
||
1816 | 5366 |
_MULTINEW:typeRef _:dim1 _:dim2 _:dim3 |
752 | 5367 |
|clsRef cls arr elType elSizes| |
5368 |
||
5369 |
clsRef := typeRef asClassPointerRef. |
|
851 | 5370 |
cls := clsRef javaArrayClass. |
752 | 5371 |
arr := cls new:dim3. |
5372 |
elType := typeRef deref. |
|
851 | 5373 |
1 to:dim3 |
5374 |
do: |
|
1816 | 5375 |
[:idx | |
851 | 5376 |
arr at:idx |
1816 | 5377 |
put:(self |
851 | 5378 |
_MULTINEW:elType |
5379 |
_:dim1 |
|
5380 |
_:dim2) ]. |
|
1816 | 5381 |
|
752 | 5382 |
"/ self halt. |
1816 | 5383 |
|
752 | 5384 |
^ arr |
5385 |
||
5386 |
"Modified: / 6.1.1998 / 23:34:35 / cg" |
|
5387 |
"Created: / 8.1.1999 / 14:15:49 / cg" |
|
1497 | 5388 |
! |
5389 |
||
1727 | 5390 |
_NEW: cls |
5391 |
| inst | |
|
5392 |
||
5393 |
cls classInit. "/initializes the class if it is not already" |
|
1793 | 5394 |
inst := cls basicNew. |
1727 | 5395 |
thisContext sender method flushCode. |
5396 |
^inst. |
|
5397 |
||
5398 |
"Created: / 15-10-2012 / 21:53:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1793 | 5399 |
"Modified: / 02-11-2012 / 21:09:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1727 | 5400 |
! |
5401 |
||
1816 | 5402 |
_NEWARRAY:type _:size |
1497 | 5403 |
"VM helper method NEWARRAY insn. Called only when |
5404 |
size is not an SmallInt or negative" |
|
5405 |
||
5406 |
size < 0 ifTrue:[ |
|
5407 |
self throwNegativeArraySizeException: size. |
|
5408 |
] |
|
5409 |
||
5410 |
"Created: / 13-05-2012 / 14:46:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1727 | 5411 |
! |
5412 |
||
5413 |
_NEW_R: clsRef |
|
5414 |
| cls inst | |
|
5415 |
||
5416 |
cls := clsRef resolve. "/initializes the class if it is not already" |
|
1793 | 5417 |
inst := cls basicNew. |
1727 | 5418 |
thisContext sender method flushCode. |
5419 |
^inst. |
|
5420 |
||
5421 |
"Created: / 15-10-2012 / 21:54:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1793 | 5422 |
"Modified: / 02-11-2012 / 21:10:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 5423 |
! ! |
5424 |
||
5425 |
!JavaVM class methodsFor:'windows - events'! |
|
5426 |
||
1816 | 5427 |
awtEventsForEvent: anEvent javaWindow: jWin |
752 | 5428 |
"given an ST/X event, create corresponding AWT event(s) for it" |
1816 | 5429 |
|
1033 | 5430 |
| jEv jEv1 jEv2 modifiers key keyChar untranslatedKey id type x y w h view menu resized moved eventArgs clickCount jRect jKeyEventClass jInputEventClass jMouseEventClass jWindowEventClass jPaintEventClass jComponentEventClass | |
752 | 5431 |
|
5432 |
type := anEvent type. |
|
5433 |
eventArgs := anEvent arguments. |
|
5434 |
key := 0. |
|
5435 |
modifiers := 0. |
|
5436 |
x := 0. |
|
5437 |
y := 0. |
|
1816 | 5438 |
((type == #exposeX:y:width:height:) |
5439 |
or: [ (type == #graphicExposeX:y:width:height:) or: [ (type == #damage) ] ]) |
|
1033 | 5440 |
ifTrue: [ |
5441 |
"/ jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'. |
|
5442 |
"/ id := (jPaintEventClass instVarNamed:'PAINT'). |
|
5443 |
jPaintEventClass := self classForName: 'java.awt.event.PaintEvent'. |
|
5444 |
id := (jPaintEventClass instVarNamed: 'UPDATE'). |
|
1816 | 5445 |
((type == #exposeX:y:width:height:) |
5446 |
or: [ (type == #graphicExposeX:y:width:height:) ]) |
|
1033 | 5447 |
ifTrue: [ |
5448 |
x := eventArgs at: 1. |
|
5449 |
y := eventArgs at: 2. |
|
5450 |
w := eventArgs at: 3. |
|
5451 |
h := eventArgs at: 4. |
|
5452 |
] |
|
5453 |
ifFalse: [ |
|
5454 |
x := eventArgs left. |
|
5455 |
y := eventArgs top. |
|
5456 |
w := eventArgs width. |
|
5457 |
h := eventArgs height. |
|
5458 |
]. |
|
5459 |
jRect := (Java classForName: 'java.awt.Rectangle') basicNew. |
|
5460 |
jRect instVarNamed: 'x' put: x. |
|
5461 |
jRect instVarNamed: 'y' put: y. |
|
5462 |
jRect instVarNamed: 'width' put: w. |
|
5463 |
jRect instVarNamed: 'height' put: h. |
|
5464 |
jEv := jPaintEventClass newCleared. |
|
5465 |
jEv instVarNamed: 'id' put: id. |
|
5466 |
jEv instVarNamed: 'updateRect' put: jRect. |
|
1816 | 5467 |
|
752 | 5468 |
"/ jEv instVarNamed:'g' put:jWin. |
1816 | 5469 |
|
1033 | 5470 |
^ Array with: jEv. |
5471 |
]. |
|
1816 | 5472 |
(anEvent isKeyEvent |
5473 |
or: [ anEvent isButtonEvent or: [ anEvent isPointerEnterLeaveEvent ] ]) |
|
1033 | 5474 |
ifTrue: [ |
5475 |
jInputEventClass := Java classForName: 'java.awt.event.InputEvent'. |
|
5476 |
anEvent hasAlt ifTrue: [ |
|
5477 |
modifiers := modifiers bitOr: (jInputEventClass instVarNamed: 'ALT_MASK') |
|
5478 |
]. |
|
5479 |
anEvent hasCtrl ifTrue: [ |
|
5480 |
modifiers := modifiers bitOr: (jInputEventClass instVarNamed: 'CTRL_MASK') |
|
5481 |
]. |
|
5482 |
anEvent hasMeta ifTrue: [ |
|
5483 |
modifiers := modifiers bitOr: (jInputEventClass instVarNamed: 'META_MASK') |
|
5484 |
]. |
|
5485 |
anEvent hasShift ifTrue: [ |
|
1816 | 5486 |
modifiers := modifiers |
1033 | 5487 |
bitOr: (jInputEventClass instVarNamed: 'SHIFT_MASK') |
5488 |
]. |
|
5489 |
anEvent hasButton1 ifTrue: [ |
|
1816 | 5490 |
modifiers := modifiers |
1033 | 5491 |
bitOr: (jInputEventClass instVarNamed: 'BUTTON1_MASK') |
5492 |
]. |
|
5493 |
anEvent hasButton2 ifTrue: [ |
|
1816 | 5494 |
modifiers := modifiers |
1033 | 5495 |
bitOr: (jInputEventClass instVarNamed: 'BUTTON2_MASK') |
5496 |
]. |
|
5497 |
anEvent hasButton3 ifTrue: [ |
|
1816 | 5498 |
modifiers := modifiers |
1033 | 5499 |
bitOr: (jInputEventClass instVarNamed: 'BUTTON3_MASK') |
5500 |
]. |
|
5501 |
anEvent isPointerEnterLeaveEvent ifFalse: [ |
|
5502 |
"/ ST/X does not (yet) record this information |
|
5503 |
"/ with pointerLeave events. |
|
5504 |
x := anEvent x. |
|
5505 |
y := anEvent y. |
|
5506 |
]. |
|
5507 |
]. |
|
5508 |
anEvent isKeyEvent ifTrue: [ |
|
5509 |
jKeyEventClass := Java classForName: 'java.awt.event.KeyEvent'. |
|
5510 |
key := 0. |
|
5511 |
keyChar := 0. |
|
5512 |
key := anEvent key. |
|
5513 |
key isCharacter ifTrue: [ key := keyChar := key asciiValue ] ifFalse: [ |
|
5514 |
untranslatedKey := anEvent view device keyboardMap keyAtValue: key |
|
5515 |
ifAbsent: key. |
|
5516 |
untranslatedKey == #Insert ifTrue: [ |
|
5517 |
key := jKeyEventClass instVarNamed: 'VK_INSERT' |
|
5518 |
]. |
|
5519 |
untranslatedKey == #Delete ifTrue: [ |
|
5520 |
key := jKeyEventClass instVarNamed: 'VK_DELETE' |
|
5521 |
"/ 127 |
|
5522 |
]. |
|
5523 |
untranslatedKey == #BackSpace ifTrue: [ |
|
5524 |
key := jKeyEventClass instVarNamed: 'VK_BACK_SPACE' |
|
5525 |
"/ 8 |
|
5526 |
]. |
|
5527 |
untranslatedKey == #Return ifTrue: [ |
|
5528 |
key := jKeyEventClass instVarNamed: 'VK_ENTER' |
|
5529 |
"/ 13 |
|
5530 |
]. |
|
5531 |
untranslatedKey == #Tab ifTrue: [ |
|
5532 |
key := jKeyEventClass instVarNamed: 'VK_TAB' |
|
5533 |
"/ 9 |
|
5534 |
]. |
|
5535 |
untranslatedKey == #Home ifTrue: [ |
|
5536 |
key := jKeyEventClass instVarNamed: 'VK_HOME' |
|
5537 |
]. |
|
5538 |
untranslatedKey == #End ifTrue: [ |
|
5539 |
key := jKeyEventClass instVarNamed: 'VK_END' |
|
5540 |
]. |
|
5541 |
(key == #PreviousPage or: [ untranslatedKey == #Prior ]) ifTrue: [ |
|
5542 |
key := jKeyEventClass instVarNamed: 'VK_PAGE_UP' |
|
5543 |
]. |
|
5544 |
(key == #NextPage or: [ key == #EndOfText ]) ifTrue: [ |
|
5545 |
key := jKeyEventClass instVarNamed: 'VK_PAGE_DOWN' |
|
5546 |
]. |
|
5547 |
untranslatedKey == #CursorUp ifTrue: [ |
|
5548 |
key := jKeyEventClass instVarNamed: 'VK_UP' |
|
5549 |
]. |
|
5550 |
untranslatedKey == #CursorDown ifTrue: [ |
|
5551 |
key := jKeyEventClass instVarNamed: 'VK_DOWN' |
|
5552 |
]. |
|
5553 |
untranslatedKey == #CursorLeft ifTrue: [ |
|
5554 |
key := jKeyEventClass instVarNamed: 'VK_LEFT' |
|
5555 |
]. |
|
5556 |
untranslatedKey == #CursorRight ifTrue: [ |
|
5557 |
key := jKeyEventClass instVarNamed: 'VK_RIGHT' |
|
5558 |
]. |
|
1816 | 5559 |
(#( #F1 #F2 #F3 #F4 #F5 #F6 #F7 #F8 #F9 #F10 #F11 #F12 ) |
5560 |
includes: untranslatedKey) |
|
1033 | 5561 |
ifTrue: [ key := jKeyEventClass instVarNamed: ('VK_' , untranslatedKey) ]. |
5562 |
]. |
|
5563 |
(type == #keyPress:x:y:) ifTrue: [ |
|
5564 |
id := jKeyEventClass instVarNamed: 'KEY_PRESSED' |
|
5565 |
] ifFalse: [ id := jKeyEventClass instVarNamed: 'KEY_RELEASED' ]. |
|
5566 |
jEv := jKeyEventClass newCleared. |
|
5567 |
jEv instVarNamed: 'modifiers' put: modifiers. |
|
5568 |
jEv instVarNamed: 'keyCode' put: key. |
|
5569 |
jEv instVarNamed: 'keyChar' put: keyChar. |
|
5570 |
jEv instVarNamed: 'id' put: id. |
|
1816 | 5571 |
|
752 | 5572 |
"/ jEv instVarNamed:'x' put:x. |
5573 |
"/ jEv instVarNamed:'y' put:y. |
|
1816 | 5574 |
|
1033 | 5575 |
jEv instVarNamed: 'when' put: (OperatingSystem getMillisecondTime). |
5576 |
^ Array with: jEv |
|
5577 |
]. |
|
5578 |
(anEvent isButtonEvent or: [ anEvent isPointerEnterLeaveEvent ]) ifTrue: [ |
|
5579 |
jMouseEventClass := Java classForName: 'java.awt.event.MouseEvent'. |
|
5580 |
clickCount := 1. |
|
5581 |
(type == #buttonPress:x:y:) ifTrue: [ |
|
5582 |
id := jMouseEventClass instVarNamed: 'MOUSE_PRESSED'. |
|
5583 |
] ifFalse: [ |
|
5584 |
(type == #buttonRelease:x:y:) ifTrue: [ |
|
5585 |
id := jMouseEventClass instVarNamed: 'MOUSE_RELEASED'. |
|
5586 |
] ifFalse: [ |
|
5587 |
(type == #buttonMotion:x:y:) ifTrue: [ |
|
5588 |
(anEvent state bitAnd: (anEvent view device anyButtonMotionMask)) == 0 ifTrue: [ |
|
5589 |
id := jMouseEventClass instVarNamed: 'MOUSE_MOVED'. |
|
5590 |
] ifFalse: [ id := jMouseEventClass instVarNamed: 'MOUSE_DRAGGED'. ]. |
|
5591 |
] ifFalse: [ |
|
5592 |
"/ (type == #'pointerMotion:x:y:') ifTrue:[ |
|
5593 |
"/ id := jMouseEventClass instVarNamed:'MOUSE_MOVED'. |
|
5594 |
"/ ] ifFalse:[ |
|
5595 |
(type == #pointerEnter:x:y:) ifTrue: [ |
|
5596 |
id := jMouseEventClass instVarNamed: 'MOUSE_ENTERED'. |
|
5597 |
] ifFalse: [ |
|
5598 |
(type == #pointerLeave:) ifTrue: [ |
|
5599 |
id := jMouseEventClass instVarNamed: 'MOUSE_EXITED'. |
|
5600 |
] ifFalse: [ |
|
5601 |
(type == #buttonMultiPress:x:y:) ifTrue: [ |
|
5602 |
id := jMouseEventClass instVarNamed: 'MOUSE_PRESSED'. |
|
5603 |
clickCount := 2. |
|
5604 |
] ifFalse: [ self halt. ] |
|
1816 | 5605 |
|
752 | 5606 |
"/ ] |
1033 | 5607 |
] |
5608 |
] |
|
5609 |
] |
|
5610 |
] |
|
5611 |
]. |
|
5612 |
jEv := jMouseEventClass newCleared. |
|
5613 |
jEv instVarNamed: 'modifiers' put: modifiers. |
|
5614 |
jEv instVarNamed: 'id' put: id. |
|
5615 |
jEv instVarNamed: 'x' put: x. |
|
5616 |
jEv instVarNamed: 'y' put: y. |
|
5617 |
jEv instVarNamed: 'when' put: (OperatingSystem getMillisecondTime). |
|
5618 |
^ Array with: jEv |
|
5619 |
]. |
|
5620 |
(type == #configureX:y:width:height:) ifTrue: [ |
|
5621 |
view := anEvent view. |
|
5622 |
x := eventArgs at: 1. |
|
5623 |
y := eventArgs at: 2. |
|
5624 |
w := eventArgs at: 3. |
|
5625 |
h := eventArgs at: 4. |
|
5626 |
resized := (w ~~ view width or: [ h ~~ view height ]). |
|
5627 |
moved := (x ~~ view left or: [ y ~~ view top ]). |
|
1816 | 5628 |
|
752 | 5629 |
"/ (view isTopView or:[view isPopUpView]) ifTrue:[ |
1033 | 5630 |
"/ view must update its origin/extent. |
1816 | 5631 |
|
1033 | 5632 |
view dispatchEvent: anEvent. |
1816 | 5633 |
|
752 | 5634 |
"/ ]. |
1033 | 5635 |
"/ |
5636 |
"/ must change the components extent |
|
5637 |
"/ is there no cleaner way to do this ? |
|
5638 |
"/ |
|
1816 | 5639 |
|
1033 | 5640 |
view isTopView ifTrue: [ |
5641 |
view isPopUpView ifFalse: [ |
|
5642 |
"/ |
|
5643 |
"/ sigh - don't include the menu. |
|
5644 |
"/ |
|
5645 |
menu := self topViewsMenu: view. |
|
5646 |
menu notNil ifTrue: [ |
|
5647 |
"/ must add the menus height |
|
5648 |
h := h - menu height |
|
5649 |
] |
|
5650 |
] |
|
5651 |
]. |
|
5652 |
jWin instVarNamed: 'width' put: w. |
|
5653 |
jWin instVarNamed: 'height' put: h. |
|
5654 |
jWin instVarNamed: 'x' put: x. |
|
5655 |
jWin instVarNamed: 'y' put: y. |
|
5656 |
jComponentEventClass := Java classForName: 'java.awt.event.ComponentEvent'. |
|
5657 |
moved ifTrue: [ |
|
5658 |
id := (jComponentEventClass instVarNamed: 'COMPONENT_MOVED'). |
|
5659 |
jEv1 := jComponentEventClass newCleared. |
|
5660 |
jEv1 instVarNamed: 'id' put: id. |
|
5661 |
]. |
|
5662 |
resized ifTrue: [ |
|
5663 |
id := (jComponentEventClass instVarNamed: 'COMPONENT_RESIZED'). |
|
5664 |
jEv2 := jComponentEventClass newCleared. |
|
5665 |
jEv2 instVarNamed: 'id' put: id. |
|
5666 |
]. |
|
5667 |
jEv1 isNil ifTrue: [ |
|
5668 |
jEv2 isNil ifTrue: [ ^ nil ]. |
|
5669 |
^ Array with: jEv2 |
|
5670 |
] ifFalse: [ jEv2 isNil ifTrue: [ ^ Array with: jEv1 ] ]. |
|
5671 |
^ Array with: jEv1 with: jEv2. |
|
5672 |
]. |
|
5673 |
(type == #focusIn) ifTrue: [ |
|
5674 |
"/ 'focusIn' printCR. |
|
5675 |
jComponentEventClass := Java classForName: 'java.awt.event.FocusEvent'. |
|
5676 |
id := (jComponentEventClass instVarNamed: 'FOCUS_GAINED'). |
|
5677 |
jEv := jComponentEventClass newCleared. |
|
5678 |
jEv instVarNamed: 'id' put: id. |
|
5679 |
^ Array with: jEv. |
|
5680 |
]. |
|
5681 |
(type == #focusOut) ifTrue: [ |
|
5682 |
"/ 'focusOut' printCR. |
|
5683 |
jComponentEventClass := Java classForName: 'java.awt.event.FocusEvent'. |
|
5684 |
id := (jComponentEventClass instVarNamed: 'FOCUS_LOST'). |
|
5685 |
jEv := jComponentEventClass newCleared. |
|
5686 |
jEv instVarNamed: 'id' put: id. |
|
5687 |
^ Array with: jEv. |
|
5688 |
]. |
|
5689 |
(type == #mapped) ifTrue: [ |
|
5690 |
"/ 'mapped' printCR. |
|
5691 |
jComponentEventClass := Java classForName: 'java.awt.event.ComponentEvent'. |
|
5692 |
id := (jComponentEventClass instVarNamed: 'COMPONENT_SHOWN'). |
|
1816 | 5693 |
|
752 | 5694 |
"/ x := eventArgs at:1. |
5695 |
"/ y := eventArgs at:2. |
|
1816 | 5696 |
|
1033 | 5697 |
jEv := jComponentEventClass newCleared. |
5698 |
jEv instVarNamed: 'id' put: id. |
|
5699 |
^ Array with: jEv. |
|
5700 |
]. |
|
5701 |
(type == #unmapped) ifTrue: [ |
|
5702 |
"/ 'unmapped' printCR. |
|
5703 |
jComponentEventClass := Java classForName: 'java.awt.event.ComponentEvent'. |
|
5704 |
id := (jComponentEventClass instVarNamed: 'COMPONENT_HIDDEN'). |
|
1816 | 5705 |
|
752 | 5706 |
"/ x := eventArgs at:1. |
5707 |
"/ y := eventArgs at:2. |
|
1816 | 5708 |
|
1033 | 5709 |
jEv := jComponentEventClass newCleared. |
5710 |
jEv instVarNamed: 'id' put: id. |
|
5711 |
^ Array with: jEv. |
|
5712 |
]. |
|
5713 |
(type == #terminate) ifTrue: [ |
|
5714 |
jWindowEventClass := Java classForName: 'java.awt.event.WindowEvent'. |
|
5715 |
"NEW |
|
5716 |
id := (jWindowEventClass instVarNamed:'WINDOW_CLOSING'). |
|
5717 |
" "OLD " |
|
5718 |
id := (jWindowEventClass instVarNamed: 'WINDOW_CLOSED'). |
|
1816 | 5719 |
|
1033 | 5720 |
jEv := jWindowEventClass newCleared. |
5721 |
jEv instVarNamed: 'id' put: id. |
|
5722 |
^ Array with: jEv. |
|
5723 |
]. |
|
5724 |
EventTrace == true ifTrue: [ ('JAVA: unhandled event:' , type) infoPrintCR. ]. |
|
752 | 5725 |
^ nil. |
5726 |
||
5727 |
"Created: / 6.1.1998 / 20:38:58 / cg" |
|
5728 |
"Modified: / 9.1.1999 / 09:29:58 / cg" |
|
5729 |
! |
|
5730 |
||
5731 |
delegatesTo:someOne |
|
5732 |
^ false |
|
5733 |
||
5734 |
"Created: / 25.9.1999 / 16:11:48 / cg" |
|
5735 |
! |
|
5736 |
||
5737 |
doWindowsEventThread |
|
5738 |
"invoked in an endless loop by the WToolkit-eventLoop |
|
5739 |
native method." |
|
1816 | 5740 |
|
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5741 |
| sensor event more | |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5742 |
(JavaWindowGroup isNil or: [ KnownWindows isNil ]) ifTrue: [ |
1816 | 5743 |
"/ '*** eventThread: no windowGroup / views ...' printCR. |
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5744 |
self halt: 'monitors are reimplemented, change me if you know how and why'. |
1816 | 5745 |
"self |
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5746 |
waitFor: FirstWindowCreationSemaphore |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5747 |
state: #eventWait |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5748 |
timeOut: nil." |
1816 | 5749 |
|
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5750 |
"/ Delay waitForSeconds:0.1. |
1816 | 5751 |
|
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5752 |
^ self |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5753 |
]. |
1816 | 5754 |
|
752 | 5755 |
"/ wait for an event to arrive ... |
1816 | 5756 |
|
752 | 5757 |
sensor := JavaWindowGroup sensor. |
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5758 |
[ sensor hasEvents or: [ sensor damageCount ~~ 0 ] ] whileFalse: [ |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5759 |
EventTrace ifTrue: [ '*** eventThread waiting ...' printCR. ]. |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5760 |
Processor activeProcess state: #eventWait. |
1816 | 5761 |
self |
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5762 |
waitFor: sensor eventSemaphore |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5763 |
state: #eventWait |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5764 |
timeOut: nil. |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5765 |
]. |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5766 |
EventTrace ifTrue: [ '*** eventThread event arrived ...' printCR. ]. |
1816 | 5767 |
|
752 | 5768 |
"/ EventTrace := true |
1816 | 5769 |
|
752 | 5770 |
more := true. |
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5771 |
[ more ] whileTrue: [ |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5772 |
sensor hasDamage ifTrue: [ |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5773 |
EventTrace ifTrue: [ '*** eventThread: damage arrived ...' printCR. ]. |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5774 |
event := sensor nextDamage. |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5775 |
] ifFalse: [ event := sensor nextEvent. ]. |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5776 |
event isNil ifTrue: [ |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5777 |
EventTrace == true ifTrue: [ '*** eventThread: nil event ignored' printCR. ]. |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5778 |
^ self |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5779 |
]. |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5780 |
more := self processEvent: event |
752 | 5781 |
] |
5782 |
||
1147
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5783 |
"Created: / 06-01-1998 / 21:02:40 / cg" |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5784 |
"Modified: / 30-12-1998 / 19:21:36 / cg" |
9431cebfd873
java monitors totally integrated.. maybe too ambitious.. we'll see
hlopkmar
parents:
1145
diff
changeset
|
5785 |
"Modified: / 22-11-2011 / 13:22:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 5786 |
! |
5787 |
||
1816 | 5788 |
processEvent: event |
1033 | 5789 |
| evQ jEvents jWToolKitClass jWToolKit jWinPeer jWin v eventConsumed | |
5790 |
||
5791 |
KnownWindows isNil ifTrue: [ ^ false ]. |
|
752 | 5792 |
v := event view. |
1033 | 5793 |
jWinPeer := self jPeerForView: v. |
5794 |
jWinPeer isNil ifTrue: [ |
|
5795 |
v isJavaView ifTrue: [ |
|
5796 |
"/ mhmh - an event for a JavaView, |
|
5797 |
"/ which has no peer (anyMore ?) |
|
5798 |
"/ should not happen. |
|
5799 |
] ifFalse: [ |
|
5800 |
"/ mhmh - an event for a subcomponent of an ST widget. |
|
5801 |
"/ let it be handled normally. |
|
5802 |
EventTrace ifTrue: [ |
|
1816 | 5803 |
('*** eventThread: ' , event type |
1033 | 5804 |
, '-event for unknown java-view - passed to view.') printCR. |
5805 |
]. |
|
5806 |
event view dispatchEvent: event. |
|
5807 |
]. |
|
5808 |
^ true |
|
5809 |
]. |
|
1816 | 5810 |
|
752 | 5811 |
"/ change: |
5812 |
"/ in the previous version, events for ST/X widgets (i.e. buttons etc) |
|
5813 |
"/ where not passed to java, but instead forwarded directly to the widget |
|
5814 |
"/ by the code below. |
|
5815 |
"/ This has changed, to pass it to Java, which eventually passes it to the |
|
5816 |
"/ peer via the handleEvent native method (unless the event got consumed). |
|
5817 |
"/ This is req'd to let java keep track of keyboard/mouse input for widgets. |
|
1816 | 5818 |
|
1033 | 5819 |
(event isDamage and: [ v isJavaView ]) ifTrue: [ |
5820 |
"/ "/ most views handle their events themself (being ST/X views) ... |
|
5821 |
"/ |
|
5822 |
"/ v class ~~ JavaView ifTrue:[ |
|
5823 |
"/"/ v class ~~ StandardSystemView ifTrue:[ |
|
5824 |
"/"/ EventTrace ifTrue:[ |
|
5825 |
"/"/ ('*** eventThread: event handled by view itself (' , v class name , ')') printCR. |
|
5826 |
"/"/ ]. |
|
5827 |
"/"/ event sendEventWithFocusOn:nil. |
|
5828 |
"/"/ ^ self. |
|
5829 |
"/"/ ]. |
|
5830 |
"/ (event type == #'exposeX:y:width:height' |
|
5831 |
"/ or:[event type == #'graphicsExposeX:y:width:height']) ifTrue:[ |
|
5832 |
"/ "/ send to view, but also handle in JAVA |
|
5833 |
"/ event sendEventWithFocusOn:nil. |
|
5834 |
"/ ] |
|
5835 |
"/ ]. |
|
5836 |
(#( #mapped |
|
5837 |
#unmapped |
|
5838 |
#configureX:y:width:height: |
|
5839 |
#exposeX:y:width:height: |
|
5840 |
#graphicsExposeX:y:width:height: ) includes: event type) ifTrue: [ |
|
5841 |
event sendEventWithFocusOn: nil. |
|
5842 |
]. |
|
5843 |
]. |
|
1816 | 5844 |
|
752 | 5845 |
"/ what a kludge - some events are passed back to |
5846 |
"/ ST via the WComponent-handleEvent native method. |
|
5847 |
"/ However, repaints are not. |
|
5848 |
"/ In order to let ST widgets do the drawing, |
|
5849 |
"/ selectively filter exposeEvents from Java ... |
|
1816 | 5850 |
|
752 | 5851 |
eventConsumed := false. |
1033 | 5852 |
v isJavaView ifTrue: [ |
5853 |
"/ all events handled by Java ... |
|
5854 |
] ifFalse: [ |
|
5855 |
eventConsumed := true. |
|
1816 | 5856 |
|
1033 | 5857 |
"/ let widget handle it. |
1816 | 5858 |
|
1033 | 5859 |
event view dispatchEvent: event. |
1816 | 5860 |
|
1033 | 5861 |
"/ some are not passed to Java ... |
1816 | 5862 |
|
1033 | 5863 |
event isDamage ifTrue: [ |
5864 |
(v isKindOf: Button) ifTrue: [ ^ true ]. |
|
5865 |
(v isKindOf: TextView) ifTrue: [ ^ true ]. |
|
5866 |
(v isKindOf: Label) ifTrue: [ ^ true ]. |
|
5867 |
(v isKindOf: ComboBoxView) ifTrue: [ ^ true ]. |
|
5868 |
(v isKindOf: ScrollBar) ifTrue: [ ^ true ]. |
|
5869 |
(v isKindOf: Scroller) ifTrue: [ ^ true ]. |
|
5870 |
(v isKindOf: MenuPanel) ifTrue: [ ^ true ]. |
|
5871 |
]. |
|
5872 |
]. |
|
5873 |
jWin := jWinPeer instVarNamed: 'target'. |
|
5874 |
EventTrace ifTrue: [ |
|
1816 | 5875 |
('*** eventThread: event (' , event type , ') handled by JAVA: ') |
1033 | 5876 |
infoPrint. |
5877 |
jWinPeer class name infoPrint. |
|
5878 |
' (' infoPrint. |
|
5879 |
jWin class name infoPrint. |
|
5880 |
')' infoPrintCR. |
|
5881 |
]. |
|
1816 | 5882 |
|
752 | 5883 |
"/ create an event |
1816 | 5884 |
|
1033 | 5885 |
jEvents := self awtEventsForEvent: event javaWindow: jWin. |
5886 |
jEvents isNil ifTrue: [ |
|
5887 |
EventTrace ifTrue: [ |
|
5888 |
('*** eventThread: event ignored: ' , event type) printCR. |
|
5889 |
]. |
|
5890 |
^ true |
|
5891 |
]. |
|
1816 | 5892 |
|
752 | 5893 |
"/ v superView isNil ifTrue:[ |
5894 |
"/ ('*** eventThread: event ignored for topView: ' , event type) printCR. |
|
5895 |
"/ ^ self |
|
5896 |
"/ ]. |
|
1816 | 5897 |
|
1033 | 5898 |
jWToolKitClass := self classForName: 'java.awt.Toolkit'. |
1816 | 5899 |
|
752 | 5900 |
"/ jWToolKit := jWToolKitClass perform:#getDefaultToolkit. |
1816 | 5901 |
|
5902 |
jWToolKit := jWToolKitClass |
|
1033 | 5903 |
performStatic: #'getDefaultToolkit()Ljava/awt/Toolkit;'. |
5904 |
jEvents do: [ |
|
1816 | 5905 |
:jEv | |
1033 | 5906 |
jEv instVarNamed: 'source' put: jWin. |
5907 |
jEv instVarNamed: 'consumed' put: 0. |
|
5908 |
eventConsumed ifFalse: [ |
|
5909 |
"/ the first gets the original event as data |
|
5910 |
jEv instVarNamed: 'data' put: event. |
|
5911 |
eventConsumed := true |
|
5912 |
]. |
|
1816 | 5913 |
|
1033 | 5914 |
"/ post it (them) to the event queue |
1816 | 5915 |
|
1033 | 5916 |
EventTrace == true ifTrue: [ 'postEvent to Java ...' printCR. ]. |
5917 |
jWToolKit "class" perform: #'postEvent(Ljava/awt/AWTEvent;)V' with: jEv. |
|
5918 |
]. |
|
752 | 5919 |
^ false |
5920 |
||
5921 |
"Created: / 6.1.1998 / 20:36:36 / cg" |
|
5922 |
"Modified: / 10.12.1998 / 19:36:59 / cg" |
|
5923 |
! ! |
|
5924 |
||
1597 | 5925 |
!JavaVM::Performance class methodsFor:'documentation'! |
5926 |
||
5927 |
documentation |
|
5928 |
" |
|
5929 |
A helper class to keep performance counters for JavaVM |
|
5930 |
||
5931 |
[author:] |
|
5932 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
5933 |
||
5934 |
[instance variables:] |
|
5935 |
||
5936 |
[class variables:] |
|
5937 |
||
5938 |
[see also:] |
|
5939 |
||
5940 |
" |
|
5941 |
! ! |
|
5942 |
||
5943 |
!JavaVM::Performance class methodsFor:'instance creation'! |
|
5944 |
||
5945 |
for: aJavaVM |
|
5946 |
||
5947 |
^self new setVM: aJavaVM. |
|
5948 |
||
5949 |
"Created: / 21-12-2010 / 19:42:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5950 |
! ! |
|
5951 |
||
1691 | 5952 |
!JavaVM::Performance methodsFor:'accessing-counters'! |
5953 |
||
1720 | 5954 |
get: name |
5955 |
"Return the value of given performance counter." |
|
5956 |
||
5957 |
^self set: name to: -1 |
|
5958 |
! |
|
5959 |
||
1691 | 5960 |
monitorEnterCount: fatOnly |
1816 | 5961 |
"Return the number of monitor enter operations. |
1691 | 5962 |
If fatOnly is true, return only those that involves |
5963 |
fat-lock enter (i.e,, uses JavaMonitor, not thinlock)" |
|
5964 |
||
5965 |
%{ |
|
5966 |
extern unsigned int __monitorEnterCount(int fat, int new); |
|
5967 |
RETURN ( __MKUINT ( __monitorEnterCount( fatOnly == true ? 1 : 0, -1 ) ) ) |
|
5968 |
%}. |
|
5969 |
^ 0 |
|
5970 |
||
5971 |
"Created: / 28-08-2012 / 10:37:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5972 |
! |
|
5973 |
||
5974 |
monitorExitCount: fatOnly |
|
1816 | 5975 |
"Return the number of monitor enter operations. |
1691 | 5976 |
If fatOnly is true, return only those that involves |
5977 |
fat-lock enter (i.e,, uses JavaMonitor, not thinlock)" |
|
5978 |
||
5979 |
%{ |
|
5980 |
extern unsigned int __monitorEnterCount(int fat, int new); |
|
5981 |
RETURN ( __MKUINT ( __monitorEnterCount( fatOnly == true ? 1 : 0, -1 ) ) ) |
|
5982 |
%}. |
|
5983 |
^ 0 |
|
5984 |
||
5985 |
"Created: / 28-08-2012 / 10:37:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1720 | 5986 |
! |
5987 |
||
5988 |
set: name to: newValue |
|
5989 |
"Set and return the value of given performance counter. |
|
1816 | 5990 |
If newValue >= 0, performance counter is set to given |
1720 | 5991 |
value and previous value is returned. If newValue < 0, |
5992 |
then the current value is returned" |
|
5993 |
||
5994 |
| value | |
|
5995 |
%{ |
|
5996 |
extern OBJ __javaPerfCounter(OBJ _name, OBJ _newValue ); |
|
5997 |
value = __javaPerfCounter( name, newValue ); |
|
5998 |
%}. |
|
5999 |
value isSymbol ifTrue:[ |
|
6000 |
self error: value. |
|
6001 |
^nil |
|
6002 |
]. |
|
6003 |
^value |
|
6004 |
||
1691 | 6005 |
! ! |
6006 |
||
1597 | 6007 |
!JavaVM::Performance methodsFor:'initialization'! |
6008 |
||
6009 |
setVM: aJavaVM |
|
6010 |
||
1816 | 6011 |
"Now, aJavaVM == JavaVM (i.e, the class JavaVM |
1597 | 6012 |
itself, not its instance)" |
6013 |
||
6014 |
vm := aJavaVM |
|
6015 |
||
6016 |
"Created: / 21-12-2010 / 19:44:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6017 |
! ! |
|
6018 |
||
6019 |
!JavaVM::Performance methodsFor:'orinting-streams'! |
|
6020 |
||
6021 |
printOpenExternalStream: stream number: index on: output |
|
6022 |
"Print info about given external stream to output. Return true, |
|
6023 |
if the instance is executor, false otherwise" |
|
6024 |
||
6025 |
| executor | |
|
6026 |
||
6027 |
executor := ((3 to: stream class instSize) allSatisfy:[:index| |
|
6028 |
index == 6 or:[index == 7 or:[(stream instVarAt: index) isNil]] |
|
6029 |
]). |
|
6030 |
||
6031 |
'%-4d %-30s %-15s %s' printf:{ |
|
6032 |
index . |
|
6033 |
stream class name. |
|
6034 |
executor ifTrue:['(executor)'] ifFalse:[(self printOpenExternalStreamIdentificationOf: stream)]. |
|
6035 |
executor ifTrue:[''] ifFalse:[stream isFileStream ifTrue:[stream pathName ? '??? no pathName ???'] ifFalse:['']] |
|
6036 |
} on: output. |
|
6037 |
||
6038 |
^ executor |
|
6039 |
||
6040 |
" |
|
6041 |
JavaVM::Performance new printOpenExternalStreams |
|
6042 |
" |
|
6043 |
||
6044 |
"Created: / 14-08-2012 / 01:02:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6045 |
! |
|
6046 |
||
6047 |
printOpenExternalStreamIdentificationOf:stream |
|
6048 |
| zc oft | |
|
6049 |
||
6050 |
(oft := Smalltalk at:#'JavaVM:OpenFileTable') notNil ifTrue:[ |
|
6051 |
| idx | |
|
6052 |
idx := oft identityIndexOf: stream. |
|
6053 |
idx ~~ 0 ifTrue:[ |
|
6054 |
^ 'VM OFT[' ,idx printString, ']'. |
|
6055 |
]. |
|
6056 |
]. |
|
6057 |
(zc := Smalltalk at:#'JavaVM:ZipCache') notNil ifTrue:[ |
|
6058 |
| idx | |
|
6059 |
idx := zc identityIndexOf: stream. |
|
6060 |
idx ~~ 0 ifTrue:[ |
|
6061 |
^ 'VM ZC[' ,idx printString, ']'. |
|
6062 |
] |
|
6063 |
]. |
|
6064 |
||
6065 |
((Smalltalk at:#'Java:SourceCache') ? #()) do:[:each| |
|
6066 |
each == stream ifTrue:[ |
|
6067 |
^ 'Java SC' |
|
6068 |
]. |
|
6069 |
]. |
|
6070 |
||
6071 |
((Smalltalk at:#'JavaClassReader:JavaArchiveCache') ? #()) do:[:each| |
|
6072 |
(each instVarAt:1 "named: #file") == stream ifTrue:[ |
|
6073 |
^ 'JCR JAC' |
|
6074 |
]. |
|
6075 |
]. |
|
6076 |
||
6077 |
((Smalltalk at:#'Java:SourceArchiveCache') ? #()) do:[:each| |
|
6078 |
(each instVarAt:1 "named: #file") == stream ifTrue:[ |
|
6079 |
^ 'Java SAC' |
|
6080 |
]. |
|
6081 |
]. |
|
6082 |
||
6083 |
^'' |
|
6084 |
||
6085 |
"Created: / 14-08-2012 / 01:17:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6086 |
! |
|
6087 |
||
6088 |
printOpenExternalStreams |
|
6089 |
^self printOpenExternalStreamsOn: Transcript |
|
6090 |
||
6091 |
"Created: / 14-08-2012 / 01:03:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6092 |
! |
|
6093 |
||
6094 |
printOpenExternalStreamsOn: aStream |
|
6095 |
||
6096 |
| nOpenStreams nExecutors | |
|
6097 |
||
6098 |
aStream nextPutLine: '=== JavaVM open external stream statistics ==='. |
|
6099 |
aStream nextPutLine: Timestamp now printString. |
|
6100 |
||
6101 |
nOpenStreams := 0. |
|
6102 |
nExecutors := 0. |
|
6103 |
ExternalStream allSubInstancesDo:[:each| |
|
6104 |
each isOpen ifTrue:[ |
|
6105 |
nOpenStreams := nOpenStreams + 1. |
|
6106 |
(self printOpenExternalStream: each number: nOpenStreams on: aStream) ifTrue:[ |
|
6107 |
nExecutors := nExecutors + 1 |
|
6108 |
]. |
|
6109 |
aStream cr. |
|
6110 |
] |
|
6111 |
]. |
|
6112 |
aStream cr. |
|
1816 | 6113 |
aStream nextPutLine: |
1597 | 6114 |
('SUMMARY: open=%1, executors=%4, java.io=%2, java.util.zip=%3' |
6115 |
bindWith: nOpenStreams |
|
6116 |
with: (((Smalltalk at:#'JavaVM:OpenFileTable') ? #()) inject:0 into:[:a :s|a + (s notNil ifTrue:[1] ifFalse:[0])]) |
|
6117 |
with: (((Smalltalk at:#'JavaVM:ZipCache') ? #()) inject:0 into:[:a :s|a + (s notNil ifTrue:[1] ifFalse:[0])]) |
|
1816 | 6118 |
with: nExecutors |
1597 | 6119 |
). |
6120 |
||
6121 |
aStream nextPutLine: '=============================================='. |
|
6122 |
aStream nextPutLine: '' |
|
6123 |
||
6124 |
" |
|
6125 |
JavaVM::Performance new printOpenExternalStreams |
|
6126 |
" |
|
6127 |
||
6128 |
"Created: / 14-08-2012 / 00:48:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6129 |
! ! |
|
6130 |
||
6131 |
!JavaVM::Performance methodsFor:'printing-counters'! |
|
6132 |
||
6133 |
printCounters |
|
6134 |
||
6135 |
self printCountersOn: Transcript |
|
6136 |
||
6137 |
"Created: / 14-08-2012 / 00:43:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6138 |
! |
|
6139 |
||
6140 |
printCountersOn: aStream |
|
6141 |
||
6142 |
aStream nextPutLine: '=== JavaVM performance statistics ============'. |
|
6143 |
aStream nextPutLine: Timestamp now printString. |
|
1720 | 6144 |
self printCounters_ExecutionOn: aStream. |
6145 |
aStream cr. |
|
1735 | 6146 |
self printCounters_CompilationOn: aStream. |
1816 | 6147 |
aStream cr. |
1691 | 6148 |
self printCounters_MonitorOn: aStream. |
1749 | 6149 |
aStream cr. |
6150 |
self printCounters_TopTenNativesOn: aStream. |
|
1816 | 6151 |
aStream nextPutLine: '=============================================='. |
1597 | 6152 |
aStream nextPutLine: '' |
6153 |
||
1691 | 6154 |
" |
6155 |
JavaVM performance printCounters |
|
6156 |
" |
|
6157 |
||
1597 | 6158 |
"Created: / 14-08-2012 / 00:43:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1749 | 6159 |
"Modified: / 27-10-2012 / 18:12:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1720 | 6160 |
! |
6161 |
||
1735 | 6162 |
printCounters_CompilationOn: aStream |
6163 |
||
6164 |
self printCounterGroup:'Just-In-Time Compilation' on: aStream. |
|
6165 |
self printCounter:'methodsCompiled' on: aStream labeled: 'methods compiled'. |
|
6166 |
self printCounter:'methodsCompiledAndBailedOut' on: aStream labeled: 'methods compiled (failed)'. |
|
6167 |
||
6168 |
"Created: / 15-10-2012 / 15:33:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6169 |
! |
|
6170 |
||
1720 | 6171 |
printCounters_ExecutionOn: aStream |
6172 |
||
6173 |
self printCounterGroup:'Execution' on: aStream. |
|
6174 |
self printCounter:'methodsInterpreted' on: aStream labeled: 'methods (interpreted)'. |
|
6175 |
self printCounter:'bytecodesInterpreted' on: aStream labeled: 'bytecodes (interpreted)'. |
|
6176 |
self printCounter:'bytecodesInterpretedWrap' on: aStream labeled: 'bytecodes wrap(interpreted)'. |
|
6177 |
||
6178 |
"Created: / 15-10-2012 / 15:33:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1691 | 6179 |
! |
6180 |
||
6181 |
printCounters_MonitorOn: aStream |
|
6182 |
||
1720 | 6183 |
self printCounterGroup:'Monitors' on: aStream. |
6184 |
self printCounter:'monitorEnterCount' on: aStream labeled: 'MONITOR ENTER'. |
|
6185 |
self printCounter:'monitorEnterCountFat' on: aStream labeled: 'MONITOR ENTER (fat)'. |
|
6186 |
||
6187 |
self printCounter:'monitorExitCount' on: aStream labeled: 'MONITOR EXIT'. |
|
6188 |
self printCounter:'monitorExitCountFat' on: aStream labeled: 'MONITOR EXIT (fat)'. |
|
1691 | 6189 |
|
6190 |
"Created: / 28-08-2012 / 10:42:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1720 | 6191 |
"Modified: / 15-10-2012 / 15:31:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1749 | 6192 |
! |
6193 |
||
6194 |
printCounters_Top: n nativesOn: aStream |
|
6195 |
||
6196 |
| nativesSorted | |
|
6197 |
||
6198 |
self printCounterGroup:'top ', n printString , ' (unoptimized) natives' on: aStream. |
|
6199 |
nativesSorted := JavaNativeMethod allInstances asSortedCollection: |
|
6200 |
[:a :b| a nCalls > b nCalls ]. |
|
6201 |
1 to: n do:[:idx| |
|
6202 |
| m | |
|
6203 |
||
6204 |
m := nativesSorted at: idx. |
|
6205 |
aStream nextPutAll: (m nCalls printStringRadix:10 size:8 fill:Character space). |
|
6206 |
aStream nextPutAll:' '. |
|
1816 | 6207 |
aStream |
1749 | 6208 |
nextPutAll: m mclass name; |
6209 |
nextPutAll: ' >> '; |
|
6210 |
nextPutAll: m selector; |
|
6211 |
cr. |
|
6212 |
] |
|
6213 |
||
6214 |
"Created: / 27-10-2012 / 18:09:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6215 |
! |
|
6216 |
||
6217 |
printCounters_TopTenNativesOn: aStream |
|
6218 |
||
6219 |
self printCounters_Top: 10 nativesOn: aStream |
|
6220 |
||
6221 |
"Created: / 27-10-2012 / 18:12:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1720 | 6222 |
! ! |
6223 |
||
6224 |
!JavaVM::Performance methodsFor:'printing-counters-private'! |
|
6225 |
||
1816 | 6226 |
printCounter: name on: stream |
1720 | 6227 |
|
6228 |
self printCounter: name on: stream labeled: name |
|
6229 |
||
6230 |
"Created: / 15-10-2012 / 15:28:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6231 |
! |
|
6232 |
||
6233 |
printCounter: name on: stream labeled: label |
|
6234 |
||
6235 |
[ |
|
1735 | 6236 |
' %-35s : %10d' printf: { label . (self get: name) } on: stream |
1720 | 6237 |
] on: Error do:[ |
6238 |
' %-35s : N/A' printf: { label } on: stream |
|
6239 |
]. |
|
6240 |
stream cr. |
|
6241 |
||
6242 |
"Created: / 15-10-2012 / 15:25:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6243 |
! |
|
6244 |
||
1816 | 6245 |
printCounterGroup: gname on: stream |
1720 | 6246 |
|
6247 |
stream nextPut:$-; nextPut:$-; space; nextPutAll: gname; space; nextPut:$-; nextPut:$-; cr. |
|
6248 |
||
6249 |
"Created: / 15-10-2012 / 15:29:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1597 | 6250 |
! ! |
6251 |
||
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
6252 |
!JavaVM::ReflectionRegistry class methodsFor:'documentation'! |
1597 | 6253 |
|
6254 |
documentation |
|
6255 |
" |
|
6256 |
A helper class to deal with Java reflection |
|
6257 |
||
6258 |
[author:] |
|
6259 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
6260 |
||
6261 |
[instance variables:] |
|
6262 |
||
6263 |
[class variables:] |
|
6264 |
||
6265 |
[see also:] |
|
6266 |
||
6267 |
" |
|
6268 |
! ! |
|
6269 |
||
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
6270 |
!JavaVM::ReflectionRegistry class methodsFor:'instance creation'! |
752 | 6271 |
|
6272 |
for: aJavaVM |
|
6273 |
||
6274 |
^self new setVM: aJavaVM. |
|
6275 |
||
6276 |
"Created: / 21-12-2010 / 19:42:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6277 |
! |
|
6278 |
||
6279 |
new |
|
6280 |
"return an initialized instance" |
|
6281 |
||
6282 |
^ self basicNew initialize. |
|
6283 |
! ! |
|
6284 |
||
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
6285 |
!JavaVM::ReflectionRegistry methodsFor:'debugging'! |
752 | 6286 |
|
6287 |
returnNilIfMissing |
|
6288 |
^ returnNilIfMissing. |
|
6289 |
||
6290 |
"Created: / 28-01-2011 / 15:14:37 / Marcel Hlopko <hlopik@gmail.com>" |
|
6291 |
! |
|
6292 |
||
6293 |
returnNilIfMissing:aBoolean |
|
6294 |
returnNilIfMissing:= aBoolean. |
|
6295 |
||
6296 |
"Created: / 28-01-2011 / 15:25:35 / Marcel Hlopko <hlopik@gmail.com>" |
|
6297 |
! ! |
|
6298 |
||
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
6299 |
!JavaVM::ReflectionRegistry methodsFor:'initialization'! |
752 | 6300 |
|
1926
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
6301 |
flush |
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
6302 |
self initialize. |
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
6303 |
|
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
6304 |
"Created: / 09-01-2013 / 16:00:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
6305 |
! |
32f3cef32ca5
Improvements in Java>>flushAllJavaResources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1902
diff
changeset
|
6306 |
|
752 | 6307 |
initialize |
6308 |
constantPoolMapping := IdentityDictionary new. |
|
6309 |
javaClasses := Dictionary new. |
|
6310 |
javaArrayClasses := IdentityDictionary new. |
|
1217 | 6311 |
realMethods := OrderedCollection new. |
6312 |
javaMethodsPerMethod := Dictionary new |
|
752 | 6313 |
|
6314 |
"Created: / 21-12-2010 / 19:46:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6315 |
"Modified: / 09-02-2011 / 00:24:28 / Marcel Hlopko <hlopik@gmail.com>" |
|
1217 | 6316 |
"Modified: / 05-12-2011 / 09:56:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 6317 |
! |
6318 |
||
6319 |
setVM: aJavaVM |
|
6320 |
||
1816 | 6321 |
"Now, aJavaVM == JavaVM (i.e, the class JavaVM |
752 | 6322 |
itself, not its instance)" |
6323 |
||
6324 |
vm := aJavaVM |
|
6325 |
||
6326 |
"Created: / 21-12-2010 / 19:44:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6327 |
! ! |
|
6328 |
||
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
6329 |
!JavaVM::ReflectionRegistry methodsFor:'reflection - classes'! |
752 | 6330 |
|
1511 | 6331 |
arrayClassFor: javaClass ifAbsentPut: block |
6332 |
^javaArrayClasses at: javaClass ifAbsentPut: block |
|
6333 |
||
6334 |
"Created: / 05-07-2012 / 23:21:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6335 |
! |
|
6336 |
||
1816 | 6337 |
classForJavaClassObject: aJavaClassObject |
752 | 6338 |
" |
6339 |
Given an instance of java.lang.Class, answers |
|
6340 |
real (Java) class associated with it. The instance |
|
6341 |
of java.lang.Class should be first created by myself |
|
1033 | 6342 |
(by sending #javaClassObjectForClass:)" |
1816 | 6343 |
|
6344 |
(javaClasses at: aJavaClassObject ifAbsent: [ 123 ]) |
|
6345 |
== (JavaVM classNamed: 'stx/libjava/tests/junir/JUnit3Tests') |
|
1033 | 6346 |
ifTrue: [ self breakPoint: #jv ]. |
6347 |
^ javaClasses at: aJavaClassObject |
|
6348 |
ifAbsent: [ |
|
6349 |
vm internalError: 'No class associated with given java.lang.Class!!'. |
|
1816 | 6350 |
|
752 | 6351 |
"/Please, no nils |
1816 | 6352 |
|
1033 | 6353 |
self returnNilIfMissing ifTrue: nil |
6354 |
]. |
|
752 | 6355 |
|
6356 |
"Created: / 28-01-2011 / 15:22:39 / Marcel Hlopko <hlopik@gmail.com>" |
|
6357 |
"Modified: / 05-02-2011 / 20:26:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1036 | 6358 |
"Modified: / 21-10-2011 / 13:41:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 6359 |
! |
6360 |
||
1816 | 6361 |
javaClassObjectArrayForClasses: classes |
752 | 6362 |
" |
6363 |
Answers an instance of java.lang.Class[] for given |
|
851 | 6364 |
real (Java) classes." |
1816 | 6365 |
|
1033 | 6366 |
| array | |
6367 |
||
1816 | 6368 |
array := (vm classForName: 'java.lang.Class') javaArrayClass |
1033 | 6369 |
new: classes size. |
6370 |
classes isNilOrEmptyCollection ifTrue: [ ^ array ]. |
|
1816 | 6371 |
classes |
1033 | 6372 |
withIndexDo: [:cls :idx | array at: idx put: (self javaClassObjectForClass: cls) ]. |
851 | 6373 |
^ array |
752 | 6374 |
|
6375 |
"Modified: / 28-01-2011 / 15:15:44 / Marcel Hlopko <hlopik@gmail.com>" |
|
6376 |
"Created: / 04-02-2011 / 22:08:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6377 |
"Modified: / 11-02-2011 / 10:21:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6378 |
! |
|
6379 |
||
1816 | 6380 |
javaClassObjectForClass:aClass |
911 | 6381 |
|
6382 |
^self javaClassObjectForClass:aClass init: true. |
|
6383 |
||
6384 |
"Modified: / 28-01-2011 / 15:15:44 / Marcel Hlopko <hlopik@gmail.com>" |
|
6385 |
"Modified: / 12-08-2011 / 19:07:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6386 |
! |
|
6387 |
||
1816 | 6388 |
javaClassObjectForClass: aClass init: init |
752 | 6389 |
" |
6390 |
Answers an instance of java.lang.Class for given |
|
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1017
diff
changeset
|
6391 |
real (Java) class." |
1816 | 6392 |
|
6393 |
| javaClassObj | |
|
1030 | 6394 |
|
752 | 6395 |
self assert: aClass isBehavior message: 'aClass is not behavior'. |
1656
c6fee8f3a640
- fixes for Groovy-Smalltalk interop - SmalltalkEvaluator example works
vranyj1
parents:
1649
diff
changeset
|
6396 |
self assert: aClass ~~ Array message: 'aClass should not be Array (old impl)'. |
c6fee8f3a640
- fixes for Groovy-Smalltalk interop - SmalltalkEvaluator example works
vranyj1
parents:
1649
diff
changeset
|
6397 |
|
1028
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1027
diff
changeset
|
6398 |
javaClasses at: aClass ifPresent: [:javaClassObj | ^ javaClassObj ]. |
1816 | 6399 |
|
752 | 6400 |
"/ class must be initialized (with all of its superclasses ?). |
1816 | 6401 |
|
1656
c6fee8f3a640
- fixes for Groovy-Smalltalk interop - SmalltalkEvaluator example works
vranyj1
parents:
1649
diff
changeset
|
6402 |
"/ false ifTrue: [ aClass isJavaClass ifTrue: [ aClass classInit ]. ]. |
c6fee8f3a640
- fixes for Groovy-Smalltalk interop - SmalltalkEvaluator example works
vranyj1
parents:
1649
diff
changeset
|
6403 |
|
c6fee8f3a640
- fixes for Groovy-Smalltalk interop - SmalltalkEvaluator example works
vranyj1
parents:
1649
diff
changeset
|
6404 |
"/ Here, install Java lookup as Java may send a messages to that |
c6fee8f3a640
- fixes for Groovy-Smalltalk interop - SmalltalkEvaluator example works
vranyj1
parents:
1649
diff
changeset
|
6405 |
"/ object |
1675
fe6aa1d083cf
- JavaVM>>javaClassObjectForClass: fix: do not install JavaLookup if the class is for one of java primitive types
vranyj1
parents:
1656
diff
changeset
|
6406 |
(aClass isJavaClass not and:[aClass isJavaArrayClass not and:[aClass isJavaPrimitiveType not]]) ifTrue:[ |
1677 | 6407 |
aClass == Object ifTrue:[ self halt. ]. |
1656
c6fee8f3a640
- fixes for Groovy-Smalltalk interop - SmalltalkEvaluator example works
vranyj1
parents:
1649
diff
changeset
|
6408 |
aClass lookupObject: JavaLookup instance. |
c6fee8f3a640
- fixes for Groovy-Smalltalk interop - SmalltalkEvaluator example works
vranyj1
parents:
1649
diff
changeset
|
6409 |
]. |
752 | 6410 |
javaClassObj := (vm classForName: 'java.lang.Class') new. |
1217 | 6411 |
self rememberJavaClassObject: javaClassObj for: aClass. |
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1017
diff
changeset
|
6412 |
^ javaClassObj |
752 | 6413 |
|
6414 |
"Modified: / 28-01-2011 / 15:15:44 / Marcel Hlopko <hlopik@gmail.com>" |
|
911 | 6415 |
"Created: / 12-08-2011 / 19:07:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 6416 |
! |
6417 |
||
1816 | 6418 |
javaClassObjectForClassNamed: className |
752 | 6419 |
" |
6420 |
Answers an instance of java.lang.Class for given |
|
6421 |
(java) class name. The className may be name of primitive |
|
758 | 6422 |
type, i.e. 'int', 'double'." |
1816 | 6423 |
|
752 | 6424 |
| cls | |
6425 |
||
758 | 6426 |
cls := JavaDescriptor baseTypesByTypeName at: className |
6427 |
ifAbsent: [ vm classForName: className ]. |
|
6428 |
^ self javaClassObjectForClass: cls. |
|
752 | 6429 |
|
6430 |
"Created: / 03-02-2011 / 21:12:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
758 | 6431 |
"Modified: / 08-04-2011 / 14:45:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1217 | 6432 |
! |
6433 |
||
6434 |
rememberJavaClassObject: jclass for: class |
|
6435 |
||
6436 |
javaClasses at: class put: jclass. |
|
6437 |
javaClasses at: jclass put: class. |
|
6438 |
||
6439 |
"Created: / 05-12-2011 / 09:57:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 6440 |
! ! |
6441 |
||
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
6442 |
!JavaVM::ReflectionRegistry methodsFor:'reflection - constant pool'! |
752 | 6443 |
|
1816 | 6444 |
constantPoolFor:javaConstantPoolObject |
752 | 6445 |
^ constantPoolMapping at:javaConstantPoolObject |
6446 |
ifAbsent:[self error:'Given ConstantPool was not created by JVM'] |
|
6447 |
||
6448 |
"Created: / 21-12-2010 / 19:56:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6449 |
"Modified: / 28-01-2011 / 14:56:54 / Marcel Hlopko <hlopik@gmail.com>" |
|
6450 |
! |
|
6451 |
||
6452 |
javaConstantPoolObjectFor: aConstantPool |
|
6453 |
||
6454 |
^constantPoolMapping at: aConstantPool ifAbsent: |
|
6455 |
[| javaConstantPoolObject | |
|
6456 |
javaConstantPoolObject := (vm classForName:'sun.reflect.ConstantPool') new. |
|
6457 |
constantPoolMapping at: aConstantPool put: javaConstantPoolObject. |
|
6458 |
constantPoolMapping at: javaConstantPoolObject put: aConstantPool. |
|
6459 |
javaConstantPoolObject] |
|
6460 |
||
6461 |
"Created: / 21-12-2010 / 19:54:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6462 |
! ! |
|
6463 |
||
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
6464 |
!JavaVM::ReflectionRegistry methodsFor:'reflection - methods & ctors'! |
752 | 6465 |
|
1816 | 6466 |
classForJavaConstructorObject:constructor |
1648 | 6467 |
"given a java.lang.reflect.Constructor, return the corresponding class for it." |
6468 |
||
6469 |
| jclass | |
|
6470 |
jclass := constructor instVarNamed: #clazz. |
|
6471 |
^self classForJavaClassObject: jclass. |
|
6472 |
||
6473 |
"Created: / 22-08-2012 / 12:23:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6474 |
! |
|
6475 |
||
1816 | 6476 |
javaConstructorObjectForMethod:method |
752 | 6477 |
"given a real method, return the corresponding java.lang.reflect.Constructor |
6478 |
instance for it." |
|
6479 |
||
6480 |
| jCtor | |
|
6481 |
||
1217 | 6482 |
javaMethodsPerMethod at:method ifPresent:[:existingCtor|^existingCtor]. |
752 | 6483 |
|
6484 |
jCtor := (Java classForName:'java.lang.reflect.Constructor') new. |
|
6485 |
self javaMethodObjectLikeSlotsInto: jCtor forMethod: method. |
|
1217 | 6486 |
self rememberJavaMethodObject: jCtor for: method. |
752 | 6487 |
|
6488 |
^ jCtor |
|
6489 |
||
6490 |
"Created: / 09-02-2011 / 10:28:12 / Marcel Hlopko <hlopik@gmail.com>" |
|
1217 | 6491 |
"Modified: / 05-12-2011 / 10:02:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 6492 |
! |
6493 |
||
1816 | 6494 |
javaMethodObjectForMethod:method |
752 | 6495 |
"given a real method, return the corresponding java.lang.reflect.Constructor |
6496 |
instance for it." |
|
6497 |
| jMethod | |
|
6498 |
||
1217 | 6499 |
javaMethodsPerMethod at:method ifPresent:[:existingCtor|^existingCtor]. |
752 | 6500 |
|
6501 |
jMethod := (Java classForName:'java.lang.reflect.Method') new. |
|
6502 |
self javaMethodObjectLikeSlotsInto: jMethod forMethod: method. |
|
1217 | 6503 |
self rememberJavaMethodObject: jMethod for: method. |
752 | 6504 |
|
1816 | 6505 |
jMethod |
752 | 6506 |
instVarNamed: #name put: (self javaStringObjectForString: (method selector upTo:$() interned: true); |
6507 |
instVarNamed: #returnType put: (method descriptor returnClassObject); |
|
6508 |
instVarNamed: #annotationDefault put: (method annotations default bytes); |
|
6509 |
||
6510 |
yourself. |
|
6511 |
||
6512 |
^jMethod |
|
6513 |
||
6514 |
"Created: / 09-02-2011 / 10:29:46 / Marcel Hlopko <hlopik@gmail.com>" |
|
1217 | 6515 |
"Modified: / 05-12-2011 / 10:02:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 6516 |
! |
6517 |
||
1816 | 6518 |
javaMethodObjectLikeSlotsInto: jMethod forMethod: method |
837
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6519 |
" |
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6520 |
Fill in slots of given instance of java.lang.Method or |
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6521 |
java.lang.Constructor" |
1816 | 6522 |
|
752 | 6523 |
| desc | |
837
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6524 |
|
752 | 6525 |
desc := method descriptor. |
6526 |
jMethod |
|
837
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6527 |
instVarNamed: #clazz put: (self javaClassObjectForClass: method javaClass); |
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6528 |
instVarNamed: #slot put: 0; |
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6529 |
instVarNamed: #modifiers put: method accessFlags; |
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6530 |
instVarNamed: #parameterTypes |
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6531 |
put: (self javaClassObjectArrayForClasses: desc parameterClasses); |
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6532 |
instVarNamed: #exceptionTypes |
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6533 |
put: (self javaClassObjectArrayForClasses: method javaExceptionTable); |
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6534 |
instVarNamed: #annotations put: (method annotations runtimeVisible bytes); |
752 | 6535 |
yourself. |
1213
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1209
diff
changeset
|
6536 |
|
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1209
diff
changeset
|
6537 |
method signature notNil ifTrue:[ |
1816 | 6538 |
jMethod |
1213
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1209
diff
changeset
|
6539 |
instVarNamed: #signature |
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1209
diff
changeset
|
6540 |
put: (self javaStringObjectForString: method signature interned: true) |
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1209
diff
changeset
|
6541 |
]. |
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1209
diff
changeset
|
6542 |
|
752 | 6543 |
^ jMethod |
6544 |
||
6545 |
"Created: / 11-02-2011 / 06:44:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
837
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
827
diff
changeset
|
6546 |
"Modified: / 04-06-2011 / 17:17:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1213
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1209
diff
changeset
|
6547 |
"Modified: / 04-12-2011 / 19:40:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 6548 |
! |
6549 |
||
1816 | 6550 |
methodForJavaConstructorObject:constructor |
752 | 6551 |
"given a java.lang.reflect.Constructor, return the corresponding method |
6552 |
it." |
|
1216 | 6553 |
|
1217 | 6554 |
| slot | |
6555 |
slot := constructor instVarNamed: #slot. |
|
1581
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1579
diff
changeset
|
6556 |
^slot |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1579
diff
changeset
|
6557 |
"/ ^realMethods at: slot ifAbsent:[self error: 'No ctor found for java ctor object']. |
1216 | 6558 |
|
6559 |
"/ |class signature| |
|
6560 |
"/ class := self classForJavaClassObject:(constructor instVarNamed:#clazz). |
|
6561 |
"/ signature := Java as_ST_String:(constructor instVarNamed:#signature). |
|
6562 |
"/ class methodsDo:[:mthd| |
|
6563 |
"/ mthd signature = signature ifTrue:[ |
|
6564 |
"/ ^mthd |
|
6565 |
"/ ]. |
|
6566 |
"/ ]. |
|
913 | 6567 |
|
752 | 6568 |
"Created: / 09-02-2011 / 10:36:07 / Marcel Hlopko <hlopik@gmail.com>" |
1581
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1579
diff
changeset
|
6569 |
"Modified: / 01-08-2012 / 11:05:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1217 | 6570 |
! |
6571 |
||
1816 | 6572 |
methodForJavaMethodObject:jmethod |
752 | 6573 |
" |
6574 |
Given an instance of java.lang.reflect.Method, answers |
|
1816 | 6575 |
real method associated with it. |
913 | 6576 |
" |
1216 | 6577 |
|
1217 | 6578 |
| slot | |
6579 |
slot := jmethod instVarNamed: #slot. |
|
1581
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1579
diff
changeset
|
6580 |
^slot |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1579
diff
changeset
|
6581 |
"/ ^realMethods at: slot ifAbsent:[self error: 'No method found for java method object']. |
1217 | 6582 |
|
1216 | 6583 |
"/ |class name signature | |
6584 |
"/ |
|
6585 |
"/ class := self classForJavaClassObject:(aJavaMethodObject instVarNamed:#clazz). |
|
6586 |
"/ name := Java as_ST_String:(aJavaMethodObject instVarNamed:#name). |
|
6587 |
"/ signature := Java as_ST_String:(aJavaMethodObject instVarNamed:#signature). |
|
6588 |
"/ class methodsDo:[:mthd| |
|
6589 |
"/ (mthd name = name and:[mthd signature = signature]) ifTrue:[ |
|
6590 |
"/ ^mthd |
|
6591 |
"/ ] |
|
6592 |
"/ ]. |
|
1217 | 6593 |
"/ self assert: false description: 'No such method, malformed java.lang.reflect.Method object?'. |
6594 |
"/ ^nil. |
|
913 | 6595 |
|
752 | 6596 |
"Created: / 09-02-2011 / 10:32:14 / Marcel Hlopko <hlopik@gmail.com>" |
1581
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1579
diff
changeset
|
6597 |
"Modified: / 01-08-2012 / 11:19:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1217 | 6598 |
! |
6599 |
||
6600 |
rememberJavaMethodObject: jmethod for: method |
|
6601 |
||
6602 |
javaMethodsPerMethod at: method put: jmethod. |
|
6603 |
realMethods add: method. |
|
6604 |
jmethod instVarNamed: #slot put: realMethods size. |
|
6605 |
||
6606 |
"Created: / 05-12-2011 / 10:00:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 6607 |
! ! |
6608 |
||
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1968
diff
changeset
|
6609 |
!JavaVM::ReflectionRegistry methodsFor:'reflection - other'! |
752 | 6610 |
|
1816 | 6611 |
javaStringObjectForString:string |
752 | 6612 |
^ self javaStringObjectForString: string interned: false |
6613 |
||
6614 |
"Created: / 09-02-2011 / 10:34:57 / Marcel Hlopko <hlopik@gmail.com>" |
|
6615 |
! |
|
6616 |
||
1816 | 6617 |
javaStringObjectForString:string interned:intern |
752 | 6618 |
| s | |
6619 |
s := Java as_String: string. |
|
6620 |
^intern ifTrue:[Java intern: s] ifFalse:[s] |
|
6621 |
||
6622 |
"Modified: / 22-11-2010 / 17:57:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6623 |
"Created: / 09-02-2011 / 10:34:29 / Marcel Hlopko <hlopik@gmail.com>" |
|
6624 |
! ! |
|
6625 |
||
6626 |
!JavaVM class methodsFor:'documentation'! |
|
6627 |
||
923 | 6628 |
version |
1864 | 6629 |
^ '$Header$' |
923 | 6630 |
! |
6631 |
||
6632 |
version_CVS |
|
1885
32d39c55b8b0
Bug fix in Float.floatToRawIntBits and rawIntBitsToFloat.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1878
diff
changeset
|
6633 |
^ '§Header: /cvs/stx/stx/libjava/JavaVM.st,v 1.186 2011/08/22 14:49:28 vrany Exp §' |
923 | 6634 |
! |
6635 |
||
1864 | 6636 |
version_HG |
6637 |
||
6638 |
^ '$Changeset: <not expanded> $' |
|
6639 |
! |
|
6640 |
||
752 | 6641 |
version_SVN |
1885
32d39c55b8b0
Bug fix in Float.floatToRawIntBits and rawIntBitsToFloat.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1878
diff
changeset
|
6642 |
^ '§Id§' |
752 | 6643 |
! ! |
6644 |
||
1989
131b7459fdab
Value of class.path and sun.misc.boot.path refactored to match values used in Oracle JVM.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1953
diff
changeset
|
6645 |
|
924
7e66564a2302
fix for native sun.reflect.NativeMethodAccessorImpl.invoke0()
vranyj1
parents:
923
diff
changeset
|
6646 |
JavaVM initialize! |