# HG changeset patch # User vranyj1 # Date 1349776586 0 # Node ID cb58709963426cfe1e7286fc5f891b7104498b39 # Parent 34b8f77e6b8f328ef476988f476d1815d365a5cd - JavaVM - support for JIT compiler changed: #_CHECKCAST2:_: #_CHECKCAST:_: #_INSTANCEOF2:_: #_INSTANCEOF:_: diff -r 34b8f77e6b8f -r cb5870996342 src/JavaVM.st --- a/src/JavaVM.st Mon Oct 08 13:30:59 2012 +0000 +++ b/src/JavaVM.st Tue Oct 09 09:56:26 2012 +0000 @@ -18178,13 +18178,15 @@ "Modified: / 09-04-2012 / 21:00:22 / Jan Vrany " ! -_CHECKCAST2: object _: aJavaClassRef - "Trampouline for unhandled cases ..." +_CHECKCAST2: 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!! Will wanish!!" | class | - aJavaClassRef isJavaRef ifTrue: [ class := aJavaClassRef resolve ] ifFalse: [ - self halt: 'I expected classRefs only - maybe I was wrong' + classRef isJavaRef ifTrue: [ class := classRef resolve ] ifFalse: [ + self error: 'I expected classRefs only - maybe I was wrong' ]. (object isNil or: [ (self canCast: object class to: class) not ]) ifTrue: [ self breakPoint: #mh. @@ -18195,22 +18197,15 @@ ^ true. "Created: / 19-05-2011 / 10:12:23 / Marcel Hlopko " - "Modified: / 13-08-2011 / 01:33:21 / Jan Vrany " -! - -_CHECKCAST: object _: classOrClassRef - "Trampouline for unhandled cases ..." - - | class | - - self breakPoint: #mh. - class := classOrClassRef javaClass. - " - Java VM Spec, 3rd edition, p 280: - - If objectref is null, the checkcast instruction throws a ClassCastException. - " "object isNil" - (false or: [ (self canCast: object class to: class) not ]) ifTrue: [ + "Modified (comment): / 09-10-2012 / 11:56:14 / Jan Vrany " +! + +_CHECKCAST: object _: class + "Called from the jitted code for unhandled cases. + Unlike in _CHECKCAST2:_: the second parameter is a class,, + not a class class reference!!" + + (self canCast: object class to: class) ifFalse: [ self throwClassCastException. ^ false ]. @@ -18218,7 +18213,7 @@ "Created: / 08-01-1999 / 14:53:51 / cg" "Modified: / 09-01-1999 / 00:45:21 / cg" - "Modified: / 25-04-2011 / 20:26:29 / Jan Vrany " + "Modified: / 09-10-2012 / 11:53:53 / Jan Vrany " ! _D2I:op1 @@ -18341,26 +18336,34 @@ ! _INSTANCEOF2: object _: classRef - |class| - classRef isJavaRef ifFalse: [self halt: 'expected only classRefs - maybe I was wrong']. + "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!!" + + | class | + + classRef isJavaRef ifFalse: [self error: 'expected only classRefs - maybe I was wrong']. class := classRef resolve. - object ifNil: [ ^ 0 ]. + object isNil ifTrue: [ ^ 0 ]. ^ (self canCast: object class to: class) ifTrue: [ 1 ] ifFalse: [ 0 ]. "Created: / 19-05-2011 / 10:14:18 / Marcel Hlopko " + "Modified (comment): / 09-10-2012 / 11:56:26 / Jan Vrany " ! _INSTANCEOF:object _:class - - object ifNil:[^0]. - + "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: / 25-02-2011 / 18:31:06 / Jan Vrany " + "Modified: / 09-10-2012 / 11:55:52 / Jan Vrany " ! _L2D:op1