From d2765c4da1c043455d8c09da02d95f5f740594d8 Mon Sep 17 00:00:00 2001 From: Doni Pracner Date: Tue, 10 Dec 2013 22:45:06 +0100 Subject: [PATCH] mjc2wsl - op code processing - everything is ordered according to the numbers and comments were added for what is still needed --- src/mjc2wsl.java | 63 ++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java index 53b2b66..b7c572b 100644 --- a/src/mjc2wsl.java +++ b/src/mjc2wsl.java @@ -254,6 +254,10 @@ public class mjc2wsl{ prl(cmdFromEStack(loc(op - store_0))); break; } + + //TODO getstatic, putstatic + //TODO getfield, putfield + case const_: { prl(cmdToEStack(get4())); break; @@ -269,24 +273,6 @@ public class mjc2wsl{ break; } - case jmp: { - prl("CALL a" + (counter + get2()) + ";"); - break; - } - - case jeq: - case jne: - case jlt: - case jle: - case jgt: - case jge: { - prl(getTopTwo()); - prl("IF tempb "+ getRelationFor(op) - +" tempa THEN CALL a" + (counter + get2()) - + " FI;"); - break; - } - case add: { prl(getTopTwo()); prl("tempres := tempb + tempa;"); @@ -320,24 +306,52 @@ public class mjc2wsl{ break; } - case enter: { - prl(createComment("enter not fully procesed yet")); - message("enter not fully procesed yet", M_WAR); - get(); - get(); + //TODO neg, shl, shr, inc + //TODO new_ newarray + //TODO aload, asstore, baload, bastore + //TODO arraylength + //TODO pop, dup, dup2 + + case jmp: { + prl("CALL a" + (counter + get2()) + ";"); break; } + + case jeq: + case jne: + case jlt: + case jle: + case jgt: + case jge: { + prl(getTopTwo()); + prl("IF tempb "+ getRelationFor(op) + +" tempa THEN CALL a" + (counter + get2()) + + " FI;"); + break; + } + + //TODO call + case return_: { prl(createComment("return not fully procesed yet")); message("return not fully procesed yet", M_WAR); break; } + case enter: { + prl(createComment("enter not fully procesed yet")); + message("enter not fully procesed yet", M_WAR); + get(); + get(); + break; + } case exit: { prl(createComment("exit not fully procesed yet")); message("exit not fully procesed yet", M_WAR); break; } + //TODO read, print + // the prints case bprint: { prl(getTopTwo()); @@ -356,6 +370,9 @@ public class mjc2wsl{ break; } + //TODO trap + + op = get(); if (op >= 0) prl("CALL a" + counter + " END"); -- 2.25.1