18176 "Created: / 08-01-1999 / 14:15:36 / cg" |
18176 "Created: / 08-01-1999 / 14:15:36 / cg" |
18177 "Modified: / 08-11-2011 / 16:32:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
18177 "Modified: / 08-11-2011 / 16:32:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
18178 "Modified: / 09-04-2012 / 21:00:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18178 "Modified: / 09-04-2012 / 21:00:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18179 ! |
18179 ! |
18180 |
18180 |
18181 _CHECKCAST2: object _: aJavaClassRef |
18181 _CHECKCAST2: object _: classRef |
18182 "Trampouline for unhandled cases ..." |
18182 "Called by the VM (java bytecode interpreter) for unhandled cases. |
|
18183 Unlike in _CHECKCAST:_: the second parameter is a class reference, |
|
18184 not the class itself!! Will wanish!!" |
18183 |
18185 |
18184 | class | |
18186 | class | |
18185 |
18187 |
18186 aJavaClassRef isJavaRef ifTrue: [ class := aJavaClassRef resolve ] ifFalse: [ |
18188 classRef isJavaRef ifTrue: [ class := classRef resolve ] ifFalse: [ |
18187 self halt: 'I expected classRefs only - maybe I was wrong' |
18189 self error: 'I expected classRefs only - maybe I was wrong' |
18188 ]. |
18190 ]. |
18189 (object isNil or: [ (self canCast: object class to: class) not ]) ifTrue: [ |
18191 (object isNil or: [ (self canCast: object class to: class) not ]) ifTrue: [ |
18190 self breakPoint: #mh. |
18192 self breakPoint: #mh. |
18191 self throwClassCastException. |
18193 self throwClassCastException. |
18192 ^ false |
18194 ^ false |
18193 ]. |
18195 ]. |
18194 |
18196 |
18195 ^ true. |
18197 ^ true. |
18196 |
18198 |
18197 "Created: / 19-05-2011 / 10:12:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
18199 "Created: / 19-05-2011 / 10:12:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
18198 "Modified: / 13-08-2011 / 01:33:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18200 "Modified (comment): / 09-10-2012 / 11:56:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18199 ! |
18201 ! |
18200 |
18202 |
18201 _CHECKCAST: object _: classOrClassRef |
18203 _CHECKCAST: object _: class |
18202 "Trampouline for unhandled cases ..." |
18204 "Called from the jitted code for unhandled cases. |
|
18205 Unlike in _CHECKCAST2:_: the second parameter is a class,, |
|
18206 not a class class reference!!" |
18203 |
18207 |
18204 | class | |
18208 (self canCast: object class to: class) ifFalse: [ |
18205 |
|
18206 self breakPoint: #mh. |
|
18207 class := classOrClassRef javaClass. |
|
18208 " |
|
18209 Java VM Spec, 3rd edition, p 280: |
|
18210 |
|
18211 If objectref is null, the checkcast instruction throws a ClassCastException. |
|
18212 " "object isNil" |
|
18213 (false or: [ (self canCast: object class to: class) not ]) ifTrue: [ |
|
18214 self throwClassCastException. |
18209 self throwClassCastException. |
18215 ^ false |
18210 ^ false |
18216 ]. |
18211 ]. |
18217 ^ true |
18212 ^ true |
18218 |
18213 |
18219 "Created: / 08-01-1999 / 14:53:51 / cg" |
18214 "Created: / 08-01-1999 / 14:53:51 / cg" |
18220 "Modified: / 09-01-1999 / 00:45:21 / cg" |
18215 "Modified: / 09-01-1999 / 00:45:21 / cg" |
18221 "Modified: / 25-04-2011 / 20:26:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18216 "Modified: / 09-10-2012 / 11:53:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18222 ! |
18217 ! |
18223 |
18218 |
18224 _D2I:op1 |
18219 _D2I:op1 |
18225 |v| |
18220 |v| |
18226 |
18221 |
18339 |
18334 |
18340 "Created: / 8.1.1999 / 15:08:17 / cg" |
18335 "Created: / 8.1.1999 / 15:08:17 / cg" |
18341 ! |
18336 ! |
18342 |
18337 |
18343 _INSTANCEOF2: object _: classRef |
18338 _INSTANCEOF2: object _: classRef |
18344 |class| |
18339 "Called by the VM (java bytecode interpreter) for unhandled cases. |
18345 classRef isJavaRef ifFalse: [self halt: 'expected only classRefs - maybe I was wrong']. |
18340 Unlike _INSTANCEOF:_: the second parameter is a class reference, |
|
18341 not the class itself!! Will wanish!!" |
|
18342 |
|
18343 | class | |
|
18344 |
|
18345 classRef isJavaRef ifFalse: [self error: 'expected only classRefs - maybe I was wrong']. |
18346 class := classRef resolve. |
18346 class := classRef resolve. |
18347 object ifNil: [ ^ 0 ]. |
18347 object isNil ifTrue: [ ^ 0 ]. |
18348 ^ (self canCast: object class to: class) ifTrue: [ 1 ] ifFalse: [ 0 ]. |
18348 ^ (self canCast: object class to: class) ifTrue: [ 1 ] ifFalse: [ 0 ]. |
18349 |
18349 |
18350 "Created: / 19-05-2011 / 10:14:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
18350 "Created: / 19-05-2011 / 10:14:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
18351 "Modified (comment): / 09-10-2012 / 11:56:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18351 ! |
18352 ! |
18352 |
18353 |
18353 _INSTANCEOF:object _:class |
18354 _INSTANCEOF:object _:class |
18354 |
18355 "Called from the jitted code for unhandled cases. |
18355 object ifNil:[^0]. |
18356 Unlike in _INSTANCEOF2:_: the second parameter is a class,, |
18356 |
18357 not a class class reference!!" |
|
18358 |
|
18359 object isNil ifTrue:[^0]. |
18357 ^(self canCast: object class to: class) |
18360 ^(self canCast: object class to: class) |
18358 ifTrue:[1] |
18361 ifTrue:[1] |
18359 ifFalse:[0] |
18362 ifFalse:[0] |
18360 |
18363 |
18361 "Created: / 08-01-1999 / 14:52:54 / cg" |
18364 "Created: / 08-01-1999 / 14:52:54 / cg" |
18362 "Modified: / 27-01-1999 / 20:56:25 / cg" |
18365 "Modified: / 27-01-1999 / 20:56:25 / cg" |
18363 "Modified: / 25-02-2011 / 18:31:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18366 "Modified: / 09-10-2012 / 11:55:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18364 ! |
18367 ! |
18365 |
18368 |
18366 _L2D:op1 |
18369 _L2D:op1 |
18367 ^ op1 asFloat |
18370 ^ op1 asFloat |
18368 |
18371 |