extensions.st
branchperformance-optimizations
changeset 2595 77ab6e032c7f
parent 2588 58b1e0fd20e7
child 2604 b9cb81e47766
--- a/extensions.st	Mon May 13 00:59:43 2013 +0100
+++ b/extensions.st	Tue May 14 15:36:56 2013 +0100
@@ -114,6 +114,30 @@
     "Modified: / 07-05-2013 / 11:21:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!BooleanArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BooleanArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == BooleanArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BooleanArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^BooleanArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !BooleanArray methodsFor:'queries'!
 
 isInterface
@@ -175,6 +199,30 @@
     "Modified: / 31-08-2011 / 23:57:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!ByteArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ByteArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == BooleanArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ByteArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^BooleanArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ByteArray class methodsFor:'testing'!
 
 isInterface
@@ -293,6 +341,37 @@
     "Modified: / 07-05-2013 / 11:21:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!CharacterArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CharacterArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    cls == Unicode16String ifTrue:[^self].
+    cls == String          ifTrue:[^self].
+    ^JavaVM throwClassCastException.
+
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:10:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CharacterArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    cls == Unicode16String ifTrue:[^1].
+    cls == String          ifTrue:[^1].
+    ^0
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:10:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !CharacterArray methodsFor:'java conversions'!
 
 asDottedJavaClassName
@@ -675,6 +754,32 @@
     "Created: / 30-11-2011 / 13:38:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 ! !
 
+!DoubleArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!DoubleArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == DoubleArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!DoubleArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^DoubleArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !DoubleArray class methodsFor:'testing'!
 
 isInterface
@@ -806,6 +911,32 @@
     "Modified: / 07-05-2013 / 11:21:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!FloatArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!FloatArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == FloatArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!FloatArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^FloatArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !FloatArray class methodsFor:'testing'!
 
 isInterface
@@ -1032,6 +1163,30 @@
     "Created: / 22-08-2012 / 13:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!Object methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^JavaVM _ARRAYLENGTH: self
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Object methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^JavaVM _CHECKCAST: self _: cls
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Object methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^JavaVM _INSTANCEOF: self _: cls
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !Object methodsFor:'accessing-Java'!
 
 getJavaLockWord
@@ -1526,6 +1681,32 @@
     "Created: / 24-02-2012 / 19:42:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!SignedIntegerArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedIntegerArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == SignedIntegerArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedIntegerArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^SignedIntegerArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !SignedIntegerArray class methodsFor:'testing'!
 
 isInterface
@@ -1570,6 +1751,32 @@
     "Modified: / 25-02-2011 / 19:03:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!SignedLongIntegerArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedLongIntegerArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == SignedLongIntegerArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:14:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedLongIntegerArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^SignedLongIntegerArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:14:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !SignedLongIntegerArray class methodsFor:'testing'!
 
 isInterface
@@ -1624,6 +1831,32 @@
     "Modified: / 25-02-2011 / 19:03:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!SignedWordArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedWordArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == SignedWordArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:14:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedWordArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^SignedWordArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:14:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !SignedWordArray class methodsFor:'queries'!
 
 isJavaArrayClass
@@ -1734,6 +1967,32 @@
     "Created: / 18-01-2013 / 22:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!UndefinedObject methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^JavaVM throwNullPointerException
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!UndefinedObject methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^nil
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!UndefinedObject methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^0
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !UndefinedObject class methodsFor:'queries'!
 
 isJavaPrimitiveType