mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 01:51:19 +00:00
Since List<AVM2Instruction> code is frequently accessed by position, it's better to use an ArrayList instead of a LinkedList. Introduced method compact() to reduce memory usage.
This commit is contained in:
@@ -60,7 +60,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public class AVM2Code {
|
public class AVM2Code {
|
||||||
|
|
||||||
public List<AVM2Instruction> code = new LinkedList<AVM2Instruction>();
|
public ArrayList<AVM2Instruction> code = new ArrayList<AVM2Instruction>();
|
||||||
public static boolean DEBUG_REWRITE=false;
|
public static boolean DEBUG_REWRITE=false;
|
||||||
public static final int OPT_U30 = 0x100;
|
public static final int OPT_U30 = 0x100;
|
||||||
public static final int OPT_U8 = 0x200;
|
public static final int OPT_U8 = 0x200;
|
||||||
@@ -705,6 +705,10 @@ public class AVM2Code {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void compact() {
|
||||||
|
code.trimToSize();
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
return getBytes(null);
|
return getBytes(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -287,6 +287,8 @@ public class ASM3Parser {
|
|||||||
}
|
}
|
||||||
} while (symb.type != ParsedSymbol.TYPE_EOF);
|
} while (symb.type != ParsedSymbol.TYPE_EOF);
|
||||||
|
|
||||||
|
code.compact();
|
||||||
|
|
||||||
for (OffsetItem oi : offsetItems) {
|
for (OffsetItem oi : offsetItems) {
|
||||||
for (LabelItem li : labelItems) {
|
for (LabelItem li : labelItems) {
|
||||||
if (oi.label.equals(li.label)) {
|
if (oi.label.equals(li.label)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user