gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
mjc2wsl - inc command
[mjc2wsl.git] / src / mjc2wsl.java
index f27f255..4c7618f 100644 (file)
@@ -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()) + ";");
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner