aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/bytecode/StackMapTable.java
diff options
context:
space:
mode:
authorTimothy Hoffman <4001421+tim-hoffman@users.noreply.github.com>2021-07-16 13:29:45 -0500
committerTimothy Hoffman <4001421+tim-hoffman@users.noreply.github.com>2021-07-16 13:29:45 -0500
commitaeee909ea7a5c12c591301e346a1da12c6e356f6 (patch)
treeaff464d194dddfff23564b795ca9ed59bb9facc9 /src/main/javassist/bytecode/StackMapTable.java
parent047f7c71be30d1fce5773c8e9c014052acac14df (diff)
downloadjavassist-aeee909ea7a5c12c591301e346a1da12c6e356f6.tar.gz
javassist-aeee909ea7a5c12c591301e346a1da12c6e356f6.zip
Replace array copy loop with System.arraycopy
Diffstat (limited to 'src/main/javassist/bytecode/StackMapTable.java')
-rw-r--r--src/main/javassist/bytecode/StackMapTable.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/javassist/bytecode/StackMapTable.java b/src/main/javassist/bytecode/StackMapTable.java
index 62a6aca0..4fed2010 100644
--- a/src/main/javassist/bytecode/StackMapTable.java
+++ b/src/main/javassist/bytecode/StackMapTable.java
@@ -912,9 +912,15 @@ public class StackMapTable extends AttributeInfo {
static byte[] insertGap(byte[] info, int where, int gap) {
int len = info.length;
byte[] newinfo = new byte[len + gap];
- for (int i = 0; i < len; i++)
- newinfo[i + (i < where ? 0 : gap)] = info[i];
-
+ if (where <= 0) {
+ System.arraycopy(info, 0, newinfo, gap, len);
+ } else if (where >= len) {
+ System.arraycopy(info, 0, newinfo, 0, len);
+ } else {
+ assert (where > 0 && where < len);
+ System.arraycopy(info, 0, newinfo, 0, where);
+ System.arraycopy(info, where, newinfo, where + gap, len - where);
+ }
return newinfo;
}