fix
This commit is contained in:
parent
1a975a65dc
commit
49ac2a8935
14
Jocaml.java
14
Jocaml.java
|
@ -57,7 +57,7 @@ public class Jocaml {
|
|||
RESTART(41, 0),
|
||||
GRAB(42, 1),
|
||||
CLOSURE(43, 2),
|
||||
CLOSUREREC(44, 4),
|
||||
CLOSUREREC(44, 2),
|
||||
OFFSETCLOSUREM2(45, 0),
|
||||
OFFSETCLOSURE0(46, 0),
|
||||
OFFSETCLOSURE2(47, 0),
|
||||
|
@ -417,8 +417,8 @@ public class Jocaml {
|
|||
public void disassemble(List<String> prim) throws Exception {
|
||||
this.data.order(ByteOrder.LITTLE_ENDIAN);
|
||||
this.data.position(0);
|
||||
int offset = 0;
|
||||
while (this.data.position() < this.data.capacity()) {
|
||||
int pc = this.data.position() / 4;
|
||||
int op = this.data.getInt();
|
||||
String rep = null;
|
||||
try {
|
||||
|
@ -433,6 +433,13 @@ public class Jocaml {
|
|||
int n = this.data.getInt();
|
||||
rep += " " + n;
|
||||
}
|
||||
} else if (inst == CamlInst.CLOSUREREC) {
|
||||
int nfuncs = this.data.getInt();
|
||||
int nargs = this.data.getInt();
|
||||
rep += " " + nfuncs + " " + nargs;
|
||||
for (int i = 0; i < nfuncs; i++) {
|
||||
rep += " " + this.data.getInt();
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < inst.numArgs; i++) {
|
||||
rep += " " + this.data.getInt();
|
||||
|
@ -441,9 +448,8 @@ public class Jocaml {
|
|||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
rep = "<UNKNOWN " + op + ">";
|
||||
}
|
||||
System.out.printf("%04d: ", offset);
|
||||
System.out.printf("%05d: ", pc);
|
||||
System.out.println(rep);
|
||||
offset += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue