- JavaVM jk_new_structure
authorvranyj1
Mon, 15 Oct 2012 19:59:35 +0000
branchjk_new_structure
changeset 1727 c23e0b74bc1c
parent 1726 2155ae48a4b3
child 1728 0d275432230d
- JavaVM added: #_INSTANCEOF_R:_: #_NEW: #_NEW_R: comment/format in: #_INSTANCEOF:_:
src/JavaVM.st
--- a/src/JavaVM.st	Mon Oct 15 19:48:38 2012 +0000
+++ b/src/JavaVM.st	Mon Oct 15 19:59:35 2012 +0000
@@ -18363,7 +18363,23 @@
     "Created: / 8.1.1999 / 15:08:17 / cg"
 !
 
-_INSTANCEOF2: object _: classRef 
+_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]
+
+    "Created: / 08-01-1999 / 14:52:54 / cg"
+    "Modified: / 27-01-1999 / 20:56:25 / cg"
+    "Modified: / 09-10-2012 / 11:55:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 15-10-2012 / 21:51:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_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!! Will wanish!!"
@@ -18375,23 +18391,7 @@
     object isNil ifTrue: [ ^ 0 ].
     ^ (self canCast: object class to: class) ifTrue: [ 1 ] ifFalse: [ 0 ].
 
-    "Created: / 19-05-2011 / 10:14:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified (comment): / 09-10-2012 / 11:56:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-_INSTANCEOF:object _:class
-    "Called from the jitted code for unhandled cases. 
-     Unlike in _INSTANCEOF2:_: 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]
-
-    "Created: / 08-01-1999 / 14:52:54 / cg"
-    "Modified: / 27-01-1999 / 20:56:25 / cg"
-    "Modified: / 09-10-2012 / 11:55:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 15-10-2012 / 21:51:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 _L2D:op1
@@ -18717,6 +18717,17 @@
     "Created: / 8.1.1999 / 14:15:49 / cg"
 !
 
+_NEW: cls
+    | inst |
+
+    cls classInit. "/initializes the class if it is not already"
+    inst := cls newCleared.
+    thisContext sender method flushCode.
+    ^inst.
+
+    "Created: / 15-10-2012 / 21:53:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 _NEWARRAY:type _:size 
     "VM helper method NEWARRAY insn. Called only when
      size is not an SmallInt or negative"
@@ -18726,6 +18737,17 @@
     ]
 
     "Created: / 13-05-2012 / 14:46:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_NEW_R: clsRef
+    | cls inst |
+
+    cls := clsRef resolve. "/initializes the class if it is not already"
+    inst := cls newCleared.
+    thisContext sender method flushCode.
+    ^inst.
+
+    "Created: / 15-10-2012 / 21:54:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaVM class methodsFor:'windows - events'!