From 5a5cb6425fe379c5722984e9f703afad7c78d100 Mon Sep 17 00:00:00 2001 From: SuspiciousActivity <38253929+SuspiciousActivity@users.noreply.github.com> Date: Wed, 10 Mar 2021 00:20:09 +0100 Subject: [PATCH] Improvements --- .../ByteEdit/decompiler/SingleThreadedExecutor.java | 1 + src/me/ByteEdit/edit/Assembler.java | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/me/ByteEdit/decompiler/SingleThreadedExecutor.java b/src/me/ByteEdit/decompiler/SingleThreadedExecutor.java index 42577e2..5b5b715 100644 --- a/src/me/ByteEdit/decompiler/SingleThreadedExecutor.java +++ b/src/me/ByteEdit/decompiler/SingleThreadedExecutor.java @@ -17,6 +17,7 @@ public class SingleThreadedExecutor { }, "SingleThreadedExecutor"); static { + thread.setPriority(Thread.MAX_PRIORITY); thread.start(); } diff --git a/src/me/ByteEdit/edit/Assembler.java b/src/me/ByteEdit/edit/Assembler.java index f03d23b..278129d 100644 --- a/src/me/ByteEdit/edit/Assembler.java +++ b/src/me/ByteEdit/edit/Assembler.java @@ -54,6 +54,7 @@ public class Assembler { public static final Pattern SPACE = Pattern.compile(" "); + private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; public static ClassNode assemble(String input) { Main.txtByteEditView.removeAllLineHighlights(); @@ -1488,12 +1489,6 @@ public LabelNode apply(SwitchIntContainer t, LabelNode u) { } } } - Object[] _args = new Object[args.size()]; - stage = 0; - for (Object o : args) { - _args[stage] = o; - stage++; - } return new InvokeDynamicInsnNode(UnicodeUtils.unescape(hsr, sp[0].substring(7)), UnicodeUtils.unescape(hsr, sp[1].substring(6)), new Handle(OpcodesReverse.getHandleOpcode(sp[7].substring(6)), @@ -1501,7 +1496,7 @@ public LabelNode apply(SwitchIntContainer t, LabelNode u) { UnicodeUtils.unescape(hsr, sp[3].substring(7)), UnicodeUtils.unescape(hsr, sp[5].substring(7)), Boolean.parseBoolean(sp[6].substring(14))), - _args); + args.toArray(new Object[args.size()])); } case "new": { return new TypeInsnNode(187, UnicodeUtils.unescape(hsr, split[1])); @@ -1565,7 +1560,7 @@ private static Object[] parseFrameList(HugeStringsRev hsr, String str, HashMap list = new ArrayList<>(); String l = str.substring(1, str.length() - 1); if (l.isEmpty()) { - return new Object[0]; + return EMPTY_OBJECT_ARRAY; } else { for (String asd : l.split(", ")) { if (!asd.startsWith("(")) {