--- a/experiments/JavaByteCodeInterpreter.st Mon Aug 04 15:43:51 2014 +0100
+++ b/experiments/JavaByteCodeInterpreter.st Mon Aug 04 16:13:14 2014 +0100
@@ -70,8 +70,10 @@
index := self pop.
arrayref := self pop.
- arrayref ifNil: [ ^ JavaVM throwNullPointerException ].
- ^ self pushRef: (arrayref at: index + 1).
+ arrayref isNil ifTrue:[
+ ^ JavaVM throwNullPointerException
+ ].
+ ^ self pushRef:(arrayref at:index + 1).
"
The arrayref must be of type reference and must refer to an array whose
@@ -83,8 +85,8 @@
Otherwise, if index is not within the bounds of the array referenced by arrayref,
the aaload instruction throws an ArrayIndexOutOfBoundsException."
- "Modified: / 16-03-2011 / 15:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 21-03-2011 / 17:20:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 04-08-2014 / 15:53:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
aastore
@@ -93,11 +95,14 @@
args: nothing"
| arrayref index value |
+
value := self pop.
index := self pop.
arrayref := self pop.
- arrayref ifNil: [ ^ JavaVM throwNullPointerException ].
- arrayref at: index + 1 put: value.
+ arrayref isNil ifTrue:[
+ ^ JavaVM throwNullPointerException
+ ].
+ arrayref at:index + 1 put:value.
"
The arrayref must be of type reference and must refer to an array whose components are of
@@ -133,6 +138,7 @@
throws an ArrayStoreException."
"Modified: / 22-03-2011 / 12:27:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 04-08-2014 / 15:53:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
aconst_null
@@ -1771,21 +1777,22 @@
| methodToBeInvoked methodNumArgs args argSignatures result |
- methodToBeInvoked := (constantPool at: self fetchIndex2) resolve.
- methodToBeInvoked ifNil: [self halt].
+ methodToBeInvoked := (constantPool at:self fetchIndex2) resolve.
+ methodToBeInvoked isNil ifTrue:[
+ self halt
+ ].
methodNumArgs := methodToBeInvoked javaNumArgs.
argSignatures := methodToBeInvoked argSignature.
- args := Array new: methodNumArgs.
- methodNumArgs to: 1 by: -1 do: [
- :index |
- args at: index put: self pop
+ args := Array new:methodNumArgs.
+ methodNumArgs to:1 by:-1 do:[:index |
+ args at:index put:self pop
].
result := self
- interpretInner: methodToBeInvoked
- receiver: receiver
- arguments: args.
- methodToBeInvoked returnsVoid ifFalse: [
- self pushConstant: result
+ interpretInner:methodToBeInvoked
+ receiver:receiver
+ arguments:args.
+ methodToBeInvoked returnsVoid ifFalse:[
+ self pushConstant:result
].
"
@@ -1845,8 +1852,8 @@
"Created: / 24-02-2011 / 10:37:05 / Marcel Hlopko <hlopik@gmail.com>"
"Modified: / 25-02-2011 / 00:18:30 / Marcel Hlopko <hlopik@gmail.com>"
- "Modified: / 24-02-2011 / 22:13:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 04-06-2011 / 18:13:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 04-08-2014 / 15:54:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
invvirt
@@ -2387,20 +2394,23 @@
stack: key -> ..
args: insane"
- | key jmpDest default npairs result |
+ | key jmpDest default npairs |
key := self pop asInteger.
self skipPadding.
default := self fetchBytes4.
npairs := self fetchBytes4.
- npairs
- timesRepeat:
- [
- key = self fetchBytes4
- ifTrue: [ jmpDest := self fetchBytes4 ]
- ifFalse: [ self fetchBytes4 ] ].
- jmpDest ifNil: [ jmpDest := default. ].
- self relativeJump: jmpDest.
+ npairs timesRepeat:[
+ key = self fetchBytes4 ifTrue:[
+ jmpDest := self fetchBytes4
+ ] ifFalse:[
+ self fetchBytes4
+ ]
+ ].
+ jmpDest isNil ifTrue:[
+ jmpDest := default.
+ ].
+ self relativeJump:jmpDest.
"
Description
@@ -2433,6 +2443,7 @@
search."
"Modified: / 21-03-2011 / 18:38:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 04-08-2014 / 15:54:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
lor
@@ -2904,21 +2915,24 @@
stack: index -> ..
args: insane :)"
- | index jmpDest default low high result |
+ | index jmpDest default low high |
index := self pop asInteger.
self skipPadding.
default := self fetchBytes4.
low := self fetchBytes4.
high := self fetchBytes4.
- low to: high
- do:
- [:idx |
- idx = index
- ifTrue: [ jmpDest := self fetchBytes4 ]
- ifFalse: [ self fetchBytes4 ] ].
- jmpDest ifNil: [ jmpDest := default. ].
- self relativeJump: jmpDest.
+ low to:high do:[:idx |
+ idx = index ifTrue:[
+ jmpDest := self fetchBytes4
+ ] ifFalse:[
+ self fetchBytes4
+ ]
+ ].
+ jmpDest isNil ifTrue:[
+ jmpDest := default.
+ ].
+ self relativeJump:jmpDest.
"
Description
@@ -2948,6 +2962,7 @@
on a 4-byte boundary."
"Modified: / 21-03-2011 / 18:35:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 04-08-2014 / 15:54:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
wide