X-Git-Url: http://svarog.pmf.uns.ac.rs/gitweb/?p=mjc2wsl.git;a=blobdiff_plain;f=src%2Fmjc2wsl.java;h=4c7618f2a212f0dbdffafebb7915a270fc783666;hp=f27f255ec77b2df8cb983f757cc8203b6c4e0dde;hb=ff01a2d354f1057698e96fcecaa749722a860544;hpb=d0dd7fa4071716e15e721edfa09249131934cfda diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java index f27f255..4c7618f 100644 --- a/src/mjc2wsl.java +++ b/src/mjc2wsl.java @@ -253,6 +253,13 @@ public class mjc2wsl{ return res; } + private String cmdPopEStack() { + String res = "mjvm_estack := TAIL(mjvm_estack);"; + if (genPrintEStackOnChange) res +="PRINT(\"eStack\",mjvm_estack);"; + return res; + } + + private String getTopTwo(){ return cmdFromEStack("tempa") + "\n" + cmdFromEStack("tempb"); } @@ -347,6 +354,13 @@ public class mjc2wsl{ break; } //TODO getfield, putfield + case getfield: + case putfield:{ + prl(createComment("fields are not processed properly", C_ERR)); + message("fields are not processed properly", M_ERR); + get2(); + break; + } case const_: { prl(cmdToEStack(get4())); @@ -397,10 +411,29 @@ public class mjc2wsl{ } //TODO neg, shl, shr, inc + + case inc : { + int b1 = get(), b2 = get(); + prl(loc(b1)+" := " +loc(b1)+" + "+b2); + break; + } //TODO new_ newarray + case new_ : + get();//needs a short, but a byte will be taken bellow as well + case newarray :{ + prl(createComment("memory allocation not processed properly", C_ERR)); + message("memory allocation not processed properly", M_ERR); + get(); + break; + } //TODO aload, asstore, baload, bastore //TODO arraylength - //TODO pop, dup, dup2 + //TODO dup, dup2 + + case pop : { + prl(cmdPopEStack()); + break; + } case jmp: { prl("CALL a" + (counter + get2()) + ";");