JavaVM.st
branchcvs_MAIN
changeset 3360 1a8899091305
parent 3324 a58245c0e83a
child 3386 ddcff50a1fdc
--- a/JavaVM.st	Fri Feb 14 14:27:26 2014 +0100
+++ b/JavaVM.st	Wed Jan 28 03:12:08 2015 +0100
@@ -1,9 +1,9 @@
 "
- COPYRIGHT (c) 1996-2011 by Claus Gittinger
+ COPYRIGHT (c) 1996-2015 by Claus Gittinger
 
  New code and modifications done at SWING Research Group [1]:
 
- COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
+ COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko
                             SWING Research Group, Czech Technical University in Prague
 
  This software is furnished under a license and may be used
@@ -36,7 +36,7 @@
 		DivisionByZeroExceptionDebug IOExceptionDebug
 		JavaPrivilegedAccessQuery SmalltalkClassLoader
 		FinalizationEnabled FinalizationLobby ParkUnparkSemaphores
-		ThreadInterrupts NativeMethodsImplementation'
+		ThreadInterrupts NativeMethodsImplementation SystemProperties'
 	poolDictionaries:'JavaConstants JavaVMData'
 	category:'Languages-Java-Support'
 !
@@ -52,7 +52,7 @@
 	instanceVariableNames:'vm constantPoolMapping javaClasses javaArrayClasses
 		javaMethodsPerMethod returnNilIfMissing realMethods'
 	classVariableNames:''
-	poolDictionaries:''
+	poolDictionaries:'JavaVMData'
 	privateIn:JavaVM
 !
 
@@ -60,11 +60,11 @@
 
 copyright
 "
- COPYRIGHT (c) 1996-2011 by Claus Gittinger
+ COPYRIGHT (c) 1996-2015 by Claus Gittinger
 
  New code and modifications done at SWING Research Group [1]:
 
- COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
+ COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko
                             SWING Research Group, Czech Technical University in Prague
 
  This software is furnished under a license and may be used
@@ -1295,6 +1295,7 @@
     OpenFileTable := nil.
     JavaMethods := nil.
     SystemClassLoader := nil.
+    SystemProperties := nil.
 
     "
      JavaVM deinitialize
@@ -1536,8 +1537,10 @@
 initializeBaseClasses
     "load req'd base classes"
 
+    _java_lang_Object_CLASS := _java_lang_System_CLASS := _java_lang_Class_CLASS := nil.
+
     #( 'java.lang.Object' 'java.lang.Class' 'java.lang.String' 'java.lang.System' ) do: [:cName |
-        (self classForName: cName) isNil ifTrue: [
+        (self classForName: cName definedBy: nil) isNil ifTrue: [
             AbortSignal raise.
             ^ self
         ]
@@ -1547,7 +1550,7 @@
 
     "Created: / 03-01-1998 / 21:13:28 / cg"
     "Modified: / 23-12-1999 / 19:27:42 / cg"
-    "Modified: / 08-02-2013 / 00:54:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 21-05-2013 / 16:37:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 initializeClassReader
@@ -1712,18 +1715,43 @@
     "return a collection of native libs which are considered
      being already loaded (used with jdk >= 1.2)"
 
+    OperatingSystem isOSXlike ifTrue: [
+        SimulatedNativeLibs := #( 'libawt.jnilib' 
+                                  'libnet.jnilib' 
+                                  'libcmm.jnilib' 
+                                  'libzip.jnilib' 
+                                  'libnio.jnilib'
+                                  'libmanagement.jnilib'    "/ Management Beans - req'd by Tomcat
+                                  'libjpeg.jnilib'          "/ Some UI stuff - req'd by Tomcat !!?!!    
+                                  "/ 'liblcms.so' 
+                                  'libfontmanager.so'       "/ req'd by java.text.Bidi
+                                  "/ 'libj2pkcs11.so'          "/ req'd by Smack and some crypto stuff
+                                    ).
+        ^ self.
+    ].
     OperatingSystem isUNIXlike ifTrue: [
-        SimulatedNativeLibs := #( 'libawt.so' 'libnet.so' 'libcmm.so' 'libzip.so' 'libnio.so'
+        SimulatedNativeLibs := #( 'libawt.so' 
+                                  'libnet.so' 
+                                  'libcmm.so' 
+                                  'libzip.so' 
+                                  'libnio.so'
                                   'libmanagement.so'        "/ Management Beans - req'd by Tomcat
                                   'libjpeg.so' 'liblcms.so' "/ Some UI stuff - req'd by Tomcat !!?!!
                                   'libfontmanager.so'       "/ req'd by java.text.Bidi
+                                  'libj2pkcs11.so'          "/ req'd by Smack and some crypto stuff
                                     ).
         ^ self.
     ].
     OperatingSystem isMSWINDOWSlike ifTrue: [
-        SimulatedNativeLibs := #( 'awt.dll' 'net.dll' 'cmm.dll' 'zip.dll' 'nio.so'
-                                  'management.dll'          "/ Management Beans - req'd by Tomcat
-                                  'fontmanager.dll'          "/ req'd by java.text.Bidi
+        SimulatedNativeLibs := #( 'awt.dll' 
+                                  'net.dll' 
+                                  'cmm.dll' 
+                                  'zip.dll' 
+                                  'nio.so'
+                                  'management.dll'        "/ Management Beans - req'd by Tomcat
+                                  'fontmanager.dll'       "/ req'd by java.text.Bidi
+                                  'j2pkcs11.dll'          "/ req'd by Smack and some crypto stuff
+                                  'dt_shmem.dll'          "/ req'd by JDI on Windows / Oracle JDK 7
                                 ).
         ^ self.
     ].
@@ -1735,7 +1763,7 @@
     "Modified: / 27-01-1998 / 18:43:10 / cg"
     "Modified: / 03-11-2011 / 19:00:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Modified: / 21-12-2011 / 23:03:35 / jv"
-    "Modified: / 12-05-2012 / 12:52:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-11-2013 / 14:26:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 initializeSimulatedNativeMemory
@@ -1755,16 +1783,18 @@
         SystemClassLoader := java_lang_ClassLoader perform: #'getSystemClassLoader()Ljava/lang/ClassLoader;'
     ].
 
-    stx_libjava_ClassLoader := JavaVM classForName: 'stx.libjava.ClassLoader'.
+    stx_libjava_ClassLoader := JavaVM classForName: 'stx.libjava.ClassLoader' definedBy: SystemClassLoader.
     (SmalltalkClassLoader := stx_libjava_ClassLoader instVarNamed:#scl) isNil ifTrue:[
         SmalltalkClassLoader := stx_libjava_ClassLoader perform: #'getSmalltalkClassLoader()Ljava/lang/ClassLoader;'
     ].
 
     "Created: / 30-10-2011 / 12:04:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 10-12-2013 / 17:56:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 initializeSystemPropertiesInto: props
-    | cpu  cpu2  os |
+    | cpu  cpu2  os dir |
+
     "/ use JAVA compatible cpu-name
     cpu := OperatingSystem getCPUType.
     cpu2 := cpu.
@@ -1778,114 +1808,123 @@
     ].
     props addPairsFrom: {
                 'java.runtime.name'.
-                'OpenJDK Runtime Environment'.
+                    'OpenJDK Runtime Environment'.
                 'sun.boot.library.path'.
-                OperatingSystem isMSWINDOWSlike ifTrue: [
-                    (Java release jreHome / 'bin') asString
-                ] ifFalse: [ (Java release jreHome / 'lib' / cpu2) asString ].
+                    OperatingSystem isMSWINDOWSlike ifTrue: [
+                        (Java release javaBinDirOnWindows) asString
+                    ] ifFalse: [
+                        OperatingSystem isOSXlike ifTrue:[
+                            (Java release javaNativeLibDirOnUnix) asString 
+                        ] ifFalse:[
+                            (Java release javaLibDirOnUnix / cpu2) asString 
+                        ].
+                    ].
                 'java.vm.version'.
-                Smalltalk versionString.
+                    Smalltalk versionString.
                 'java.vm.vendor'.
-                'eXept Software AG & SWING Research Group'.
+                    'eXept Software AG & SWING Research Group'.
                 'java.vendor.url'.
-                'http://www.exept.de & http://swing.fit.cvut.cz'.
+                    'http://www.exept.de & http://swing.fit.cvut.cz'.
                 'path.separator'.
-                OperatingSystem pathSeparator asString.
+                    OperatingSystem pathSeparator asString.
                 'java.vm.name'.
-                'Smalltalk/X'.
+                    'Smalltalk/X'.
                 'file.encoding.pkg'.
-                'sun.io'.
+                    'sun.io'.
                 'sun.java.launcher'.
-                'SUN_STANDARD'.
+                    'SUN_STANDARD'.
                 'user.country'.
-                'US'.
+                    'US'.
                 'sun.os.patch.level'.
-                'unknown'.
+                    'unknown'.
                 'java.vm.specification.name'.
-                'Java Virtual Machine Specification'.
+                    'Java Virtual Machine Specification'.
                 'user.dir'.
-                Filename currentDirectory pathName.
+                    Filename currentDirectory pathName.
                 'java.awt.graphicsenv'.
-                'sun.awt.X11GraphicsEnvironment'.
+                    'sun.awt.X11GraphicsEnvironment'.
                 'java.endorsed.dirs'.
-                (Java release jreHome / 'lib' / 'endorsed') asString.
+                    (Java release javaLibDir / 'endorsed') asString.
                 'os.arch'.
-                cpu.
+                    cpu.
                 'java.io.tmpdir'.
-                Filename tempDirectory pathName.
+                    Filename tempDirectory pathName.
                 'line.separator'.
-                Character cr asString.
+                    Character cr asString.
                 'java.vm.specification.vendor'.
-                'Sun Microsystems Inc.'.
+                    'Sun Microsystems Inc.'.
                 'os.name'.
-                os.
+                    os.
                 'sun.jnu.encoding'.
-                'UTF-8'.
+                    'UTF-8'.
                 'java.library.path'.
-                self defaultJavaLibraryPath.
+                    self defaultJavaLibraryPath.
                 'java.specification.name'.
-                'Java Platform API Specification'.
+                    'Java Platform API Specification'.
                 'java.class.version'.
-                '50.0'.
+                    '50.0'.
                 'sun.management.compiler'.
-                'Smalltalk/X jinterpreter'.
+                    'Smalltalk/X jinterpreter'.
                 'os.version'.
-                OperatingSystem isMSWINDOWSlike ifTrue: [
-                    OperatingSystem getSystemInfo at: #release
-                ] ifFalse: [ OperatingSystem getSystemInfo at: #version ].
+                    OperatingSystem isMSWINDOWSlike ifTrue: [
+                        OperatingSystem getSystemInfo at: #release
+                    ] ifFalse: [ 
+                        OperatingSystem getSystemInfo at: #version 
+                    ].
                 'user.home'.
-                Filename homeDirectory pathName.
+                    Filename homeDirectory pathName.
                 'user.timezone'.
-                ''.
+                    ''.
                 'java.awt.printerjob'.
-                'sun.print.PSPrinterJob'.
+                    'sun.print.PSPrinterJob'.
                 'file.encoding'.
-                'UTF-8'.
+                    'UTF-8'.
                 'java.specification.version'.
-                '1.6'.
+                    '1.6'.
                 'java.class.path'.
-                self defaultCLASSPATH.
+                    self defaultCLASSPATH.
                 'user.name'.
-                OperatingSystem getLoginName.
+                    OperatingSystem getLoginName.
                 'java.vm.specification.version'.
-                '1.0'.
-                 "'sun.java.command'            . 'SystemProperties' ."
+                    '1.0'.
+                 "'sun.java.command'            . 
+                    'SystemProperties' ."
                 'java.home'.
-                Java release jreHome pathName.
+                    Java release jreHome pathName.
                 'sun.arch.data.model'.
-                '32'.
+                    '32'.
                 'user.language'.
-                Smalltalk language.
+                    Smalltalk language.
                 'java.specification.vendor'.
-                'Sun Microsystems Inc.'.
+                    'Sun Microsystems Inc.'.
                 'java.vm.info'.
-                'Smalltalk/X 6.2.1'.
+                    'Smalltalk/X 6.2.1'.
                 'java.version'.
-                '1.6'.
+                    '1.6'.
                 'java.ext.dirs'.
-                self defaultExtDirs.
+                    self defaultExtDirs.
                 'sun.boot.class.path'.
-                self defaultSunBootLibraryPath.
+                    self defaultSunBootLibraryPath.
                 'java.vendor'.
-                'Sun Microsystems Inc.'.
+                    'Sun Microsystems Inc.'.
                 'file.separator'.
-                Filename separatorString.
+                    Filename separatorString.
                 'java.vendor.url.bug'.
-                'https://swing.fit.cvut.cz/projects/stx-libjava/newticket'.
+                    'https://swing.fit.cvut.cz/projects/stx-libjava/newticket'.
                 'sun.io.unicode.encoding'.
-                'UnicodeLittle'.
+                    'UnicodeLittle'.
                 'sun.cpu.endian'.
-                'little'.
+                '   little'.
                 'sun.desktop'.
-                'gnome'.
+                    'gnome'.
                 'sun.cpu.isalist'.
-                ''
+                    ''
             }.
 
     "/ props at:'user.dir'           put:(Filename currentDirectory pathName).
     "/props at:'awt.toolkit'        put:(self defaultWindowingToolKit).
 
-    props at: 'user.country' put: 'US'.
+    "/ props at: 'user.country' put: 'US'.   - already done above
     props at: 'hotjava.home' put: (self defaultHotJavaHome).
 
     "/ new with jdk 1.1.8
@@ -1896,34 +1935,42 @@
 
     "/ new with jdk 1.2
 
-    props at: 'java.awt.graphicsenv' put: 'sun.awt.X11GraphicsEnvironment'.
+    "/ props at: 'java.awt.graphicsenv' put: 'sun.awt.X11GraphicsEnvironment'.  -- already done above
     props at: 'java.awt.fonts' put: '/usr/lib/X11/fonts'.
 
     "/ jws
     "/props at:'jws.home'             put:(self defaultJWSHome).
     "/ new with jws 2.0 ...
     "/props at:'jws.startcmd'         put:'jws.showwin.mainide'.
-"/    props at: 'sun.misc.URLClassPath.debug' put: 'true'.
+"/    props at: 'un.misc.URLClassPath.debug' put: 'true'.
+
+    OperatingSystem isMSWINDOWSlike ifTrue:[
+        props at:'java.net.preferIPv4Stack' put: 'true'.
+    ].
 
     "/ Java tests, sigh..."
 
-    props at: 'libjava.tests.dir' put: ((Smalltalk getPackageDirectoryForPackage: self package) / 'tests') pathName.
-
+    (dir := Smalltalk getPackageDirectoryForPackage: self package) notNil ifTrue:[
+        props at: 'libjava.tests.dir' put: (dir / 'tests') pathName.
+    ].
     ^ props
 
     "
-     self initializeSystemPropertiesInto:(Dictionary new)"
+     self initializeSystemPropertiesInto:(Dictionary new)
+    "
 
     "Created: / 03-01-1998 / 14:26:39 / cg"
     "Modified: / 27-01-2000 / 02:20:18 / cg"
     "Modified (format): / 03-11-2011 / 12:40:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Modified: / 21-12-2011 / 23:05:11 / jv"
     "Modified: / 13-09-2012 / 20:33:56 / m"
-    "Modified: / 09-01-2013 / 17:11:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-11-2013 / 23:43:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 initializeVM
 
+    | booter blocker errorDuringInit|
+
     OperatingSystem initResources.
 
     Java initializeRelease.
@@ -1933,7 +1980,7 @@
      - Groovy 'rnd = new java.security.SecureRandom()' requires > 4MB
      - ant run on Groovy 1.8.7 source requires > 8MB
     "
-    "/Process defaultMaximumStackSize: ((1024 * 1024 * 16) max: Process defaultMaximumStackSize).
+    Process defaultMaximumStackSize: ((1024 * 1024 * 4) max: Process defaultMaximumStackSize).
 
     "Java Classes are huge and there is a (unfixed) bug in 2-phase oldspace
      compress, so try to avoid it by pre-allocating more oldspace."
@@ -1954,7 +2001,11 @@
     Java initAllStaticFields.
     Java markAllClassesUninitialized.
     ZipCache := OrderedCollection new.
+
     ZipEntryCache := OrderedCollection new.
+    ZipEntryCacheFirstFree := 0.
+    ZipEntryCacheLock := RecursionLock new.
+
     ZipInflaters := OrderedCollection new.
     FinalizationLobby := JavaFinalizationRegistry new.
     JavaVMData classVarNames do:[:nm |
@@ -1969,12 +2020,10 @@
     "/ by resolver ... (sigh)
 
     JavaNativeMethod flushAllCachedNativeMethods.
-    JavaMethod
-        allSubInstancesDo: [
-            :m |
-            m checked: false.
-            m code: nil.
-        ].
+    JavaMethod allSubInstancesDo: [ :m |
+            m clearJittedCodeAndForceJittingAgain.
+            "/ m checked: false; code: nil.
+    ].
     ObjectMemory flushCaches.
 
     "/ sigh - must flush inline caches.
@@ -2001,13 +2050,39 @@
     self initializeReflection.
     self initializeBaseClasses.
     self initializePrimitiveClasses.
-    Java initSystemClass.
-    Java initializeCurrentThread.
-    self initializeSystemClassLoader.
+
+    "/ Initialization spawns couple of new threads, namely
+    "/ finalization handler and signal handler. Those processes
+    "/ should form their own new process group. 
+    blocker := Semaphore new.
+
+    errorDuringInit := nil.
+    booter := [
+        [
+            Error handle:[:ex |
+                errorDuringInit := ex.
+                ex reject.
+            ] do:[
+                Java initSystemClass.
+                Java initializeCurrentThread.
+                self initializeSystemClassLoader.
+                FinalizationLobby startFinalizationProcessAt: 5.
+            ].
+        ] ensure:[
+            blocker signal.
+        ].
+    ] newProcess.
+    booter name:'JVM boot process'.
+    booter beGroupLeader.
+    booter resume.
+
+    blocker wait.
+    errorDuringInit notNil ifTrue:[
+        self error:'error during boot of JVM: ',errorDuringInit description
+    ].
+
     ObjectMemory addDependent: self.
     StartupTime := OperatingSystem getOSTime.
-    FinalizationLobby startFinalizationProcessAt: 5.
-
 
     JavaNativeMethod allInstancesDo:[:e|e nCallsReset ].
 
@@ -2020,7 +2095,7 @@
     "Modified: / 15-10-2010 / 15:27:45 / Jan Kurs <kurs.jan@post.cz>"
     "Modified: / 24-02-2012 / 13:59:29 / Marcel Hlopko <hlopik@gmail.com>"
     "Modified: / 24-02-2012 / 14:37:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 13-08-2013 / 11:49:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 04-04-2014 / 12:43:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 initializeVMIfNoEventThreadRunning
@@ -2256,8 +2331,11 @@
 systemProperties
     |props|
 
-    props := Dictionary new.
-    self initializeSystemPropertiesInto:props.
+    (props := SystemProperties) isNil ifTrue:[
+        props := Dictionary new.
+        self initializeSystemPropertiesInto:props.
+        SystemProperties := props
+    ].
     ^ props
 
     "Created: / 3.1.1998 / 14:25:58 / cg"
@@ -2368,25 +2446,18 @@
 
 !JavaVM class methodsFor:'accessing'!
 
-addClass:aJavaClass definedBy:aJavaClassLoader
-
-    self assert: aJavaClass classLoader == aJavaClassLoader.
-    ^ ClassRegistry registerClass:aJavaClass
-
-    "Modified: / 23-10-2011 / 11:58:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-addSelector:newSelector withMethod:newMethod
+addSelector:newSelector withMethod:newMethod 
     super addSelector:newSelector withMethod:newMethod.
-
+    
     "/JavaNativeMethod may not be loaded..."
-
-    (Smalltalk at:#JavaNativeMethod)
-        ifNotNil:[JavaNativeMethod flushAllCachedNativeMethods].
+    
+    (Smalltalk at:#JavaNativeMethod) notNil ifTrue:[
+        JavaNativeMethod flushAllCachedNativeMethods
+    ].
 
     "Created: / 24-12-1999 / 03:12:05 / cg"
-    "Modified: / 02-02-2011 / 04:38:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 02-02-2011 / 23:38:08 / Marcel Hlopko <hlopik@gmail.com>"
+    "Modified: / 04-08-2014 / 15:52:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 assertionsEnabled: aBoolean
@@ -2500,6 +2571,31 @@
     "Created: / 23-02-2011 / 12:59:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!JavaVM class methodsFor:'accessing-builtin classes'!
+
+builtInClassNames
+    "Returns an array with (binary) names of classes known by the runtime system.
+     When a builtin class is loaded and registered in class registry,
+     JavaClassRegistry is sent #registerBuiltIn:
+
+     NOTE: If you add class here, you may want to update
+     JavaClassRegistry>>registerBuiltIn:.
+    "
+    ^#(
+        #'java/lang/Object'
+        #'java/lang/String'
+        #'java/lang/System'
+        #'java/lang/Class'
+
+        #'java/lang/reflect/Constructor'
+        #'java/lang/reflect/Method'
+        #'java/lang/reflect/Field'
+
+    )
+
+    "Created: / 22-05-2013 / 20:38:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !JavaVM class methodsFor:'cache management'!
 
 flushCachesFor: aClass
@@ -2510,8 +2606,8 @@
     aClass methodDictionary do:[:mthd|
         (mthd isJavaMethod and:[mthd isNative not and:[mthd isResolved not]]) ifTrue:[
             "Stdout nextPutAll:'Flushing code for ' , mthd printString; cr."
-            mthd code: nil.
-            mthd checked: false.
+            mthd clearJittedCodeAndForceJittingAgain.
+            "/ mthd code: nil; checked: false.
         ].
     ].
     ObjectMemory flushCachesFor: aClass.
@@ -2536,13 +2632,13 @@
 !
 
 at: aString put: aJavaClass
-    self breakPoint: #mh.
-    self breakPoint: #jv.
-    "dont use me anymore"
+    <resource: #obsolete>
+    
+    self error: 'Should not be used anymore'.
     ^ ClassRegistry registerClass: aJavaClass
 
     "Modified (comment): / 21-10-2011 / 12:14:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 23-10-2011 / 11:58:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-08-2014 / 01:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 classForName: className
@@ -2560,6 +2656,11 @@
     "load class from registry - load using given classLoader if not nil"
 
     | result binaryName |
+
+"/    classLoader isNil ifTrue:[
+"/        Logger log: 'JavaVM>>classForName: ''', className , ''' definedBy: nil' severity: #trace.
+"/    ].
+
     binaryName := className asSlashedJavaClassName.
     result := self
                 classForName: binaryName
@@ -2567,49 +2668,10 @@
                 ifAbsentPut: [
                     | class  classLoaderEnsured |
                     self assert: (binaryName includes: $.) not.
-                    self booted ifFalse: [
-                        "class loaders allowed after vm boot, until then, only primordial"
-                        class := self usePrimordialCLToLoadClassNamed: binaryName.
-                        self assert:(class notNil)
-                            message:'Couldnt load class ' , binaryName , ' while booting Java VM'.
+                        class := self loadClassNamed: binaryName usingClassLoader: classLoader.
                         class.
-                    ] ifTrue: [
-                        self assert:(self booted)
-                            message:'Java VM is not booted and we are not using primordial class loader to load: ' , className.
-                        (Java release bootClassPathIncludesClassNamed: className) ifTrue: [
-                            "we will use primordial class loader for classes in rt.jar etc"
-                            class := self usePrimordialCLToLoadClassNamed: binaryName.
-                            self assert:(class notNil)
-                                message:'Class ' , binaryName , ' is supposed to be in boot classpath, but we couldnt load it'.
-                            class.
-                        ] ifFalse: [
-                            (Java release extDirsIncludesClassNamed: binaryName) ifTrue: [
-                                class := self useExtCLToLoadClassNamed: binaryName.
-                                self assert:(class notNil)
-                                    message:'Class ' , binaryName  , ' is supposed to be in java.ext,dirs, but we couldnt load it'.
-                                class.
-                            ] ifFalse: [
-                                "at this point, nil classLoader means use system class loader,
-                                 in other words, at this point, we shouldnt use primordial cl at all"
-                                classLoader isNil ifTrue: [
-                                    self assert:(self systemClassLoader notNil)
-                                        message:'We needed system class loader, but its not loaded yet'.
-                                    classLoaderEnsured := self systemClassLoader
-                                ] ifFalse: [ classLoaderEnsured := classLoader ].
-                                class := self useUserDefinedCL: classLoaderEnsured
-                                            toLoadClassNamed: binaryName.
-                                class isNil ifTrue: [
-                                    Logger
-                                        log: 'Even ' , classLoader printString , ' was not able to load class '
-                                                , className
-                                        severity: #warn
-                                        facility: 'JVM'.
-                                    nil
-                                ] ifFalse: [ class ].
-                            ]
-                        ]
-                    ]
                 ].
+
     result isNil ifTrue: [
         Logger
             log: 'Class ' , className , ' couldnt be loaded'
@@ -2620,7 +2682,7 @@
 
     "Created: / 21-10-2011 / 12:01:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Modified: / 02-11-2011 / 16:49:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 07-05-2013 / 12:27:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 10-12-2013 / 22:59:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 classForName: className definedBy: classLoader ifAbsentPut: aBlock
@@ -2673,20 +2735,19 @@
 !
 
 loadClassesIn: directory
-"load all classes (.class files, strictly speaking) found in given directory.
-The argument is string containing the name of the directory.
-
-Returns a set of loaded classes."
-
-^ self loadClassesIn: directory matching: '*'.
-
-    "Modified: / 11-06-2011 / 13:35:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Load all classes (.class files, strictly speaking) found in given directory or .jar file.
+
+    Returns a set of loaded classes."
+
+    ^ self loadClassesIn: directory matching: nil.
+
     "Created: / 21-10-2011 / 12:40:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 27-05-2014 / 12:19:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 loadClassesIn: directory matching: pattern
-    "load all classes (.class files, strictly speaking) found in given directory.
-     The arguments are a string containing the name of the directory
+    "Load all classes (.class files, strictly speaking) found in given directory or .jar file.
+     The arguments are a string containing the name of the directory or .jar file
      and a class name pattern. Only classes matching the pattern are loaded.
      class names are matched using String>>matches:.
      ALL CLASSES ARE INSTALLED!!
@@ -2697,19 +2758,36 @@
     loadedClasses := Set new.
     Java addToClassPath: dir pathName.
     JavaClassReader classLoaderQuerySignal answer: SystemClassLoader do:[
-
-    dir
-        recursiveDirectoryContentsAsFilenamesDo: [
-            :filename |
-            (filename isRegularFile and: [ filename suffix = #class ]) ifTrue: [
-                dirString := dir pathName.
-                className := filename withoutSuffix pathName.
-                className := className subString: dirString size + 2 to: className size.
-                className := className copyReplaceAll: (Filename separator) with: $..
-                (className matches: pattern) ifTrue: [
-                    (self classNamed: className) isNil ifTrue:[
-                        loadedClasses add: (self classForName:className).
-                    ].
+        dir isDirectory ifTrue:[
+            dir recursiveDirectoryContentsAsFilenamesDo: [
+                :filename |
+                (filename isRegularFile and: [ filename suffix = #class ]) ifTrue: [
+                    dirString := dir pathName.
+                    className := filename withoutSuffix pathName.
+                    className := className subString: dirString size + 2 to: className size.
+                    className := className replaceAll: (Filename separator) with: $..
+                    (pattern isNil or:[className matches: pattern]) ifTrue: [
+                        (self classNamed: className) isNil ifTrue:[
+                            loadedClasses add: (self classForName:className).
+                        ].
+                    ]
+                ]
+            ].
+        ] ifFalse:[
+            | zar |
+
+            zar := ZipArchive oldFileNamed: dir pathName.
+            zar entries do:[:entry|
+            (entry endsWith:'.class') ifTrue:[
+                | nm |
+
+                nm := entry copyTo: entry size - 6.
+                className := nm replaceAll: (Filename separator) with: $..
+                    (pattern isNil or:[className matches: pattern]) ifTrue: [
+                        (self classNamed: className) isNil ifTrue:[
+                            loadedClasses add: (self classForName:className).
+                        ].
+                    ]
                 ]
             ]
         ].
@@ -2717,51 +2795,45 @@
     ^ loadedClasses.
 
     "Modified: / 21-10-2011 / 12:52:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 30-10-2011 / 14:02:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 27-05-2014 / 12:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!JavaVM class methodsFor:'class loading'!
-
-useExtCLToLoadClassNamed: className
-    | ecl  class |
-    ecl := self extClassLoader.
-    self assert:(ecl notNil)
-    message:'we want to use ExtClassLoader, but its not loaded yet'.
-    class := ecl
-                perform: #'loadClassInternal(Ljava/lang/String;)Ljava/lang/Class;'
-                with: (Java as_String: (className asDottedJavaClassName)).
-    self assert:(class notNil)
-    message:'we tried to load class ' , className 
-            , ' using ExtClassLoader and we failed:)'.
-                class := JavaVM classForJavaClassObject: class.
-                class classLoader: ecl.
+!JavaVM class methodsFor:'class loading/unloading'!
+
+loadClassNamed: className usingClassLoader: classLoader
+    "Load class with given `className` using given `classLoader`. If
+     `classLoader` is nil (i.e., primordial class loader), load
+     the class ourselfs"
+
+    | class |
+
+    JavaClassReader classLoaderQuerySignal answer: classLoader do: [
+        classLoader isNil ifTrue:[
+            "/ Primordial load...
+            class := JavaClassReader readClass: className classPath: Java release bootClassPath
+        ] ifFalse:[
+            class := classLoader
+                    perform: #'loadClassInternal(Ljava/lang/String;)Ljava/lang/Class;'
+                    with: (Java as_String: (className asDottedJavaClassName)).
+            class := self classForJavaClassObject: class.
+        ].
+    ].
     ^ class.
 
-    "Created: / 02-11-2011 / 13:48:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-usePrimordialCLToLoadClassNamed: className
-    | class |
-    JavaClassReader classLoaderQuerySignal answer: nil do: [
-        class := JavaClassReader readClass: className classPath: Java release bootClassPath  
-    ].
-    ^ class
-
-    "Modified: / 02-11-2011 / 17:28:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 23-01-2013 / 15:18:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-useUserDefinedCL: classLoader toLoadClassNamed: className
-    | classObject  class |
-    classObject := classLoader
-                perform: #'loadClassInternal(Ljava/lang/String;)Ljava/lang/Class;'
-                with: (Java as_String: (className asDottedJavaClassName)).
-    class := self classForJavaClassObject: classObject.
-    class javaMirror getClassLoader isNil ifTrue: [self breakPoint:#mh].
-    ^ class.
-
-    "Created: / 02-11-2011 / 16:20:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 22-08-2012 / 12:57:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 14-09-2013 / 23:06:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 15-09-2013 / 00:17:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+unloadClass: class
+    "Remove given `class` from the system, i.e., remove it from
+     the class registry as well as from system dictionary (Smalltalk).
+
+     Note, that this method also removes all dependent classes and
+     invalidates all references"
+
+    ClassRegistry unregisterClass: class.
+
+    "Created: / 14-09-2013 / 23:25:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaVM class methodsFor:'debugging support'!
@@ -2816,12 +2888,30 @@
     ExceptionDebugPatterns add: 'java/lang/InstantiationException'.
     ExceptionDebugPatterns add: 'java/lang/RuntimeException'.
     ExceptionDebugPatterns add: 'java/lang/ClassCastException'.
+    ExceptionDebugPatterns add: 'java/lang/IllegalAccess*'.
+    ExceptionDebugPatterns add: 'java/util/zip/ZipException'.
+    ExceptionDebugPatterns add: 'java/lang/UnsatisfiedLinkError'.
+    ExceptionDebugPatterns add: 'java/lang/ThreadDeath'.
+
+
 
 
     ExceptionDebug := true.
     "
 
     "Created: / 25-02-2011 / 08:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 12-06-2014 / 11:36:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+exceptionTrace:aBoolean
+    ExceptionTrace := aBoolean
+
+!
+
+monitorTrace
+    ^ MonitorTrace
+
+    "Created: / 11-10-2013 / 11:16:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaVM class methodsFor:'debugging-dumping'!
@@ -2957,30 +3047,53 @@
 !
 
 defaultJavaLibraryPath
-
-    | dirs |
-    dirs := OrderedCollection new
-            add: Java release javaHome asFilename / 'lib';
-            add: Java release javaHome asFilename / 'lib' / 'amd64';
-            add: Java release javaHome asFilename / 'lib' / 'i386';
-            add: Java release javaHome asFilename / 'jre' / 'lib' ;
-            add: Java release javaHome asFilename / 'jre' / 'lib' / 'amd64'  ;
-            add: Java release javaHome asFilename / 'jre' / 'lib' / 'i386' ;
-            add: Java release javaHome asFilename / 'jre' / 'bin' ;
-            yourself.
+    |javaHome jreHome dirs libDir jniLibDir|
+
+    javaHome := Java release javaHome asFilename.
+    jreHome := Java release jreHome.
+    libDir := Java release libDirInJreHome.
+    jniLibDir := Java release jniLibDirInJreHome.
+
+    dirs := Set new.
+    dirs
+        add: javaHome / libDir;
+        add: javaHome / libDir / 'amd64';
+        add: javaHome / libDir / 'i386'.
+
+    libDir ~= jniLibDir ifTrue:[
+        dirs 
+            add: javaHome / jniLibDir;
+            add: javaHome / jniLibDir / 'amd64';
+            add: javaHome / jniLibDir / 'i386'.
+    ].
+    jreHome notNil ifTrue:[
+        dirs 
+            add: jreHome / libDir ;
+            add: jreHome / libDir / 'amd64'  ;
+            add: jreHome / libDir / 'i386' ;
+            add: jreHome / 'bin'.
+        libDir ~= jniLibDir ifTrue:[
+            dirs 
+                add: jreHome / jniLibDir;
+                add: jreHome / jniLibDir / 'amd64';
+                add: jreHome / jniLibDir / 'i386'
+        ].
+    ].
+
     OperatingSystem isMSWINDOWSlike ifTrue:[
         dirs
-            add: Java release javaHome asFilename / 'bin'.
-    ].
+            add: javaHome / 'bin'.
+    ].
+    dirs := (dirs select:[:d| d exists]) asOrderedCollection.
 
     ^String streamContents:
         [:path|
-        (dirs select:[:d|d exists])
+        dirs
             do:[:d|path nextPutAll:d pathName]
             separatedBy:[path nextPut: OperatingSystem pathSeparator]]
 
     "
-        JavaVM defaultJavaLibraryPath
+     JavaVM defaultJavaLibraryPath
     "
 
     "Created: / 10-12-2010 / 14:09:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -3161,7 +3274,7 @@
      "
      - If T is a class type, then T must be Object.
     "
-    t isJavaClassType ifTrue: [ ^ t == (self classForName: 'java.lang.Object') ].
+    t isJavaClassType ifTrue: [ ^ t == (self classForName: 'java.lang.Object' definedBy: nil) ].
      "
      - If T is an array type TC[], that is, an array of components of type TC ,
      then one of the following must be true:
@@ -3186,7 +3299,7 @@
     "Modified: / 09-01-1999 / 00:45:21 / cg"
     "Created: / 11-02-2011 / 08:21:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 21-10-2011 / 13:50:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 24-02-2012 / 16:34:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-05-2013 / 12:57:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 javaStringObjectForString:string
@@ -3220,9 +3333,11 @@
 makeArrayOf: loadedJavaClass asDescribedBy: className
     | arrayClass  dimensions |
 
+    className first == $[ ifFalse:[ ^ loadedJavaClass ].
+
     arrayClass := loadedJavaClass.
     dimensions := className occurrencesOf: $[.
-        arrayClass isJavaArrayClass ifTrue: [
+    arrayClass isJavaArrayClass ifTrue: [
         "is already array (primitive arrays case, like ByteArray etc)"
         dimensions := dimensions - 1.
     ].
@@ -3230,7 +3345,7 @@
         ^ arrayClass.
 
     "Created: / 21-10-2011 / 12:18:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified (format): / 23-10-2011 / 22:30:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 27-05-2014 / 12:40:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 newThread: name
@@ -3294,7 +3409,7 @@
         standardGroup instVarNamed: 'maxPriority'
             put: (threadClass instVarNamed: 'MAX_PRIORITY').
         standardGroup instVarNamed: 'destroyed' put: 0.
-        standardGroup instVarNamed: 'daemon' put: nil.
+        standardGroup instVarNamed: 'daemon' put: 0.
         (standardGroup class instVarOffsetOf: 'vmAllowSuspension') notNil ifTrue: [
             standardGroup instVarNamed: 'vmAllowSuspension' put: 0.
         ].
@@ -3307,7 +3422,7 @@
 
     "Created: / 03-01-1998 / 01:41:54 / cg"
     "Modified: / 17-11-1998 / 22:55:30 / cg"
-    "Modified: / 25-04-2011 / 20:27:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 07-10-2013 / 11:51:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaVM class methodsFor:'helpers - exceptions'!
@@ -3341,12 +3456,12 @@
     "Created: / 8.1.1999 / 15:03:59 / cg"
 !
 
-throwArrayStoreException:badArray
+throwArrayStoreException:message
     ^ self
         throwExceptionClassName:'java.lang.ArrayStoreException'
-         withMessage:('bad array store: ' , badArray class printString)
-
-    "Modified: / 23-06-2011 / 09:19:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+        withMessage:message
+
+    "Modified: / 02-06-2014 / 14:21:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 throwClassCastException
@@ -3395,6 +3510,20 @@
     "Modified: / 10.11.1998 / 13:20:31 / cg"
 !
 
+throwCloneNotSupportedException
+    ^ self throwCloneNotSupportedException: 'clone() not supported (object does not implement java.lang.Cloneable)'
+
+    "Created: / 08-11-2013 / 22:38:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+throwCloneNotSupportedException: message
+    ^ self
+        throwExceptionClassName:'java.lang.CloneNotSupportedException'
+        withMessage: message
+
+    "Created: / 08-11-2013 / 22:39:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 throwDataFormatException: message
     ^ self
         throwExceptionClassName:'java.util.zip.DataFormatException'
@@ -3424,9 +3553,9 @@
             tmpMessage := Java as_ST_String: tmpMessage
         ].
         Logger
-            log: 'JAVA: exception: ' , aJavaException class fullName , ' ('
+            log: 'JAVA: exception: ' , aJavaException class binaryName , ' ('
                     , tmpMessage , ')'
-            severity: #debug
+            severity: #trace
             facility: 'JVM'
     ].
     ExceptionDebug ifTrue: [
@@ -3434,10 +3563,11 @@
         (ExceptionDebugPatterns isNilOrEmptyCollection
             or: [
                 ExceptionDebugPatterns
-                    anySatisfy: [:pattern | pattern match: aJavaException class fullName ]
+                    anySatisfy: [:pattern | pattern match: aJavaException class binaryName ]
             ])
                 ifTrue: [
-                    self halt: ('JAVA: exceptionDebug: ' , aJavaException class fullName)
+                    ObjectMemory debugBreakPoint3.
+                    self halt: ('JAVA: exceptionDebug: ' , aJavaException class binaryName )
                 ]
     ].
 
@@ -3477,11 +3607,14 @@
         "/ no JavaHandler ... let smalltalk handle it
         "/
         exClass := aJavaException class.
-        exClass == (self classNamed: 'java/lang/ThreadDeath') ifTrue: [
-            "/mh 1.12.11 uncaught threadDeaths are not delegated out.. Thread.stop javadoc
-            ^ self
+        (exClass binaryName == #'java/lang/ThreadDeath') ifTrue: [
+            JavaUnhandledThreadDeathError
+                raiseWith: aJavaException
+                errorString: msg
+                in: thisContext sender.
+            ^ self.
         ].
-        msg := 'Java ' , exClass name.
+        msg := 'Java ' , exClass binaryName.
         jMsg := aJavaException instVarNamed: 'detailMessage'.
         jMsg notNil ifTrue: [ msg := msg , ': ' , (Java as_ST_String: jMsg). ].
 
@@ -3532,8 +3665,7 @@
     "Created: / 07-01-1998 / 15:28:22 / cg"
     "Modified: / 24-12-1999 / 02:33:25 / cg"
     "Modified: / 01-12-2011 / 18:32:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 07-05-2013 / 01:59:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-
+    "Modified: / 12-06-2014 / 11:59:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 throwExceptionClassName: aJavaExceptionClassName withMessage: someMessage
@@ -3571,28 +3703,31 @@
 
     method := context method.
     pc := context pc.
-
-    token := JavaContext::FinallyToken new.
     returnContext := thisContext sender sender sender.
-    returnContext selector == #return: ifTrue:[
-        token
-            context: context;
-            selector: #return:;
-            exception: returnContext receiver;
-            value: (returnContext argAt:1).
+
+    (returnContext receiver class == JavaContext finallyTokenClass and:[returnContext selector == #pass ]) ifTrue:[
+        token := returnContext receiver
     ] ifFalse:[
-        returnContext selector == #return ifTrue:[
+    token := JavaContext finallyTokenClass new.
+        returnContext selector == #return: ifTrue:[
             token
-                context: context;
-                selector: #return;
+                context: (returnContext at: 2); "/ context which should return, see GenericException>>return:
+                selector: #return:;
                 exception: returnContext receiver;
-                value: nil.
+                value: (returnContext argAt:1).
         ] ifFalse:[
-            self error:'Unhandled case, inform libjava developers (JV in particular)' .
+            returnContext selector == #return ifTrue:[
+                token
+                    context: (returnContext at: 1); "/ context which should return, see GenericException>>return
+                    selector: #return;
+                    exception: returnContext receiver;
+                    value: (returnContext at: 2).  "/ value which should be returned, see GenericException>>return
+            ] ifFalse:[
+                self error:'Unhandled case, inform libjava developers (JV in particular)' .
+            ].
         ].
     ].
 
-
     handlerPC := method handlerFor: nil at: pc.
     handlerPC isNil ifTrue:[ ^ self ].
 
@@ -3604,6 +3739,7 @@
     self halt: 'should not be reached'.
 
     "Created: / 03-04-2012 / 16:56:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 10-10-2013 / 10:03:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 throwExceptionInInitializerError:className
@@ -3912,35 +4048,34 @@
     "Modified: / 09-02-2011 / 00:58:09 / Marcel Hlopko <hlopik@gmail.com>"
 !
 
-javaFieldObjectForField: aJavaField in: aJavaLangClass
+javaFieldObjectForField:aJavaField in:aJavaLangClass 
     "given a java field, return the corresponding java.lang.Field
      instance for it."
     "
         See OpenJDK7 source:
         jdk7/hotspot/src/share/vm/runtime/reflection.cpp,
         oop Reflection::new_field"
-
-    | field  clazz  name  slot  type  modifiers |
+    
+    | field  clazz  nm  slot  type  modifiers |
 
     clazz := aJavaLangClass.
-    name := self reflection javaStringObjectForString: aJavaField name
-                interned: true.
+    nm := self reflection javaStringObjectForString:aJavaField name
+            interned:true.
     slot := aJavaField index.
-    type := self javaClassObjectForClass: aJavaField typeClass.
+    type := self javaClassObjectForClass:aJavaField typeClass.
     modifiers := aJavaField accessFlags.
-    field := (self classForName: 'java.lang.reflect.Field') new.
+    field := (self classForName:'java.lang.reflect.Field') new.
     field
-        instVarNamed: #clazz put: clazz;
-        instVarNamed: #name put: name;
-        instVarNamed: #slot put: slot;
-        instVarNamed: #type put: type;
-        instVarNamed: #modifiers put: modifiers;
+        instVarNamed:#clazz put:clazz;
+        instVarNamed:#name put:nm;
+        instVarNamed:#slot put:slot;
+        instVarNamed:#type put:type;
+        instVarNamed:#modifiers put:modifiers;
         yourself.
-    aJavaField annotations
-        ifNotNil: [
-            field instVarNamed: #annotations
-                put: aJavaField annotations runtimeVisible rawAnnotations
-        ].
+    aJavaField annotations notNil ifTrue:[
+        field instVarNamed:#annotations
+            put:aJavaField annotations runtimeVisible rawAnnotations
+    ].
     ^ field.
 
     "Modified: / 05-12-1998 / 15:29:32 / cg"
@@ -4002,7 +4137,7 @@
 !
 
 monitorEnter:someObject in:aJavaContext
-    | thisProcess  wasBlocked  lockWordOrJavaMonitor |
+    | thisProcess  wasBlocked |
 
     "/ Following assesrtion no longer holds as native methods are not
     "/ JavaMethods (they are smalltalk trampolines) and thus their
@@ -4026,15 +4161,8 @@
     ].
     wasBlocked := OperatingSystem blockInterrupts.
 
-    "/ Fetch the lockword. If it is thinlock, iflate it
-    lockWordOrJavaMonitor := someObject getJavaLockWord.
-    lockWordOrJavaMonitor class == SmallInteger ifTrue:[
-        self inflateLockFor: someObject lockword: lockWordOrJavaMonitor
-    ] ifFalse:[
-        lockWordOrJavaMonitor class ~~ JavaMonitor ifTrue:[
-            self internalError: 'lockWord does not contain SmallIntefer nor JavaMonitor!!'.
-        ]
-    ].
+    "/ Ensure any eventual thinlock is inflated here...
+    someObject getJavaMonitor.
 
     "/ Now, we're sure that the lock is fat JavaMonitor, enter it
     self enterMonitor:someObject ofProcess:thisProcess.
@@ -4053,7 +4181,7 @@
     ].
 
     "Created: / 08-11-2011 / 15:15:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 10-03-2013 / 01:49:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 06-12-2013 / 22:07:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 monitorExit: someObject in: aJavaContext
@@ -4567,10 +4695,12 @@
 monitorFriendlyPrintStringOf: someObject
     | objString |
     someObject isJavaClass ifTrue: [ objString := someObject name ] ifFalse: [
-        objString := someObject class name , '@'
+        objString := someObject class binaryName , '@'
                     , someObject identityHash printString.
     ].
     ^ objString
+
+    "Modified: / 08-10-2013 / 22:49:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 releaseMonitor: obj ofProcess: aProcess
@@ -4690,19 +4820,29 @@
 
 !JavaVM class methodsFor:'native - java.lang'!
 
-_java_lang_System_arraycopy: nativeContext
+_java_lang_Object_clone: this
     "Forward here as optimized code delegates to  JavaVM"
 
-    ^ NativeMethodsImplementation _java_lang_System_arraycopy: nativeContext receiver _:(nativeContext argAt:1) _: (nativeContext argAt:2) _: (nativeContext argAt:3) _: (nativeContext argAt:4) _: (nativeContext argAt:5) 
+    ^ NativeMethodsImplementation _java_lang_Object_clone: this
+
+    "Created: / 12-11-2013 / 01:09:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_System_arraycopy: nativeContext
+    <resource: #obsolete>
+    "Forward here as optimized code delegates to  JavaVM"
+
+    ^ NativeMethodsImplementation _java_lang_System_arraycopy: nativeContext receiver _:(nativeContext argAt:1) _: (nativeContext argAt:2) _: (nativeContext argAt:3) _: (nativeContext argAt:4) _: (nativeContext argAt:5)
 
     "Modified: / 21-01-2013 / 09:18:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaVM class methodsFor:'others'!
-
-version_HG
-
-    ^ 'Changeset: <not expanded> '
+!
+
+_java_lang_System_arraycopy: this _:a1 _: a2 _: a3 _: a4 _: a5
+    "Forward here as optimized code delegates to JavaVM"
+
+    ^ NativeMethodsImplementation _java_lang_System_arraycopy: this _:a1 _: a2 _: a3 _: a4 _: a5
+
+    "Created: / 12-11-2013 / 01:11:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaVM class methodsFor:'queries'!
@@ -4748,9 +4888,7 @@
     | blocked sema |
 
     blocked := OperatingSystem blockInterrupts.
-    ParkUnparkSemaphores isNil ifTrue:[
-        ParkUnparkSemaphores := Dictionary new.
-    ].
+    ParkUnparkSemaphores isNil ifTrue:[ ParkUnparkSemaphores := Dictionary new ].
     sema := ParkUnparkSemaphores at: process ifAbsentPut:[Semaphore new].
     blocked ifFalse:[ OperatingSystem unblockInterrupts ].
 
@@ -4759,6 +4897,7 @@
     Logger log: 'parked thread ', process printString , ' resumed' severity: #debug facility: #JVM.
 
     "Created: / 16-08-2012 / 21:51:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 18-11-2013 / 14:43:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 setInterrupted: process
@@ -4807,11 +4946,13 @@
 
     stProcess
         addExitAction: [
-            Logger
-                log: ('%1 is going to die, notifying all waiters and disabling waiting on its monitor'
-                        bindWith: jThread printString)
-                severity: #debug
-                facility: #JVM.
+            MonitorTrace ifTrue:[
+                Logger
+                    log: ('%1 is going to die, notifying all waiters and disabling waiting on its monitor'
+                            bindWith: jThread printString)
+                    severity: #debug
+                    facility: #JVM.
+            ].
             jThread instVarNamed: 'threadStatus' put: 0.
             jThread getJavaMonitor disableWait.
             self acquireMonitorAndNotifyAll: jThread.
@@ -4829,7 +4970,7 @@
     "Modified: / 24-12-1999 / 03:14:33 / cg"
     "Created: / 14-12-2010 / 21:31:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 09-12-2011 / 12:58:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 03-09-2012 / 18:42:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-10-2013 / 11:25:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 unpark: process
@@ -4838,7 +4979,7 @@
     | blocked sema |
 
     blocked := OperatingSystem blockInterrupts.
-    ParkUnparkSemaphores isNil ifTrue:[ParkUnparkSemaphores dictionary new].
+    ParkUnparkSemaphores isNil ifTrue:[ ParkUnparkSemaphores := Dictionary new ].
     sema := ParkUnparkSemaphores at: process ifAbsentPut:[Semaphore new].
     blocked ifFalse:[ OperatingSystem unblockInterrupts ].
 
@@ -4846,16 +4987,21 @@
     sema signal.
 
     "Created: / 16-08-2012 / 21:52:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-11-2013 / 14:43:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaVM class methodsFor:'vm support'!
 
-_AALOAD: arr _: index
+_AALOAD: arr _: idx
     "Called from the VM (___aaload()) for unhandled cases"
-     
-    arr basicAt: index + 1
+
+    (idx between: 0 and: arr size - 1) ifFalse:[ 
+        ^ JavaVM throwArrayIndexOutOfBoundsException: arr _: idx. 
+    ].
+    arr basicAt: idx + 1
 
     "Created: / 29-04-2013 / 21:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 10-04-2014 / 09:59:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 _AASTORE: arr _: val _: index
@@ -4863,14 +5009,14 @@
 
      (val notNil and:[arr isJavaArray])"false" ifTrue:[
         (self canCast: val class to: arr class javaComponentClass) ifFalse: [
-            self throwArrayStoreException: 'Incompatible types'.
+            self throwArrayStoreException: ('Incompatible types: try to store %1 in %2' bindWith: val class javaName with: arr class javaName).
             ^ nil "Not reached"
         ].
     ].
     arr basicAt: index + 1 put: val
 
     "Created: / 29-04-2013 / 21:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-
+    "Modified: / 02-06-2014 / 14:17:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 _ANEWARRAY:cls _:size
@@ -4889,6 +5035,15 @@
     "Modified: / 22-11-2011 / 09:46:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+_ANEWARRAY_R:classRef _:size
+    "Returns a new array of elements of type referenced by classRef.
+     Sent from jitted code when classRef is not resolved during jit-compilation"
+
+    ^ self _ANEWARRAY: classRef resolve _: size
+
+    "Created: / 16-01-2014 / 22:26:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 _ARRAYLENGTH:arr
     arr isNil ifTrue:[
         "/self halt:'should not happen'.
@@ -4911,12 +5066,20 @@
     ].
     "When an exception is handled in Smalltalk code and the stack is
      being unwound, then all intermediate Java finally blocks are executed.
-     This is done by fake-throwing special FinallyToken, as there must an
+     This is done by fake-throwing special FinallyToken, as there must be an
      exception instance for Java. A Java compiler compiles unconditional
      ATHROW at the end of finally block to pass execution to another handler.
      We don't want to do so, in case we're manually invoking finally blocks.
      Hence following hack: we teleport back to handler caller"
     aJavaException class == JavaContext finallyTokenClass ifTrue:[
+        | sender |
+
+        "/ First, if the method is synchronized, leave its monitor
+        sender := thisContext sender.
+        sender method isSynchronized ifTrue:[
+            self releaseMonitorsOfUnwindingContext: thisContext sender.
+        ].
+        "/ Proceed to unwind or exception handler.
         aJavaException pass.
         self halt:'Should never be reached'.
     ].
@@ -4924,7 +5087,7 @@
      there's an unresolved compilation problem. We want to open debugger
      in this case tp be more Smalltalk-like - so translate such exception
      to JavaUnresolvedCompilationError"
-    aJavaException class name == #'java/lang/Error' ifTrue:[
+    aJavaException class binaryName == #'stx/libjava/tools/compiler/CompileError' ifTrue:[
         message := aJavaException getMessage.
         (message startsWith: 'Unresolved compilation problem:') ifTrue:[
             JavaUnresolvedCompilationError newException
@@ -4939,45 +5102,34 @@
 
     "Created: / 08-01-1999 / 14:15:36 / cg"
     "Modified: / 08-11-2011 / 16:32:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 18-04-2013 / 23:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-_CHECKCAST: object _: class
-    "Called from the JIT-compiled code for unhandled cases.
-     Unlike in _CHECKCAST2:_: the second parameter is a class,,
-     not a class class reference!!
-
-     This method *MUST* return the object for this may lead
-     into GC. See ___checkcast() VM function
-     "
-
-    object isNil ifTrue: [ ^ object ].
-    (self canCast: object class to: class) ifFalse: [
+    "Modified: / 16-10-2013 / 12:53:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_CHECKCAST: obj _: cls
+    "A principal implementation of CHECKCAST instruction. Called by the bytecode
+     interpreter for unhandled cases."
+
+    obj isNil ifTrue:[ ^ obj ].
+    (self canCast: obj class to: cls) ifFalse: [
         self throwClassCastException.
-        ^ nil "Not reached"
-    ].
-    ^ object
-
-    "Created: / 08-01-1999 / 14:53:51 / cg"
-    "Modified: / 09-01-1999 / 00:45:21 / cg"
-    "Modified: / 09-10-2012 / 11:53:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+        ^ nil
+    ].
+    ^ obj
+
 !
 
 _CHECKCAST_R: object _: classRef
-    "Called by the VM (java bytecode interpreter) for unhandled cases.
-     Unlike in _CHECKCAST:_: the second parameter is a class reference,
-     not the class itself!! Called by JIT-compiled code."
-
+    "An implementation of CHECKCAST instruction. Called by the jitted code
+     when if the classRef hasn't been resolved at the time of jitting."
     | class |
 
     object isNil ifTrue: [ ^ object ].
     class := classRef resolve.
-    (self canCast: object class to: class) ifFalse: [
+    (self canCast: object class to: class) ifFalse:[
         self throwClassCastException.
-        ^ nil
-    ].
-
-    ^ object.
+        ^nil.
+    ].
+    ^object.
 
     "Created: / 19-05-2011 / 10:12:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Modified (comment): / 09-10-2012 / 11:56:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -5102,15 +5254,54 @@
     "Created: / 8.1.1999 / 15:08:17 / cg"
 !
 
-_INSTANCEOF:object _:class
-    "Called from the jitted code for unhandled cases.
-     Unlike in _INSTANCEOF_R:_: the second parameter is a class,,
-     not a class class reference!!"
-
-    object isNil ifTrue:[^0].
-    ^(self canCast: object class to: class)
-        ifTrue:[1]
-        ifFalse:[0]
+_GETFIELD_R: fieldRef _: obj
+    "Called by jitted code for GETFIELD insn iff fieldref is not yet resolved"
+
+    | class offset |
+
+    obj isNil ifTrue:[
+        ^self throwNullPointerException.
+    ].
+    class := fieldRef classRef resolve; javaClass.
+    class hasMultipleVersions ifTrue:[
+        fieldRef classRef resolveForVersionOf: obj or: nil.
+        fieldRef resolve.
+        offset := fieldRef resolvedOffset.
+        fieldRef invalidate.
+    ] ifFalse:[
+        fieldRef resolve.
+        offset := fieldRef resolvedOffset.
+    ].
+    ^ obj instVarAt: offset.
+
+    "Created: / 20-01-2014 / 14:56:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 16-08-2014 / 07:55:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_GETSTATIC_R: fieldRef
+    "Called by jitted code for GETSTATIC insn iff fieldref is not yet resolved"
+
+    | class |
+
+    fieldRef resolve.
+    class := fieldRef javaClass.
+    class classInitInternal.
+    ^ class instVarAt: fieldRef resolvedOffset.
+
+    "Created: / 20-01-2014 / 15:03:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 31-01-2014 / 09:15:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INSTANCEOF:obj _:cls
+    "A principal implementation of INSTANCEOF instruction. Called by the bytecode
+     interpreter for unhandled cases."
+
+    obj isNil ifTrue: [ ^ 0 ].
+    (self canCast: obj class to: cls) ifFalse: [
+        ^ 0
+    ].
+    ^ 1
+
 
     "Created: / 08-01-1999 / 14:52:54 / cg"
     "Modified: / 27-01-1999 / 20:56:25 / cg"
@@ -5119,19 +5310,1168 @@
 !
 
 _INSTANCEOF_R: object _: classRef
-    "Called by the VM (java bytecode interpreter) for unhandled cases.
-     Unlike _INSTANCEOF:_: the second parameter is a class reference,
-     not the class itself!! Called by JIT-compiled code."
-   
+    "An implementation of INSTANCEOF instruction. Called by the jitted code
+     when if the classRef hasn't been resolved at the time of jitting."
+
     | class |
 
     object isNil ifTrue: [ ^ 0 ].
-    class := classRef resolve.    
-    ^ (self canCast: object class to: class) ifTrue: [ 1 ] ifFalse: [ 0 ].
+    class := classRef resolve.
+     ^(self canCast: object class to: class)
+        ifTrue:  [ 1 ]
+        ifFalse: [ 0 ].
 
     "Created: / 15-10-2012 / 21:51:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+_INVOKEINTERFACE_R: methodRef _: receiver
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method |
+
+    method := methodRef resolve.
+
+
+    ^ receiver perform: method selector withArguments: #()
+
+    "Created: / 17-01-2014 / 12:09:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 1.
+    args at: 1 put: a1.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:09:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 2.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:09:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2 _: a3
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 3.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:10:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 4.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 5.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 6.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:11:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 7.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:14:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 8.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:14:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 9.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:15:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 10.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:16:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 11.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:16:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 12.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    args at:12 put: a12.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:16:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEINTERFACE_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 13.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    args at:12 put: a12.
+    args at:13 put: a13.
+    ^ receiver perform: method selector withArguments: args
+
+
+    "Created: / 17-01-2014 / 12:17:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    ^ method valueWithReceiver:receiver arguments:#() selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:09:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 1.
+    args at: 1 put: a1.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:09:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 2.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:09:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2 _: a3
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 3.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:10:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 4.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 5.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 6.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:11:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 7.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:14:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 8.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:14:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 9.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:15:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 10.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:16:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 11.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:16:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 12.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    args at:12 put: a12.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:16:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESPECIAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+
+    args := Array new: 13.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    args at:12 put: a12.
+    args at:13 put: a13.
+    ^ method valueWithReceiver:receiver arguments:args selector:method selector search:class sender: thisContext sender
+
+
+    "Created: / 17-01-2014 / 12:17:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    ^ method valueWithReceiver:class arguments:#() selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:09:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 1.
+    args at: 1 put: a1.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:09:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 2.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:09:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2 _: a3
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 3.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:10:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2 _: a3 _: a4
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 4.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2 _: a3 _: a4 _: a5
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 5.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2 _: a3 _: a4 _: a5 _: a6
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 6.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:11:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 7.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:14:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 8.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:14:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 9.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:15:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 10.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:16:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 11.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:16:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 12.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    args at:12 put: a12.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+    "Created: / 17-01-2014 / 12:16:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKESTATIC_R: methodRef _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method class args |
+
+    method := methodRef resolve.
+    class  := method javaClass.
+    class classInitInternal.
+    args := Array new: 13.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    args at:12 put: a12.
+    args at:13 put: a13.
+    ^ method valueWithReceiver:class arguments:args selector:method selector search:class sender: thisContext sender
+
+
+    "Created: / 17-01-2014 / 12:17:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method |
+
+    method := methodRef resolve.
+
+
+    ^ receiver perform: method selector withArguments: #()
+
+    "Created: / 17-01-2014 / 12:09:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 1.
+    args at: 1 put: a1.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:09:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 2.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:09:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2 _: a3
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 3.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:10:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 4.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 5.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 6.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:11:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 7.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:14:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 8.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:14:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 9.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:15:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 10.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:16:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 11.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:16:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 12.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    args at:12 put: a12.
+    ^ receiver perform: method selector withArguments: args
+
+    "Created: / 17-01-2014 / 12:16:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_INVOKEVIRTUAL_R: methodRef _: receiver _: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13
+    "Called by jitted code for sends with unresolved method ref"
+
+    | method args |
+
+    method := methodRef resolve.
+
+
+    args := Array new: 13.
+    args at: 1 put: a1.
+    args at: 2 put: a2.
+    args at: 3 put: a3.
+    args at: 4 put: a4.
+    args at: 5 put: a5.
+    args at: 6 put: a6.
+    args at: 7 put: a7.
+    args at: 8 put: a8.
+    args at: 9 put: a9.
+    args at:10 put: a10.
+    args at:11 put: a11.
+    args at:12 put: a12.
+    args at:13 put: a13.
+    ^ receiver perform: method selector withArguments: args
+
+
+    "Created: / 17-01-2014 / 12:17:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 _L2D:op1
     ^ op1 asFloat
 
@@ -5313,8 +6653,8 @@
 !
 
 _MONITORENTER: someObject
-    self assert: (thisContext sender isJavaContext).
-    self assert: (thisContext sender isMarkedForUnwind).
+    "/self assert: (thisContext sender isJavaContext).
+    "/self assert: (thisContext sender isMarkedForUnwind).
 
     self monitorEnter: someObject in: thisContext sender.
 
@@ -5334,138 +6674,262 @@
     "Modified: / 26-08-2012 / 23:51:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-_MULTINEW2: classRef _: dim1
-
-    | arrCls arr |
-
-    dim1 <  0 ifTrue:[
+_MULTIANEWARRAY1: cls _: dim1
+
+    | a1 |
+
+    dim1 < 0 ifTrue:[
         self throwExceptionClassName:'java.lang.NegativeArraySizeException'
                          withMessage:'negative array size not allowed'.
         ^nil
     ].
-    self assert: classRef isJavaClassRef.
-    arrCls := classRef resolve.
-    arr := arrCls new: dim1.
-    ^ arr.
-
-    "Created: / 19-05-2011 / 10:46:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 22-11-2011 / 09:45:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-_MULTINEW2: classRef _: dim1 _: dim2
-
-    | arrCls arr |
-
-    dim1 <  0 ifTrue:[
+    a1 := cls new: dim1.
+    ^ a1.
+
+    "Created: / 28-01-2014 / 10:02:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-04-2014 / 15:49:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTIANEWARRAY1_R: clsRef _: dim1
+    ^ self _MULTIANEWARRAY1: clsRef resolve _: dim1
+
+    "Created: / 28-01-2014 / 10:04:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTIANEWARRAY2: cls _: dim1 _: dim2
+
+    | a1 |
+
+    dim1 < 0 ifTrue:[
         self throwExceptionClassName:'java.lang.NegativeArraySizeException'
                          withMessage:'negative array size not allowed'.
         ^nil
     ].
-    dim2 <  0 ifTrue:[
+    dim2 < 0 ifTrue:[
         self throwExceptionClassName:'java.lang.NegativeArraySizeException'
                          withMessage:'negative array size not allowed'.
         ^nil
     ].
-
-
-    self assert: classRef isJavaClassRef.
-    arrCls := classRef resolve.
-    arr := arrCls new: dim2.
-    1 to: dim2 do:[:i|
-        arr at: i put: (arrCls javaComponentClass new: dim1)
-    ].
-    ^ arr.
-
-    "Created: / 19-05-2011 / 10:47:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 22-11-2011 / 09:45:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-_MULTINEW2: classRef _: dim1 _: dim2 _: dim3
-
-    | arrCls arr |
-
-    dim1 <  0 ifTrue:[
+    a1 := cls new: dim1.
+    1 to: dim1 do:[:i1|
+        | a2 |
+        a2 := (a1 class javaComponentClass new: dim2).
+        a1 at: i1  put: a2.
+    ].
+    ^ a1.
+
+    "Created: / 28-01-2014 / 10:03:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTIANEWARRAY2_R: clsRef _: dim1 _: dim2
+    ^ self _MULTIANEWARRAY2: clsRef resolve _: dim1 _: dim2
+
+    "Created: / 28-01-2014 / 10:04:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTIANEWARRAY3: cls _: dim1 _: dim2 _: dim3
+
+    | a1 |
+
+    dim1 < 0 ifTrue:[
+        self throwExceptionClassName:'java.lang.NegativeArraySizeException'
+                         withMessage:'negative array size not allowed'.
+        ^nil
+    ].
+    dim2 < 0 ifTrue:[
+        self throwExceptionClassName:'java.lang.NegativeArraySizeException'
+                         withMessage:'negative array size not allowed'.
+        ^nil
+    ].
+    dim3 < 0 ifTrue:[
         self throwExceptionClassName:'java.lang.NegativeArraySizeException'
                          withMessage:'negative array size not allowed'.
         ^nil
     ].
-    dim2 <  0 ifTrue:[
+    a1 := cls new: dim1.
+    1 to: dim1 do:[:i1|
+        | a2 |
+
+        a2 := a1 class javaComponentClass new: dim2.
+        1 to: dim2 do:[:i2 |
+            | a3 |
+
+            a3 := a2 class javaComponentClass new: dim3.
+            a2 at: i2 put: a3.
+        ].
+        a1 at: i1  put: a2.
+    ].
+    ^ a1.
+
+    "Created: / 28-01-2014 / 10:04:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTIANEWARRAY3_R: clsRef _: dim1 _: dim2 _: dim3
+    ^ self _MULTIANEWARRAY3: clsRef resolve _: dim1 _: dim2 _: dim3
+
+    "Created: / 28-01-2014 / 10:05:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTIANEWARRAY4: cls _: dim1 _: dim2 _: dim3 _: dim4
+
+    | a1 |
+
+    dim1 < 0 ifTrue:[
         self throwExceptionClassName:'java.lang.NegativeArraySizeException'
                          withMessage:'negative array size not allowed'.
         ^nil
     ].
-    dim3 <  0 ifTrue:[
+    dim2 < 0 ifTrue:[
+        self throwExceptionClassName:'java.lang.NegativeArraySizeException'
+                         withMessage:'negative array size not allowed'.
+        ^nil
+    ].
+    dim3 < 0 ifTrue:[
+        self throwExceptionClassName:'java.lang.NegativeArraySizeException'
+                         withMessage:'negative array size not allowed'.
+        ^nil
+    ].
+    dim4 < 0 ifTrue:[
         self throwExceptionClassName:'java.lang.NegativeArraySizeException'
                          withMessage:'negative array size not allowed'.
         ^nil
     ].
-
-
-    self assert: classRef isJavaClassRef.
-    arrCls := classRef resolve.
-    arr := arrCls new: dim3.
-    1 to: dim3 do:[:i|
-        | arr2 |
-        arr2 := arrCls javaComponentClass new: dim2.
-        1 to: dim2 do:[:j|
-            arr2 at: j put: (arrCls javaComponentClass javaComponentClass new: dim1).
+    a1 := cls new: dim1.
+    1 to: dim1 do:[:i1|
+        | a2 |
+
+        a2 := a1 class javaComponentClass new: dim2.
+        1 to: dim2 do:[:i2 |
+            | a3 |
+
+            a3 := a2 class javaComponentClass new: dim3.
+            1 to: dim3 do:[:i3 |
+                | a4 |
+
+                a4 := a3 class javaComponentClass new: dim4.
+                a3 at: i3 put: a4.
+            ].
+            a2 at: i2 put: a3.
         ].
-        arr at: i put: arr2.
-    ].
-    ^ arr.
-
-    "Created: / 19-05-2011 / 10:47:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 22-11-2011 / 09:45:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-_MULTINEW:typeRef _:dim1
-
-    |arr|
-
-    arr := typeRef new:dim1.
-
-    ^ arr
-
-    "Created: / 08-01-1999 / 14:15:42 / cg"
-    "Modified: / 08-01-1999 / 18:03:05 / cg"
-    "Modified: / 16-03-2011 / 16:20:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-_MULTINEW: typeRef _: dim1 _: dim2
-    | arr |
-
-    arr := typeRef new: dim2.
-    1 to: dim2
-        do: [:idx | arr at: idx put: (self _MULTINEW: typeRef javaComponentClass _: dim1) ].
-    ^ arr
-
-    "Created: / 08-01-1999 / 14:15:46 / cg"
-    "Modified: / 08-01-1999 / 17:58:11 / cg"
-    "Modified: / 16-03-2011 / 16:19:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-_MULTINEW:typeRef _:dim1 _:dim2 _:dim3
-    |clsRef cls arr elType elSizes|
-
-    clsRef := typeRef asClassPointerRef.
-    cls := clsRef javaArrayClass.
-    arr := cls new:dim3.
-    elType := typeRef deref.
-    1 to:dim3
-        do:
-            [:idx |
-            arr at:idx
-                put:(self
-                        _MULTINEW:elType
-                        _:dim1
-                        _:dim2) ].
-
-"/ self halt.
-
-    ^ arr
-
-    "Modified: / 6.1.1998 / 23:34:35 / cg"
-    "Created: / 8.1.1999 / 14:15:49 / cg"
+        a1 at: i1  put: a2.
+    ].
+    ^ a1.
+
+    "Created: / 28-01-2014 / 10:03:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTIANEWARRAY4_R: clsRef _: dim1 _: dim2 _: dim3 _: dim4
+    ^ self _MULTIANEWARRAY4: clsRef resolve _: dim1 _: dim2 _: dim3 _: dim4
+
+    "Created: / 28-01-2014 / 10:05:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTIANEWARRAY5: cls _: dim1 _: dim2 _: dim3 _: dim4 _: dim5
+
+    | a1 |
+
+    dim1 < 0 ifTrue:[
+        self throwExceptionClassName:'java.lang.NegativeArraySizeException'
+                         withMessage:'negative array size not allowed'.
+        ^nil
+    ].
+    dim2 < 0 ifTrue:[
+        self throwExceptionClassName:'java.lang.NegativeArraySizeException'
+                         withMessage:'negative array size not allowed'.
+        ^nil
+    ].
+    dim3 < 0 ifTrue:[
+        self throwExceptionClassName:'java.lang.NegativeArraySizeException'
+                         withMessage:'negative array size not allowed'.
+        ^nil
+    ].
+    dim4 < 0 ifTrue:[
+        self throwExceptionClassName:'java.lang.NegativeArraySizeException'
+                         withMessage:'negative array size not allowed'.
+        ^nil
+    ].
+    dim5  < 0 ifTrue:[
+        self throwExceptionClassName:'java.lang.NegativeArraySizeException'
+                         withMessage:'negative array size not allowed'.
+        ^nil
+    ].
+    a1 := cls new: dim1.
+    1 to: dim1 do:[:i1|
+        | a2 |
+
+        a2 := a1 class javaComponentClass new: dim2.
+        1 to: dim2 do:[:i2 |
+            | a3 |
+
+            a3 := a2 class javaComponentClass new: dim3.
+            1 to: dim3 do:[:i3 |
+                | a4 |
+
+                a4 := a3 class javaComponentClass new: dim4.
+                1 to: dim4 do:[:i4 |
+                    | a5 |
+
+                    a5 := a4 class javaComponentClass new: dim5.
+                    a4 at: i4 put: a5.
+                ].
+                a3 at: i3 put: a4.
+            ].
+            a2 at: i2 put: a3.
+        ].
+        a1 at: i1  put: a2.
+    ].
+    ^ a1.
+
+    "Created: / 28-01-2014 / 10:03:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTIANEWARRAY5_R: clsRef _: dim1 _: dim2 _: dim3 _: dim4 _: dim5
+    ^ self _MULTIANEWARRAY5: clsRef resolve _: dim1 _: dim2 _: dim3 _: dim4 _: dim5
+
+    "Created: / 28-01-2014 / 10:05:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTIANEWARRAY: cls _: dims
+
+    | allocator |
+
+    dims isEmptyOrNil ifTrue:[
+        self throwExceptionClassName:'java.lang.NegativeArraySizeException'
+                         withMessage:'zero dimensions given, should not happen!!'.
+    ].
+
+    dims do:[:d |
+        d < 0 ifTrue:[
+            self throwExceptionClassName:'java.lang.NegativeArraySizeException'
+                             withMessage:'negative array size not allowed'.
+            ^nil
+        ].
+    ].
+
+    allocator := [ :arrayClass :dimIndex |
+        | array |
+
+        array := arrayClass new: (dims at: dimIndex).
+        dimIndex ~~ dims size ifTrue:[
+            1 to: (dims at: dimIndex) do:[:i |
+                array at: i put: (allocator value: arrayClass javaComponentClass value: dimIndex + 1).
+            ]
+        ].
+        array.
+    ].
+
+    ^ allocator value: cls value: 1.
+
+    "Created: / 28-01-2014 / 09:46:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 28-01-2014 / 14:40:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTIANEWARRAY_R: clsRef _: dims
+
+    ^ self _MULTIANEWARRAY: clsRef resolve _: dims
+
+    "Created: / 28-01-2014 / 09:43:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 28-01-2014 / 14:36:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 _NEW: cls
@@ -5501,6 +6965,47 @@
 
     "Created: / 15-10-2012 / 21:54:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 02-11-2012 / 21:10:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_PUTFIELD_R: fieldRef _: obj _: value
+    "Called by jitted code for PUTFIELD insn iff fieldref is not yet resolved"
+
+    | class offset |
+
+    obj isNil ifTrue:[
+        ^self throwNullPointerException.
+    ].
+    obj isNil ifTrue:[
+        ^self throwNullPointerException.
+    ].
+    class := fieldRef classRef resolve; javaClass.
+    class hasMultipleVersions ifTrue:[
+        fieldRef classRef resolveForVersionOf: obj or: nil.
+        fieldRef resolve.
+        offset := fieldRef resolvedOffset.
+        fieldRef invalidate.
+    ] ifFalse:[
+        fieldRef resolve.
+        offset := fieldRef resolvedOffset.
+    ].   
+    obj instVarAt: offset put: value
+
+    "Created: / 20-01-2014 / 15:01:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 16-08-2014 / 07:57:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_PUTSTATIC_R: fieldRef _: value
+    "Called by jitted code for PUTSTATIC insn iff fieldref is not yet resolved"
+
+    | class |
+
+    fieldRef resolve.
+    class := fieldRef javaClass.
+    class classInitInternal.
+    ^ class instVarAt: fieldRef resolvedOffset put: value
+
+    "Created: / 20-01-2014 / 15:06:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 31-01-2014 / 09:16:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaVM class methodsFor:'windows - events'!
@@ -6120,7 +7625,7 @@
 
     '%-4d %-30s %-15s %s' printf:{
         index .
-        stream class name.
+        stream class binaryName.
         executor ifTrue:['(executor)'] ifFalse:[(self printOpenExternalStreamIdentificationOf: stream)].
         executor ifTrue:[''] ifFalse:[stream isFileStream ifTrue:[stream pathName ? '??? no pathName ???'] ifFalse:['']]
     } on: output.
@@ -6132,6 +7637,7 @@
     "
 
     "Created: / 14-08-2012 / 01:02:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-10-2013 / 22:49:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 printOpenExternalStreamIdentificationOf:stream
@@ -6300,13 +7806,14 @@
         aStream nextPutAll: (m nCalls printStringRadix:10 size:8 fill:Character space).
         aStream nextPutAll:'   '.
         aStream
-            nextPutAll: m mclass name;
+            nextPutAll: m mclass binaryName;
             nextPutAll: ' >> ';
             nextPutAll: m selector;
             cr.
     ]
 
     "Created: / 27-10-2012 / 18:09:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-10-2013 / 22:49:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 printCounters_TopTenNativesOn: aStream
@@ -6457,7 +7964,7 @@
 
     | array |
 
-    array := (vm classForName: 'java.lang.Class') javaArrayClass
+    array := _java_lang_Class_CLASS javaArrayClass
                 new: classes size.
     classes isNilOrEmptyCollection ifTrue: [ ^ array ].
     classes
@@ -6466,7 +7973,7 @@
 
     "Modified: / 28-01-2011 / 15:15:44 / Marcel Hlopko <hlopik@gmail.com>"
     "Created: / 04-02-2011 / 22:08:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 11-02-2011 / 10:21:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 21-05-2013 / 16:29:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 javaClassObjectForClass:aClass
@@ -6499,12 +8006,13 @@
         aClass == Object ifTrue:[ self halt. ].
         aClass lookupObject: JavaLookup instance.
     ].
-    javaClassObj := (vm classForName: 'java.lang.Class') new.
+    javaClassObj := _java_lang_Class_CLASS new.
     self rememberJavaClassObject: javaClassObj for: aClass.
     ^ javaClassObj
 
     "Modified: / 28-01-2011 / 15:15:44 / Marcel Hlopko <hlopik@gmail.com>"
     "Created: / 12-08-2011 / 19:07:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 21-05-2013 / 16:28:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 javaClassObjectForClassNamed: className
@@ -6529,6 +8037,17 @@
     javaClasses at: jclass put: class.
 
     "Created: / 05-12-2011 / 09:57:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+removeJavaClassObjectForClass: class
+    | classObject |
+
+    classObject := javaClasses at: class ifAbsent:[ ^ self ].
+
+    javaClasses removeKey: class.
+    javaClasses removeKey: classObject.
+
+    "Created: / 09-08-2014 / 00:05:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaVM::ReflectionRegistry methodsFor:'reflection - constant pool'!
@@ -6718,11 +8237,16 @@
 !JavaVM class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libjava/JavaVM.st,v 1.192 2013-09-06 00:41:27 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libjava/JavaVM.st,v 1.193 2015-01-28 02:10:50 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libjava/JavaVM.st,v 1.192 2013-09-06 00:41:27 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libjava/JavaVM.st,v 1.193 2015-01-28 02:10:50 vrany Exp $'
+!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
 !
 
 version_SVN