Skip to content

Commit

Permalink
Adding classes to cpEntry dissasembly
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreijstal committed Oct 4, 2024
1 parent 1a0639c commit b8f8b10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions dissasembleClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ function disassemble(ast, constantPool) {
commentText = `int ${cpEntry.info.bytes}`;
} else if (cpEntry.tag === 4) {
commentText = `float ${cpEntry.info.bytes}`;
} else if (cpEntry.tag === 7) {
const className = getClassName(cpEntry.info.name_index);
commentText = `Class ${className}`;
}
if (commentText) {
line = line.padEnd(40) + ` // ${commentText}`;
Expand Down Expand Up @@ -518,6 +521,9 @@ function parseClassFile(jsonObject, opcodeNames) {
instruction.comment = `int ${cpEntry.info.bytes}`;
} else if (cpEntry.tag === 4) {
instruction.comment = `float ${cpEntry.info.bytes}`;
} else if (cpEntry.tag === 7) {
const className = getClassName(cpEntry.info.name_index);
instruction.comment = `Class ${className}`;
}
}
} else if (opcode === 197) {
Expand Down
2 changes: 1 addition & 1 deletion parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ const TableswitchParser = Parser.start()
return this.high - this.low + 1;
},
formatter: function (att) {
return att.map((v) => v + this.offset);
return att.map((v) => v);
},
})
.buffer("length", {
Expand Down

0 comments on commit b8f8b10

Please sign in to comment.