changeset 11:e4b2d9a387ad

Added information to method visitor interface. * dex/DexMethodVisitor.java (visitCode): Takes three new arguments now. * dex/Code.java (accept): Adapted to above change.
author Michael Starzinger <michi@complang.tuwien.ac.at>
date Mon, 14 Mar 2011 21:30:24 +0100
parents 195f2ce5387a
children 3ba5b4e7c5c4
files src/main/java/org/icedrobot/daneel/dex/Code.java src/main/java/org/icedrobot/daneel/dex/DexMethodVisitor.java
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/org/icedrobot/daneel/dex/Code.java	Mon Mar 14 21:25:15 2011 +0100
+++ b/src/main/java/org/icedrobot/daneel/dex/Code.java	Mon Mar 14 21:30:24 2011 +0100
@@ -47,13 +47,10 @@
 
     private final DexFile dex;
 
-    // XXX Keep around even if not used. Will be needed in visitCode() soon.
     private final int registersSize;
 
-    // XXX Likewise.
     private final int insSize;
 
-    // XXX Likewise.
     private final int outsSize;
 
     private final int triesSize;
@@ -127,7 +124,7 @@
      * @param visitor The given DEX method visitor object.
      */
     public void accept(DexMethodVisitor visitor) {
-        visitor.visitCode();
+        visitor.visitCode(registersSize, insSize, outsSize);
         acceptInsns(visitor);
         for (TryCatchInfo tryCatch : tryCatchInfos)
             // XXX Define interface method for visitor!
--- a/src/main/java/org/icedrobot/daneel/dex/DexMethodVisitor.java	Mon Mar 14 21:25:15 2011 +0100
+++ b/src/main/java/org/icedrobot/daneel/dex/DexMethodVisitor.java	Mon Mar 14 21:30:24 2011 +0100
@@ -30,8 +30,12 @@
     /**
      * Starts visiting the method's code. The code is visited by subsequent
      * calls to {@code visitLabel()} and {@code visitInstr*()} methods.
+     * @param registers The number of registers used by the code.
+     * @param ins The number of words of incoming arguments to the code.
+     * @param outs The number of words of outgoing argument space required by
+     * the code for method invocation.
      */
-    void visitCode();
+    void visitCode(int registers, int ins, int outs);
 
     /**
      * Visits a label. The given label refers to the instruction immediately