--- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1383,7 +1383,12 @@
// save regs before copy_memory
__ push(RegSet::of(d, count), sp);
}
- copy_memory(aligned, s, d, count, rscratch1, size);
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ bool add_entry = !is_oop && (!aligned || sizeof(jlong) == size);
+ UnsafeCopyMemoryMark ucmm(this, add_entry, true);
+ copy_memory(aligned, s, d, count, rscratch1, size);
+ }
if (is_oop) {
__ pop(RegSet::of(d, count), sp);
@@ -1455,7 +1460,12 @@
// save regs before copy_memory
__ push(RegSet::of(d, count), sp);
}
- copy_memory(aligned, s, d, count, rscratch1, -size);
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ bool add_entry = !is_oop && (!aligned || sizeof(jlong) == size);
+ UnsafeCopyMemoryMark ucmm(this, add_entry, true);
+ copy_memory(aligned, s, d, count, rscratch1, -size);
+ }
if (is_oop) {
__ pop(RegSet::of(d, count), sp);
if (VerifyOops)
@@ -5816,6 +5826,10 @@
}
}; // end class declaration
+#define UCM_TABLE_MAX_ENTRIES 8
void StubGenerator_generate(CodeBuffer* code, bool all) {
+ if (UnsafeCopyMemory::_table == NULL) {
+ UnsafeCopyMemory::create_table(UCM_TABLE_MAX_ENTRIES);
+ }
StubGenerator g(code, all);
}
--- a/src/hotspot/cpu/arm/stubGenerator_arm.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/cpu/arm/stubGenerator_arm.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -928,7 +928,7 @@
// Scratches 'count', R3.
// R4-R10 are preserved (saved/restored).
//
- int generate_forward_aligned_copy_loop(Register from, Register to, Register count, int bytes_per_count) {
+ int generate_forward_aligned_copy_loop(Register from, Register to, Register count, int bytes_per_count, bool unsafe_copy = false) {
assert (from == R0 && to == R1 && count == R2, "adjust the implementation below");
const int bytes_per_loop = 8*wordSize; // 8 registers are read and written on every loop iteration
@@ -954,107 +954,111 @@
Label L_skip_pld;
- // predecrease to exit when there is less than count_per_loop
- __ sub_32(count, count, count_per_loop);
-
- if (pld_offset != 0) {
- pld_offset = (pld_offset < 0) ? -pld_offset : pld_offset;
-
- prefetch(from, to, 0);
-
- if (prefetch_before) {
- // If prefetch is done ahead, final PLDs that overflow the
- // copied area can be easily avoided. 'count' is predecreased
- // by the prefetch distance to optimize the inner loop and the
- // outer loop skips the PLD.
- __ subs_32(count, count, (bytes_per_loop+pld_offset)/bytes_per_count);
-
- // skip prefetch for small copies
- __ b(L_skip_pld, lt);
- }
-
- int offset = ArmCopyCacheLineSize;
- while (offset <= pld_offset) {
- prefetch(from, to, offset);
- offset += ArmCopyCacheLineSize;
- };
- }
-
{
- // 32-bit ARM note: we have tried implementing loop unrolling to skip one
- // PLD with 64 bytes cache line but the gain was not significant.
-
- Label L_copy_loop;
- __ align(OptoLoopAlignment);
- __ BIND(L_copy_loop);
-
- if (prefetch_before) {
- prefetch(from, to, bytes_per_loop + pld_offset);
- __ BIND(L_skip_pld);
- }
-
- if (split_read) {
- // Split the register set in two sets so that there is less
- // latency between LDM and STM (R3-R6 available while R7-R10
- // still loading) and less register locking issue when iterating
- // on the first LDM.
- __ ldmia(from, RegisterSet(R3, R6), writeback);
- __ ldmia(from, RegisterSet(R7, R10), writeback);
- } else {
- __ ldmia(from, RegisterSet(R3, R10), writeback);
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true);
+ // predecrease to exit when there is less than count_per_loop
+ __ sub_32(count, count, count_per_loop);
+
+ if (pld_offset != 0) {
+ pld_offset = (pld_offset < 0) ? -pld_offset : pld_offset;
+
+ prefetch(from, to, 0);
+
+ if (prefetch_before) {
+ // If prefetch is done ahead, final PLDs that overflow the
+ // copied area can be easily avoided. 'count' is predecreased
+ // by the prefetch distance to optimize the inner loop and the
+ // outer loop skips the PLD.
+ __ subs_32(count, count, (bytes_per_loop+pld_offset)/bytes_per_count);
+
+ // skip prefetch for small copies
+ __ b(L_skip_pld, lt);
+ }
+
+ int offset = ArmCopyCacheLineSize;
+ while (offset <= pld_offset) {
+ prefetch(from, to, offset);
+ offset += ArmCopyCacheLineSize;
+ };
}
- __ subs_32(count, count, count_per_loop);
-
- if (prefetch_after) {
- prefetch(from, to, pld_offset, bytes_per_loop);
- }
-
- if (split_write) {
- __ stmia(to, RegisterSet(R3, R6), writeback);
- __ stmia(to, RegisterSet(R7, R10), writeback);
- } else {
- __ stmia(to, RegisterSet(R3, R10), writeback);
- }
-
- __ b(L_copy_loop, ge);
-
- if (prefetch_before) {
- // the inner loop may end earlier, allowing to skip PLD for the last iterations
- __ cmn_32(count, (bytes_per_loop + pld_offset)/bytes_per_count);
- __ b(L_skip_pld, ge);
+ {
+ // 32-bit ARM note: we have tried implementing loop unrolling to skip one
+ // PLD with 64 bytes cache line but the gain was not significant.
+
+ Label L_copy_loop;
+ __ align(OptoLoopAlignment);
+ __ BIND(L_copy_loop);
+
+ if (prefetch_before) {
+ prefetch(from, to, bytes_per_loop + pld_offset);
+ __ BIND(L_skip_pld);
+ }
+
+ if (split_read) {
+ // Split the register set in two sets so that there is less
+ // latency between LDM and STM (R3-R6 available while R7-R10
+ // still loading) and less register locking issue when iterating
+ // on the first LDM.
+ __ ldmia(from, RegisterSet(R3, R6), writeback);
+ __ ldmia(from, RegisterSet(R7, R10), writeback);
+ } else {
+ __ ldmia(from, RegisterSet(R3, R10), writeback);
+ }
+
+ __ subs_32(count, count, count_per_loop);
+
+ if (prefetch_after) {
+ prefetch(from, to, pld_offset, bytes_per_loop);
+ }
+
+ if (split_write) {
+ __ stmia(to, RegisterSet(R3, R6), writeback);
+ __ stmia(to, RegisterSet(R7, R10), writeback);
+ } else {
+ __ stmia(to, RegisterSet(R3, R10), writeback);
+ }
+
+ __ b(L_copy_loop, ge);
+
+ if (prefetch_before) {
+ // the inner loop may end earlier, allowing to skip PLD for the last iterations
+ __ cmn_32(count, (bytes_per_loop + pld_offset)/bytes_per_count);
+ __ b(L_skip_pld, ge);
+ }
}
- }
- BLOCK_COMMENT("Remaining bytes:");
- // still 0..bytes_per_loop-1 aligned bytes to copy, count already decreased by (at least) bytes_per_loop bytes
-
- // __ add(count, count, ...); // addition useless for the bit tests
- assert (pld_offset % bytes_per_loop == 0, "decreasing count by pld_offset before loop must not change tested bits");
-
- __ tst(count, 16 / bytes_per_count);
- __ ldmia(from, RegisterSet(R3, R6), writeback, ne); // copy 16 bytes
- __ stmia(to, RegisterSet(R3, R6), writeback, ne);
-
- __ tst(count, 8 / bytes_per_count);
- __ ldmia(from, RegisterSet(R3, R4), writeback, ne); // copy 8 bytes
- __ stmia(to, RegisterSet(R3, R4), writeback, ne);
-
- if (bytes_per_count <= 4) {
- __ tst(count, 4 / bytes_per_count);
- __ ldr(R3, Address(from, 4, post_indexed), ne); // copy 4 bytes
- __ str(R3, Address(to, 4, post_indexed), ne);
- }
-
- if (bytes_per_count <= 2) {
- __ tst(count, 2 / bytes_per_count);
- __ ldrh(R3, Address(from, 2, post_indexed), ne); // copy 2 bytes
- __ strh(R3, Address(to, 2, post_indexed), ne);
- }
-
- if (bytes_per_count == 1) {
- __ tst(count, 1);
- __ ldrb(R3, Address(from, 1, post_indexed), ne);
- __ strb(R3, Address(to, 1, post_indexed), ne);
+ BLOCK_COMMENT("Remaining bytes:");
+ // still 0..bytes_per_loop-1 aligned bytes to copy, count already decreased by (at least) bytes_per_loop bytes
+
+ // __ add(count, count, ...); // addition useless for the bit tests
+ assert (pld_offset % bytes_per_loop == 0, "decreasing count by pld_offset before loop must not change tested bits");
+
+ __ tst(count, 16 / bytes_per_count);
+ __ ldmia(from, RegisterSet(R3, R6), writeback, ne); // copy 16 bytes
+ __ stmia(to, RegisterSet(R3, R6), writeback, ne);
+
+ __ tst(count, 8 / bytes_per_count);
+ __ ldmia(from, RegisterSet(R3, R4), writeback, ne); // copy 8 bytes
+ __ stmia(to, RegisterSet(R3, R4), writeback, ne);
+
+ if (bytes_per_count <= 4) {
+ __ tst(count, 4 / bytes_per_count);
+ __ ldr(R3, Address(from, 4, post_indexed), ne); // copy 4 bytes
+ __ str(R3, Address(to, 4, post_indexed), ne);
+ }
+
+ if (bytes_per_count <= 2) {
+ __ tst(count, 2 / bytes_per_count);
+ __ ldrh(R3, Address(from, 2, post_indexed), ne); // copy 2 bytes
+ __ strh(R3, Address(to, 2, post_indexed), ne);
+ }
+
+ if (bytes_per_count == 1) {
+ __ tst(count, 1);
+ __ ldrb(R3, Address(from, 1, post_indexed), ne);
+ __ strb(R3, Address(to, 1, post_indexed), ne);
+ }
}
__ pop(RegisterSet(R4,R10));
@@ -1083,7 +1087,7 @@
// Scratches 'count', R3.
// ARM R4-R10 are preserved (saved/restored).
//
- int generate_backward_aligned_copy_loop(Register end_from, Register end_to, Register count, int bytes_per_count) {
+ int generate_backward_aligned_copy_loop(Register end_from, Register end_to, Register count, int bytes_per_count, bool unsafe_copy = false) {
assert (end_from == R0 && end_to == R1 && count == R2, "adjust the implementation below");
const int bytes_per_loop = 8*wordSize; // 8 registers are read and written on every loop iteration
@@ -1099,102 +1103,105 @@
__ push(RegisterSet(R4,R10));
- __ sub_32(count, count, count_per_loop);
-
- const bool prefetch_before = pld_offset < 0;
- const bool prefetch_after = pld_offset > 0;
-
- Label L_skip_pld;
-
- if (pld_offset != 0) {
- pld_offset = (pld_offset < 0) ? -pld_offset : pld_offset;
-
- prefetch(end_from, end_to, -wordSize);
-
- if (prefetch_before) {
- __ subs_32(count, count, (bytes_per_loop + pld_offset) / bytes_per_count);
- __ b(L_skip_pld, lt);
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true);
+ __ sub_32(count, count, count_per_loop);
+
+ const bool prefetch_before = pld_offset < 0;
+ const bool prefetch_after = pld_offset > 0;
+
+ Label L_skip_pld;
+
+ if (pld_offset != 0) {
+ pld_offset = (pld_offset < 0) ? -pld_offset : pld_offset;
+
+ prefetch(end_from, end_to, -wordSize);
+
+ if (prefetch_before) {
+ __ subs_32(count, count, (bytes_per_loop + pld_offset) / bytes_per_count);
+ __ b(L_skip_pld, lt);
+ }
+
+ int offset = ArmCopyCacheLineSize;
+ while (offset <= pld_offset) {
+ prefetch(end_from, end_to, -(wordSize + offset));
+ offset += ArmCopyCacheLineSize;
+ };
}
- int offset = ArmCopyCacheLineSize;
- while (offset <= pld_offset) {
- prefetch(end_from, end_to, -(wordSize + offset));
- offset += ArmCopyCacheLineSize;
- };
- }
-
- {
- // 32-bit ARM note: we have tried implementing loop unrolling to skip one
- // PLD with 64 bytes cache line but the gain was not significant.
-
- Label L_copy_loop;
- __ align(OptoLoopAlignment);
- __ BIND(L_copy_loop);
-
- if (prefetch_before) {
- prefetch(end_from, end_to, -(wordSize + bytes_per_loop + pld_offset));
- __ BIND(L_skip_pld);
+ {
+ // 32-bit ARM note: we have tried implementing loop unrolling to skip one
+ // PLD with 64 bytes cache line but the gain was not significant.
+
+ Label L_copy_loop;
+ __ align(OptoLoopAlignment);
+ __ BIND(L_copy_loop);
+
+ if (prefetch_before) {
+ prefetch(end_from, end_to, -(wordSize + bytes_per_loop + pld_offset));
+ __ BIND(L_skip_pld);
+ }
+
+ if (split_read) {
+ __ ldmdb(end_from, RegisterSet(R7, R10), writeback);
+ __ ldmdb(end_from, RegisterSet(R3, R6), writeback);
+ } else {
+ __ ldmdb(end_from, RegisterSet(R3, R10), writeback);
+ }
+
+ __ subs_32(count, count, count_per_loop);
+
+ if (prefetch_after) {
+ prefetch(end_from, end_to, -(wordSize + pld_offset), -bytes_per_loop);
+ }
+
+ if (split_write) {
+ __ stmdb(end_to, RegisterSet(R7, R10), writeback);
+ __ stmdb(end_to, RegisterSet(R3, R6), writeback);
+ } else {
+ __ stmdb(end_to, RegisterSet(R3, R10), writeback);
+ }
+
+ __ b(L_copy_loop, ge);
+
+ if (prefetch_before) {
+ __ cmn_32(count, (bytes_per_loop + pld_offset)/bytes_per_count);
+ __ b(L_skip_pld, ge);
+ }
}
-
- if (split_read) {
- __ ldmdb(end_from, RegisterSet(R7, R10), writeback);
- __ ldmdb(end_from, RegisterSet(R3, R6), writeback);
- } else {
- __ ldmdb(end_from, RegisterSet(R3, R10), writeback);
- }
-
- __ subs_32(count, count, count_per_loop);
-
- if (prefetch_after) {
- prefetch(end_from, end_to, -(wordSize + pld_offset), -bytes_per_loop);
+ BLOCK_COMMENT("Remaining bytes:");
+ // still 0..bytes_per_loop-1 aligned bytes to copy, count already decreased by (at least) bytes_per_loop bytes
+
+ // __ add(count, count, ...); // addition useless for the bit tests
+ assert (pld_offset % bytes_per_loop == 0, "decreasing count by pld_offset before loop must not change tested bits");
+
+ __ tst(count, 16 / bytes_per_count);
+ __ ldmdb(end_from, RegisterSet(R3, R6), writeback, ne); // copy 16 bytes
+ __ stmdb(end_to, RegisterSet(R3, R6), writeback, ne);
+
+ __ tst(count, 8 / bytes_per_count);
+ __ ldmdb(end_from, RegisterSet(R3, R4), writeback, ne); // copy 8 bytes
+ __ stmdb(end_to, RegisterSet(R3, R4), writeback, ne);
+
+ if (bytes_per_count <= 4) {
+ __ tst(count, 4 / bytes_per_count);
+ __ ldr(R3, Address(end_from, -4, pre_indexed), ne); // copy 4 bytes
+ __ str(R3, Address(end_to, -4, pre_indexed), ne);
}
- if (split_write) {
- __ stmdb(end_to, RegisterSet(R7, R10), writeback);
- __ stmdb(end_to, RegisterSet(R3, R6), writeback);
- } else {
- __ stmdb(end_to, RegisterSet(R3, R10), writeback);
+ if (bytes_per_count <= 2) {
+ __ tst(count, 2 / bytes_per_count);
+ __ ldrh(R3, Address(end_from, -2, pre_indexed), ne); // copy 2 bytes
+ __ strh(R3, Address(end_to, -2, pre_indexed), ne);
}
- __ b(L_copy_loop, ge);
-
- if (prefetch_before) {
- __ cmn_32(count, (bytes_per_loop + pld_offset)/bytes_per_count);
- __ b(L_skip_pld, ge);
+ if (bytes_per_count == 1) {
+ __ tst(count, 1);
+ __ ldrb(R3, Address(end_from, -1, pre_indexed), ne);
+ __ strb(R3, Address(end_to, -1, pre_indexed), ne);
}
}
- BLOCK_COMMENT("Remaining bytes:");
- // still 0..bytes_per_loop-1 aligned bytes to copy, count already decreased by (at least) bytes_per_loop bytes
-
- // __ add(count, count, ...); // addition useless for the bit tests
- assert (pld_offset % bytes_per_loop == 0, "decreasing count by pld_offset before loop must not change tested bits");
-
- __ tst(count, 16 / bytes_per_count);
- __ ldmdb(end_from, RegisterSet(R3, R6), writeback, ne); // copy 16 bytes
- __ stmdb(end_to, RegisterSet(R3, R6), writeback, ne);
-
- __ tst(count, 8 / bytes_per_count);
- __ ldmdb(end_from, RegisterSet(R3, R4), writeback, ne); // copy 8 bytes
- __ stmdb(end_to, RegisterSet(R3, R4), writeback, ne);
-
- if (bytes_per_count <= 4) {
- __ tst(count, 4 / bytes_per_count);
- __ ldr(R3, Address(end_from, -4, pre_indexed), ne); // copy 4 bytes
- __ str(R3, Address(end_to, -4, pre_indexed), ne);
- }
-
- if (bytes_per_count <= 2) {
- __ tst(count, 2 / bytes_per_count);
- __ ldrh(R3, Address(end_from, -2, pre_indexed), ne); // copy 2 bytes
- __ strh(R3, Address(end_to, -2, pre_indexed), ne);
- }
-
- if (bytes_per_count == 1) {
- __ tst(count, 1);
- __ ldrb(R3, Address(end_from, -1, pre_indexed), ne);
- __ strb(R3, Address(end_to, -1, pre_indexed), ne);
- }
-
__ pop(RegisterSet(R4,R10));
return count_per_loop;
@@ -1749,17 +1756,21 @@
//
// Notes:
// shifts 'from' and 'to'
- void copy_small_array(Register from, Register to, Register count, Register tmp, Register tmp2, int bytes_per_count, bool forward, Label & entry) {
+ void copy_small_array(Register from, Register to, Register count, Register tmp, Register tmp2, int bytes_per_count, bool forward, Label & entry, bool unsafe_copy = false) {
assert_different_registers(from, to, count, tmp);
- __ align(OptoLoopAlignment);
- Label L_small_loop;
- __ BIND(L_small_loop);
- store_one(tmp, to, bytes_per_count, forward, al, tmp2);
- __ BIND(entry); // entry point
- __ subs(count, count, 1);
- load_one(tmp, from, bytes_per_count, forward, ge, tmp2);
- __ b(L_small_loop, ge);
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true);
+ __ align(OptoLoopAlignment);
+ Label L_small_loop;
+ __ BIND(L_small_loop);
+ store_one(tmp, to, bytes_per_count, forward, al, tmp2);
+ __ BIND(entry); // entry point
+ __ subs(count, count, 1);
+ load_one(tmp, from, bytes_per_count, forward, ge, tmp2);
+ __ b(L_small_loop, ge);
+ }
}
// Aligns 'to' by reading one word from 'from' and writting its part to 'to'.
@@ -1876,7 +1887,7 @@
//
// Scratches 'from', 'count', R3 and R12.
// R4-R10 saved for use.
- int align_dst_and_generate_shifted_copy_loop(Register from, Register to, Register count, int bytes_per_count, bool forward) {
+ int align_dst_and_generate_shifted_copy_loop(Register from, Register to, Register count, int bytes_per_count, bool forward, bool unsafe_copy = false) {
const Register Rval = forward ? R12 : R3; // as generate_{forward,backward}_shifted_copy_loop expect
@@ -1886,60 +1897,64 @@
// then the remainder of 'to' divided by wordSize is one of elements of {seq}.
__ push(RegisterSet(R4,R10));
- load_one(Rval, from, wordSize, forward);
-
- switch (bytes_per_count) {
- case 2:
- min_copy = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 2, bytes_per_count, forward);
- break;
- case 1:
- {
- Label L1, L2, L3;
- int min_copy1, min_copy2, min_copy3;
-
- Label L_loop_finished;
-
- if (forward) {
- __ tbz(to, 0, L2);
- __ tbz(to, 1, L1);
-
- __ BIND(L3);
- min_copy3 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 3, bytes_per_count, forward);
- __ b(L_loop_finished);
-
- __ BIND(L1);
- min_copy1 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 1, bytes_per_count, forward);
- __ b(L_loop_finished);
-
- __ BIND(L2);
- min_copy2 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 2, bytes_per_count, forward);
- } else {
- __ tbz(to, 0, L2);
- __ tbnz(to, 1, L3);
-
- __ BIND(L1);
- min_copy1 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 1, bytes_per_count, forward);
- __ b(L_loop_finished);
-
- __ BIND(L3);
- min_copy3 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 3, bytes_per_count, forward);
- __ b(L_loop_finished);
-
- __ BIND(L2);
- min_copy2 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 2, bytes_per_count, forward);
+
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true);
+ load_one(Rval, from, wordSize, forward);
+
+ switch (bytes_per_count) {
+ case 2:
+ min_copy = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 2, bytes_per_count, forward);
+ break;
+ case 1:
+ {
+ Label L1, L2, L3;
+ int min_copy1, min_copy2, min_copy3;
+
+ Label L_loop_finished;
+
+ if (forward) {
+ __ tbz(to, 0, L2);
+ __ tbz(to, 1, L1);
+
+ __ BIND(L3);
+ min_copy3 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 3, bytes_per_count, forward);
+ __ b(L_loop_finished);
+
+ __ BIND(L1);
+ min_copy1 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 1, bytes_per_count, forward);
+ __ b(L_loop_finished);
+
+ __ BIND(L2);
+ min_copy2 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 2, bytes_per_count, forward);
+ } else {
+ __ tbz(to, 0, L2);
+ __ tbnz(to, 1, L3);
+
+ __ BIND(L1);
+ min_copy1 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 1, bytes_per_count, forward);
+ __ b(L_loop_finished);
+
+ __ BIND(L3);
+ min_copy3 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 3, bytes_per_count, forward);
+ __ b(L_loop_finished);
+
+ __ BIND(L2);
+ min_copy2 = align_dst_and_generate_shifted_copy_loop(from, to, count, Rval, 2, bytes_per_count, forward);
+ }
+
+ min_copy = MAX2(MAX2(min_copy1, min_copy2), min_copy3);
+
+ __ BIND(L_loop_finished);
+
+ break;
}
-
- min_copy = MAX2(MAX2(min_copy1, min_copy2), min_copy3);
-
- __ BIND(L_loop_finished);
-
- break;
+ default:
+ ShouldNotReachHere();
+ break;
}
- default:
- ShouldNotReachHere();
- break;
}
-
__ pop(RegisterSet(R4,R10));
return min_copy;
@@ -1963,6 +1978,13 @@
}
#endif // !PRODUCT
+ address generate_unsafecopy_common_error_exit() {
+ address start_pc = __ pc();
+ __ mov(R0, 0);
+ __ ret();
+ return start_pc;
+ }
+
//
// Generate stub for primitive array copy. If "aligned" is true, the
// "from" and "to" addresses are assumed to be heapword aligned.
@@ -2033,8 +2055,13 @@
from_is_aligned = true;
}
- int count_required_to_align = from_is_aligned ? 0 : align_src(from, to, count, tmp1, bytes_per_count, forward);
- assert (small_copy_limit >= count_required_to_align, "alignment could exhaust count");
+ int count_required_to_align = 0;
+ {
+ // UnsafeCopyMemoryMark page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+ count_required_to_align = from_is_aligned ? 0 : align_src(from, to, count, tmp1, bytes_per_count, forward);
+ assert (small_copy_limit >= count_required_to_align, "alignment could exhaust count");
+ }
// now 'from' is aligned
@@ -2064,9 +2091,9 @@
int min_copy;
if (forward) {
- min_copy = generate_forward_aligned_copy_loop (from, to, count, bytes_per_count);
+ min_copy = generate_forward_aligned_copy_loop(from, to, count, bytes_per_count, !aligned /*add UnsafeCopyMemory entry*/);
} else {
- min_copy = generate_backward_aligned_copy_loop(from, to, count, bytes_per_count);
+ min_copy = generate_backward_aligned_copy_loop(from, to, count, bytes_per_count, !aligned /*add UnsafeCopyMemory entry*/);
}
assert(small_copy_limit >= count_required_to_align + min_copy, "first loop might exhaust count");
@@ -2077,7 +2104,7 @@
__ ret();
{
- copy_small_array(from, to, count, tmp1, tmp2, bytes_per_count, forward, L_small_array /* entry */);
+ copy_small_array(from, to, count, tmp1, tmp2, bytes_per_count, forward, L_small_array /* entry */, !aligned /*add UnsafeCopyMemory entry*/);
if (status) {
__ mov(R0, 0); // OK
@@ -2088,7 +2115,7 @@
if (! to_is_aligned) {
__ BIND(L_unaligned_dst);
- int min_copy_shifted = align_dst_and_generate_shifted_copy_loop(from, to, count, bytes_per_count, forward);
+ int min_copy_shifted = align_dst_and_generate_shifted_copy_loop(from, to, count, bytes_per_count, forward, !aligned /*add UnsafeCopyMemory entry*/);
assert (small_copy_limit >= count_required_to_align + min_copy_shifted, "first loop might exhaust count");
if (status) {
@@ -2873,6 +2900,9 @@
status = true; // generate a status compatible with C1 calls
#endif
+ address ucm_common_error_exit = generate_unsafecopy_common_error_exit();
+ UnsafeCopyMemory::set_common_exit_stub_pc(ucm_common_error_exit);
+
// these need always status in case they are called from generic_arraycopy
StubRoutines::_jbyte_disjoint_arraycopy = generate_primitive_copy(false, "jbyte_disjoint_arraycopy", true, 1, true);
StubRoutines::_jshort_disjoint_arraycopy = generate_primitive_copy(false, "jshort_disjoint_arraycopy", true, 2, true);
@@ -3055,6 +3085,10 @@
}
}; // end class declaration
+#define UCM_TABLE_MAX_ENTRIES 32
void StubGenerator_generate(CodeBuffer* code, bool all) {
+ if (UnsafeCopyMemory::_table == NULL) {
+ UnsafeCopyMemory::create_table(UCM_TABLE_MAX_ENTRIES);
+ }
StubGenerator g(code, all);
}
--- a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -952,6 +952,20 @@
// need to copy backwards
}
+ // This is common errorexit stub for UnsafeCopyMemory.
+ address generate_unsafecopy_common_error_exit() {
+ address start_pc = __ pc();
+ Register tmp1 = R6_ARG4;
+ // probably copy stub would have changed value reset it.
+ if (VM_Version::has_mfdscr()) {
+ __ load_const_optimized(tmp1, VM_Version::_dscr_val);
+ __ mtdscr(tmp1);
+ }
+ __ li(R3_RET, 0); // return 0
+ __ blr();
+ return start_pc;
+ }
+
// The guideline in the implementations of generate_disjoint_xxx_copy
// (xxx=byte,short,int,long,oop) is to copy as many elements as possible with
// single instructions, but to avoid alignment interrupts (see subsequent
@@ -989,150 +1003,154 @@
VectorSRegister tmp_vsr2 = VSR2;
Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9, l_10;
-
- // Don't try anything fancy if arrays don't have many elements.
- __ li(tmp3, 0);
- __ cmpwi(CCR0, R5_ARG3, 17);
- __ ble(CCR0, l_6); // copy 4 at a time
-
- if (!aligned) {
- __ xorr(tmp1, R3_ARG1, R4_ARG2);
- __ andi_(tmp1, tmp1, 3);
- __ bne(CCR0, l_6); // If arrays don't have the same alignment mod 4, do 4 element copy.
-
- // Copy elements if necessary to align to 4 bytes.
- __ neg(tmp1, R3_ARG1); // Compute distance to alignment boundary.
- __ andi_(tmp1, tmp1, 3);
- __ beq(CCR0, l_2);
-
- __ subf(R5_ARG3, tmp1, R5_ARG3);
- __ bind(l_9);
- __ lbz(tmp2, 0, R3_ARG1);
- __ addic_(tmp1, tmp1, -1);
- __ stb(tmp2, 0, R4_ARG2);
- __ addi(R3_ARG1, R3_ARG1, 1);
- __ addi(R4_ARG2, R4_ARG2, 1);
- __ bne(CCR0, l_9);
-
- __ bind(l_2);
- }
-
- // copy 8 elements at a time
- __ xorr(tmp2, R3_ARG1, R4_ARG2); // skip if src & dest have differing alignment mod 8
- __ andi_(tmp1, tmp2, 7);
- __ bne(CCR0, l_7); // not same alignment -> to or from is aligned -> copy 8
-
- // copy a 2-element word if necessary to align to 8 bytes
- __ andi_(R0, R3_ARG1, 7);
- __ beq(CCR0, l_7);
-
- __ lwzx(tmp2, R3_ARG1, tmp3);
- __ addi(R5_ARG3, R5_ARG3, -4);
- __ stwx(tmp2, R4_ARG2, tmp3);
- { // FasterArrayCopy
- __ addi(R3_ARG1, R3_ARG1, 4);
- __ addi(R4_ARG2, R4_ARG2, 4);
- }
- __ bind(l_7);
-
- { // FasterArrayCopy
- __ cmpwi(CCR0, R5_ARG3, 31);
- __ ble(CCR0, l_6); // copy 2 at a time if less than 32 elements remain
-
- __ srdi(tmp1, R5_ARG3, 5);
- __ andi_(R5_ARG3, R5_ARG3, 31);
- __ mtctr(tmp1);
-
- if (!VM_Version::has_vsx()) {
-
- __ bind(l_8);
- // Use unrolled version for mass copying (copy 32 elements a time)
- // Load feeding store gets zero latency on Power6, however not on Power5.
- // Therefore, the following sequence is made for the good of both.
- __ ld(tmp1, 0, R3_ARG1);
- __ ld(tmp2, 8, R3_ARG1);
- __ ld(tmp3, 16, R3_ARG1);
- __ ld(tmp4, 24, R3_ARG1);
- __ std(tmp1, 0, R4_ARG2);
- __ std(tmp2, 8, R4_ARG2);
- __ std(tmp3, 16, R4_ARG2);
- __ std(tmp4, 24, R4_ARG2);
- __ addi(R3_ARG1, R3_ARG1, 32);
- __ addi(R4_ARG2, R4_ARG2, 32);
- __ bdnz(l_8);
-
- } else { // Processor supports VSX, so use it to mass copy.
-
- // Prefetch the data into the L2 cache.
- __ dcbt(R3_ARG1, 0);
-
- // If supported set DSCR pre-fetch to deepest.
- if (VM_Version::has_mfdscr()) {
- __ load_const_optimized(tmp2, VM_Version::_dscr_val | 7);
- __ mtdscr(tmp2);
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+
+ // Don't try anything fancy if arrays don't have many elements.
+ __ li(tmp3, 0);
+ __ cmpwi(CCR0, R5_ARG3, 17);
+ __ ble(CCR0, l_6); // copy 4 at a time
+
+ if (!aligned) {
+ __ xorr(tmp1, R3_ARG1, R4_ARG2);
+ __ andi_(tmp1, tmp1, 3);
+ __ bne(CCR0, l_6); // If arrays don't have the same alignment mod 4, do 4 element copy.
+
+ // Copy elements if necessary to align to 4 bytes.
+ __ neg(tmp1, R3_ARG1); // Compute distance to alignment boundary.
+ __ andi_(tmp1, tmp1, 3);
+ __ beq(CCR0, l_2);
+
+ __ subf(R5_ARG3, tmp1, R5_ARG3);
+ __ bind(l_9);
+ __ lbz(tmp2, 0, R3_ARG1);
+ __ addic_(tmp1, tmp1, -1);
+ __ stb(tmp2, 0, R4_ARG2);
+ __ addi(R3_ARG1, R3_ARG1, 1);
+ __ addi(R4_ARG2, R4_ARG2, 1);
+ __ bne(CCR0, l_9);
+
+ __ bind(l_2);
+ }
+
+ // copy 8 elements at a time
+ __ xorr(tmp2, R3_ARG1, R4_ARG2); // skip if src & dest have differing alignment mod 8
+ __ andi_(tmp1, tmp2, 7);
+ __ bne(CCR0, l_7); // not same alignment -> to or from is aligned -> copy 8
+
+ // copy a 2-element word if necessary to align to 8 bytes
+ __ andi_(R0, R3_ARG1, 7);
+ __ beq(CCR0, l_7);
+
+ __ lwzx(tmp2, R3_ARG1, tmp3);
+ __ addi(R5_ARG3, R5_ARG3, -4);
+ __ stwx(tmp2, R4_ARG2, tmp3);
+ { // FasterArrayCopy
+ __ addi(R3_ARG1, R3_ARG1, 4);
+ __ addi(R4_ARG2, R4_ARG2, 4);
}
-
- __ li(tmp1, 16);
-
- // Backbranch target aligned to 32-byte. Not 16-byte align as
- // loop contains < 8 instructions that fit inside a single
- // i-cache sector.
- __ align(32);
-
- __ bind(l_10);
- // Use loop with VSX load/store instructions to
- // copy 32 elements a time.
- __ lxvd2x(tmp_vsr1, R3_ARG1); // Load src
- __ stxvd2x(tmp_vsr1, R4_ARG2); // Store to dst
- __ lxvd2x(tmp_vsr2, tmp1, R3_ARG1); // Load src + 16
- __ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst + 16
- __ addi(R3_ARG1, R3_ARG1, 32); // Update src+=32
- __ addi(R4_ARG2, R4_ARG2, 32); // Update dsc+=32
- __ bdnz(l_10); // Dec CTR and loop if not zero.
-
- // Restore DSCR pre-fetch value.
- if (VM_Version::has_mfdscr()) {
- __ load_const_optimized(tmp2, VM_Version::_dscr_val);
- __ mtdscr(tmp2);
+ __ bind(l_7);
+
+ { // FasterArrayCopy
+ __ cmpwi(CCR0, R5_ARG3, 31);
+ __ ble(CCR0, l_6); // copy 2 at a time if less than 32 elements remain
+
+ __ srdi(tmp1, R5_ARG3, 5);
+ __ andi_(R5_ARG3, R5_ARG3, 31);
+ __ mtctr(tmp1);
+
+ if (!VM_Version::has_vsx()) {
+
+ __ bind(l_8);
+ // Use unrolled version for mass copying (copy 32 elements a time)
+ // Load feeding store gets zero latency on Power6, however not on Power5.
+ // Therefore, the following sequence is made for the good of both.
+ __ ld(tmp1, 0, R3_ARG1);
+ __ ld(tmp2, 8, R3_ARG1);
+ __ ld(tmp3, 16, R3_ARG1);
+ __ ld(tmp4, 24, R3_ARG1);
+ __ std(tmp1, 0, R4_ARG2);
+ __ std(tmp2, 8, R4_ARG2);
+ __ std(tmp3, 16, R4_ARG2);
+ __ std(tmp4, 24, R4_ARG2);
+ __ addi(R3_ARG1, R3_ARG1, 32);
+ __ addi(R4_ARG2, R4_ARG2, 32);
+ __ bdnz(l_8);
+
+ } else { // Processor supports VSX, so use it to mass copy.
+
+ // Prefetch the data into the L2 cache.
+ __ dcbt(R3_ARG1, 0);
+
+ // If supported set DSCR pre-fetch to deepest.
+ if (VM_Version::has_mfdscr()) {
+ __ load_const_optimized(tmp2, VM_Version::_dscr_val | 7);
+ __ mtdscr(tmp2);
+ }
+
+ __ li(tmp1, 16);
+
+ // Backbranch target aligned to 32-byte. Not 16-byte align as
+ // loop contains < 8 instructions that fit inside a single
+ // i-cache sector.
+ __ align(32);
+
+ __ bind(l_10);
+ // Use loop with VSX load/store instructions to
+ // copy 32 elements a time.
+ __ lxvd2x(tmp_vsr1, R3_ARG1); // Load src
+ __ stxvd2x(tmp_vsr1, R4_ARG2); // Store to dst
+ __ lxvd2x(tmp_vsr2, tmp1, R3_ARG1); // Load src + 16
+ __ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst + 16
+ __ addi(R3_ARG1, R3_ARG1, 32); // Update src+=32
+ __ addi(R4_ARG2, R4_ARG2, 32); // Update dsc+=32
+ __ bdnz(l_10); // Dec CTR and loop if not zero.
+
+ // Restore DSCR pre-fetch value.
+ if (VM_Version::has_mfdscr()) {
+ __ load_const_optimized(tmp2, VM_Version::_dscr_val);
+ __ mtdscr(tmp2);
+ }
+
+ } // VSX
+ } // FasterArrayCopy
+
+ __ bind(l_6);
+
+ // copy 4 elements at a time
+ __ cmpwi(CCR0, R5_ARG3, 4);
+ __ blt(CCR0, l_1);
+ __ srdi(tmp1, R5_ARG3, 2);
+ __ mtctr(tmp1); // is > 0
+ __ andi_(R5_ARG3, R5_ARG3, 3);
+
+ { // FasterArrayCopy
+ __ addi(R3_ARG1, R3_ARG1, -4);
+ __ addi(R4_ARG2, R4_ARG2, -4);
+ __ bind(l_3);
+ __ lwzu(tmp2, 4, R3_ARG1);
+ __ stwu(tmp2, 4, R4_ARG2);
+ __ bdnz(l_3);
+ __ addi(R3_ARG1, R3_ARG1, 4);
+ __ addi(R4_ARG2, R4_ARG2, 4);
}
- } // VSX
- } // FasterArrayCopy
-
- __ bind(l_6);
-
- // copy 4 elements at a time
- __ cmpwi(CCR0, R5_ARG3, 4);
- __ blt(CCR0, l_1);
- __ srdi(tmp1, R5_ARG3, 2);
- __ mtctr(tmp1); // is > 0
- __ andi_(R5_ARG3, R5_ARG3, 3);
-
- { // FasterArrayCopy
- __ addi(R3_ARG1, R3_ARG1, -4);
- __ addi(R4_ARG2, R4_ARG2, -4);
- __ bind(l_3);
- __ lwzu(tmp2, 4, R3_ARG1);
- __ stwu(tmp2, 4, R4_ARG2);
- __ bdnz(l_3);
- __ addi(R3_ARG1, R3_ARG1, 4);
- __ addi(R4_ARG2, R4_ARG2, 4);
- }
-
- // do single element copy
- __ bind(l_1);
- __ cmpwi(CCR0, R5_ARG3, 0);
- __ beq(CCR0, l_4);
-
- { // FasterArrayCopy
- __ mtctr(R5_ARG3);
- __ addi(R3_ARG1, R3_ARG1, -1);
- __ addi(R4_ARG2, R4_ARG2, -1);
-
- __ bind(l_5);
- __ lbzu(tmp2, 1, R3_ARG1);
- __ stbu(tmp2, 1, R4_ARG2);
- __ bdnz(l_5);
+ // do single element copy
+ __ bind(l_1);
+ __ cmpwi(CCR0, R5_ARG3, 0);
+ __ beq(CCR0, l_4);
+
+ { // FasterArrayCopy
+ __ mtctr(R5_ARG3);
+ __ addi(R3_ARG1, R3_ARG1, -1);
+ __ addi(R4_ARG2, R4_ARG2, -1);
+
+ __ bind(l_5);
+ __ lbzu(tmp2, 1, R3_ARG1);
+ __ stbu(tmp2, 1, R4_ARG2);
+ __ bdnz(l_5);
+ }
}
__ bind(l_4);
@@ -1167,15 +1185,17 @@
// Do reverse copy. We assume the case of actual overlap is rare enough
// that we don't have to optimize it.
Label l_1, l_2;
-
- __ b(l_2);
- __ bind(l_1);
- __ stbx(tmp1, R4_ARG2, R5_ARG3);
- __ bind(l_2);
- __ addic_(R5_ARG3, R5_ARG3, -1);
- __ lbzx(tmp1, R3_ARG1, R5_ARG3);
- __ bge(CCR0, l_1);
-
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+ __ b(l_2);
+ __ bind(l_1);
+ __ stbx(tmp1, R4_ARG2, R5_ARG3);
+ __ bind(l_2);
+ __ addic_(R5_ARG3, R5_ARG3, -1);
+ __ lbzx(tmp1, R3_ARG1, R5_ARG3);
+ __ bge(CCR0, l_1);
+ }
__ li(R3_RET, 0); // return 0
__ blr();
@@ -1252,155 +1272,159 @@
assert_positive_int(R5_ARG3);
Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9;
-
- // don't try anything fancy if arrays don't have many elements
- __ li(tmp3, 0);
- __ cmpwi(CCR0, R5_ARG3, 9);
- __ ble(CCR0, l_6); // copy 2 at a time
-
- if (!aligned) {
- __ xorr(tmp1, R3_ARG1, R4_ARG2);
- __ andi_(tmp1, tmp1, 3);
- __ bne(CCR0, l_6); // if arrays don't have the same alignment mod 4, do 2 element copy
-
- // At this point it is guaranteed that both, from and to have the same alignment mod 4.
-
- // Copy 1 element if necessary to align to 4 bytes.
- __ andi_(tmp1, R3_ARG1, 3);
- __ beq(CCR0, l_2);
-
- __ lhz(tmp2, 0, R3_ARG1);
- __ addi(R3_ARG1, R3_ARG1, 2);
- __ sth(tmp2, 0, R4_ARG2);
- __ addi(R4_ARG2, R4_ARG2, 2);
- __ addi(R5_ARG3, R5_ARG3, -1);
- __ bind(l_2);
-
- // At this point the positions of both, from and to, are at least 4 byte aligned.
-
- // Copy 4 elements at a time.
- // Align to 8 bytes, but only if both, from and to, have same alignment mod 8.
- __ xorr(tmp2, R3_ARG1, R4_ARG2);
- __ andi_(tmp1, tmp2, 7);
- __ bne(CCR0, l_7); // not same alignment mod 8 -> copy 4, either from or to will be unaligned
-
- // Copy a 2-element word if necessary to align to 8 bytes.
- __ andi_(R0, R3_ARG1, 7);
- __ beq(CCR0, l_7);
-
- __ lwzx(tmp2, R3_ARG1, tmp3);
- __ addi(R5_ARG3, R5_ARG3, -2);
- __ stwx(tmp2, R4_ARG2, tmp3);
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+ // don't try anything fancy if arrays don't have many elements
+ __ li(tmp3, 0);
+ __ cmpwi(CCR0, R5_ARG3, 9);
+ __ ble(CCR0, l_6); // copy 2 at a time
+
+ if (!aligned) {
+ __ xorr(tmp1, R3_ARG1, R4_ARG2);
+ __ andi_(tmp1, tmp1, 3);
+ __ bne(CCR0, l_6); // if arrays don't have the same alignment mod 4, do 2 element copy
+
+ // At this point it is guaranteed that both, from and to have the same alignment mod 4.
+
+ // Copy 1 element if necessary to align to 4 bytes.
+ __ andi_(tmp1, R3_ARG1, 3);
+ __ beq(CCR0, l_2);
+
+ __ lhz(tmp2, 0, R3_ARG1);
+ __ addi(R3_ARG1, R3_ARG1, 2);
+ __ sth(tmp2, 0, R4_ARG2);
+ __ addi(R4_ARG2, R4_ARG2, 2);
+ __ addi(R5_ARG3, R5_ARG3, -1);
+ __ bind(l_2);
+
+ // At this point the positions of both, from and to, are at least 4 byte aligned.
+
+ // Copy 4 elements at a time.
+ // Align to 8 bytes, but only if both, from and to, have same alignment mod 8.
+ __ xorr(tmp2, R3_ARG1, R4_ARG2);
+ __ andi_(tmp1, tmp2, 7);
+ __ bne(CCR0, l_7); // not same alignment mod 8 -> copy 4, either from or to will be unaligned
+
+ // Copy a 2-element word if necessary to align to 8 bytes.
+ __ andi_(R0, R3_ARG1, 7);
+ __ beq(CCR0, l_7);
+
+ __ lwzx(tmp2, R3_ARG1, tmp3);
+ __ addi(R5_ARG3, R5_ARG3, -2);
+ __ stwx(tmp2, R4_ARG2, tmp3);
+ { // FasterArrayCopy
+ __ addi(R3_ARG1, R3_ARG1, 4);
+ __ addi(R4_ARG2, R4_ARG2, 4);
+ }
+ }
+
+ __ bind(l_7);
+
+ // Copy 4 elements at a time; either the loads or the stores can
+ // be unaligned if aligned == false.
+
{ // FasterArrayCopy
+ __ cmpwi(CCR0, R5_ARG3, 15);
+ __ ble(CCR0, l_6); // copy 2 at a time if less than 16 elements remain
+
+ __ srdi(tmp1, R5_ARG3, 4);
+ __ andi_(R5_ARG3, R5_ARG3, 15);
+ __ mtctr(tmp1);
+
+ if (!VM_Version::has_vsx()) {
+
+ __ bind(l_8);
+ // Use unrolled version for mass copying (copy 16 elements a time).
+ // Load feeding store gets zero latency on Power6, however not on Power5.
+ // Therefore, the following sequence is made for the good of both.
+ __ ld(tmp1, 0, R3_ARG1);
+ __ ld(tmp2, 8, R3_ARG1);
+ __ ld(tmp3, 16, R3_ARG1);
+ __ ld(tmp4, 24, R3_ARG1);
+ __ std(tmp1, 0, R4_ARG2);
+ __ std(tmp2, 8, R4_ARG2);
+ __ std(tmp3, 16, R4_ARG2);
+ __ std(tmp4, 24, R4_ARG2);
+ __ addi(R3_ARG1, R3_ARG1, 32);
+ __ addi(R4_ARG2, R4_ARG2, 32);
+ __ bdnz(l_8);
+
+ } else { // Processor supports VSX, so use it to mass copy.
+
+ // Prefetch src data into L2 cache.
+ __ dcbt(R3_ARG1, 0);
+
+ // If supported set DSCR pre-fetch to deepest.
+ if (VM_Version::has_mfdscr()) {
+ __ load_const_optimized(tmp2, VM_Version::_dscr_val | 7);
+ __ mtdscr(tmp2);
+ }
+ __ li(tmp1, 16);
+
+ // Backbranch target aligned to 32-byte. It's not aligned 16-byte
+ // as loop contains < 8 instructions that fit inside a single
+ // i-cache sector.
+ __ align(32);
+
+ __ bind(l_9);
+ // Use loop with VSX load/store instructions to
+ // copy 16 elements a time.
+ __ lxvd2x(tmp_vsr1, R3_ARG1); // Load from src.
+ __ stxvd2x(tmp_vsr1, R4_ARG2); // Store to dst.
+ __ lxvd2x(tmp_vsr2, R3_ARG1, tmp1); // Load from src + 16.
+ __ stxvd2x(tmp_vsr2, R4_ARG2, tmp1); // Store to dst + 16.
+ __ addi(R3_ARG1, R3_ARG1, 32); // Update src+=32.
+ __ addi(R4_ARG2, R4_ARG2, 32); // Update dsc+=32.
+ __ bdnz(l_9); // Dec CTR and loop if not zero.
+
+ // Restore DSCR pre-fetch value.
+ if (VM_Version::has_mfdscr()) {
+ __ load_const_optimized(tmp2, VM_Version::_dscr_val);
+ __ mtdscr(tmp2);
+ }
+
+ }
+ } // FasterArrayCopy
+ __ bind(l_6);
+
+ // copy 2 elements at a time
+ { // FasterArrayCopy
+ __ cmpwi(CCR0, R5_ARG3, 2);
+ __ blt(CCR0, l_1);
+ __ srdi(tmp1, R5_ARG3, 1);
+ __ andi_(R5_ARG3, R5_ARG3, 1);
+
+ __ addi(R3_ARG1, R3_ARG1, -4);
+ __ addi(R4_ARG2, R4_ARG2, -4);
+ __ mtctr(tmp1);
+
+ __ bind(l_3);
+ __ lwzu(tmp2, 4, R3_ARG1);
+ __ stwu(tmp2, 4, R4_ARG2);
+ __ bdnz(l_3);
+
__ addi(R3_ARG1, R3_ARG1, 4);
__ addi(R4_ARG2, R4_ARG2, 4);
}
+
+ // do single element copy
+ __ bind(l_1);
+ __ cmpwi(CCR0, R5_ARG3, 0);
+ __ beq(CCR0, l_4);
+
+ { // FasterArrayCopy
+ __ mtctr(R5_ARG3);
+ __ addi(R3_ARG1, R3_ARG1, -2);
+ __ addi(R4_ARG2, R4_ARG2, -2);
+
+ __ bind(l_5);
+ __ lhzu(tmp2, 2, R3_ARG1);
+ __ sthu(tmp2, 2, R4_ARG2);
+ __ bdnz(l_5);
+ }
}
- __ bind(l_7);
-
- // Copy 4 elements at a time; either the loads or the stores can
- // be unaligned if aligned == false.
-
- { // FasterArrayCopy
- __ cmpwi(CCR0, R5_ARG3, 15);
- __ ble(CCR0, l_6); // copy 2 at a time if less than 16 elements remain
-
- __ srdi(tmp1, R5_ARG3, 4);
- __ andi_(R5_ARG3, R5_ARG3, 15);
- __ mtctr(tmp1);
-
- if (!VM_Version::has_vsx()) {
-
- __ bind(l_8);
- // Use unrolled version for mass copying (copy 16 elements a time).
- // Load feeding store gets zero latency on Power6, however not on Power5.
- // Therefore, the following sequence is made for the good of both.
- __ ld(tmp1, 0, R3_ARG1);
- __ ld(tmp2, 8, R3_ARG1);
- __ ld(tmp3, 16, R3_ARG1);
- __ ld(tmp4, 24, R3_ARG1);
- __ std(tmp1, 0, R4_ARG2);
- __ std(tmp2, 8, R4_ARG2);
- __ std(tmp3, 16, R4_ARG2);
- __ std(tmp4, 24, R4_ARG2);
- __ addi(R3_ARG1, R3_ARG1, 32);
- __ addi(R4_ARG2, R4_ARG2, 32);
- __ bdnz(l_8);
-
- } else { // Processor supports VSX, so use it to mass copy.
-
- // Prefetch src data into L2 cache.
- __ dcbt(R3_ARG1, 0);
-
- // If supported set DSCR pre-fetch to deepest.
- if (VM_Version::has_mfdscr()) {
- __ load_const_optimized(tmp2, VM_Version::_dscr_val | 7);
- __ mtdscr(tmp2);
- }
- __ li(tmp1, 16);
-
- // Backbranch target aligned to 32-byte. It's not aligned 16-byte
- // as loop contains < 8 instructions that fit inside a single
- // i-cache sector.
- __ align(32);
-
- __ bind(l_9);
- // Use loop with VSX load/store instructions to
- // copy 16 elements a time.
- __ lxvd2x(tmp_vsr1, R3_ARG1); // Load from src.
- __ stxvd2x(tmp_vsr1, R4_ARG2); // Store to dst.
- __ lxvd2x(tmp_vsr2, R3_ARG1, tmp1); // Load from src + 16.
- __ stxvd2x(tmp_vsr2, R4_ARG2, tmp1); // Store to dst + 16.
- __ addi(R3_ARG1, R3_ARG1, 32); // Update src+=32.
- __ addi(R4_ARG2, R4_ARG2, 32); // Update dsc+=32.
- __ bdnz(l_9); // Dec CTR and loop if not zero.
-
- // Restore DSCR pre-fetch value.
- if (VM_Version::has_mfdscr()) {
- __ load_const_optimized(tmp2, VM_Version::_dscr_val);
- __ mtdscr(tmp2);
- }
-
- }
- } // FasterArrayCopy
- __ bind(l_6);
-
- // copy 2 elements at a time
- { // FasterArrayCopy
- __ cmpwi(CCR0, R5_ARG3, 2);
- __ blt(CCR0, l_1);
- __ srdi(tmp1, R5_ARG3, 1);
- __ andi_(R5_ARG3, R5_ARG3, 1);
-
- __ addi(R3_ARG1, R3_ARG1, -4);
- __ addi(R4_ARG2, R4_ARG2, -4);
- __ mtctr(tmp1);
-
- __ bind(l_3);
- __ lwzu(tmp2, 4, R3_ARG1);
- __ stwu(tmp2, 4, R4_ARG2);
- __ bdnz(l_3);
-
- __ addi(R3_ARG1, R3_ARG1, 4);
- __ addi(R4_ARG2, R4_ARG2, 4);
- }
-
- // do single element copy
- __ bind(l_1);
- __ cmpwi(CCR0, R5_ARG3, 0);
- __ beq(CCR0, l_4);
-
- { // FasterArrayCopy
- __ mtctr(R5_ARG3);
- __ addi(R3_ARG1, R3_ARG1, -2);
- __ addi(R4_ARG2, R4_ARG2, -2);
-
- __ bind(l_5);
- __ lhzu(tmp2, 2, R3_ARG1);
- __ sthu(tmp2, 2, R4_ARG2);
- __ bdnz(l_5);
- }
__ bind(l_4);
__ li(R3_RET, 0); // return 0
__ blr();
@@ -1432,15 +1456,18 @@
array_overlap_test(nooverlap_target, 1);
Label l_1, l_2;
- __ sldi(tmp1, R5_ARG3, 1);
- __ b(l_2);
- __ bind(l_1);
- __ sthx(tmp2, R4_ARG2, tmp1);
- __ bind(l_2);
- __ addic_(tmp1, tmp1, -2);
- __ lhzx(tmp2, R3_ARG1, tmp1);
- __ bge(CCR0, l_1);
-
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+ __ sldi(tmp1, R5_ARG3, 1);
+ __ b(l_2);
+ __ bind(l_1);
+ __ sthx(tmp2, R4_ARG2, tmp1);
+ __ bind(l_2);
+ __ addic_(tmp1, tmp1, -2);
+ __ lhzx(tmp2, R3_ARG1, tmp1);
+ __ bge(CCR0, l_1);
+ }
__ li(R3_RET, 0); // return 0
__ blr();
@@ -1588,7 +1615,11 @@
StubCodeMark mark(this, "StubRoutines", name);
address start = __ function_entry();
assert_positive_int(R5_ARG3);
- generate_disjoint_int_copy_core(aligned);
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+ generate_disjoint_int_copy_core(aligned);
+ }
__ li(R3_RET, 0); // return 0
__ blr();
return start;
@@ -1736,8 +1767,11 @@
STUB_ENTRY(jint_disjoint_arraycopy);
array_overlap_test(nooverlap_target, 2);
-
- generate_conjoint_int_copy_core(aligned);
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+ generate_conjoint_int_copy_core(aligned);
+ }
__ li(R3_RET, 0); // return 0
__ blr();
@@ -1859,11 +1893,15 @@
StubCodeMark mark(this, "StubRoutines", name);
address start = __ function_entry();
assert_positive_int(R5_ARG3);
- generate_disjoint_long_copy_core(aligned);
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+ generate_disjoint_long_copy_core(aligned);
+ }
__ li(R3_RET, 0); // return 0
__ blr();
- return start;
+ return start;
}
// Generate core code for conjoint long copy (and oop copy on
@@ -1986,8 +2024,11 @@
STUB_ENTRY(jlong_disjoint_arraycopy);
array_overlap_test(nooverlap_target, 3);
- generate_conjoint_long_copy_core(aligned);
-
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+ generate_conjoint_long_copy_core(aligned);
+ }
__ li(R3_RET, 0); // return 0
__ blr();
@@ -3008,6 +3049,9 @@
// Note: the disjoint stubs must be generated first, some of
// the conjoint stubs use them.
+ address ucm_common_error_exit = generate_unsafecopy_common_error_exit();
+ UnsafeCopyMemory::set_common_exit_stub_pc(ucm_common_error_exit);
+
// non-aligned disjoint versions
StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, "jbyte_disjoint_arraycopy");
StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, "jshort_disjoint_arraycopy");
@@ -3579,6 +3623,10 @@
}
};
+#define UCM_TABLE_MAX_ENTRIES 8
void StubGenerator_generate(CodeBuffer* code, bool all) {
+ if (UnsafeCopyMemory::_table == NULL) {
+ UnsafeCopyMemory::create_table(UCM_TABLE_MAX_ENTRIES);
+ }
StubGenerator g(code, all);
}
--- a/src/hotspot/cpu/sparc/stubGenerator_sparc.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/cpu/sparc/stubGenerator_sparc.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1076,6 +1076,17 @@
__ delayed()->add(end_from, left_shift, end_from); // restore address
}
+ address generate_unsafecopy_common_error_exit() {
+ address start_pc = __ pc();
+ if (UseBlockCopy) {
+ __ wrasi(G0, Assembler::ASI_PRIMARY_NOFAULT);
+ __ membar(Assembler::StoreLoad);
+ }
+ __ retl();
+ __ delayed()->mov(G0, O0); // return 0
+ return start_pc;
+ }
+
//
// Generate stub for disjoint byte copy. If "aligned" is true, the
// "from" and "to" addresses are assumed to be heapword aligned.
@@ -1107,61 +1118,66 @@
BLOCK_COMMENT("Entry:");
}
- // for short arrays, just do single element copy
- __ cmp(count, 23); // 16 + 7
- __ brx(Assembler::less, false, Assembler::pn, L_copy_byte);
- __ delayed()->mov(G0, offset);
-
- if (aligned) {
- // 'aligned' == true when it is known statically during compilation
- // of this arraycopy call site that both 'from' and 'to' addresses
- // are HeapWordSize aligned (see LibraryCallKit::basictype2arraycopy()).
- //
- // Aligned arrays have 4 bytes alignment in 32-bits VM
- // and 8 bytes - in 64-bits VM. So we do it only for 32-bits VM
- //
- } else {
- // copy bytes to align 'to' on 8 byte boundary
- __ andcc(to, 7, G1); // misaligned bytes
- __ br(Assembler::zero, false, Assembler::pt, L_skip_alignment);
- __ delayed()->neg(G1);
- __ inc(G1, 8); // bytes need to copy to next 8-bytes alignment
- __ sub(count, G1, count);
- __ BIND(L_align);
- __ ldub(from, 0, O3);
- __ deccc(G1);
- __ inc(from);
- __ stb(O3, to, 0);
- __ br(Assembler::notZero, false, Assembler::pt, L_align);
- __ delayed()->inc(to);
- __ BIND(L_skip_alignment);
- }
- if (!aligned) {
- // Copy with shift 16 bytes per iteration if arrays do not have
- // the same alignment mod 8, otherwise fall through to the next
- // code for aligned copy.
- // The compare above (count >= 23) guarantes 'count' >= 16 bytes.
- // Also jump over aligned copy after the copy with shift completed.
-
- copy_16_bytes_forward_with_shift(from, to, count, 0, L_copy_byte);
- }
-
- // Both array are 8 bytes aligned, copy 16 bytes at a time
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+
+ // for short arrays, just do single element copy
+ __ cmp(count, 23); // 16 + 7
+ __ brx(Assembler::less, false, Assembler::pn, L_copy_byte);
+ __ delayed()->mov(G0, offset);
+
+ if (aligned) {
+ // 'aligned' == true when it is known statically during compilation
+ // of this arraycopy call site that both 'from' and 'to' addresses
+ // are HeapWordSize aligned (see LibraryCallKit::basictype2arraycopy()).
+ //
+ // Aligned arrays have 4 bytes alignment in 32-bits VM
+ // and 8 bytes - in 64-bits VM. So we do it only for 32-bits VM
+ //
+ } else {
+ // copy bytes to align 'to' on 8 byte boundary
+ __ andcc(to, 7, G1); // misaligned bytes
+ __ br(Assembler::zero, false, Assembler::pt, L_skip_alignment);
+ __ delayed()->neg(G1);
+ __ inc(G1, 8); // bytes need to copy to next 8-bytes alignment
+ __ sub(count, G1, count);
+ __ BIND(L_align);
+ __ ldub(from, 0, O3);
+ __ deccc(G1);
+ __ inc(from);
+ __ stb(O3, to, 0);
+ __ br(Assembler::notZero, false, Assembler::pt, L_align);
+ __ delayed()->inc(to);
+ __ BIND(L_skip_alignment);
+ }
+ if (!aligned) {
+ // Copy with shift 16 bytes per iteration if arrays do not have
+ // the same alignment mod 8, otherwise fall through to the next
+ // code for aligned copy.
+ // The compare above (count >= 23) guarantes 'count' >= 16 bytes.
+ // Also jump over aligned copy after the copy with shift completed.
+
+ copy_16_bytes_forward_with_shift(from, to, count, 0, L_copy_byte);
+ }
+
+ // Both array are 8 bytes aligned, copy 16 bytes at a time
__ and3(count, 7, G4); // Save count
__ srl(count, 3, count);
- generate_disjoint_long_copy_core(aligned);
+ generate_disjoint_long_copy_core(aligned);
__ mov(G4, count); // Restore count
- // copy tailing bytes
- __ BIND(L_copy_byte);
- __ cmp_and_br_short(count, 0, Assembler::equal, Assembler::pt, L_exit);
- __ align(OptoLoopAlignment);
- __ BIND(L_copy_byte_loop);
- __ ldub(from, offset, O3);
- __ deccc(count);
- __ stb(O3, to, offset);
- __ brx(Assembler::notZero, false, Assembler::pt, L_copy_byte_loop);
- __ delayed()->inc(offset);
+ // copy tailing bytes
+ __ BIND(L_copy_byte);
+ __ cmp_and_br_short(count, 0, Assembler::equal, Assembler::pt, L_exit);
+ __ align(OptoLoopAlignment);
+ __ BIND(L_copy_byte_loop);
+ __ ldub(from, offset, O3);
+ __ deccc(count);
+ __ stb(O3, to, offset);
+ __ brx(Assembler::notZero, false, Assembler::pt, L_copy_byte_loop);
+ __ delayed()->inc(offset);
+ }
__ BIND(L_exit);
// O3, O4 are used as temp registers
@@ -1207,70 +1223,75 @@
array_overlap_test(nooverlap_target, 0);
- __ add(to, count, end_to); // offset after last copied element
-
- // for short arrays, just do single element copy
- __ cmp(count, 23); // 16 + 7
- __ brx(Assembler::less, false, Assembler::pn, L_copy_byte);
- __ delayed()->add(from, count, end_from);
-
{
- // Align end of arrays since they could be not aligned even
- // when arrays itself are aligned.
-
- // copy bytes to align 'end_to' on 8 byte boundary
- __ andcc(end_to, 7, G1); // misaligned bytes
- __ br(Assembler::zero, false, Assembler::pt, L_skip_alignment);
- __ delayed()->nop();
- __ sub(count, G1, count);
- __ BIND(L_align);
- __ dec(end_from);
- __ dec(end_to);
- __ ldub(end_from, 0, O3);
- __ deccc(G1);
- __ brx(Assembler::notZero, false, Assembler::pt, L_align);
- __ delayed()->stb(O3, end_to, 0);
- __ BIND(L_skip_alignment);
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+
+ __ add(to, count, end_to); // offset after last copied element
+
+ // for short arrays, just do single element copy
+ __ cmp(count, 23); // 16 + 7
+ __ brx(Assembler::less, false, Assembler::pn, L_copy_byte);
+ __ delayed()->add(from, count, end_from);
+
+ {
+ // Align end of arrays since they could be not aligned even
+ // when arrays itself are aligned.
+
+ // copy bytes to align 'end_to' on 8 byte boundary
+ __ andcc(end_to, 7, G1); // misaligned bytes
+ __ br(Assembler::zero, false, Assembler::pt, L_skip_alignment);
+ __ delayed()->nop();
+ __ sub(count, G1, count);
+ __ BIND(L_align);
+ __ dec(end_from);
+ __ dec(end_to);
+ __ ldub(end_from, 0, O3);
+ __ deccc(G1);
+ __ brx(Assembler::notZero, false, Assembler::pt, L_align);
+ __ delayed()->stb(O3, end_to, 0);
+ __ BIND(L_skip_alignment);
+ }
+ if (aligned) {
+ // Both arrays are aligned to 8-bytes in 64-bits VM.
+ // The 'count' is decremented in copy_16_bytes_backward_with_shift()
+ // in unaligned case.
+ __ dec(count, 16);
+ } else {
+ // Copy with shift 16 bytes per iteration if arrays do not have
+ // the same alignment mod 8, otherwise jump to the next
+ // code for aligned copy (and substracting 16 from 'count' before jump).
+ // The compare above (count >= 11) guarantes 'count' >= 16 bytes.
+ // Also jump over aligned copy after the copy with shift completed.
+
+ copy_16_bytes_backward_with_shift(end_from, end_to, count, 16,
+ L_aligned_copy, L_copy_byte);
+ }
+ // copy 4 elements (16 bytes) at a time
+ __ align(OptoLoopAlignment);
+ __ BIND(L_aligned_copy);
+ __ dec(end_from, 16);
+ __ ldx(end_from, 8, O3);
+ __ ldx(end_from, 0, O4);
+ __ dec(end_to, 16);
+ __ deccc(count, 16);
+ __ stx(O3, end_to, 8);
+ __ brx(Assembler::greaterEqual, false, Assembler::pt, L_aligned_copy);
+ __ delayed()->stx(O4, end_to, 0);
+ __ inc(count, 16);
+
+ // copy 1 element (2 bytes) at a time
+ __ BIND(L_copy_byte);
+ __ cmp_and_br_short(count, 0, Assembler::equal, Assembler::pt, L_exit);
+ __ align(OptoLoopAlignment);
+ __ BIND(L_copy_byte_loop);
+ __ dec(end_from);
+ __ dec(end_to);
+ __ ldub(end_from, 0, O4);
+ __ deccc(count);
+ __ brx(Assembler::greater, false, Assembler::pt, L_copy_byte_loop);
+ __ delayed()->stb(O4, end_to, 0);
}
- if (aligned) {
- // Both arrays are aligned to 8-bytes in 64-bits VM.
- // The 'count' is decremented in copy_16_bytes_backward_with_shift()
- // in unaligned case.
- __ dec(count, 16);
- } else {
- // Copy with shift 16 bytes per iteration if arrays do not have
- // the same alignment mod 8, otherwise jump to the next
- // code for aligned copy (and substracting 16 from 'count' before jump).
- // The compare above (count >= 11) guarantes 'count' >= 16 bytes.
- // Also jump over aligned copy after the copy with shift completed.
-
- copy_16_bytes_backward_with_shift(end_from, end_to, count, 16,
- L_aligned_copy, L_copy_byte);
- }
- // copy 4 elements (16 bytes) at a time
- __ align(OptoLoopAlignment);
- __ BIND(L_aligned_copy);
- __ dec(end_from, 16);
- __ ldx(end_from, 8, O3);
- __ ldx(end_from, 0, O4);
- __ dec(end_to, 16);
- __ deccc(count, 16);
- __ stx(O3, end_to, 8);
- __ brx(Assembler::greaterEqual, false, Assembler::pt, L_aligned_copy);
- __ delayed()->stx(O4, end_to, 0);
- __ inc(count, 16);
-
- // copy 1 element (2 bytes) at a time
- __ BIND(L_copy_byte);
- __ cmp_and_br_short(count, 0, Assembler::equal, Assembler::pt, L_exit);
- __ align(OptoLoopAlignment);
- __ BIND(L_copy_byte_loop);
- __ dec(end_from);
- __ dec(end_to);
- __ ldub(end_from, 0, O4);
- __ deccc(count);
- __ brx(Assembler::greater, false, Assembler::pt, L_copy_byte_loop);
- __ delayed()->stb(O4, end_to, 0);
__ BIND(L_exit);
// O3, O4 are used as temp registers
@@ -1311,68 +1332,72 @@
BLOCK_COMMENT("Entry:");
}
- // for short arrays, just do single element copy
- __ cmp(count, 11); // 8 + 3 (22 bytes)
- __ brx(Assembler::less, false, Assembler::pn, L_copy_2_bytes);
- __ delayed()->mov(G0, offset);
-
- if (aligned) {
- // 'aligned' == true when it is known statically during compilation
- // of this arraycopy call site that both 'from' and 'to' addresses
- // are HeapWordSize aligned (see LibraryCallKit::basictype2arraycopy()).
- //
- // Aligned arrays have 4 bytes alignment in 32-bits VM
- // and 8 bytes - in 64-bits VM.
- //
- } else {
- // copy 1 element if necessary to align 'to' on an 4 bytes
- __ andcc(to, 3, G0);
- __ br(Assembler::zero, false, Assembler::pt, L_skip_alignment);
- __ delayed()->lduh(from, 0, O3);
- __ inc(from, 2);
- __ inc(to, 2);
- __ dec(count);
- __ sth(O3, to, -2);
- __ BIND(L_skip_alignment);
-
- // copy 2 elements to align 'to' on an 8 byte boundary
- __ andcc(to, 7, G0);
- __ br(Assembler::zero, false, Assembler::pn, L_skip_alignment2);
- __ delayed()->lduh(from, 0, O3);
- __ dec(count, 2);
- __ lduh(from, 2, O4);
- __ inc(from, 4);
- __ inc(to, 4);
- __ sth(O3, to, -4);
- __ sth(O4, to, -2);
- __ BIND(L_skip_alignment2);
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+ // for short arrays, just do single element copy
+ __ cmp(count, 11); // 8 + 3 (22 bytes)
+ __ brx(Assembler::less, false, Assembler::pn, L_copy_2_bytes);
+ __ delayed()->mov(G0, offset);
+
+ if (aligned) {
+ // 'aligned' == true when it is known statically during compilation
+ // of this arraycopy call site that both 'from' and 'to' addresses
+ // are HeapWordSize aligned (see LibraryCallKit::basictype2arraycopy()).
+ //
+ // Aligned arrays have 4 bytes alignment in 32-bits VM
+ // and 8 bytes - in 64-bits VM.
+ //
+ } else {
+ // copy 1 element if necessary to align 'to' on an 4 bytes
+ __ andcc(to, 3, G0);
+ __ br(Assembler::zero, false, Assembler::pt, L_skip_alignment);
+ __ delayed()->lduh(from, 0, O3);
+ __ inc(from, 2);
+ __ inc(to, 2);
+ __ dec(count);
+ __ sth(O3, to, -2);
+ __ BIND(L_skip_alignment);
+
+ // copy 2 elements to align 'to' on an 8 byte boundary
+ __ andcc(to, 7, G0);
+ __ br(Assembler::zero, false, Assembler::pn, L_skip_alignment2);
+ __ delayed()->lduh(from, 0, O3);
+ __ dec(count, 2);
+ __ lduh(from, 2, O4);
+ __ inc(from, 4);
+ __ inc(to, 4);
+ __ sth(O3, to, -4);
+ __ sth(O4, to, -2);
+ __ BIND(L_skip_alignment2);
+ }
+ if (!aligned) {
+ // Copy with shift 16 bytes per iteration if arrays do not have
+ // the same alignment mod 8, otherwise fall through to the next
+ // code for aligned copy.
+ // The compare above (count >= 11) guarantes 'count' >= 16 bytes.
+ // Also jump over aligned copy after the copy with shift completed.
+
+ copy_16_bytes_forward_with_shift(from, to, count, 1, L_copy_2_bytes);
+ }
+
+ // Both array are 8 bytes aligned, copy 16 bytes at a time
+ __ and3(count, 3, G4); // Save
+ __ srl(count, 2, count);
+ generate_disjoint_long_copy_core(aligned);
+ __ mov(G4, count); // restore
+
+ // copy 1 element at a time
+ __ BIND(L_copy_2_bytes);
+ __ cmp_and_br_short(count, 0, Assembler::equal, Assembler::pt, L_exit);
+ __ align(OptoLoopAlignment);
+ __ BIND(L_copy_2_bytes_loop);
+ __ lduh(from, offset, O3);
+ __ deccc(count);
+ __ sth(O3, to, offset);
+ __ brx(Assembler::notZero, false, Assembler::pt, L_copy_2_bytes_loop);
+ __ delayed()->inc(offset, 2);
}
- if (!aligned) {
- // Copy with shift 16 bytes per iteration if arrays do not have
- // the same alignment mod 8, otherwise fall through to the next
- // code for aligned copy.
- // The compare above (count >= 11) guarantes 'count' >= 16 bytes.
- // Also jump over aligned copy after the copy with shift completed.
-
- copy_16_bytes_forward_with_shift(from, to, count, 1, L_copy_2_bytes);
- }
-
- // Both array are 8 bytes aligned, copy 16 bytes at a time
- __ and3(count, 3, G4); // Save
- __ srl(count, 2, count);
- generate_disjoint_long_copy_core(aligned);
- __ mov(G4, count); // restore
-
- // copy 1 element at a time
- __ BIND(L_copy_2_bytes);
- __ cmp_and_br_short(count, 0, Assembler::equal, Assembler::pt, L_exit);
- __ align(OptoLoopAlignment);
- __ BIND(L_copy_2_bytes_loop);
- __ lduh(from, offset, O3);
- __ deccc(count);
- __ sth(O3, to, offset);
- __ brx(Assembler::notZero, false, Assembler::pt, L_copy_2_bytes_loop);
- __ delayed()->inc(offset, 2);
__ BIND(L_exit);
// O3, O4 are used as temp registers
@@ -1639,79 +1664,83 @@
array_overlap_test(nooverlap_target, 1);
- __ sllx(count, LogBytesPerShort, byte_count);
- __ add(to, byte_count, end_to); // offset after last copied element
-
- // for short arrays, just do single element copy
- __ cmp(count, 11); // 8 + 3 (22 bytes)
- __ brx(Assembler::less, false, Assembler::pn, L_copy_2_bytes);
- __ delayed()->add(from, byte_count, end_from);
-
{
- // Align end of arrays since they could be not aligned even
- // when arrays itself are aligned.
-
- // copy 1 element if necessary to align 'end_to' on an 4 bytes
- __ andcc(end_to, 3, G0);
- __ br(Assembler::zero, false, Assembler::pt, L_skip_alignment);
- __ delayed()->lduh(end_from, -2, O3);
- __ dec(end_from, 2);
- __ dec(end_to, 2);
- __ dec(count);
- __ sth(O3, end_to, 0);
- __ BIND(L_skip_alignment);
-
- // copy 2 elements to align 'end_to' on an 8 byte boundary
- __ andcc(end_to, 7, G0);
- __ br(Assembler::zero, false, Assembler::pn, L_skip_alignment2);
- __ delayed()->lduh(end_from, -2, O3);
- __ dec(count, 2);
- __ lduh(end_from, -4, O4);
- __ dec(end_from, 4);
- __ dec(end_to, 4);
- __ sth(O3, end_to, 2);
- __ sth(O4, end_to, 0);
- __ BIND(L_skip_alignment2);
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+
+ __ sllx(count, LogBytesPerShort, byte_count);
+ __ add(to, byte_count, end_to); // offset after last copied element
+
+ // for short arrays, just do single element copy
+ __ cmp(count, 11); // 8 + 3 (22 bytes)
+ __ brx(Assembler::less, false, Assembler::pn, L_copy_2_bytes);
+ __ delayed()->add(from, byte_count, end_from);
+
+ {
+ // Align end of arrays since they could be not aligned even
+ // when arrays itself are aligned.
+
+ // copy 1 element if necessary to align 'end_to' on an 4 bytes
+ __ andcc(end_to, 3, G0);
+ __ br(Assembler::zero, false, Assembler::pt, L_skip_alignment);
+ __ delayed()->lduh(end_from, -2, O3);
+ __ dec(end_from, 2);
+ __ dec(end_to, 2);
+ __ dec(count);
+ __ sth(O3, end_to, 0);
+ __ BIND(L_skip_alignment);
+
+ // copy 2 elements to align 'end_to' on an 8 byte boundary
+ __ andcc(end_to, 7, G0);
+ __ br(Assembler::zero, false, Assembler::pn, L_skip_alignment2);
+ __ delayed()->lduh(end_from, -2, O3);
+ __ dec(count, 2);
+ __ lduh(end_from, -4, O4);
+ __ dec(end_from, 4);
+ __ dec(end_to, 4);
+ __ sth(O3, end_to, 2);
+ __ sth(O4, end_to, 0);
+ __ BIND(L_skip_alignment2);
+ }
+ if (aligned) {
+ // Both arrays are aligned to 8-bytes in 64-bits VM.
+ // The 'count' is decremented in copy_16_bytes_backward_with_shift()
+ // in unaligned case.
+ __ dec(count, 8);
+ } else {
+ // Copy with shift 16 bytes per iteration if arrays do not have
+ // the same alignment mod 8, otherwise jump to the next
+ // code for aligned copy (and substracting 8 from 'count' before jump).
+ // The compare above (count >= 11) guarantes 'count' >= 16 bytes.
+ // Also jump over aligned copy after the copy with shift completed.
+
+ copy_16_bytes_backward_with_shift(end_from, end_to, count, 8,
+ L_aligned_copy, L_copy_2_bytes);
+ }
+ // copy 4 elements (16 bytes) at a time
+ __ align(OptoLoopAlignment);
+ __ BIND(L_aligned_copy);
+ __ dec(end_from, 16);
+ __ ldx(end_from, 8, O3);
+ __ ldx(end_from, 0, O4);
+ __ dec(end_to, 16);
+ __ deccc(count, 8);
+ __ stx(O3, end_to, 8);
+ __ brx(Assembler::greaterEqual, false, Assembler::pt, L_aligned_copy);
+ __ delayed()->stx(O4, end_to, 0);
+ __ inc(count, 8);
+
+ // copy 1 element (2 bytes) at a time
+ __ BIND(L_copy_2_bytes);
+ __ cmp_and_br_short(count, 0, Assembler::equal, Assembler::pt, L_exit);
+ __ BIND(L_copy_2_bytes_loop);
+ __ dec(end_from, 2);
+ __ dec(end_to, 2);
+ __ lduh(end_from, 0, O4);
+ __ deccc(count);
+ __ brx(Assembler::greater, false, Assembler::pt, L_copy_2_bytes_loop);
+ __ delayed()->sth(O4, end_to, 0);
}
- if (aligned) {
- // Both arrays are aligned to 8-bytes in 64-bits VM.
- // The 'count' is decremented in copy_16_bytes_backward_with_shift()
- // in unaligned case.
- __ dec(count, 8);
- } else {
- // Copy with shift 16 bytes per iteration if arrays do not have
- // the same alignment mod 8, otherwise jump to the next
- // code for aligned copy (and substracting 8 from 'count' before jump).
- // The compare above (count >= 11) guarantes 'count' >= 16 bytes.
- // Also jump over aligned copy after the copy with shift completed.
-
- copy_16_bytes_backward_with_shift(end_from, end_to, count, 8,
- L_aligned_copy, L_copy_2_bytes);
- }
- // copy 4 elements (16 bytes) at a time
- __ align(OptoLoopAlignment);
- __ BIND(L_aligned_copy);
- __ dec(end_from, 16);
- __ ldx(end_from, 8, O3);
- __ ldx(end_from, 0, O4);
- __ dec(end_to, 16);
- __ deccc(count, 8);
- __ stx(O3, end_to, 8);
- __ brx(Assembler::greaterEqual, false, Assembler::pt, L_aligned_copy);
- __ delayed()->stx(O4, end_to, 0);
- __ inc(count, 8);
-
- // copy 1 element (2 bytes) at a time
- __ BIND(L_copy_2_bytes);
- __ cmp_and_br_short(count, 0, Assembler::equal, Assembler::pt, L_exit);
- __ BIND(L_copy_2_bytes_loop);
- __ dec(end_from, 2);
- __ dec(end_to, 2);
- __ lduh(end_from, 0, O4);
- __ deccc(count);
- __ brx(Assembler::greater, false, Assembler::pt, L_copy_2_bytes_loop);
- __ delayed()->sth(O4, end_to, 0);
-
__ BIND(L_exit);
// O3, O4 are used as temp registers
inc_counter_np(SharedRuntime::_jshort_array_copy_ctr, O3, O4);
@@ -1870,9 +1899,11 @@
// caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
BLOCK_COMMENT("Entry:");
}
-
- generate_disjoint_int_copy_core(aligned);
-
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+ generate_disjoint_int_copy_core(aligned);
+ }
// O3, O4 are used as temp registers
inc_counter_np(SharedRuntime::_jint_array_copy_ctr, O3, O4);
__ retl();
@@ -2005,9 +2036,11 @@
}
array_overlap_test(nooverlap_target, 2);
-
- generate_conjoint_int_copy_core(aligned);
-
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false);
+ generate_conjoint_int_copy_core(aligned);
+ }
// O3, O4 are used as temp registers
inc_counter_np(SharedRuntime::_jint_array_copy_ctr, O3, O4);
__ retl();
@@ -2156,8 +2189,11 @@
BLOCK_COMMENT("Entry:");
}
- generate_disjoint_long_copy_core(aligned);
-
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, true, false);
+ generate_disjoint_long_copy_core(aligned);
+ }
// O3, O4 are used as temp registers
inc_counter_np(SharedRuntime::_jlong_array_copy_ctr, O3, O4);
__ retl();
@@ -2232,9 +2268,11 @@
}
array_overlap_test(nooverlap_target, 3);
-
- generate_conjoint_long_copy_core(aligned);
-
+ {
+ // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
+ UnsafeCopyMemoryMark ucmm(this, true, false);
+ generate_conjoint_long_copy_core(aligned);
+ }
// O3, O4 are used as temp registers
inc_counter_np(SharedRuntime::_jlong_array_copy_ctr, O3, O4);
__ retl();
@@ -2929,6 +2967,9 @@
address entry_jlong_arraycopy;
address entry_checkcast_arraycopy;
+ address ucm_common_error_exit = generate_unsafecopy_common_error_exit();
+ UnsafeCopyMemory::set_common_exit_stub_pc(ucm_common_error_exit);
+
//*** jbyte
// Always need aligned and unaligned versions
StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, &entry,
@@ -5821,6 +5862,10 @@
}; // end class declaration
+#define UCM_TABLE_MAX_ENTRIES 8
void StubGenerator_generate(CodeBuffer* code, bool all) {
+ if (UnsafeCopyMemory::_table == NULL) {
+ UnsafeCopyMemory::create_table(UCM_TABLE_MAX_ENTRIES);
+ }
StubGenerator g(code, all);
}
--- a/src/hotspot/cpu/x86/assembler_x86.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/cpu/x86/assembler_x86.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -789,6 +789,8 @@
case 0x59: // mulpd
case 0x6E: // movd
case 0x7E: // movd
+ case 0x6F: // movdq
+ case 0x7F: // movdq
case 0xAE: // ldmxcsr, stmxcsr, fxrstor, fxsave, clflush
case 0xFE: // paddd
debug_only(has_disp32 = true);
@@ -4274,6 +4276,7 @@
emit_operand(dst, src);
emit_int8(mode & 0xFF);
}
+
void Assembler::evshufi64x2(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8, int vector_len) {
assert(VM_Version::supports_evex(), "requires EVEX support");
assert(vector_len == Assembler::AVX_256bit || vector_len == Assembler::AVX_512bit, "");
--- a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -889,91 +889,98 @@
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->arraycopy_prologue(_masm, decorators, t, from, to, count);
-
- __ subptr(to, from); // to --> to_from
- __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
- __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
- if (!UseUnalignedLoadStores && !aligned && (t == T_BYTE || t == T_SHORT)) {
- // align source address at 4 bytes address boundary
- if (t == T_BYTE) {
- // One byte misalignment happens only for byte arrays
- __ testl(from, 1);
- __ jccb(Assembler::zero, L_skip_align1);
- __ movb(rax, Address(from, 0));
- __ movb(Address(from, to_from, Address::times_1, 0), rax);
- __ increment(from);
- __ decrement(count);
- __ BIND(L_skip_align1);
+ {
+ bool add_entry = (t != T_OBJECT && (!aligned || t == T_INT));
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, add_entry, true);
+ __ subptr(to, from); // to --> to_from
+ __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
+ __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
+ if (!UseUnalignedLoadStores && !aligned && (t == T_BYTE || t == T_SHORT)) {
+ // align source address at 4 bytes address boundary
+ if (t == T_BYTE) {
+ // One byte misalignment happens only for byte arrays
+ __ testl(from, 1);
+ __ jccb(Assembler::zero, L_skip_align1);
+ __ movb(rax, Address(from, 0));
+ __ movb(Address(from, to_from, Address::times_1, 0), rax);
+ __ increment(from);
+ __ decrement(count);
+ __ BIND(L_skip_align1);
+ }
+ // Two bytes misalignment happens only for byte and short (char) arrays
+ __ testl(from, 2);
+ __ jccb(Assembler::zero, L_skip_align2);
+ __ movw(rax, Address(from, 0));
+ __ movw(Address(from, to_from, Address::times_1, 0), rax);
+ __ addptr(from, 2);
+ __ subl(count, 1<<(shift-1));
+ __ BIND(L_skip_align2);
}
- // Two bytes misalignment happens only for byte and short (char) arrays
- __ testl(from, 2);
- __ jccb(Assembler::zero, L_skip_align2);
- __ movw(rax, Address(from, 0));
- __ movw(Address(from, to_from, Address::times_1, 0), rax);
- __ addptr(from, 2);
- __ subl(count, 1<<(shift-1));
- __ BIND(L_skip_align2);
- }
- if (!VM_Version::supports_mmx()) {
- __ mov(rax, count); // save 'count'
- __ shrl(count, shift); // bytes count
- __ addptr(to_from, from);// restore 'to'
- __ rep_mov();
- __ subptr(to_from, from);// restore 'to_from'
- __ mov(count, rax); // restore 'count'
- __ jmpb(L_copy_2_bytes); // all dwords were copied
- } else {
- if (!UseUnalignedLoadStores) {
- // align to 8 bytes, we know we are 4 byte aligned to start
- __ testptr(from, 4);
- __ jccb(Assembler::zero, L_copy_64_bytes);
- __ movl(rax, Address(from, 0));
- __ movl(Address(from, to_from, Address::times_1, 0), rax);
+ if (!VM_Version::supports_mmx()) {
+ __ mov(rax, count); // save 'count'
+ __ shrl(count, shift); // bytes count
+ __ addptr(to_from, from);// restore 'to'
+ __ rep_mov();
+ __ subptr(to_from, from);// restore 'to_from'
+ __ mov(count, rax); // restore 'count'
+ __ jmpb(L_copy_2_bytes); // all dwords were copied
+ } else {
+ if (!UseUnalignedLoadStores) {
+ // align to 8 bytes, we know we are 4 byte aligned to start
+ __ testptr(from, 4);
+ __ jccb(Assembler::zero, L_copy_64_bytes);
+ __ movl(rax, Address(from, 0));
+ __ movl(Address(from, to_from, Address::times_1, 0), rax);
+ __ addptr(from, 4);
+ __ subl(count, 1<<shift);
+ }
+ __ BIND(L_copy_64_bytes);
+ __ mov(rax, count);
+ __ shrl(rax, shift+1); // 8 bytes chunk count
+ //
+ // Copy 8-byte chunks through MMX registers, 8 per iteration of the loop
+ //
+ if (UseXMMForArrayCopy) {
+ xmm_copy_forward(from, to_from, rax);
+ } else {
+ mmx_copy_forward(from, to_from, rax);
+ }
+ }
+ // copy tailing dword
+ __ BIND(L_copy_4_bytes);
+ __ testl(count, 1<<shift);
+ __ jccb(Assembler::zero, L_copy_2_bytes);
+ __ movl(rax, Address(from, 0));
+ __ movl(Address(from, to_from, Address::times_1, 0), rax);
+ if (t == T_BYTE || t == T_SHORT) {
__ addptr(from, 4);
- __ subl(count, 1<<shift);
- }
- __ BIND(L_copy_64_bytes);
- __ mov(rax, count);
- __ shrl(rax, shift+1); // 8 bytes chunk count
- //
- // Copy 8-byte chunks through MMX registers, 8 per iteration of the loop
- //
- if (UseXMMForArrayCopy) {
- xmm_copy_forward(from, to_from, rax);
+ __ BIND(L_copy_2_bytes);
+ // copy tailing word
+ __ testl(count, 1<<(shift-1));
+ __ jccb(Assembler::zero, L_copy_byte);
+ __ movw(rax, Address(from, 0));
+ __ movw(Address(from, to_from, Address::times_1, 0), rax);
+ if (t == T_BYTE) {
+ __ addptr(from, 2);
+ __ BIND(L_copy_byte);
+ // copy tailing byte
+ __ testl(count, 1);
+ __ jccb(Assembler::zero, L_exit);
+ __ movb(rax, Address(from, 0));
+ __ movb(Address(from, to_from, Address::times_1, 0), rax);
+ __ BIND(L_exit);
+ } else {
+ __ BIND(L_copy_byte);
+ }
} else {
- mmx_copy_forward(from, to_from, rax);
+ __ BIND(L_copy_2_bytes);
}
}
- // copy tailing dword
- __ BIND(L_copy_4_bytes);
- __ testl(count, 1<<shift);
- __ jccb(Assembler::zero, L_copy_2_bytes);
- __ movl(rax, Address(from, 0));
- __ movl(Address(from, to_from, Address::times_1, 0), rax);
- if (t == T_BYTE || t == T_SHORT) {
- __ addptr(from, 4);
- __ BIND(L_copy_2_bytes);
- // copy tailing word
- __ testl(count, 1<<(shift-1));
- __ jccb(Assembler::zero, L_copy_byte);
- __ movw(rax, Address(from, 0));
- __ movw(Address(from, to_from, Address::times_1, 0), rax);
- if (t == T_BYTE) {
- __ addptr(from, 2);
- __ BIND(L_copy_byte);
- // copy tailing byte
- __ testl(count, 1);
- __ jccb(Assembler::zero, L_exit);
- __ movb(rax, Address(from, 0));
- __ movb(Address(from, to_from, Address::times_1, 0), rax);
- __ BIND(L_exit);
- } else {
- __ BIND(L_copy_byte);
- }
- } else {
- __ BIND(L_copy_2_bytes);
+
+ if (VM_Version::supports_mmx() && !UseXMMForArrayCopy) {
+ __ emms();
}
-
__ movl(count, Address(rsp, 12+12)); // reread 'count'
bs->arraycopy_epilogue(_masm, decorators, t, from, to, count);
@@ -1079,104 +1086,112 @@
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->arraycopy_prologue(_masm, decorators, t, from, to, count);
- // copy from high to low
- __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
- __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
- if (t == T_BYTE || t == T_SHORT) {
- // Align the end of destination array at 4 bytes address boundary
- __ lea(end, Address(dst, count, sf, 0));
- if (t == T_BYTE) {
- // One byte misalignment happens only for byte arrays
- __ testl(end, 1);
- __ jccb(Assembler::zero, L_skip_align1);
- __ decrement(count);
- __ movb(rdx, Address(from, count, sf, 0));
- __ movb(Address(to, count, sf, 0), rdx);
- __ BIND(L_skip_align1);
- }
- // Two bytes misalignment happens only for byte and short (char) arrays
- __ testl(end, 2);
- __ jccb(Assembler::zero, L_skip_align2);
- __ subptr(count, 1<<(shift-1));
- __ movw(rdx, Address(from, count, sf, 0));
- __ movw(Address(to, count, sf, 0), rdx);
- __ BIND(L_skip_align2);
+ {
+ bool add_entry = (t != T_OBJECT && (!aligned || t == T_INT));
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, add_entry, true);
+ // copy from high to low
__ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
- __ jcc(Assembler::below, L_copy_4_bytes);
- }
-
- if (!VM_Version::supports_mmx()) {
- __ std();
- __ mov(rax, count); // Save 'count'
- __ mov(rdx, to); // Save 'to'
- __ lea(rsi, Address(from, count, sf, -4));
- __ lea(rdi, Address(to , count, sf, -4));
- __ shrptr(count, shift); // bytes count
- __ rep_mov();
- __ cld();
- __ mov(count, rax); // restore 'count'
- __ andl(count, (1<<shift)-1); // mask the number of rest elements
- __ movptr(from, Address(rsp, 12+4)); // reread 'from'
- __ mov(to, rdx); // restore 'to'
- __ jmpb(L_copy_2_bytes); // all dword were copied
- } else {
- // Align to 8 bytes the end of array. It is aligned to 4 bytes already.
- __ testptr(end, 4);
- __ jccb(Assembler::zero, L_copy_8_bytes);
- __ subl(count, 1<<shift);
- __ movl(rdx, Address(from, count, sf, 0));
- __ movl(Address(to, count, sf, 0), rdx);
- __ jmpb(L_copy_8_bytes);
-
- __ align(OptoLoopAlignment);
- // Move 8 bytes
- __ BIND(L_copy_8_bytes_loop);
- if (UseXMMForArrayCopy) {
- __ movq(xmm0, Address(from, count, sf, 0));
- __ movq(Address(to, count, sf, 0), xmm0);
+ __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
+ if (t == T_BYTE || t == T_SHORT) {
+ // Align the end of destination array at 4 bytes address boundary
+ __ lea(end, Address(dst, count, sf, 0));
+ if (t == T_BYTE) {
+ // One byte misalignment happens only for byte arrays
+ __ testl(end, 1);
+ __ jccb(Assembler::zero, L_skip_align1);
+ __ decrement(count);
+ __ movb(rdx, Address(from, count, sf, 0));
+ __ movb(Address(to, count, sf, 0), rdx);
+ __ BIND(L_skip_align1);
+ }
+ // Two bytes misalignment happens only for byte and short (char) arrays
+ __ testl(end, 2);
+ __ jccb(Assembler::zero, L_skip_align2);
+ __ subptr(count, 1<<(shift-1));
+ __ movw(rdx, Address(from, count, sf, 0));
+ __ movw(Address(to, count, sf, 0), rdx);
+ __ BIND(L_skip_align2);
+ __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
+ __ jcc(Assembler::below, L_copy_4_bytes);
+ }
+
+ if (!VM_Version::supports_mmx()) {
+ __ std();
+ __ mov(rax, count); // Save 'count'
+ __ mov(rdx, to); // Save 'to'
+ __ lea(rsi, Address(from, count, sf, -4));
+ __ lea(rdi, Address(to , count, sf, -4));
+ __ shrptr(count, shift); // bytes count
+ __ rep_mov();
+ __ cld();
+ __ mov(count, rax); // restore 'count'
+ __ andl(count, (1<<shift)-1); // mask the number of rest elements
+ __ movptr(from, Address(rsp, 12+4)); // reread 'from'
+ __ mov(to, rdx); // restore 'to'
+ __ jmpb(L_copy_2_bytes); // all dword were copied
} else {
- __ movq(mmx0, Address(from, count, sf, 0));
- __ movq(Address(to, count, sf, 0), mmx0);
+ // Align to 8 bytes the end of array. It is aligned to 4 bytes already.
+ __ testptr(end, 4);
+ __ jccb(Assembler::zero, L_copy_8_bytes);
+ __ subl(count, 1<<shift);
+ __ movl(rdx, Address(from, count, sf, 0));
+ __ movl(Address(to, count, sf, 0), rdx);
+ __ jmpb(L_copy_8_bytes);
+
+ __ align(OptoLoopAlignment);
+ // Move 8 bytes
+ __ BIND(L_copy_8_bytes_loop);
+ if (UseXMMForArrayCopy) {
+ __ movq(xmm0, Address(from, count, sf, 0));
+ __ movq(Address(to, count, sf, 0), xmm0);
+ } else {
+ __ movq(mmx0, Address(from, count, sf, 0));
+ __ movq(Address(to, count, sf, 0), mmx0);
+ }
+ __ BIND(L_copy_8_bytes);
+ __ subl(count, 2<<shift);
+ __ jcc(Assembler::greaterEqual, L_copy_8_bytes_loop);
+ __ addl(count, 2<<shift);
+ if (!UseXMMForArrayCopy) {
+ __ emms();
+ }
}
- __ BIND(L_copy_8_bytes);
- __ subl(count, 2<<shift);
- __ jcc(Assembler::greaterEqual, L_copy_8_bytes_loop);
- __ addl(count, 2<<shift);
- if (!UseXMMForArrayCopy) {
- __ emms();
+ __ BIND(L_copy_4_bytes);
+ // copy prefix qword
+ __ testl(count, 1<<shift);
+ __ jccb(Assembler::zero, L_copy_2_bytes);
+ __ movl(rdx, Address(from, count, sf, -4));
+ __ movl(Address(to, count, sf, -4), rdx);
+
+ if (t == T_BYTE || t == T_SHORT) {
+ __ subl(count, (1<<shift));
+ __ BIND(L_copy_2_bytes);
+ // copy prefix dword
+ __ testl(count, 1<<(shift-1));
+ __ jccb(Assembler::zero, L_copy_byte);
+ __ movw(rdx, Address(from, count, sf, -2));
+ __ movw(Address(to, count, sf, -2), rdx);
+ if (t == T_BYTE) {
+ __ subl(count, 1<<(shift-1));
+ __ BIND(L_copy_byte);
+ // copy prefix byte
+ __ testl(count, 1);
+ __ jccb(Assembler::zero, L_exit);
+ __ movb(rdx, Address(from, 0));
+ __ movb(Address(to, 0), rdx);
+ __ BIND(L_exit);
+ } else {
+ __ BIND(L_copy_byte);
+ }
+ } else {
+ __ BIND(L_copy_2_bytes);
}
}
- __ BIND(L_copy_4_bytes);
- // copy prefix qword
- __ testl(count, 1<<shift);
- __ jccb(Assembler::zero, L_copy_2_bytes);
- __ movl(rdx, Address(from, count, sf, -4));
- __ movl(Address(to, count, sf, -4), rdx);
-
- if (t == T_BYTE || t == T_SHORT) {
- __ subl(count, (1<<shift));
- __ BIND(L_copy_2_bytes);
- // copy prefix dword
- __ testl(count, 1<<(shift-1));
- __ jccb(Assembler::zero, L_copy_byte);
- __ movw(rdx, Address(from, count, sf, -2));
- __ movw(Address(to, count, sf, -2), rdx);
- if (t == T_BYTE) {
- __ subl(count, 1<<(shift-1));
- __ BIND(L_copy_byte);
- // copy prefix byte
- __ testl(count, 1);
- __ jccb(Assembler::zero, L_exit);
- __ movb(rdx, Address(from, 0));
- __ movb(Address(to, 0), rdx);
- __ BIND(L_exit);
- } else {
- __ BIND(L_copy_byte);
- }
- } else {
- __ BIND(L_copy_2_bytes);
+
+ if (VM_Version::supports_mmx() && !UseXMMForArrayCopy) {
+ __ emms();
}
-
__ movl2ptr(count, Address(rsp, 12+12)); // reread count
bs->arraycopy_epilogue(_masm, decorators, t, from, to, count);
@@ -1212,23 +1227,30 @@
*entry = __ pc(); // Entry point from conjoint arraycopy stub.
BLOCK_COMMENT("Entry:");
- __ subptr(to, from); // to --> to_from
- if (VM_Version::supports_mmx()) {
- if (UseXMMForArrayCopy) {
- xmm_copy_forward(from, to_from, count);
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, true, true);
+ __ subptr(to, from); // to --> to_from
+ if (VM_Version::supports_mmx()) {
+ if (UseXMMForArrayCopy) {
+ xmm_copy_forward(from, to_from, count);
+ } else {
+ mmx_copy_forward(from, to_from, count);
+ }
} else {
- mmx_copy_forward(from, to_from, count);
+ __ jmpb(L_copy_8_bytes);
+ __ align(OptoLoopAlignment);
+ __ BIND(L_copy_8_bytes_loop);
+ __ fild_d(Address(from, 0));
+ __ fistp_d(Address(from, to_from, Address::times_1));
+ __ addptr(from, 8);
+ __ BIND(L_copy_8_bytes);
+ __ decrement(count);
+ __ jcc(Assembler::greaterEqual, L_copy_8_bytes_loop);
}
- } else {
- __ jmpb(L_copy_8_bytes);
- __ align(OptoLoopAlignment);
- __ BIND(L_copy_8_bytes_loop);
- __ fild_d(Address(from, 0));
- __ fistp_d(Address(from, to_from, Address::times_1));
- __ addptr(from, 8);
- __ BIND(L_copy_8_bytes);
- __ decrement(count);
- __ jcc(Assembler::greaterEqual, L_copy_8_bytes_loop);
+ }
+ if (VM_Version::supports_mmx() && !UseXMMForArrayCopy) {
+ __ emms();
}
inc_copy_counter_np(T_LONG);
__ leave(); // required for proper stackwalking of RuntimeStub frame
@@ -1267,26 +1289,31 @@
__ movptr(from, Address(rsp, 8)); // from
__ jump_cc(Assembler::aboveEqual, nooverlap);
- __ jmpb(L_copy_8_bytes);
-
- __ align(OptoLoopAlignment);
- __ BIND(L_copy_8_bytes_loop);
- if (VM_Version::supports_mmx()) {
- if (UseXMMForArrayCopy) {
- __ movq(xmm0, Address(from, count, Address::times_8));
- __ movq(Address(to, count, Address::times_8), xmm0);
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, true, true);
+
+ __ jmpb(L_copy_8_bytes);
+
+ __ align(OptoLoopAlignment);
+ __ BIND(L_copy_8_bytes_loop);
+ if (VM_Version::supports_mmx()) {
+ if (UseXMMForArrayCopy) {
+ __ movq(xmm0, Address(from, count, Address::times_8));
+ __ movq(Address(to, count, Address::times_8), xmm0);
+ } else {
+ __ movq(mmx0, Address(from, count, Address::times_8));
+ __ movq(Address(to, count, Address::times_8), mmx0);
+ }
} else {
- __ movq(mmx0, Address(from, count, Address::times_8));
- __ movq(Address(to, count, Address::times_8), mmx0);
+ __ fild_d(Address(from, count, Address::times_8));
+ __ fistp_d(Address(to, count, Address::times_8));
}
- } else {
- __ fild_d(Address(from, count, Address::times_8));
- __ fistp_d(Address(to, count, Address::times_8));
+ __ BIND(L_copy_8_bytes);
+ __ decrement(count);
+ __ jcc(Assembler::greaterEqual, L_copy_8_bytes_loop);
+
}
- __ BIND(L_copy_8_bytes);
- __ decrement(count);
- __ jcc(Assembler::greaterEqual, L_copy_8_bytes_loop);
-
if (VM_Version::supports_mmx() && !UseXMMForArrayCopy) {
__ emms();
}
@@ -3945,7 +3972,10 @@
}
}; // end class declaration
-
+#define UCM_TABLE_MAX_ENTRIES 8
void StubGenerator_generate(CodeBuffer* code, bool all) {
+ if (UnsafeCopyMemory::_table == NULL) {
+ UnsafeCopyMemory::create_table(UCM_TABLE_MAX_ENTRIES);
+ }
StubGenerator g(code, all);
}
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1433,7 +1433,6 @@
__ jcc(Assembler::greater, L_copy_8_bytes); // Copy trailing qwords
}
-
// Arguments:
// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
// ignored
@@ -1482,51 +1481,55 @@
setup_arg_regs(); // from => rdi, to => rsi, count => rdx
// r9 and r10 may be used to save non-volatile registers
- // 'from', 'to' and 'count' are now valid
- __ movptr(byte_count, count);
- __ shrptr(count, 3); // count => qword_count
-
- // Copy from low to high addresses. Use 'to' as scratch.
- __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
- __ lea(end_to, Address(to, qword_count, Address::times_8, -8));
- __ negptr(qword_count); // make the count negative
- __ jmp(L_copy_bytes);
-
- // Copy trailing qwords
- __ BIND(L_copy_8_bytes);
- __ movq(rax, Address(end_from, qword_count, Address::times_8, 8));
- __ movq(Address(end_to, qword_count, Address::times_8, 8), rax);
- __ increment(qword_count);
- __ jcc(Assembler::notZero, L_copy_8_bytes);
-
- // Check for and copy trailing dword
- __ BIND(L_copy_4_bytes);
- __ testl(byte_count, 4);
- __ jccb(Assembler::zero, L_copy_2_bytes);
- __ movl(rax, Address(end_from, 8));
- __ movl(Address(end_to, 8), rax);
-
- __ addptr(end_from, 4);
- __ addptr(end_to, 4);
-
- // Check for and copy trailing word
- __ BIND(L_copy_2_bytes);
- __ testl(byte_count, 2);
- __ jccb(Assembler::zero, L_copy_byte);
- __ movw(rax, Address(end_from, 8));
- __ movw(Address(end_to, 8), rax);
-
- __ addptr(end_from, 2);
- __ addptr(end_to, 2);
-
- // Check for and copy trailing byte
- __ BIND(L_copy_byte);
- __ testl(byte_count, 1);
- __ jccb(Assembler::zero, L_exit);
- __ movb(rax, Address(end_from, 8));
- __ movb(Address(end_to, 8), rax);
-
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !aligned, true);
+ // 'from', 'to' and 'count' are now valid
+ __ movptr(byte_count, count);
+ __ shrptr(count, 3); // count => qword_count
+
+ // Copy from low to high addresses. Use 'to' as scratch.
+ __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
+ __ lea(end_to, Address(to, qword_count, Address::times_8, -8));
+ __ negptr(qword_count); // make the count negative
+ __ jmp(L_copy_bytes);
+
+ // Copy trailing qwords
+ __ BIND(L_copy_8_bytes);
+ __ movq(rax, Address(end_from, qword_count, Address::times_8, 8));
+ __ movq(Address(end_to, qword_count, Address::times_8, 8), rax);
+ __ increment(qword_count);
+ __ jcc(Assembler::notZero, L_copy_8_bytes);
+
+ // Check for and copy trailing dword
+ __ BIND(L_copy_4_bytes);
+ __ testl(byte_count, 4);
+ __ jccb(Assembler::zero, L_copy_2_bytes);
+ __ movl(rax, Address(end_from, 8));
+ __ movl(Address(end_to, 8), rax);
+
+ __ addptr(end_from, 4);
+ __ addptr(end_to, 4);
+
+ // Check for and copy trailing word
+ __ BIND(L_copy_2_bytes);
+ __ testl(byte_count, 2);
+ __ jccb(Assembler::zero, L_copy_byte);
+ __ movw(rax, Address(end_from, 8));
+ __ movw(Address(end_to, 8), rax);
+
+ __ addptr(end_from, 2);
+ __ addptr(end_to, 2);
+
+ // Check for and copy trailing byte
+ __ BIND(L_copy_byte);
+ __ testl(byte_count, 1);
+ __ jccb(Assembler::zero, L_exit);
+ __ movb(rax, Address(end_from, 8));
+ __ movb(Address(end_to, 8), rax);
+ }
__ BIND(L_exit);
+ address ucme_exit_pc = __ pc();
restore_arg_regs();
inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); // Update counter after rscratch1 is free
__ xorptr(rax, rax); // return 0
@@ -1534,10 +1537,12 @@
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
- // Copy in multi-bytes chunks
- copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
- __ jmp(L_copy_4_bytes);
-
+ {
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false, ucme_exit_pc);
+ // Copy in multi-bytes chunks
+ copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
+ __ jmp(L_copy_4_bytes);
+ }
return start;
}
@@ -1582,41 +1587,44 @@
setup_arg_regs(); // from => rdi, to => rsi, count => rdx
// r9 and r10 may be used to save non-volatile registers
- // 'from', 'to' and 'count' are now valid
- __ movptr(byte_count, count);
- __ shrptr(count, 3); // count => qword_count
-
- // Copy from high to low addresses.
-
- // Check for and copy trailing byte
- __ testl(byte_count, 1);
- __ jcc(Assembler::zero, L_copy_2_bytes);
- __ movb(rax, Address(from, byte_count, Address::times_1, -1));
- __ movb(Address(to, byte_count, Address::times_1, -1), rax);
- __ decrement(byte_count); // Adjust for possible trailing word
-
- // Check for and copy trailing word
- __ BIND(L_copy_2_bytes);
- __ testl(byte_count, 2);
- __ jcc(Assembler::zero, L_copy_4_bytes);
- __ movw(rax, Address(from, byte_count, Address::times_1, -2));
- __ movw(Address(to, byte_count, Address::times_1, -2), rax);
-
- // Check for and copy trailing dword
- __ BIND(L_copy_4_bytes);
- __ testl(byte_count, 4);
- __ jcc(Assembler::zero, L_copy_bytes);
- __ movl(rax, Address(from, qword_count, Address::times_8));
- __ movl(Address(to, qword_count, Address::times_8), rax);
- __ jmp(L_copy_bytes);
-
- // Copy trailing qwords
- __ BIND(L_copy_8_bytes);
- __ movq(rax, Address(from, qword_count, Address::times_8, -8));
- __ movq(Address(to, qword_count, Address::times_8, -8), rax);
- __ decrement(qword_count);
- __ jcc(Assembler::notZero, L_copy_8_bytes);
-
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !aligned, true);
+ // 'from', 'to' and 'count' are now valid
+ __ movptr(byte_count, count);
+ __ shrptr(count, 3); // count => qword_count
+
+ // Copy from high to low addresses.
+
+ // Check for and copy trailing byte
+ __ testl(byte_count, 1);
+ __ jcc(Assembler::zero, L_copy_2_bytes);
+ __ movb(rax, Address(from, byte_count, Address::times_1, -1));
+ __ movb(Address(to, byte_count, Address::times_1, -1), rax);
+ __ decrement(byte_count); // Adjust for possible trailing word
+
+ // Check for and copy trailing word
+ __ BIND(L_copy_2_bytes);
+ __ testl(byte_count, 2);
+ __ jcc(Assembler::zero, L_copy_4_bytes);
+ __ movw(rax, Address(from, byte_count, Address::times_1, -2));
+ __ movw(Address(to, byte_count, Address::times_1, -2), rax);
+
+ // Check for and copy trailing dword
+ __ BIND(L_copy_4_bytes);
+ __ testl(byte_count, 4);
+ __ jcc(Assembler::zero, L_copy_bytes);
+ __ movl(rax, Address(from, qword_count, Address::times_8));
+ __ movl(Address(to, qword_count, Address::times_8), rax);
+ __ jmp(L_copy_bytes);
+
+ // Copy trailing qwords
+ __ BIND(L_copy_8_bytes);
+ __ movq(rax, Address(from, qword_count, Address::times_8, -8));
+ __ movq(Address(to, qword_count, Address::times_8, -8), rax);
+ __ decrement(qword_count);
+ __ jcc(Assembler::notZero, L_copy_8_bytes);
+ }
restore_arg_regs();
inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); // Update counter after rscratch1 is free
__ xorptr(rax, rax); // return 0
@@ -1624,9 +1632,12 @@
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
- // Copy in multi-bytes chunks
- copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
-
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !aligned, true);
+ // Copy in multi-bytes chunks
+ copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
+ }
restore_arg_regs();
inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); // Update counter after rscratch1 is free
__ xorptr(rax, rax); // return 0
@@ -1684,44 +1695,48 @@
setup_arg_regs(); // from => rdi, to => rsi, count => rdx
// r9 and r10 may be used to save non-volatile registers
- // 'from', 'to' and 'count' are now valid
- __ movptr(word_count, count);
- __ shrptr(count, 2); // count => qword_count
-
- // Copy from low to high addresses. Use 'to' as scratch.
- __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
- __ lea(end_to, Address(to, qword_count, Address::times_8, -8));
- __ negptr(qword_count);
- __ jmp(L_copy_bytes);
-
- // Copy trailing qwords
- __ BIND(L_copy_8_bytes);
- __ movq(rax, Address(end_from, qword_count, Address::times_8, 8));
- __ movq(Address(end_to, qword_count, Address::times_8, 8), rax);
- __ increment(qword_count);
- __ jcc(Assembler::notZero, L_copy_8_bytes);
-
- // Original 'dest' is trashed, so we can't use it as a
- // base register for a possible trailing word copy
-
- // Check for and copy trailing dword
- __ BIND(L_copy_4_bytes);
- __ testl(word_count, 2);
- __ jccb(Assembler::zero, L_copy_2_bytes);
- __ movl(rax, Address(end_from, 8));
- __ movl(Address(end_to, 8), rax);
-
- __ addptr(end_from, 4);
- __ addptr(end_to, 4);
-
- // Check for and copy trailing word
- __ BIND(L_copy_2_bytes);
- __ testl(word_count, 1);
- __ jccb(Assembler::zero, L_exit);
- __ movw(rax, Address(end_from, 8));
- __ movw(Address(end_to, 8), rax);
-
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !aligned, true);
+ // 'from', 'to' and 'count' are now valid
+ __ movptr(word_count, count);
+ __ shrptr(count, 2); // count => qword_count
+
+ // Copy from low to high addresses. Use 'to' as scratch.
+ __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
+ __ lea(end_to, Address(to, qword_count, Address::times_8, -8));
+ __ negptr(qword_count);
+ __ jmp(L_copy_bytes);
+
+ // Copy trailing qwords
+ __ BIND(L_copy_8_bytes);
+ __ movq(rax, Address(end_from, qword_count, Address::times_8, 8));
+ __ movq(Address(end_to, qword_count, Address::times_8, 8), rax);
+ __ increment(qword_count);
+ __ jcc(Assembler::notZero, L_copy_8_bytes);
+
+ // Original 'dest' is trashed, so we can't use it as a
+ // base register for a possible trailing word copy
+
+ // Check for and copy trailing dword
+ __ BIND(L_copy_4_bytes);
+ __ testl(word_count, 2);
+ __ jccb(Assembler::zero, L_copy_2_bytes);
+ __ movl(rax, Address(end_from, 8));
+ __ movl(Address(end_to, 8), rax);
+
+ __ addptr(end_from, 4);
+ __ addptr(end_to, 4);
+
+ // Check for and copy trailing word
+ __ BIND(L_copy_2_bytes);
+ __ testl(word_count, 1);
+ __ jccb(Assembler::zero, L_exit);
+ __ movw(rax, Address(end_from, 8));
+ __ movw(Address(end_to, 8), rax);
+ }
__ BIND(L_exit);
+ address ucme_exit_pc = __ pc();
restore_arg_regs();
inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); // Update counter after rscratch1 is free
__ xorptr(rax, rax); // return 0
@@ -1729,9 +1744,12 @@
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
- // Copy in multi-bytes chunks
- copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
- __ jmp(L_copy_4_bytes);
+ {
+ UnsafeCopyMemoryMark ucmm(this, !aligned, false, ucme_exit_pc);
+ // Copy in multi-bytes chunks
+ copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
+ __ jmp(L_copy_4_bytes);
+ }
return start;
}
@@ -1798,33 +1816,36 @@
setup_arg_regs(); // from => rdi, to => rsi, count => rdx
// r9 and r10 may be used to save non-volatile registers
- // 'from', 'to' and 'count' are now valid
- __ movptr(word_count, count);
- __ shrptr(count, 2); // count => qword_count
-
- // Copy from high to low addresses. Use 'to' as scratch.
-
- // Check for and copy trailing word
- __ testl(word_count, 1);
- __ jccb(Assembler::zero, L_copy_4_bytes);
- __ movw(rax, Address(from, word_count, Address::times_2, -2));
- __ movw(Address(to, word_count, Address::times_2, -2), rax);
-
- // Check for and copy trailing dword
- __ BIND(L_copy_4_bytes);
- __ testl(word_count, 2);
- __ jcc(Assembler::zero, L_copy_bytes);
- __ movl(rax, Address(from, qword_count, Address::times_8));
- __ movl(Address(to, qword_count, Address::times_8), rax);
- __ jmp(L_copy_bytes);
-
- // Copy trailing qwords
- __ BIND(L_copy_8_bytes);
- __ movq(rax, Address(from, qword_count, Address::times_8, -8));
- __ movq(Address(to, qword_count, Address::times_8, -8), rax);
- __ decrement(qword_count);
- __ jcc(Assembler::notZero, L_copy_8_bytes);
-
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !aligned, true);
+ // 'from', 'to' and 'count' are now valid
+ __ movptr(word_count, count);
+ __ shrptr(count, 2); // count => qword_count
+
+ // Copy from high to low addresses. Use 'to' as scratch.
+
+ // Check for and copy trailing word
+ __ testl(word_count, 1);
+ __ jccb(Assembler::zero, L_copy_4_bytes);
+ __ movw(rax, Address(from, word_count, Address::times_2, -2));
+ __ movw(Address(to, word_count, Address::times_2, -2), rax);
+
+ // Check for and copy trailing dword
+ __ BIND(L_copy_4_bytes);
+ __ testl(word_count, 2);
+ __ jcc(Assembler::zero, L_copy_bytes);
+ __ movl(rax, Address(from, qword_count, Address::times_8));
+ __ movl(Address(to, qword_count, Address::times_8), rax);
+ __ jmp(L_copy_bytes);
+
+ // Copy trailing qwords
+ __ BIND(L_copy_8_bytes);
+ __ movq(rax, Address(from, qword_count, Address::times_8, -8));
+ __ movq(Address(to, qword_count, Address::times_8, -8), rax);
+ __ decrement(qword_count);
+ __ jcc(Assembler::notZero, L_copy_8_bytes);
+ }
restore_arg_regs();
inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); // Update counter after rscratch1 is free
__ xorptr(rax, rax); // return 0
@@ -1832,9 +1853,12 @@
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
- // Copy in multi-bytes chunks
- copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
-
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !aligned, true);
+ // Copy in multi-bytes chunks
+ copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
+ }
restore_arg_regs();
inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); // Update counter after rscratch1 is free
__ xorptr(rax, rax); // return 0
@@ -1905,31 +1929,35 @@
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->arraycopy_prologue(_masm, decorators, type, from, to, count);
- // 'from', 'to' and 'count' are now valid
- __ movptr(dword_count, count);
- __ shrptr(count, 1); // count => qword_count
-
- // Copy from low to high addresses. Use 'to' as scratch.
- __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
- __ lea(end_to, Address(to, qword_count, Address::times_8, -8));
- __ negptr(qword_count);
- __ jmp(L_copy_bytes);
-
- // Copy trailing qwords
- __ BIND(L_copy_8_bytes);
- __ movq(rax, Address(end_from, qword_count, Address::times_8, 8));
- __ movq(Address(end_to, qword_count, Address::times_8, 8), rax);
- __ increment(qword_count);
- __ jcc(Assembler::notZero, L_copy_8_bytes);
-
- // Check for and copy trailing dword
- __ BIND(L_copy_4_bytes);
- __ testl(dword_count, 1); // Only byte test since the value is 0 or 1
- __ jccb(Assembler::zero, L_exit);
- __ movl(rax, Address(end_from, 8));
- __ movl(Address(end_to, 8), rax);
-
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
+ // 'from', 'to' and 'count' are now valid
+ __ movptr(dword_count, count);
+ __ shrptr(count, 1); // count => qword_count
+
+ // Copy from low to high addresses. Use 'to' as scratch.
+ __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
+ __ lea(end_to, Address(to, qword_count, Address::times_8, -8));
+ __ negptr(qword_count);
+ __ jmp(L_copy_bytes);
+
+ // Copy trailing qwords
+ __ BIND(L_copy_8_bytes);
+ __ movq(rax, Address(end_from, qword_count, Address::times_8, 8));
+ __ movq(Address(end_to, qword_count, Address::times_8, 8), rax);
+ __ increment(qword_count);
+ __ jcc(Assembler::notZero, L_copy_8_bytes);
+
+ // Check for and copy trailing dword
+ __ BIND(L_copy_4_bytes);
+ __ testl(dword_count, 1); // Only byte test since the value is 0 or 1
+ __ jccb(Assembler::zero, L_exit);
+ __ movl(rax, Address(end_from, 8));
+ __ movl(Address(end_to, 8), rax);
+ }
__ BIND(L_exit);
+ address ucme_exit_pc = __ pc();
bs->arraycopy_epilogue(_masm, decorators, type, from, to, dword_count);
restore_arg_regs_using_thread();
inc_counter_np(SharedRuntime::_jint_array_copy_ctr); // Update counter after rscratch1 is free
@@ -1938,9 +1966,12 @@
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
- // Copy in multi-bytes chunks
- copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
- __ jmp(L_copy_4_bytes);
+ {
+ UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, false, ucme_exit_pc);
+ // Copy in multi-bytes chunks
+ copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
+ __ jmp(L_copy_4_bytes);
+ }
return start;
}
@@ -2001,26 +2032,29 @@
bs->arraycopy_prologue(_masm, decorators, type, from, to, count);
assert_clean_int(count, rax); // Make sure 'count' is clean int.
- // 'from', 'to' and 'count' are now valid
- __ movptr(dword_count, count);
- __ shrptr(count, 1); // count => qword_count
-
- // Copy from high to low addresses. Use 'to' as scratch.
-
- // Check for and copy trailing dword
- __ testl(dword_count, 1);
- __ jcc(Assembler::zero, L_copy_bytes);
- __ movl(rax, Address(from, dword_count, Address::times_4, -4));
- __ movl(Address(to, dword_count, Address::times_4, -4), rax);
- __ jmp(L_copy_bytes);
-
- // Copy trailing qwords
- __ BIND(L_copy_8_bytes);
- __ movq(rax, Address(from, qword_count, Address::times_8, -8));
- __ movq(Address(to, qword_count, Address::times_8, -8), rax);
- __ decrement(qword_count);
- __ jcc(Assembler::notZero, L_copy_8_bytes);
-
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
+ // 'from', 'to' and 'count' are now valid
+ __ movptr(dword_count, count);
+ __ shrptr(count, 1); // count => qword_count
+
+ // Copy from high to low addresses. Use 'to' as scratch.
+
+ // Check for and copy trailing dword
+ __ testl(dword_count, 1);
+ __ jcc(Assembler::zero, L_copy_bytes);
+ __ movl(rax, Address(from, dword_count, Address::times_4, -4));
+ __ movl(Address(to, dword_count, Address::times_4, -4), rax);
+ __ jmp(L_copy_bytes);
+
+ // Copy trailing qwords
+ __ BIND(L_copy_8_bytes);
+ __ movq(rax, Address(from, qword_count, Address::times_8, -8));
+ __ movq(Address(to, qword_count, Address::times_8, -8), rax);
+ __ decrement(qword_count);
+ __ jcc(Assembler::notZero, L_copy_8_bytes);
+ }
if (is_oop) {
__ jmp(L_exit);
}
@@ -2031,8 +2065,12 @@
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
- // Copy in multi-bytes chunks
- copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
+ // Copy in multi-bytes chunks
+ copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
+ }
__ BIND(L_exit);
bs->arraycopy_epilogue(_masm, decorators, type, from, to, dword_count);
@@ -2102,20 +2140,23 @@
BasicType type = is_oop ? T_OBJECT : T_LONG;
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->arraycopy_prologue(_masm, decorators, type, from, to, qword_count);
-
- // Copy from low to high addresses. Use 'to' as scratch.
- __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
- __ lea(end_to, Address(to, qword_count, Address::times_8, -8));
- __ negptr(qword_count);
- __ jmp(L_copy_bytes);
-
- // Copy trailing qwords
- __ BIND(L_copy_8_bytes);
- __ movq(rax, Address(end_from, qword_count, Address::times_8, 8));
- __ movq(Address(end_to, qword_count, Address::times_8, 8), rax);
- __ increment(qword_count);
- __ jcc(Assembler::notZero, L_copy_8_bytes);
-
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
+
+ // Copy from low to high addresses. Use 'to' as scratch.
+ __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
+ __ lea(end_to, Address(to, qword_count, Address::times_8, -8));
+ __ negptr(qword_count);
+ __ jmp(L_copy_bytes);
+
+ // Copy trailing qwords
+ __ BIND(L_copy_8_bytes);
+ __ movq(rax, Address(end_from, qword_count, Address::times_8, 8));
+ __ movq(Address(end_to, qword_count, Address::times_8, 8), rax);
+ __ increment(qword_count);
+ __ jcc(Assembler::notZero, L_copy_8_bytes);
+ }
if (is_oop) {
__ jmp(L_exit);
} else {
@@ -2127,8 +2168,12 @@
__ ret(0);
}
- // Copy in multi-bytes chunks
- copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
+ // Copy in multi-bytes chunks
+ copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
+ }
__ BIND(L_exit);
bs->arraycopy_epilogue(_masm, decorators, type, from, to, qword_count);
@@ -2195,16 +2240,19 @@
BasicType type = is_oop ? T_OBJECT : T_LONG;
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->arraycopy_prologue(_masm, decorators, type, from, to, qword_count);
-
- __ jmp(L_copy_bytes);
-
- // Copy trailing qwords
- __ BIND(L_copy_8_bytes);
- __ movq(rax, Address(from, qword_count, Address::times_8, -8));
- __ movq(Address(to, qword_count, Address::times_8, -8), rax);
- __ decrement(qword_count);
- __ jcc(Assembler::notZero, L_copy_8_bytes);
-
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
+
+ __ jmp(L_copy_bytes);
+
+ // Copy trailing qwords
+ __ BIND(L_copy_8_bytes);
+ __ movq(rax, Address(from, qword_count, Address::times_8, -8));
+ __ movq(Address(to, qword_count, Address::times_8, -8), rax);
+ __ decrement(qword_count);
+ __ jcc(Assembler::notZero, L_copy_8_bytes);
+ }
if (is_oop) {
__ jmp(L_exit);
} else {
@@ -2215,10 +2263,13 @@
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
}
-
- // Copy in multi-bytes chunks
- copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
-
+ {
+ // UnsafeCopyMemory page error: continue after ucm
+ UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
+
+ // Copy in multi-bytes chunks
+ copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
+ }
__ BIND(L_exit);
bs->arraycopy_epilogue(_masm, decorators, type, from, to, qword_count);
restore_arg_regs_using_thread();
@@ -6036,6 +6087,10 @@
}
}; // end class declaration
+#define UCM_TABLE_MAX_ENTRIES 16
void StubGenerator_generate(CodeBuffer* code, bool all) {
+ if (UnsafeCopyMemory::_table == NULL) {
+ UnsafeCopyMemory::create_table(UCM_TABLE_MAX_ENTRIES);
+ }
StubGenerator g(code, all);
}
--- a/src/hotspot/os/windows/os_windows.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os/windows/os_windows.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -2581,10 +2581,18 @@
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
}
- if ((thread->thread_state() == _thread_in_vm &&
+
+ bool is_unsafe_arraycopy = (thread->thread_state() == _thread_in_native || in_java) && UnsafeCopyMemory::contains_pc(pc);
+ if (((thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native ||
+ is_unsafe_arraycopy) &&
thread->doing_unsafe_access()) ||
(nm != NULL && nm->has_unsafe_access())) {
- return Handle_Exception(exceptionInfo, SharedRuntime::handle_unsafe_access(thread, (address)Assembler::locate_next_instruction(pc)));
+ address next_pc = Assembler::locate_next_instruction(pc);
+ if (is_unsafe_arraycopy) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
+ return Handle_Exception(exceptionInfo, SharedRuntime::handle_unsafe_access(thread, next_pc));
}
}
--- a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -441,8 +441,12 @@
// underlying file has been truncated. Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = cb->as_compiled_method_or_null();
- if (nm != NULL && nm->has_unsafe_access()) {
+ bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
+ if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
address next_pc = pc + 4;
+ if (is_unsafe_arraycopy) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
os::Aix::ucontext_set_pc(uc, next_pc);
return 1;
@@ -461,9 +465,13 @@
stub = pc + 4; // continue with next instruction.
goto run_stub;
}
- else if (thread->thread_state() == _thread_in_vm &&
+ else if ((thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) &&
sig == SIGBUS && thread->doing_unsafe_access()) {
address next_pc = pc + 4;
+ if (UnsafeCopyMemory::contains_pc(pc)) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
os::Aix::ucontext_set_pc(uc, next_pc);
return 1;
--- a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -589,8 +589,12 @@
// Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
- if (nm != NULL && nm->has_unsafe_access()) {
+ bool is_unsafe_arraycopy = thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc);
+ if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
address next_pc = Assembler::locate_next_instruction(pc);
+ if (is_unsafe_arraycopy) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
}
@@ -659,10 +663,14 @@
// Determination of interpreter/vtable stub/compiled code null exception
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
}
- } else if (thread->thread_state() == _thread_in_vm &&
+ } else if ((thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) &&
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
thread->doing_unsafe_access()) {
address next_pc = Assembler::locate_next_instruction(pc);
+ if (UnsafeCopyMemory::contains_pc(pc)) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
--- a/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -193,7 +193,8 @@
/*if (thread->thread_state() == _thread_in_Java) {
ShouldNotCallThis();
}
- else*/ if (thread->thread_state() == _thread_in_vm &&
+ else*/ if ((thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) &&
sig == SIGBUS && thread->doing_unsafe_access()) {
ShouldNotCallThis();
}
--- a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -419,8 +419,12 @@
// Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
- if (nm != NULL && nm->has_unsafe_access()) {
+ bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
+ if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
address next_pc = pc + NativeCall::instruction_size;
+ if (is_unsafe_arraycopy) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
}
@@ -439,10 +443,14 @@
// Determination of interpreter/vtable stub/compiled code null exception
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
}
- } else if (thread->thread_state() == _thread_in_vm &&
+ } else if ((thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) &&
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
thread->doing_unsafe_access()) {
address next_pc = pc + NativeCall::instruction_size;
+ if (UnsafeCopyMemory::contains_pc(pc)) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -384,7 +384,7 @@
// Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
- if (nm != NULL && nm->has_unsafe_access()) {
+ if ((nm != NULL && nm->has_unsafe_access()) || (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc))) {
unsafe_access = true;
}
} else if (sig == SIGSEGV &&
@@ -398,7 +398,8 @@
// Zombie
stub = SharedRuntime::get_handle_wrong_method_stub();
}
- } else if (thread->thread_state() == _thread_in_vm &&
+ } else if ((thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) &&
sig == SIGBUS && thread->doing_unsafe_access()) {
unsafe_access = true;
}
@@ -418,6 +419,9 @@
// any other suitable exception reason,
// so assume it is an unsafe access.
address next_pc = pc + Assembler::InstructionSize;
+ if (UnsafeCopyMemory::contains_pc(pc)) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
#ifdef __thumb__
if (uc->uc_mcontext.arm_cpsr & PSR_T_BIT) {
next_pc = (address)((intptr_t)next_pc | 0x1);
--- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -469,8 +469,12 @@
// underlying file has been truncated. Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
- if (nm != NULL && nm->has_unsafe_access()) {
+ bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
+ if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
address next_pc = pc + 4;
+ if (is_unsafe_arraycopy) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
os::Linux::ucontext_set_pc(uc, next_pc);
return true;
@@ -485,11 +489,15 @@
// flushing of icache is not necessary.
stub = pc + 4; // continue with next instruction.
}
- else if (thread->thread_state() == _thread_in_vm &&
+ else if ((thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) &&
sig == SIGBUS && thread->doing_unsafe_access()) {
address next_pc = pc + 4;
+ if (UnsafeCopyMemory::contains_pc(pc)) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
- os::Linux::ucontext_set_pc(uc, pc + 4);
+ os::Linux::ucontext_set_pc(uc, next_pc);
return true;
}
}
--- a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -467,7 +467,8 @@
// when the vector facility is installed, but operating system support is missing.
VM_Version::reset_has_VectorFacility();
stub = pc; // Continue with next instruction.
- } else if (thread->thread_state() == _thread_in_vm &&
+ } else if ((thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) &&
sig == SIGBUS && thread->doing_unsafe_access()) {
// We don't really need a stub here! Just set the pending exeption and
// continue at the next instruction after the faulting read. Returning
--- a/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -385,7 +385,11 @@
// Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = cb->as_compiled_method_or_null();
- if (nm != NULL && nm->has_unsafe_access()) {
+ bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
+ if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
+ if (is_unsafe_arraycopy) {
+ npc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
*stub = SharedRuntime::handle_unsafe_access(thread, npc);
return true;
}
@@ -550,8 +554,12 @@
}
if (sig == SIGBUS &&
- thread->thread_state() == _thread_in_vm &&
+ (thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) &&
thread->doing_unsafe_access()) {
+ if (UnsafeCopyMemory::contains_pc(pc)) {
+ npc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
stub = SharedRuntime::handle_unsafe_access(thread, npc);
}
--- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -435,8 +435,12 @@
// Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
- if (nm != NULL && nm->has_unsafe_access()) {
+ bool is_unsafe_arraycopy = thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc);
+ if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
address next_pc = Assembler::locate_next_instruction(pc);
+ if (is_unsafe_arraycopy) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
}
@@ -483,10 +487,14 @@
// Determination of interpreter/vtable stub/compiled code null exception
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
}
- } else if (thread->thread_state() == _thread_in_vm &&
- sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
- thread->doing_unsafe_access()) {
+ } else if ((thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) &&
+ (sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
+ thread->doing_unsafe_access())) {
address next_pc = Assembler::locate_next_instruction(pc);
+ if (UnsafeCopyMemory::contains_pc(pc)) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
--- a/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -207,7 +207,8 @@
/*if (thread->thread_state() == _thread_in_Java) {
ShouldNotCallThis();
}
- else*/ if (thread->thread_state() == _thread_in_vm &&
+ else*/ if ((thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) &&
sig == SIGBUS && thread->doing_unsafe_access()) {
ShouldNotCallThis();
}
--- a/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -436,8 +436,12 @@
}
- if (thread->thread_state() == _thread_in_vm) {
+ if (thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) {
if (sig == SIGBUS && thread->doing_unsafe_access()) {
+ if (UnsafeCopyMemory::contains_pc(pc)) {
+ npc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
stub = SharedRuntime::handle_unsafe_access(thread, npc);
}
}
@@ -476,7 +480,11 @@
// Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = cb->as_compiled_method_or_null();
- if (nm != NULL && nm->has_unsafe_access()) {
+ bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
+ if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
+ if (is_unsafe_arraycopy) {
+ npc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
stub = SharedRuntime::handle_unsafe_access(thread, npc);
}
}
--- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -517,9 +517,13 @@
stub = VM_Version::cpuinfo_cont_addr();
}
- if (thread->thread_state() == _thread_in_vm) {
+ if (thread->thread_state() == _thread_in_vm ||
+ thread->thread_state() == _thread_in_native) {
if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) {
address next_pc = Assembler::locate_next_instruction(pc);
+ if (UnsafeCopyMemory::contains_pc(pc)) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
}
@@ -536,8 +540,12 @@
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
if (cb != NULL) {
CompiledMethod* nm = cb->as_compiled_method_or_null();
- if (nm != NULL && nm->has_unsafe_access()) {
+ bool is_unsafe_arraycopy = thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc);
+ if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy)) {
address next_pc = Assembler::locate_next_instruction(pc);
+ if (is_unsafe_arraycopy) {
+ next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
+ }
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
}
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -609,12 +609,6 @@
return JVMCIENV->get_jobject(result);
}
-C2V_VMENTRY_NULL(jobject, resolveConstantInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index))
- constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool);
- oop result = cp->resolve_constant_at(index, CHECK_NULL);
- return JVMCIENV->get_jobject(JVMCIENV->get_object_constant(result));
-C2V_END
-
C2V_VMENTRY_NULL(jobject, resolvePossiblyCachedConstantInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index))
constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool);
oop result = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL);
@@ -2673,7 +2667,6 @@
{CC "lookupAppendixInPool", CC "(" HS_CONSTANT_POOL "I)" OBJECTCONSTANT, FN_PTR(lookupAppendixInPool)},
{CC "lookupMethodInPool", CC "(" HS_CONSTANT_POOL "IB)" HS_RESOLVED_METHOD, FN_PTR(lookupMethodInPool)},
{CC "constantPoolRemapInstructionOperandFromCache", CC "(" HS_CONSTANT_POOL "I)I", FN_PTR(constantPoolRemapInstructionOperandFromCache)},
- {CC "resolveConstantInPool", CC "(" HS_CONSTANT_POOL "I)" OBJECTCONSTANT, FN_PTR(resolveConstantInPool)},
{CC "resolvePossiblyCachedConstantInPool", CC "(" HS_CONSTANT_POOL "I)" OBJECTCONSTANT, FN_PTR(resolvePossiblyCachedConstantInPool)},
{CC "resolveTypeInPool", CC "(" HS_CONSTANT_POOL "I)" HS_RESOLVED_KLASS, FN_PTR(resolveTypeInPool)},
{CC "resolveFieldInPool", CC "(" HS_CONSTANT_POOL "I" HS_RESOLVED_METHOD "B[I)" HS_RESOLVED_KLASS, FN_PTR(resolveFieldInPool)},
--- a/src/hotspot/share/opto/library_call.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/share/opto/library_call.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -4240,6 +4240,14 @@
// Do not let writes of the copy source or destination float below the copy.
insert_mem_bar(Op_MemBarCPUOrder);
+ Node* thread = _gvn.transform(new ThreadLocalNode());
+ Node* doing_unsafe_access_addr = basic_plus_adr(top(), thread, in_bytes(JavaThread::doing_unsafe_access_offset()));
+ BasicType doing_unsafe_access_bt = T_BYTE;
+ assert((sizeof(bool) * CHAR_BIT) == 8, "not implemented");
+
+ // update volatile field
+ store_to_memory(control(), doing_unsafe_access_addr, intcon(1), doing_unsafe_access_bt, Compile::AliasIdxRaw, MemNode::unordered);
+
// Call it. Note that the length argument is not scaled.
make_runtime_call(RC_LEAF|RC_NO_FP,
OptoRuntime::fast_arraycopy_Type(),
@@ -4248,6 +4256,8 @@
TypeRawPtr::BOTTOM,
src, dst, size XTOP);
+ store_to_memory(control(), doing_unsafe_access_addr, intcon(0), doing_unsafe_access_bt, Compile::AliasIdxRaw, MemNode::unordered);
+
// Do not let reads of the copy destination float above the copy.
insert_mem_bar(Op_MemBarCPUOrder);
--- a/src/hotspot/share/prims/unsafe.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/share/prims/unsafe.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -149,6 +149,25 @@
///// Data read/writes on the Java heap and in native (off-heap) memory
/**
+ * Helper class to wrap memory accesses in JavaThread::doing_unsafe_access()
+ */
+class GuardUnsafeAccess {
+ JavaThread* _thread;
+
+public:
+ GuardUnsafeAccess(JavaThread* thread) : _thread(thread) {
+ // native/off-heap access which may raise SIGBUS if accessing
+ // memory mapped file data in a region of the file which has
+ // been truncated and is now invalid.
+ _thread->set_doing_unsafe_access(true);
+ }
+
+ ~GuardUnsafeAccess() {
+ _thread->set_doing_unsafe_access(false);
+ }
+};
+
+/**
* Helper class for accessing memory.
*
* Normalizes values and wraps accesses in
@@ -189,25 +208,6 @@
return x != 0;
}
- /**
- * Helper class to wrap memory accesses in JavaThread::doing_unsafe_access()
- */
- class GuardUnsafeAccess {
- JavaThread* _thread;
-
- public:
- GuardUnsafeAccess(JavaThread* thread) : _thread(thread) {
- // native/off-heap access which may raise SIGBUS if accessing
- // memory mapped file data in a region of the file which has
- // been truncated and is now invalid
- _thread->set_doing_unsafe_access(true);
- }
-
- ~GuardUnsafeAccess() {
- _thread->set_doing_unsafe_access(false);
- }
- };
-
public:
MemoryAccess(JavaThread* thread, jobject obj, jlong offset)
: _thread(thread), _obj(JNIHandles::resolve(obj)), _offset((ptrdiff_t)offset) {
@@ -399,8 +399,14 @@
void* src = index_oop_from_field_offset_long(srcp, srcOffset);
void* dst = index_oop_from_field_offset_long(dstp, dstOffset);
-
- Copy::conjoint_memory_atomic(src, dst, sz);
+ {
+ GuardUnsafeAccess guard(thread);
+ if (StubRoutines::unsafe_arraycopy() != NULL) {
+ StubRoutines::UnsafeArrayCopy_stub()(src, dst, sz);
+ } else {
+ Copy::conjoint_memory_atomic(src, dst, sz);
+ }
+ }
} UNSAFE_END
// This function is a leaf since if the source and destination are both in native memory
@@ -416,7 +422,11 @@
address src = (address)srcOffset;
address dst = (address)dstOffset;
- Copy::conjoint_swap(src, dst, sz, esz);
+ {
+ JavaThread* thread = JavaThread::thread_from_jni_environment(env);
+ GuardUnsafeAccess guard(thread);
+ Copy::conjoint_swap(src, dst, sz, esz);
+ }
} else {
// At least one of src/dst are on heap, transition to VM to access raw pointers
@@ -427,7 +437,10 @@
address src = (address)index_oop_from_field_offset_long(srcp, srcOffset);
address dst = (address)index_oop_from_field_offset_long(dstp, dstOffset);
- Copy::conjoint_swap(src, dst, sz, esz);
+ {
+ GuardUnsafeAccess guard(thread);
+ Copy::conjoint_swap(src, dst, sz, esz);
+ }
} JVM_END
}
} UNSAFE_END
--- a/src/hotspot/share/runtime/sharedRuntime.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/share/runtime/sharedRuntime.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2020,7 +2020,7 @@
const char* caster_name = caster_klass->external_name();
assert(target_klass != NULL || target_klass_name != NULL, "one must be provided");
- const char* target_name = target_klass == NULL ? target_klass_name->as_C_string() :
+ const char* target_name = target_klass == NULL ? target_klass_name->as_klass_external_name() :
target_klass->external_name();
size_t msglen = strlen(caster_name) + strlen("class ") + strlen(" cannot be cast to class ") + strlen(target_name) + 1;
--- a/src/hotspot/share/runtime/stubRoutines.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/share/runtime/stubRoutines.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -38,6 +38,10 @@
#include "opto/runtime.hpp"
#endif
+UnsafeCopyMemory* UnsafeCopyMemory::_table = NULL;
+int UnsafeCopyMemory::_table_length = 0;
+int UnsafeCopyMemory::_table_max_length = 0;
+address UnsafeCopyMemory::_common_exit_stub_pc = NULL;
// Implementation of StubRoutines - for a description
// of how to extend it, see the header file.
@@ -113,7 +117,6 @@
address StubRoutines::_unsafe_arraycopy = NULL;
address StubRoutines::_generic_arraycopy = NULL;
-
address StubRoutines::_jbyte_fill;
address StubRoutines::_jshort_fill;
address StubRoutines::_jint_fill;
@@ -177,6 +180,31 @@
extern void StubGenerator_generate(CodeBuffer* code, bool all); // only interface to generators
+void UnsafeCopyMemory::create_table(int max_size) {
+ UnsafeCopyMemory::_table = new UnsafeCopyMemory[max_size];
+ UnsafeCopyMemory::_table_max_length = max_size;
+}
+
+bool UnsafeCopyMemory::contains_pc(address pc) {
+ for (int i = 0; i < UnsafeCopyMemory::_table_length; i++) {
+ UnsafeCopyMemory* entry = &UnsafeCopyMemory::_table[i];
+ if (pc >= entry->start_pc() && pc < entry->end_pc()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+address UnsafeCopyMemory::page_error_continue_pc(address pc) {
+ for (int i = 0; i < UnsafeCopyMemory::_table_length; i++) {
+ UnsafeCopyMemory* entry = &UnsafeCopyMemory::_table[i];
+ if (pc >= entry->start_pc() && pc < entry->end_pc()) {
+ return entry->error_exit_pc();
+ }
+ }
+ return NULL;
+}
+
void StubRoutines::initialize1() {
if (_code1 == NULL) {
ResourceMark rm;
@@ -569,3 +597,25 @@
#undef RETURN_STUB
#undef RETURN_STUB_PARM
}
+
+UnsafeCopyMemoryMark::UnsafeCopyMemoryMark(StubCodeGenerator* cgen, bool add_entry, bool continue_at_scope_end, address error_exit_pc) {
+ _cgen = cgen;
+ _ucm_entry = NULL;
+ if (add_entry) {
+ address err_exit_pc = NULL;
+ if (!continue_at_scope_end) {
+ err_exit_pc = error_exit_pc != NULL ? error_exit_pc : UnsafeCopyMemory::common_exit_stub_pc();
+ }
+ assert(err_exit_pc != NULL || continue_at_scope_end, "error exit not set");
+ _ucm_entry = UnsafeCopyMemory::add_to_table(_cgen->assembler()->pc(), NULL, err_exit_pc);
+ }
+}
+
+UnsafeCopyMemoryMark::~UnsafeCopyMemoryMark() {
+ if (_ucm_entry != NULL) {
+ _ucm_entry->set_end_pc(_cgen->assembler()->pc());
+ if (_ucm_entry->error_exit_pc() == NULL) {
+ _ucm_entry->set_error_exit_pc(_cgen->assembler()->pc());
+ }
+ }
+}
--- a/src/hotspot/share/runtime/stubRoutines.hpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/share/runtime/stubRoutines.hpp Wed Jun 26 12:12:25 2019 +0530
@@ -74,6 +74,51 @@
// 4. implement the corresponding generator function in the platform-dependent
// stubGenerator_<arch>.cpp file and call the function in generate_all() of that file
+class UnsafeCopyMemory : public CHeapObj<mtCode> {
+ private:
+ address _start_pc;
+ address _end_pc;
+ address _error_exit_pc;
+ public:
+ static address _common_exit_stub_pc;
+ static UnsafeCopyMemory* _table;
+ static int _table_length;
+ static int _table_max_length;
+ UnsafeCopyMemory() : _start_pc(NULL), _end_pc(NULL), _error_exit_pc(NULL) {}
+ void set_start_pc(address pc) { _start_pc = pc; }
+ void set_end_pc(address pc) { _end_pc = pc; }
+ void set_error_exit_pc(address pc) { _error_exit_pc = pc; }
+ address start_pc() const { return _start_pc; }
+ address end_pc() const { return _end_pc; }
+ address error_exit_pc() const { return _error_exit_pc; }
+
+ static void set_common_exit_stub_pc(address pc) { _common_exit_stub_pc = pc; }
+ static address common_exit_stub_pc() { return _common_exit_stub_pc; }
+
+ static UnsafeCopyMemory* add_to_table(address start_pc, address end_pc, address error_exit_pc) {
+ guarantee(_table_length < _table_max_length, "Incorrect UnsafeCopyMemory::_table_max_length");
+ UnsafeCopyMemory* entry = &_table[_table_length];
+ entry->set_start_pc(start_pc);
+ entry->set_end_pc(end_pc);
+ entry->set_error_exit_pc(error_exit_pc);
+
+ _table_length++;
+ return entry;
+ }
+
+ static bool contains_pc(address pc);
+ static address page_error_continue_pc(address pc);
+ static void create_table(int max_size);
+};
+
+class UnsafeCopyMemoryMark : public StackObj {
+ private:
+ UnsafeCopyMemory* _ucm_entry;
+ StubCodeGenerator* _cgen;
+ public:
+ UnsafeCopyMemoryMark(StubCodeGenerator* cgen, bool add_entry, bool continue_at_scope_end, address error_exit_pc = NULL);
+ ~UnsafeCopyMemoryMark();
+};
class StubRoutines: AllStatic {
@@ -310,11 +355,14 @@
static address arrayof_oop_disjoint_arraycopy(bool dest_uninitialized = false) {
return dest_uninitialized ? _arrayof_oop_disjoint_arraycopy_uninit : _arrayof_oop_disjoint_arraycopy;
}
-
static address checkcast_arraycopy(bool dest_uninitialized = false) {
return dest_uninitialized ? _checkcast_arraycopy_uninit : _checkcast_arraycopy;
}
- static address unsafe_arraycopy() { return _unsafe_arraycopy; }
+ static address unsafe_arraycopy() { return _unsafe_arraycopy; }
+
+ typedef void (*UnsafeArrayCopyStub)(const void* src, void* dst, size_t count);
+ static UnsafeArrayCopyStub UnsafeArrayCopy_stub() { return CAST_TO_FN_PTR(UnsafeArrayCopyStub, _unsafe_arraycopy); }
+
static address generic_arraycopy() { return _generic_arraycopy; }
static address jbyte_fill() { return _jbyte_fill; }
--- a/src/hotspot/share/runtime/thread.hpp Tue Jun 25 16:21:42 2019 +0530
+++ b/src/hotspot/share/runtime/thread.hpp Wed Jun 26 12:12:25 2019 +0530
@@ -1794,6 +1794,7 @@
static ByteSize should_post_on_exceptions_flag_offset() {
return byte_offset_of(JavaThread, _should_post_on_exceptions_flag);
}
+ static ByteSize doing_unsafe_access_offset() { return byte_offset_of(JavaThread, _doing_unsafe_access); }
// Returns the jni environment for this thread
JNIEnv* jni_environment() { return &_jni_environment; }
--- a/src/java.base/aix/native/libjli/java_md_aix.c Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.base/aix/native/libjli/java_md_aix.c Wed Jun 26 12:12:25 2019 +0530
@@ -27,7 +27,7 @@
#include "java_md_aix.h"
-static unsigned char dladdr_buffer[0x4000];
+static unsigned char dladdr_buffer[0x8000];
static int fill_dll_info(void) {
return loadquery(L_GETINFO, dladdr_buffer, sizeof(dladdr_buffer));
--- a/src/java.base/share/classes/com/sun/crypto/provider/PBES1Core.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.base/share/classes/com/sun/crypto/provider/PBES1Core.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -268,17 +268,20 @@
if (algo.equals("DES")) {
// P || S (password concatenated with salt)
- byte[] concat = new byte[Math.addExact(passwdBytes.length, salt.length)];
- System.arraycopy(passwdBytes, 0, concat, 0, passwdBytes.length);
- System.arraycopy(salt, 0, concat, passwdBytes.length, salt.length);
-
- // digest P || S with c iterations
- byte[] toBeHashed = concat;
- for (int i = 0; i < iCount; i++) {
+ md.update(passwdBytes);
+ md.update(salt);
+ // digest P || S with iCount iterations
+ // first iteration
+ byte[] toBeHashed = md.digest(); // this resets the digest
+ // remaining (iCount - 1) iterations
+ for (int i = 1; i < iCount; ++i) {
md.update(toBeHashed);
- toBeHashed = md.digest(); // this resets the digest
+ try {
+ md.digest(toBeHashed, 0, toBeHashed.length);
+ } catch (DigestException e) {
+ throw new ProviderException("Internal error", e);
+ }
}
- Arrays.fill(concat, (byte)0x00);
result = toBeHashed;
} else if (algo.equals("DESede")) {
// if the 2 salt halves are the same, invert one of them
@@ -305,13 +308,19 @@
result = new byte[DESedeKeySpec.DES_EDE_KEY_LEN +
DESConstants.DES_BLOCK_SIZE];
for (i = 0; i < 2; i++) {
- toBeHashed = new byte[salt.length/2];
- System.arraycopy(salt, i*(salt.length/2), toBeHashed, 0,
- toBeHashed.length);
- for (int j=0; j < iCount; j++) {
+ // first iteration
+ md.update(salt, i * (salt.length / 2), salt.length / 2);
+ md.update(passwdBytes);
+ toBeHashed = md.digest();
+ // remaining (iCount - 1) iterations
+ for (int j = 1; j < iCount; ++j) {
md.update(toBeHashed);
md.update(passwdBytes);
- toBeHashed = md.digest();
+ try {
+ md.digest(toBeHashed, 0, toBeHashed.length);
+ } catch (DigestException e) {
+ throw new ProviderException("Internal error", e);
+ }
}
System.arraycopy(toBeHashed, 0, result, i*16,
toBeHashed.length);
--- a/src/java.base/share/classes/java/util/regex/Pattern.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.base/share/classes/java/util/regex/Pattern.java Wed Jun 26 12:12:25 2019 +0530
@@ -357,11 +357,11 @@
* <a href="#UNIX_LINES">d</a> <a href="#MULTILINE">m</a> <a href="#DOTALL">s</a>
* <a href="#UNICODE_CASE">u</a> <a href="#COMMENTS">x</a> <a href="#UNICODE_CHARACTER_CLASS">U</a>
* on - off</td></tr>
- * <tr><th style="vertical-align:top; font-weight:normal" id="non_capture_group_flags"><code>(?idmsux-idmsux:</code><i>X</i>{@code )} </th>
+ * <tr><th style="vertical-align:top; font-weight:normal" id="non_capture_group_flags"><code>(?idmsuxU-idmsuxU:</code><i>X</i>{@code )} </th>
* <td headers="matches special non_capture_group_flags"><i>X</i>, as a <a href="#cg">non-capturing group</a> with the
* given flags <a href="#CASE_INSENSITIVE">i</a> <a href="#UNIX_LINES">d</a>
* <a href="#MULTILINE">m</a> <a href="#DOTALL">s</a> <a href="#UNICODE_CASE">u</a >
- * <a href="#COMMENTS">x</a> on - off</td></tr>
+ * <a href="#COMMENTS">x</a> <a href="#UNICODE_CHARACTER_CLASS">U</a> on - off</td></tr>
* <tr><th style="vertical-align:top; font-weight:normal" id="pos_lookahead">{@code (?=}<i>X</i>{@code )}</th>
* <td headers="matches special pos_lookahead"><i>X</i>, via zero-width positive lookahead</td></tr>
* <tr><th style="vertical-align:top; font-weight:normal" id="neg_lookahead">{@code (?!}<i>X</i>{@code )}</th>
--- a/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -127,9 +127,10 @@
*
* @param algorithm the standard name of the requested algorithm.
* See the <a href=
- * "{@docRoot}/../specs/security/standard-names.html">
- * Java Security Standard Algorithm Names</a> document
- * for information about standard algorithm names.
+ * "{@docRoot}/../specs/security/standard-names.html#keymanagerfactory-algorithms">
+ * KeyManagerFactory section</a> in the Java Security Standard
+ * Algorithm Names Specification for information about standard
+ * algorithm names.
*
* @return the new {@code KeyManagerFactory} object
*
@@ -165,9 +166,10 @@
* @param algorithm the standard name of the requested algorithm.
* See the <a href=
- * "{@docRoot}/../specs/security/standard-names.html">
- * Java Security Standard Algorithm Names</a> document
- * for information about standard algorithm names.
+ * "{@docRoot}/../specs/security/standard-names.html#keymanagerfactory-algorithms">
+ * KeyManagerFactory section</a> in the Java Security Standard
+ * Algorithm Names Specification for information about standard
+ * algorithm names.
*
* @param provider the name of the provider.
*
@@ -209,9 +211,10 @@
*
* @param algorithm the standard name of the requested algorithm.
* See the <a href=
- * "{@docRoot}/../specs/security/standard-names.html">
- * Java Security Standard Algorithm Names</a> document
- * for information about standard algorithm names.
+ * "{@docRoot}/../specs/security/standard-names.html#keymanagerfactory-algorithms">
+ * KeyManagerFactory section</a> in the Java Security Standard
+ * Algorithm Names Specification for information about standard
+ * algorithm names.
*
* @param provider an instance of the provider.
*
--- a/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -141,9 +141,10 @@
*
* @param algorithm the standard name of the requested trust management
* algorithm. See the <a href=
- * "{@docRoot}/../specs/security/standard-names.html">
- * Java Security Standard Algorithm Names</a> document
- * for information about standard algorithm names.
+ * "{@docRoot}/../specs/security/standard-names.html#trustmanagerfactory-algorithms">
+ * TrustManagerFactory section</a> in the Java Security Standard
+ * Algorithm Names Specification for information about standard
+ * algorithm names.
*
* @return the new {@code TrustManagerFactory} object
*
@@ -179,9 +180,10 @@
*
* @param algorithm the standard name of the requested trust management
* algorithm. See the <a href=
- * "{@docRoot}/../specs/security/standard-names.html">
- * Java Security Standard Algorithm Names</a> document
- * for information about standard algorithm names.
+ * "{@docRoot}/../specs/security/standard-names.html#trustmanagerfactory-algorithms">
+ * TrustManagerFactory section</a> in the Java Security Standard
+ * Algorithm Names Specification for information about standard
+ * algorithm names.
*
* @param provider the name of the provider.
*
@@ -223,9 +225,10 @@
*
* @param algorithm the standard name of the requested trust management
* algorithm. See the <a href=
- * "{@docRoot}/../specs/security/standard-names.html">
- * Java Security Standard Algorithm Names</a> document
- * for information about standard algorithm names.
+ * "{@docRoot}/../specs/security/standard-names.html#trustmanagerfactory-algorithms">
+ * TrustManagerFactory section</a> in the Java Security Standard
+ * Algorithm Names Specification for information about standard
+ * algorithm names.
*
* @param provider an instance of the provider.
*
--- a/src/java.desktop/aix/native/libawt/porting_aix.c Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.desktop/aix/native/libawt/porting_aix.c Wed Jun 26 12:12:25 2019 +0530
@@ -30,7 +30,7 @@
#include "porting_aix.h"
-static unsigned char dladdr_buffer[0x4000];
+static unsigned char dladdr_buffer[0x8000];
static void fill_dll_info(void) {
int rc = loadquery(L_GETINFO,dladdr_buffer, sizeof(dladdr_buffer));
--- a/src/java.desktop/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.desktop/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html Wed Jun 26 12:12:25 2019 +0530
@@ -2,10 +2,10 @@
<html lang="en">
<head>
<meta charset="utf-8"/>
- <title>Nimbus colors</title>
+ <title>Colors Used in Nimbus Look and Feel</title>
</head>
<!--
- Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@@ -31,212 +31,208 @@
<body>
<main role="main">
-<h1 id="primaryColors">Primary Colors</h1>
+<h1>Colors Used in Nimbus Look and Feel</h1>
+<h2 id="primaryColors">Primary Colors</h2>
<table>
-<caption>Primary colors used in Nimbus Look And Feel</caption>
+<caption style="display:none">Primary colors used in Nimbus Look And Feel
+</caption>
<thead>
-<tr><th>Key</th><th>Value</th><th>Preview</th></tr>
-</thead>
-<tbody>
<tr>
-<td width="250"><code>control</code></td>
-<td><pre>#d6d9df (214,217,223)</pre></td>
-
-<td width="100" bgcolor="#d6d9df"> </td>
+ <th scope="col">Key</th>
+ <th scope="col">Value</th>
+ <th scope="col">Preview</th>
</tr>
+</thead>
+<tbody style="text-align:left">
<tr>
-<td width="250"><code>info</code></td>
-<td><pre>#f2f2bd (242,242,189)</pre></td>
-<td width="100" bgcolor="#f2f2bd"> </td>
+<th scope="row" width="250"><code>control</code></th>
+<td><pre>#d6d9df (214,217,223)</pre></td>
+<td width="100" bgcolor="#d6d9df" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>nimbusAlertYellow</code></td>
-<td><pre>#ffdc23 (255,220,35)</pre></td>
-<td width="100" bgcolor="#ffdc23"> </td>
+<th scope="row" width="250"><code>info</code></th>
+<td><pre>#f2f2bd (242,242,189)</pre></td>
+<td width="100" bgcolor="#f2f2bd" aria-label="Color preview"> </td>
</tr>
<tr>
-
-<td width="250"><code>nimbusBase</code></td>
-<td><pre>#33628c (51,98,140)</pre></td>
-<td width="100" bgcolor="#33628c"> </td>
+<th scope="row" width="250"><code>nimbusAlertYellow</code></th>
+<td><pre>#ffdc23 (255,220,35)</pre></td>
+<td width="100" bgcolor="#ffdc23" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>nimbusDisabledText</code></td>
-<td><pre>#8e8f91 (142,143,145)</pre></td>
-<td width="100" bgcolor="#8e8f91"> </td>
+<th scope="row" width="250"><code>nimbusBase</code></th>
+<td><pre>#33628c (51,98,140)</pre></td>
+<td width="100" bgcolor="#33628c" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>nimbusFocus</code></td>
-<td><pre>#73a4d1 (115,164,209)</pre></td>
-
-<td width="100" bgcolor="#73a4d1"> </td>
+<th scope="row" width="250"><code>nimbusDisabledText</code></th>
+<td><pre>#8e8f91 (142,143,145)</pre></td>
+<td width="100" bgcolor="#8e8f91" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>nimbusGreen</code></td>
-<td><pre>#b0b332 (176,179,50)</pre></td>
-<td width="100" bgcolor="#b0b332"> </td>
-</tr>
-<tr>
-<td width="250"><code>nimbusInfoBlue</code></td>
-<td><pre>#2f5cb4 (47,92,180)</pre></td>
-<td width="100" bgcolor="#2f5cb4"> </td>
+<th scope="row" width="250"><code>nimbusFocus</code></th>
+<td><pre>#73a4d1 (115,164,209)</pre></td>
+<td width="100" bgcolor="#73a4d1" aria-label="Color preview"> </td>
</tr>
<tr>
-
-<td width="250"><code>nimbusLightBackground</code></td>
-<td><pre>#ffffff (255,255,255)</pre></td>
-<td width="100" bgcolor="#ffffff"> </td>
+<th scope="row" width="250"><code>nimbusGreen</code></th>
+<td><pre>#b0b332 (176,179,50)</pre></td>
+<td width="100" bgcolor="#b0b332" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>nimbusOrange</code></td>
-<td><pre>#bf6204 (191,98,4)</pre></td>
-<td width="100" bgcolor="#bf6204"> </td>
+<th scope="row" width="250"><code>nimbusInfoBlue</code></th>
+<td><pre>#2f5cb4 (47,92,180)</pre></td>
+<td width="100" bgcolor="#2f5cb4" aria-label="Color preview"> </td>
+</tr>
+<tr>
+<th scope="row" width="250"><code>nimbusLightBackground</code></th>
+<td><pre>#ffffff (255,255,255)</pre></td>
+<td width="100" bgcolor="#ffffff" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>nimbusRed</code></td>
+<th scope="row" width="250"><code>nimbusOrange</code></th>
+<td><pre>#bf6204 (191,98,4)</pre></td>
+<td width="100" bgcolor="#bf6204" aria-label="Color preview"> </td>
+</tr>
+<tr>
+<th scope="row" width="250"><code>nimbusRed</code></th>
<td><pre>#a92e22 (169,46,34)</pre></td>
-
-<td width="100" bgcolor="#a92e22"> </td>
+<td width="100" bgcolor="#a92e22" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>nimbusSelectedText</code></td>
+<th scope="row" width="250"><code>nimbusSelectedText</code></th>
<td><pre>#ffffff (255,255,255)</pre></td>
-<td width="100" bgcolor="#ffffff"> </td>
+<td width="100" bgcolor="#ffffff" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>nimbusSelectionBackground</code></td>
+<th scope="row" width="250"><code>nimbusSelectionBackground</code></th>
<td><pre>#39698a (57,105,138)</pre></td>
-<td width="100" bgcolor="#39698a"> </td>
+<td width="100" bgcolor="#39698a" aria-label="Color preview"> </td>
</tr>
<tr>
-
-<td width="250"><code>text</code></td>
+<th scope="row" width="250"><code>text</code></th>
<td><pre>#000000 (0,0,0)</pre></td>
-<td width="100" bgcolor="#000000"> </td>
+<td width="100" bgcolor="#000000" aria-label="Color preview"> </td>
</tr>
</tbody>
</table>
-<h1 id="secondaryColors">Secondary Colors</h1>
+<h2 id="secondaryColors">Secondary Colors</h2>
<table>
-<caption>Secondary colors used in Nimbus Look And Feel </caption>
+<caption style="display:none">Secondary colors used in Nimbus Look And Feel
+</caption>
<thead>
-<tr><th>Key</th><th>Value</th><th>Preview</th></tr>
+<tr>
+ <th scope="col">Key</th>
+ <th scope="col">Value</th>
+ <th scope="col">Preview</th>
+</tr>
</thead>
-<tbody>
+<tbody style="text-align:left">
<tr>
-<td width="250"><code>activeCaption</code></td>
-
+<th scope="row" width="250"><code>activeCaption</code></th>
<td><pre>#babec6 (186,190,198)</pre></td>
-<td width="100" bgcolor="#babec6"> </td>
+<td width="100" bgcolor="#babec6" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>background</code></td>
+<th scope="row" width="250"><code>background</code></th>
<td><pre>#d6d9df (214,217,223)</pre></td>
-<td width="100" bgcolor="#d6d9df"> </td>
+<td width="100" bgcolor="#d6d9df" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>controlDkShadow</code></td>
+<th scope="row" width="250"><code>controlDkShadow</code></th>
<td><pre>#a4abb8 (164,171,184)</pre></td>
-<td width="100" bgcolor="#a4abb8"> </td>
-
+<td width="100" bgcolor="#a4abb8" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>controlHighlight</code></td>
+<th scope="row" width="250"><code>controlHighlight</code></th>
<td><pre>#e9ecf2 (233,236,242)</pre></td>
-<td width="100" bgcolor="#e9ecf2"> </td>
+<td width="100" bgcolor="#e9ecf2" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>controlLHighlight</code></td>
+<th scope="row" width="250"><code>controlLHighlight</code></th>
<td><pre>#f7f8fa (247,248,250)</pre></td>
-<td width="100" bgcolor="#f7f8fa"> </td>
+<td width="100" bgcolor="#f7f8fa" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>controlShadow</code></td>
-
+<th scope="row" width="250"><code>controlShadow</code></th>
<td><pre>#ccd3e0 (204,211,224)</pre></td>
-<td width="100" bgcolor="#ccd3e0"> </td>
+<td width="100" bgcolor="#ccd3e0" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>controlText</code></td>
+<th scope="row" width="250"><code>controlText</code></th>
<td><pre>#000000 (0,0,0)</pre></td>
-<td width="100" bgcolor="#000000"> </td>
+<td width="100" bgcolor="#000000" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>desktop</code></td>
+<th scope="row" width="250"><code>desktop</code></th>
<td><pre>#3d6079 (61,96,121)</pre></td>
-<td width="100" bgcolor="#3d6079"> </td>
-
+<td width="100" bgcolor="#3d6079" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>inactiveCaption</code></td>
+<th scope="row" width="250"><code>inactiveCaption</code></th>
<td><pre>#bdc1c8 (189,193,200)</pre></td>
-<td width="100" bgcolor="#bdc1c8"> </td>
+<td width="100" bgcolor="#bdc1c8" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>infoText</code></td>
+<th scope="row" width="250"><code>infoText</code></th>
<td><pre>#000000 (0,0,0)</pre></td>
-<td width="100" bgcolor="#000000"> </td>
+<td width="100" bgcolor="#000000" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>menu</code></td>
-
+<th scope="row" width="250"><code>menu</code></th>
<td><pre>#edeff2 (237,239,242)</pre></td>
-<td width="100" bgcolor="#edeff2"> </td>
+<td width="100" bgcolor="#edeff2" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>menuText</code></td>
+<th scope="row" width="250"><code>menuText</code></th>
<td><pre>#000000 (0,0,0)</pre></td>
-<td width="100" bgcolor="#000000"> </td>
+<td width="100" bgcolor="#000000" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>nimbusBlueGrey</code></td>
+<th scope="row" width="250"><code>nimbusBlueGrey</code></th>
<td><pre>#a9b0be (169,176,190)</pre></td>
-<td width="100" bgcolor="#a9b0be"> </td>
-
+<td width="100" bgcolor="#a9b0be" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>nimbusBorder</code></td>
+<th scope="row" width="250"><code>nimbusBorder</code></th>
<td><pre>#9297a1 (146,151,161)</pre></td>
-<td width="100" bgcolor="#9297a1"> </td>
-</tr>
-<tr>
-<td width="250"><code>nimbusSelection</code></td>
-<td><pre>#39698a (57,105,138)</pre></td>
-<td width="100" bgcolor="#39698a"> </td>
+<td width="100" bgcolor="#9297a1" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>scrollbar</code></td>
-
-<td><pre>#cdd0d5 (205,208,213)</pre></td>
-<td width="100" bgcolor="#cdd0d5"> </td>
+<th scope="row" width="250"><code>nimbusSelection</code></th>
+<td><pre>#39698a (57,105,138)</pre></td>
+<td width="100" bgcolor="#39698a" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>textBackground</code></td>
+<th scope="row" width="250"><code>scrollbar</code></th>
+<td><pre>#cdd0d5 (205,208,213)</pre></td>
+<td width="100" bgcolor="#cdd0d5" aria-label="Color preview"> </td>
+</tr>
+<tr>
+<th scope="row" width="250"><code>textBackground</code></th>
<td><pre>#39698a (57,105,138)</pre></td>
-<td width="100" bgcolor="#39698a"> </td>
+<td width="100" bgcolor="#39698a" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>textForeground</code></td>
+<th scope="row" width="250"><code>textForeground</code></th>
<td><pre>#000000 (0,0,0)</pre></td>
-<td width="100" bgcolor="#000000"> </td>
-
+<td width="100" bgcolor="#000000" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>textHighlight</code></td>
+<th scope="row" width="250"><code>textHighlight</code></th>
<td><pre>#39698a (57,105,138)</pre></td>
-<td width="100" bgcolor="#39698a"> </td>
+<td width="100" bgcolor="#39698a" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>textHighlightText</code></td>
+<th scope="row" width="250"><code>textHighlightText</code></th>
<td><pre>#ffffff (255,255,255)</pre></td>
-<td width="100" bgcolor="#ffffff"> </td>
+<td width="100" bgcolor="#ffffff" aria-label="Color preview"> </td>
</tr>
<tr>
-<td width="250"><code>textInactiveText</code></td>
-
+<th scope="row" width="250"><code>textInactiveText</code></th>
<td><pre>#8e8f91 (142,143,145)</pre></td>
-<td width="100" bgcolor="#8e8f91"> </td>
+<td width="100" bgcolor="#8e8f91" aria-label="Color preview"> </td>
</tr>
</tbody>
</table>
--- a/src/java.smartcardio/unix/legal/pcsclite.md Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.smartcardio/unix/legal/pcsclite.md Wed Jun 26 12:12:25 2019 +0530
@@ -1,10 +1,10 @@
-## PC/SC Lite for Suse Linux v1.1.1
+## PC/SC Lite v1.8.24
### PC/SC Lite License
<pre>
-Copyright (c) 1999-2004 David Corcoran <corcoran@linuxnet.com>
-Copyright (c) 1999-2004 Ludovic Rousseau <ludovic.rousseau (at) free.fr>
+Copyright (c) 1999-2003 David Corcoran <corcoran@linuxnet.com>
+Copyright (c) 2001-2011 Ludovic Rousseau <ludovic.rousseau@free.fr>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -16,12 +16,7 @@
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by:
- David Corcoran <corcoran@linuxnet.com>
- http://www.linuxnet.com (MUSCLE)
-4. The name of the author may not be used to endorse or promote products
+3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
Changes to this license can be made only by the copyright author with
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.smartcardio/unix/native/libj2pcsc/MUSCLE/COPYING Wed Jun 26 12:12:25 2019 +0530
@@ -0,0 +1,95 @@
+Copyright (c) 1999-2003 David Corcoran <corcoran@musclecard.com>
+Copyright (c) 2001-2011 Ludovic Rousseau <ludovic.rousseau@free.fr>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Some files are under GNU GPL v3 or any later version
+- doc/example/pcsc_demo.c
+- the files in src/spy/
+- the files in UnitaryTests/
+
+ Copyright (C) 2003-2014 Ludovic Rousseau
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+Files src/auth.c and src/auth.h are:
+ * Copyright (C) 2013 Red Hat
+ *
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * Author: Nikos Mavrogiannopoulos <nmav@redhat.com>
+
+
+Files src/simclist.c and src/simclist.h are:
+ * Copyright (c) 2007,2008,2009,2010,2011 Mij <mij@bitchx.it>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/Const.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/Const.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,3503 +25,2362 @@
/**
* Constants for the project, mostly defined in the JVM specification.
*
- * @version $Id: Const.java 1748987 2016-06-18 12:36:47Z sebb $
+ * @version $Id$
* @since 6.0 (intended to replace the Constants interface)
*/
public final class Const {
- /**
- * Java class file format Magic number (0xCAFEBABE)
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.1-200-A">
- * The ClassFile Structure in The Java Virtual Machine Specification</a>
- */
- public static final int JVM_CLASSFILE_MAGIC = 0xCAFEBABE;
-
- /**
- * Major version number of class files for Java 1.1.
- *
- * @see #MINOR_1_1
- *
- */
- public static final short MAJOR_1_1 = 45;
-
- /**
- * Minor version number of class files for Java 1.1.
- *
- * @see #MAJOR_1_1
+ /**
+ * Java class file format Magic number (0xCAFEBABE)
*
- */
- public static final short MINOR_1_1 = 3;
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.1-200-A">
+ * The ClassFile Structure in The Java Virtual Machine Specification</a>
+ */
+ public static final int JVM_CLASSFILE_MAGIC = 0xCAFEBABE;
- /**
- * Major version number of class files for Java 1.2.
- *
- * @see #MINOR_1_2
- *
- */
- public static final short MAJOR_1_2 = 46;
+ /** Major version number of class files for Java 1.1.
+ * @see #MINOR_1_1
+ * */
+ public static final short MAJOR_1_1 = 45;
+
+ /** Minor version number of class files for Java 1.1.
+ * @see #MAJOR_1_1
+ * */
+ public static final short MINOR_1_1 = 3;
- /**
- * Minor version number of class files for Java 1.2.
- *
- * @see #MAJOR_1_2
- *
- */
- public static final short MINOR_1_2 = 0;
+ /** Major version number of class files for Java 1.2.
+ * @see #MINOR_1_2
+ * */
+ public static final short MAJOR_1_2 = 46;
- /**
- * Major version number of class files for Java 1.2.
- *
- * @see #MINOR_1_2
- *
- */
- public static final short MAJOR_1_3 = 47;
+ /** Minor version number of class files for Java 1.2.
+ * @see #MAJOR_1_2
+ * */
+ public static final short MINOR_1_2 = 0;
+
+ /** Major version number of class files for Java 1.2.
+ * @see #MINOR_1_2
+ * */
+ public static final short MAJOR_1_3 = 47;
- /**
- * Minor version number of class files for Java 1.3.
- *
- * @see #MAJOR_1_3
- *
- */
- public static final short MINOR_1_3 = 0;
+ /** Minor version number of class files for Java 1.3.
+ * @see #MAJOR_1_3
+ * */
+ public static final short MINOR_1_3 = 0;
- /**
- * Major version number of class files for Java 1.3.
- *
- * @see #MINOR_1_3
- *
- */
- public static final short MAJOR_1_4 = 48;
+ /** Major version number of class files for Java 1.3.
+ * @see #MINOR_1_3
+ * */
+ public static final short MAJOR_1_4 = 48;
- /**
- * Minor version number of class files for Java 1.4.
- *
- * @see #MAJOR_1_4
- *
- */
- public static final short MINOR_1_4 = 0;
+ /** Minor version number of class files for Java 1.4.
+ * @see #MAJOR_1_4
+ * */
+ public static final short MINOR_1_4 = 0;
- /**
- * Major version number of class files for Java 1.4.
- *
- * @see #MINOR_1_4
- *
- */
- public static final short MAJOR_1_5 = 49;
+ /** Major version number of class files for Java 1.4.
+ * @see #MINOR_1_4
+ * */
+ public static final short MAJOR_1_5 = 49;
- /**
- * Minor version number of class files for Java 1.5.
- *
- * @see #MAJOR_1_5
- *
- */
- public static final short MINOR_1_5 = 0;
+ /** Minor version number of class files for Java 1.5.
+ * @see #MAJOR_1_5
+ * */
+ public static final short MINOR_1_5 = 0;
- /**
- * Major version number of class files for Java 1.6.
- *
- * @see #MINOR_1_6
- *
- */
- public static final short MAJOR_1_6 = 50;
+ /** Major version number of class files for Java 1.6.
+ * @see #MINOR_1_6
+ * */
+ public static final short MAJOR_1_6 = 50;
- /**
- * Minor version number of class files for Java 1.6.
- *
- * @see #MAJOR_1_6
- *
- */
- public static final short MINOR_1_6 = 0;
+ /** Minor version number of class files for Java 1.6.
+ * @see #MAJOR_1_6
+ * */
+ public static final short MINOR_1_6 = 0;
- /**
- * Major version number of class files for Java 1.7.
- *
- * @see #MINOR_1_7
- *
- */
- public static final short MAJOR_1_7 = 51;
+ /** Major version number of class files for Java 1.7.
+ * @see #MINOR_1_7
+ * */
+ public static final short MAJOR_1_7 = 51;
- /**
- * Minor version number of class files for Java 1.7.
- *
- * @see #MAJOR_1_7
- *
- */
- public static final short MINOR_1_7 = 0;
+ /** Minor version number of class files for Java 1.7.
+ * @see #MAJOR_1_7
+ * */
+ public static final short MINOR_1_7 = 0;
- /**
- * Major version number of class files for Java 1.8.
- *
- * @see #MINOR_1_8
- *
- */
- public static final short MAJOR_1_8 = 52;
+ /** Major version number of class files for Java 1.8.
+ * @see #MINOR_1_8
+ * */
+ public static final short MAJOR_1_8 = 52;
- /**
- * Major version number of class files for Java 9.
- *
- * @see #MINOR_1_9
- *
- */
- public static final short MAJOR_1_9 = 53;
+ /** Minor version number of class files for Java 1.8.
+ * @see #MAJOR_1_8
+ * */
+ public static final short MINOR_1_8 = 0;
+
+ /** Major version number of class files for Java 9.
+ * @see #MINOR_9
+ * */
+ public static final short MAJOR_9 = 53;
- /**
- * Minor version number of class files for Java 1.8.
- *
- * @see #MAJOR_1_8
- *
- */
- public static final short MINOR_1_8 = 0;
+ /** Minor version number of class files for Java 9.
+ * @see #MAJOR_9
+ * */
+ public static final short MINOR_9 = 0;
- /**
- * Minor version number of class files for Java 9.
- *
- * @see #MAJOR_1_9
- *
- */
- public static final short MINOR_1_9 = 0;
+ /**
+ * @deprecated Use {@link #MAJOR_9} instead
+ */
+ @Deprecated
+ public static final short MAJOR_1_9 = MAJOR_9;
- /**
- * Default major version number. Class file is for Java 1.1.
- *
- * @see #MAJOR_1_1
- *
- */
- public static final short MAJOR = MAJOR_1_1;
+ /**
+ * @deprecated Use {@link #MINOR_9} instead
+ */
+ @Deprecated
+ public static final short MINOR_1_9 = MINOR_9;
- /**
- * Default major version number. Class file is for Java 1.1.
- *
- * @see #MAJOR_1_1
- *
- */
- public static final short MINOR = MINOR_1_1;
+ /** Major version number of class files for Java 10.
+ * @see #MINOR_10
+ * */
+ public static final short MAJOR_10 = 54;
- /**
- * Maximum value for an unsigned short.
- */
- public static final int MAX_SHORT = 65535; // 2^16 - 1
-
- /**
- * Maximum value for an unsigned byte.
- */
- public static final int MAX_BYTE = 255; // 2^8 - 1
+ /** Minor version number of class files for Java 10.
+ * @see #MAJOR_10
+ * */
+ public static final short MINOR_10 = 0;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see <a
- * href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.5'>
- * Flag definitions for Fields in the Java Virtual Machine Specification
- * (Java SE 8 Edition).</a>
- * @see <a
- * href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6'>
- * Flag definitions for Methods in the Java Virtual Machine Specification
- * (Java SE 8 Edition).</a>
- * @see <a
- * href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6-300-D.1-D.1'>
- * Flag definitions for Classes in the Java Virtual Machine Specification
- * (Java SE 8 Edition).</a>
- */
- public static final short ACC_PUBLIC = 0x0001;
+ /** Major version number of class files for Java 11.
+ * @see #MINOR_11
+ * */
+ public static final short MAJOR_11 = 55;
+
+ /** Minor version number of class files for Java 11.
+ * @see #MAJOR_11
+ * */
+ public static final short MINOR_11 = 0;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_PRIVATE = 0x0002;
+ /** Major version number of class files for Java 12.
+ * @see #MINOR_12
+ * */
+ public static final short MAJOR_12 = 56;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_PROTECTED = 0x0004;
+ /** Minor version number of class files for Java 12.
+ * @see #MAJOR_12
+ * */
+ public static final short MINOR_12 = 0;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_STATIC = 0x0008;
+ /** Major version number of class files for Java 13.
+ * @see #MINOR_13
+ * */
+ public static final short MAJOR_13 = 57;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_FINAL = 0x0010;
-
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_SYNCHRONIZED = 0x0020;
+ /** Minor version number of class files for Java 13.
+ * @see #MAJOR_13
+ * */
+ public static final short MINOR_13 = 0;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_VOLATILE = 0x0040;
-
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_BRIDGE = 0x0040;
+ /** Default major version number. Class file is for Java 1.1.
+ * @see #MAJOR_1_1
+ * */
+ public static final short MAJOR = MAJOR_1_1;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_TRANSIENT = 0x0080;
+ /** Default major version number. Class file is for Java 1.1.
+ * @see #MAJOR_1_1
+ * */
+ public static final short MINOR = MINOR_1_1;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_VARARGS = 0x0080;
+ /** Maximum value for an unsigned short.
+ */
+ public static final int MAX_SHORT = 65535; // 2^16 - 1
+
+ /** Maximum value for an unsigned byte.
+ */
+ public static final int MAX_BYTE = 255; // 2^8 - 1
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_NATIVE = 0x0100;
-
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_INTERFACE = 0x0200;
+ /** One of the access flags for fields, methods, or classes.
+ * @see <a href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.5'>
+ * Flag definitions for Fields in the Java Virtual Machine Specification (Java SE 8 Edition).</a>
+ * @see <a href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6'>
+ * Flag definitions for Methods in the Java Virtual Machine Specification (Java SE 8 Edition).</a>
+ * @see <a href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6-300-D.1-D.1'>
+ * Flag definitions for Classes in the Java Virtual Machine Specification (Java SE 8 Edition).</a>
+ */
+ public static final short ACC_PUBLIC = 0x0001;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_ABSTRACT = 0x0400;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_PRIVATE = 0x0002;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_STRICT = 0x0800;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_PROTECTED = 0x0004;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_SYNTHETIC = 0x1000;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_STATIC = 0x0008;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_ANNOTATION = 0x2000;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_FINAL = 0x0010;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_ENUM = 0x4000;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_SYNCHRONIZED = 0x0020;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_MANDATED = (short) 0x8000;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_VOLATILE = 0x0040;
+
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_BRIDGE = 0x0040;
- // Applies to classes compiled by new compilers only
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short ACC_SUPER = 0x0020;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_TRANSIENT = 0x0080;
- /**
- * One of the access flags for fields, methods, or classes.
- *
- * @see #ACC_PUBLIC
- */
- public static final short MAX_ACC_FLAG = ACC_ENUM;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_VARARGS = 0x0080;
- /**
- * The names of the access flags.
- */
- private static final String[] ACCESS_NAMES = {
- "public", "private", "protected", "static", "final", "synchronized",
- "volatile", "transient", "native", "interface", "abstract", "strictfp",
- "synthetic", "annotation", "enum"
- };
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_NATIVE = 0x0100;
- /**
- * @since 6.0
- */
- public static final int ACCESS_NAMES_LENGTH = ACCESS_NAMES.length;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_INTERFACE = 0x0200;
- /**
- * @param index
- * @return the ACCESS_NAMES entry at the given index
- * @since 6.0
- */
- public static String getAccessName(final int index) {
- return ACCESS_NAMES[index];
- }
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_ABSTRACT = 0x0400;
- /*
- * The description of the constant pool is at:
- * http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4
- * References below are to the individual sections
- */
- /**
- * Marks a constant pool entry as type UTF-8.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.7">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_Utf8 = 1;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_STRICT = 0x0800;
+
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_SYNTHETIC = 0x1000;
- /**
- * Marks a constant pool entry as type Integer.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.4">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_Integer = 3;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_ANNOTATION = 0x2000;
- /**
- * Marks a constant pool entry as type Float.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.4">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_Float = 4;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_ENUM = 0x4000;
- /**
- * Marks a constant pool entry as type Long.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.5">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_Long = 5;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_MANDATED = (short) 0x8000;
- /**
- * Marks a constant pool entry as type Double.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.5">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_Double = 6;
+ // Applies to classes compiled by new compilers only
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short ACC_SUPER = 0x0020;
- /**
- * Marks a constant pool entry as a Class
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.1">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_Class = 7;
+ /** One of the access flags for fields, methods, or classes.
+ * @see #ACC_PUBLIC
+ */
+ public static final short MAX_ACC_FLAG = ACC_ENUM;
- /**
- * Marks a constant pool entry as a Field Reference.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_Fieldref = 9;
+ /**
+ * The names of the access flags.
+ */
+ private static final String[] ACCESS_NAMES = {
+ "public", "private", "protected", "static", "final", "synchronized",
+ "volatile", "transient", "native", "interface", "abstract", "strictfp",
+ "synthetic", "annotation", "enum"
+ };
- /**
- * Marks a constant pool entry as type String
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.3">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_String = 8;
+ /** @since 6.0 */
+ public static final int ACCESS_NAMES_LENGTH = ACCESS_NAMES.length;
- /**
- * Marks a constant pool entry as a Method Reference.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_Methodref = 10;
-
- /**
- * Marks a constant pool entry as an Interface Method Reference.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_InterfaceMethodref = 11;
+ /**
+ * @param index
+ * @return the ACCESS_NAMES entry at the given index
+ * @since 6.0
+ */
+ public static String getAccessName(final int index) {
+ return ACCESS_NAMES[index];
+ }
- /**
- * Marks a constant pool entry as a name and type.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.6">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_NameAndType = 12;
+ /*
+ * The description of the constant pool is at:
+ * http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4
+ * References below are to the individual sections
+ */
- /**
- * Marks a constant pool entry as a Method Handle.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.8">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_MethodHandle = 15;
+ /**
+ * Marks a constant pool entry as type UTF-8.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.7">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_Utf8 = 1;
- /**
- * Marks a constant pool entry as a Method Type.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.9">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_MethodType = 16;
+ /**
+ * Marks a constant pool entry as type Integer.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.4">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_Integer = 3;
- /**
- * Marks a constant pool entry as an Invoke Dynamic
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.10">
- * The Constant Pool in The Java Virtual Machine Specification</a>
- */
- public static final byte CONSTANT_InvokeDynamic = 18;
+ /**
+ * Marks a constant pool entry as type Float.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.4">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_Float = 4;
- /**
- * The names of the types of entries in a constant pool. Use getConstantName
- * instead
- */
- private static final String[] CONSTANT_NAMES = {
- "", "CONSTANT_Utf8", "", "CONSTANT_Integer",
- "CONSTANT_Float", "CONSTANT_Long", "CONSTANT_Double",
- "CONSTANT_Class", "CONSTANT_String", "CONSTANT_Fieldref",
- "CONSTANT_Methodref", "CONSTANT_InterfaceMethodref",
- "CONSTANT_NameAndType", "", "", "CONSTANT_MethodHandle",
- "CONSTANT_MethodType", "", "CONSTANT_InvokeDynamic"};
+ /**
+ * Marks a constant pool entry as type Long.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.5">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_Long = 5;
+
+ /**
+ * Marks a constant pool entry as type Double.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.5">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_Double = 6;
- /**
- *
- * @param index
- * @return the CONSTANT_NAMES entry at the given index
- * @since 6.0
- */
- public static String getConstantName(final int index) {
- return CONSTANT_NAMES[index];
- }
-
- /**
- * The name of the static initializer, also called "class
- * initialization method" or "interface initialization
- * method". This is "<clinit>".
- */
- public static final String STATIC_INITIALIZER_NAME = "<clinit>";
+ /**
+ * Marks a constant pool entry as a Class
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.1">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_Class = 7;
- /**
- * The name of every constructor method in a class, also called
- * "instance initialization method". This is
- * "<init>".
- */
- public static final String CONSTRUCTOR_NAME = "<init>";
+ /**
+ * Marks a constant pool entry as a Field Reference.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_Fieldref = 9;
- /**
- * The names of the interfaces implemented by arrays
- */
- private static final String[] INTERFACES_IMPLEMENTED_BY_ARRAYS = {"java.lang.Cloneable", "java.io.Serializable"};
-
- /**
- * @since 6.0
- */
- public static Iterable<String> getInterfacesImplementedByArrays() {
- return Collections.unmodifiableList(Arrays.asList(INTERFACES_IMPLEMENTED_BY_ARRAYS));
- }
+ /**
+ * Marks a constant pool entry as type String
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.3">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_String = 8;
- /**
- * Maximum Constant Pool entries. One of the limitations of the Java Virtual
- * Machine.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.11-100-A">
- * The Java Virtual Machine Specification, Java SE 8 Edition, page 330,
- * chapter 4.11.</a>
- */
- public static final int MAX_CP_ENTRIES = 65535;
+ /** Marks a constant pool entry as a Method Reference.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
+ * The Constant Pool in The Java Virtual Machine Specification</a> */
+ public static final byte CONSTANT_Methodref = 10;
+
+ /**
+ * Marks a constant pool entry as an Interface Method Reference.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_InterfaceMethodref = 11;
- /**
- * Maximum code size (plus one; the code size must be LESS than this) One of
- * the limitations of the Java Virtual Machine. Note vmspec2 page 152
- * ("Limitations") says: "The amount of code per non-native, non-abstract
- * method is limited to 65536 bytes by the sizes of the indices in the
- * exception_table of the Code attribute (4.7.3), in the LineNumberTable
- * attribute (4.7.8), and in the LocalVariableTable attribute (4.7.9)."
- * However this should be taken as an upper limit rather than the defined
- * maximum. On page 134 (4.8.1 Static Constants) of the same spec, it says:
- * "The value of the code_length item must be less than 65536." The entry in
- * the Limitations section has been removed from later versions of the spec;
- * it is not present in the Java SE 8 edition.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3-300-E">
- * The Java Virtual Machine Specification, Java SE 8 Edition, page 104,
- * chapter 4.7.</a>
- */
- public static final int MAX_CODE_SIZE = 65536; //bytes
+ /** Marks a constant pool entry as a name and type.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.6">
+ * The Constant Pool in The Java Virtual Machine Specification</a> */
+ public static final byte CONSTANT_NameAndType = 12;
- /**
- * The maximum number of dimensions in an array ({@value}). One of the
- * limitations of the Java Virtual Machine.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.3.2-150">
- * Field Descriptors in The Java Virtual Machine Specification</a>
- */
- public static final int MAX_ARRAY_DIMENSIONS = 255;
+ /**
+ * Marks a constant pool entry as a Method Handle.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.8">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_MethodHandle = 15;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.nop">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short NOP = 0;
+ /**
+ * Marks a constant pool entry as a Method Type.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.9">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_MethodType = 16;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aconst_null">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ACONST_NULL = 1;
+ /**
+ * Marks a constant pool entry as dynamically computed.
+ * @see <a href="https://bugs.openjdk.java.net/secure/attachment/74618/constant-dynamic.html">
+ * Change request for JEP 309</a>
+ * @since 6.3
+ */
+ public static final byte CONSTANT_Dynamic = 17;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ICONST_M1 = 2;
-
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ICONST_0 = 3;
+ /**
+ * Marks a constant pool entry as an Invoke Dynamic
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.10">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ */
+ public static final byte CONSTANT_InvokeDynamic = 18;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ICONST_1 = 4;
-
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ICONST_2 = 5;
+ /**
+ * Marks a constant pool entry as a Module Reference.
+ * @see <a href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.4.11">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ * @since 6.1
+ */
+ public static final byte CONSTANT_Module = 19;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ICONST_3 = 6;
+ /**
+ * Marks a constant pool entry as a Package Reference.
+ * @see <a href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.4.12">
+ * The Constant Pool in The Java Virtual Machine Specification</a>
+ * @since 6.1
+ */
+ public static final byte CONSTANT_Package = 20;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ICONST_4 = 7;
+ /**
+ * The names of the types of entries in a constant pool.
+ * Use getConstantName instead
+ */
+ private static final String[] CONSTANT_NAMES = {
+ "", "CONSTANT_Utf8", "", "CONSTANT_Integer",
+ "CONSTANT_Float", "CONSTANT_Long", "CONSTANT_Double",
+ "CONSTANT_Class", "CONSTANT_String", "CONSTANT_Fieldref",
+ "CONSTANT_Methodref", "CONSTANT_InterfaceMethodref",
+ "CONSTANT_NameAndType", "", "", "CONSTANT_MethodHandle",
+ "CONSTANT_MethodType", "CONSTANT_Dynamic", "CONSTANT_InvokeDynamic",
+ "CONSTANT_Module", "CONSTANT_Package"};
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ICONST_5 = 8;
+ /**
+ *
+ * @param index
+ * @return the CONSTANT_NAMES entry at the given index
+ * @since 6.0
+ */
+ public static String getConstantName(final int index) {
+ return CONSTANT_NAMES[index];
+ }
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lconst_l">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LCONST_0 = 9;
-
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lconst_l">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LCONST_1 = 10;
+ /** The name of the static initializer, also called "class
+ * initialization method" or "interface initialization
+ * method". This is "<clinit>".
+ */
+ public static final String STATIC_INITIALIZER_NAME = "<clinit>";
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fconst_f">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FCONST_0 = 11;
+ /** The name of every constructor method in a class, also called
+ * "instance initialization method". This is "<init>".
+ */
+ public static final String CONSTRUCTOR_NAME = "<init>";
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fconst_f">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FCONST_1 = 12;
+ /**
+ * The names of the interfaces implemented by arrays
+ */
+ private static final String[] INTERFACES_IMPLEMENTED_BY_ARRAYS = {"java.lang.Cloneable", "java.io.Serializable"};
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fconst_f">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FCONST_2 = 13;
+ /**
+ * @since 6.0
+ */
+ public static Iterable<String> getInterfacesImplementedByArrays() {
+ return Collections.unmodifiableList(Arrays.asList(INTERFACES_IMPLEMENTED_BY_ARRAYS));
+ }
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dconst_d">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DCONST_0 = 14;
-
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dconst_d">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DCONST_1 = 15;
-
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.bipush">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short BIPUSH = 16;
+ /**
+ * Maximum Constant Pool entries.
+ * One of the limitations of the Java Virtual Machine.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.11-100-A">
+ * The Java Virtual Machine Specification, Java SE 8 Edition, page 330, chapter 4.11.</a>
+ */
+ public static final int MAX_CP_ENTRIES = 65535;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.sipush">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short SIPUSH = 17;
+ /**
+ * Maximum code size (plus one; the code size must be LESS than this)
+ * One of the limitations of the Java Virtual Machine.
+ * Note vmspec2 page 152 ("Limitations") says:
+ * "The amount of code per non-native, non-abstract method is limited to 65536 bytes by
+ * the sizes of the indices in the exception_table of the Code attribute (4.7.3),
+ * in the LineNumberTable attribute (4.7.8), and in the LocalVariableTable attribute (4.7.9)."
+ * However this should be taken as an upper limit rather than the defined maximum.
+ * On page 134 (4.8.1 Static Constants) of the same spec, it says:
+ * "The value of the code_length item must be less than 65536."
+ * The entry in the Limitations section has been removed from later versions of the spec;
+ * it is not present in the Java SE 8 edition.
+ *
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3-300-E">
+ * The Java Virtual Machine Specification, Java SE 8 Edition, page 104, chapter 4.7.3</a>
+ */
+ public static final int MAX_CODE_SIZE = 65536; //bytes
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ldc">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LDC = 18;
+ /**
+ * The maximum number of dimensions in an array ({@value}).
+ * One of the limitations of the Java Virtual Machine.
+ *
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.3.2-150">
+ * Field Descriptors in The Java Virtual Machine Specification</a>
+ */
+ public static final int MAX_ARRAY_DIMENSIONS = 255;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ldc_w">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LDC_W = 19;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.nop">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short NOP = 0;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ldc2_w">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LDC2_W = 20;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aconst_null">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ACONST_NULL = 1;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ILOAD = 21;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ICONST_M1 = 2;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LLOAD = 22;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ICONST_0 = 3;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FLOAD = 23;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ICONST_1 = 4;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ICONST_2 = 5;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DLOAD = 24;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ICONST_3 = 6;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ALOAD = 25;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ICONST_4 = 7;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ILOAD_0 = 26;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iconst_i">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ICONST_5 = 8;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lconst_l">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LCONST_0 = 9;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ILOAD_1 = 27;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lconst_l">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LCONST_1 = 10;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ILOAD_2 = 28;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fconst_f">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FCONST_0 = 11;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ILOAD_3 = 29;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fconst_f">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FCONST_1 = 12;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fconst_f">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FCONST_2 = 13;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LLOAD_0 = 30;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dconst_d">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DCONST_0 = 14;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LLOAD_1 = 31;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dconst_d">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DCONST_1 = 15;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LLOAD_2 = 32;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.bipush">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short BIPUSH = 16;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LLOAD_3 = 33;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.sipush">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short SIPUSH = 17;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FLOAD_0 = 34;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ldc">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LDC = 18;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FLOAD_1 = 35;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ldc_w">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LDC_W = 19;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ldc2_w">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LDC2_W = 20;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FLOAD_2 = 36;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ILOAD = 21;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FLOAD_3 = 37;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LLOAD = 22;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DLOAD_0 = 38;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FLOAD = 23;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DLOAD_1 = 39;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DLOAD = 24;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DLOAD_2 = 40;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ALOAD = 25;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DLOAD_3 = 41;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ILOAD_0 = 26;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ILOAD_1 = 27;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ALOAD_0 = 42;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ILOAD_2 = 28;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ALOAD_1 = 43;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ILOAD_3 = 29;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ALOAD_2 = 44;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LLOAD_0 = 30;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aload_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ALOAD_3 = 45;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LLOAD_1 = 31;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iaload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IALOAD = 46;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LLOAD_2 = 32;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.laload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LALOAD = 47;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LLOAD_3 = 33;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FLOAD_0 = 34;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.faload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FALOAD = 48;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FLOAD_1 = 35;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.daload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DALOAD = 49;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FLOAD_2 = 36;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aaload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short AALOAD = 50;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FLOAD_3 = 37;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DLOAD_0 = 38;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.baload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short BALOAD = 51;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DLOAD_1 = 39;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.caload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short CALOAD = 52;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DLOAD_2 = 40;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.saload">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short SALOAD = 53;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DLOAD_3 = 41;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ALOAD_0 = 42;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.istore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ISTORE = 54;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ALOAD_1 = 43;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lstore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LSTORE = 55;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ALOAD_2 = 44;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fstore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FSTORE = 56;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aload_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ALOAD_3 = 45;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dstore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DSTORE = 57;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iaload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IALOAD = 46;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.astore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ASTORE = 58;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.laload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LALOAD = 47;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.istore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ISTORE_0 = 59;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.faload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FALOAD = 48;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.daload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DALOAD = 49;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.istore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ISTORE_1 = 60;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aaload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short AALOAD = 50;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.istore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ISTORE_2 = 61;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.baload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short BALOAD = 51;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.istore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ISTORE_3 = 62;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.caload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short CALOAD = 52;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LSTORE_0 = 63;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.saload">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short SALOAD = 53;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LSTORE_1 = 64;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.istore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ISTORE = 54;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LSTORE_2 = 65;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lstore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LSTORE = 55;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fstore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FSTORE = 56;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LSTORE_3 = 66;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dstore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DSTORE = 57;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FSTORE_0 = 67;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.astore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ASTORE = 58;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FSTORE_1 = 68;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.istore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ISTORE_0 = 59;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FSTORE_2 = 69;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.istore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ISTORE_1 = 60;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FSTORE_3 = 70;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.istore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ISTORE_2 = 61;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DSTORE_0 = 71;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.istore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ISTORE_3 = 62;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LSTORE_0 = 63;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DSTORE_1 = 72;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LSTORE_1 = 64;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DSTORE_2 = 73;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LSTORE_2 = 65;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dstore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DSTORE_3 = 74;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LSTORE_3 = 66;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FSTORE_0 = 67;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.astore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ASTORE_0 = 75;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FSTORE_1 = 68;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.astore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ASTORE_1 = 76;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FSTORE_2 = 69;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.astore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ASTORE_2 = 77;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FSTORE_3 = 70;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DSTORE_0 = 71;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.astore_n">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ASTORE_3 = 78;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DSTORE_1 = 72;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iastore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IASTORE = 79;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DSTORE_2 = 73;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lastore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LASTORE = 80;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dstore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DSTORE_3 = 74;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fastore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FASTORE = 81;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.astore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ASTORE_0 = 75;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dastore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DASTORE = 82;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.astore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ASTORE_1 = 76;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aastore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short AASTORE = 83;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.astore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ASTORE_2 = 77;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.astore_n">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ASTORE_3 = 78;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.bastore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short BASTORE = 84;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iastore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IASTORE = 79;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.castore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short CASTORE = 85;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lastore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LASTORE = 80;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.sastore">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short SASTORE = 86;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fastore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FASTORE = 81;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.pop">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short POP = 87;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dastore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DASTORE = 82;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.pop2">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short POP2 = 88;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.aastore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short AASTORE = 83;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DUP = 89;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.bastore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short BASTORE = 84;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.castore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short CASTORE = 85;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup_x1">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DUP_X1 = 90;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.sastore">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short SASTORE = 86;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup_x2">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DUP_X2 = 91;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.pop">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short POP = 87;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup2">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DUP2 = 92;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.pop2">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short POP2 = 88;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup2_x1">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DUP2_X1 = 93;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DUP = 89;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup2_x2">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DUP2_X2 = 94;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup_x1">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DUP_X1 = 90;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.swap">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short SWAP = 95;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup_x2">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DUP_X2 = 91;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup2">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DUP2 = 92;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iadd">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IADD = 96;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup2_x1">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DUP2_X1 = 93;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ladd">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LADD = 97;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dup2_x2">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DUP2_X2 = 94;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fadd">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FADD = 98;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.swap">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short SWAP = 95;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iadd">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IADD = 96;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dadd">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DADD = 99;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ladd">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LADD = 97;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.isub">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ISUB = 100;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fadd">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FADD = 98;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lsub">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LSUB = 101;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dadd">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DADD = 99;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.isub">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ISUB = 100;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fsub">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FSUB = 102;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lsub">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LSUB = 101;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dsub">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DSUB = 103;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fsub">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FSUB = 102;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.imul">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IMUL = 104;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dsub">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DSUB = 103;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lmul">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LMUL = 105;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.imul">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IMUL = 104;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fmul">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FMUL = 106;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lmul">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LMUL = 105;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dmul">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DMUL = 107;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fmul">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FMUL = 106;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dmul">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DMUL = 107;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.idiv">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IDIV = 108;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.idiv">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IDIV = 108;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ldiv">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LDIV = 109;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ldiv">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LDIV = 109;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fdiv">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FDIV = 110;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fdiv">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FDIV = 110;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ddiv">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DDIV = 111;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ddiv">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DDIV = 111;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.irem">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IREM = 112;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.irem">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IREM = 112;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lrem">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LREM = 113;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lrem">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LREM = 113;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.frem">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FREM = 114;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.frem">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FREM = 114;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.drem">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DREM = 115;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.drem">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DREM = 115;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ineg">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short INEG = 116;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ineg">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short INEG = 116;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lneg">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LNEG = 117;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lneg">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LNEG = 117;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fneg">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FNEG = 118;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fneg">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FNEG = 118;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dneg">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DNEG = 119;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dneg">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DNEG = 119;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ishl">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ISHL = 120;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lshl">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LSHL = 121;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ishl">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ISHL = 120;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ishr">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ISHR = 122;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lshl">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LSHL = 121;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lshr">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LSHR = 123;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ishr">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ISHR = 122;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iushr">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IUSHR = 124;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lushr">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LUSHR = 125;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lshr">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LSHR = 123;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iand">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IAND = 126;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iushr">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IUSHR = 124;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.land">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LAND = 127;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lushr">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LUSHR = 125;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ior">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IOR = 128;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lor">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LOR = 129;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iand">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IAND = 126;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ixor">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IXOR = 130;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.land">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LAND = 127;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lxor">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LXOR = 131;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ior">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IOR = 128;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iinc">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IINC = 132;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lor">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LOR = 129;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2l">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short I2L = 133;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ixor">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IXOR = 130;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2f">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short I2F = 134;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lxor">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LXOR = 131;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2d">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short I2D = 135;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.l2i">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short L2I = 136;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iinc">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IINC = 132;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.l2f">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short L2F = 137;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2l">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short I2L = 133;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.l2d">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short L2D = 138;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2f">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short I2F = 134;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.f2i">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short F2I = 139;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2d">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short I2D = 135;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.f2l">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short F2L = 140;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.l2i">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short L2I = 136;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.f2d">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short F2D = 141;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.l2f">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short L2F = 137;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.d2i">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short D2I = 142;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.d2l">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short D2L = 143;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.l2d">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short L2D = 138;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.d2f">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short D2F = 144;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.f2i">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short F2I = 139;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2b">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short I2B = 145;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.f2l">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short F2L = 140;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short INT2BYTE = 145; // Old notation
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.f2d">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short F2D = 141;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2c">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short I2C = 146;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.d2i">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short D2I = 142;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short INT2CHAR = 146; // Old notation
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.d2l">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short D2L = 143;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2s">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short I2S = 147;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short INT2SHORT = 147; // Old notation
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.d2f">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short D2F = 144;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lcmp">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LCMP = 148;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2b">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short I2B = 145;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fcmpl">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FCMPL = 149;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short INT2BYTE = 145; // Old notation
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fcmpg">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FCMPG = 150;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dcmpl">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DCMPL = 151;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2c">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short I2C = 146;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dcmpg">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DCMPG = 152;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short INT2CHAR = 146; // Old notation
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifeq">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IFEQ = 153;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.i2s">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short I2S = 147;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifne">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IFNE = 154;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iflt">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IFLT = 155;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short INT2SHORT = 147; // Old notation
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifge">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IFGE = 156;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lcmp">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LCMP = 148;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifgt">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IFGT = 157;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fcmpl">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FCMPL = 149;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifle">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IFLE = 158;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.fcmpg">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FCMPG = 150;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IF_ICMPEQ = 159;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dcmpl">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DCMPL = 151;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IF_ICMPNE = 160;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dcmpg">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DCMPG = 152;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IF_ICMPLT = 161;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IF_ICMPGE = 162;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifeq">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IFEQ = 153;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IF_ICMPGT = 163;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifne">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IFNE = 154;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IF_ICMPLE = 164;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iflt">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IFLT = 155;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_acmp_cond">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IF_ACMPEQ = 165;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifge">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IFGE = 156;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_acmp_cond">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IF_ACMPNE = 166;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifgt">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IFGT = 157;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.goto">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short GOTO = 167;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifle">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IFLE = 158;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.jsr">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short JSR = 168;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ret">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short RET = 169;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IF_ICMPEQ = 159;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.tableswitch">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short TABLESWITCH = 170;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IF_ICMPNE = 160;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lookupswitch">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LOOKUPSWITCH = 171;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IF_ICMPLT = 161;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ireturn">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IRETURN = 172;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IF_ICMPGE = 162;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lreturn">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short LRETURN = 173;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IF_ICMPGT = 163;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.freturn">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short FRETURN = 174;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IF_ICMPLE = 164;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dreturn">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short DRETURN = 175;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.areturn">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ARETURN = 176;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_acmp_cond">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IF_ACMPEQ = 165;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.return">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short RETURN = 177;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_acmp_cond">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IF_ACMPNE = 166;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.getstatic">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short GETSTATIC = 178;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.goto">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short GOTO = 167;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.putstatic">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short PUTSTATIC = 179;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.getfield">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short GETFIELD = 180;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.jsr">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short JSR = 168;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.putfield">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short PUTFIELD = 181;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ret">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short RET = 169;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokevirtual">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short INVOKEVIRTUAL = 182;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.tableswitch">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short TABLESWITCH = 170;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokespecial">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short INVOKESPECIAL = 183;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short INVOKENONVIRTUAL = 183; // Old name in JDK 1.0
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lookupswitch">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LOOKUPSWITCH = 171;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokestatic">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short INVOKESTATIC = 184;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ireturn">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IRETURN = 172;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokeinterface">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short INVOKEINTERFACE = 185;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lreturn">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short LRETURN = 173;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokedynamic">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short INVOKEDYNAMIC = 186;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.freturn">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short FRETURN = 174;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.new">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short NEW = 187;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.dreturn">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short DRETURN = 175;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.newarray">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short NEWARRAY = 188;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.areturn">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ARETURN = 176;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.anewarray">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ANEWARRAY = 189;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.arraylength">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ARRAYLENGTH = 190;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.return">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short RETURN = 177;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.athrow">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short ATHROW = 191;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.getstatic">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short GETSTATIC = 178;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.checkcast">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short CHECKCAST = 192;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.putstatic">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short PUTSTATIC = 179;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.instanceof">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short INSTANCEOF = 193;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.getfield">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short GETFIELD = 180;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.monitorenter">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short MONITORENTER = 194;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.putfield">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short PUTFIELD = 181;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.monitorexit">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short MONITOREXIT = 195;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokevirtual">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short INVOKEVIRTUAL = 182;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.wide">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short WIDE = 196;
+
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.multianewarray">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short MULTIANEWARRAY = 197;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokespecial">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short INVOKESPECIAL = 183;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifnull">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IFNULL = 198;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short INVOKENONVIRTUAL = 183; // Old name in JDK 1.0
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifnonnull">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short IFNONNULL = 199;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokestatic">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short INVOKESTATIC = 184;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.goto_w">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short GOTO_W = 200;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokeinterface">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short INVOKEINTERFACE = 185;
-
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokedynamic">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short INVOKEDYNAMIC = 186;
+ /** Java VM opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.jsr_w">
+ * Opcode definitions in The Java Virtual Machine Specification</a> */
+ public static final short JSR_W = 201;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.new">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short NEW = 187;
+ /** JVM internal opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.2">
+ * Reserved opcodes in the Java Virtual Machine Specification</a> */
+ public static final short BREAKPOINT = 202;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.newarray">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short NEWARRAY = 188;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short LDC_QUICK = 203;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.anewarray">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ANEWARRAY = 189;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short LDC_W_QUICK = 204;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.arraylength">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ARRAYLENGTH = 190;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short LDC2_W_QUICK = 205;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.athrow">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short ATHROW = 191;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short GETFIELD_QUICK = 206;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.checkcast">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short CHECKCAST = 192;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short PUTFIELD_QUICK = 207;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.instanceof">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short INSTANCEOF = 193;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short GETFIELD2_QUICK = 208;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.monitorenter">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short MONITORENTER = 194;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short PUTFIELD2_QUICK = 209;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.monitorexit">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short MONITOREXIT = 195;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short GETSTATIC_QUICK = 210;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.wide">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short WIDE = 196;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short PUTSTATIC_QUICK = 211;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.multianewarray">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short MULTIANEWARRAY = 197;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short GETSTATIC2_QUICK = 212;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifnull">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IFNULL = 198;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short PUTSTATIC2_QUICK = 213;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifnonnull">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short IFNONNULL = 199;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short INVOKEVIRTUAL_QUICK = 214;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.goto_w">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short GOTO_W = 200;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short INVOKENONVIRTUAL_QUICK = 215;
- /**
- * Java VM opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.jsr_w">
- * Opcode definitions in The Java Virtual Machine Specification</a>
- */
- public static final short JSR_W = 201;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short INVOKESUPER_QUICK = 216;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.2">
- * Reserved opcodes in the Java Virtual Machine Specification</a>
- */
- public static final short BREAKPOINT = 202;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short INVOKESTATIC_QUICK = 217;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short LDC_QUICK = 203;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short INVOKEINTERFACE_QUICK = 218;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short LDC_W_QUICK = 204;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short INVOKEVIRTUALOBJECT_QUICK = 219;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short LDC2_W_QUICK = 205;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short NEW_QUICK = 221;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short GETFIELD_QUICK = 206;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short ANEWARRAY_QUICK = 222;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short PUTFIELD_QUICK = 207;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short MULTIANEWARRAY_QUICK = 223;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short GETFIELD2_QUICK = 208;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short CHECKCAST_QUICK = 224;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short PUTFIELD2_QUICK = 209;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short INSTANCEOF_QUICK = 225;
+
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short INVOKEVIRTUAL_QUICK_W = 226;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short GETSTATIC_QUICK = 210;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short GETFIELD_QUICK_W = 227;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short PUTSTATIC_QUICK = 211;
+ /** JVM internal opcode.
+ * @see <a href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
+ * Specification of _quick opcodes in the Java Virtual Machine Specification (version 1)</a>
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
+ * Why the _quick opcodes were removed from the second version of the Java Virtual Machine Specification.</a> */
+ public static final short PUTFIELD_QUICK_W = 228;
+
+ /** JVM internal opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.2">
+ * Reserved opcodes in the Java Virtual Machine Specification</a> */
+ public static final short IMPDEP1 = 254;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short GETSTATIC2_QUICK = 212;
+ /** JVM internal opcode.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.2">
+ * Reserved opcodes in the Java Virtual Machine Specification</a> */
+ public static final short IMPDEP2 = 255;
+
+ /**
+ * BCEL virtual instruction for pushing an arbitrary data type onto the stack. Will be converted to the appropriate JVM
+ * opcode when the class is dumped.
+ */
+ public static final short PUSH = 4711;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short PUTSTATIC2_QUICK = 213;
+ /**
+ * BCEL virtual instruction for either LOOKUPSWITCH or TABLESWITCH. Will be converted to the appropriate JVM
+ * opcode when the class is dumped.
+ */
+ public static final short SWITCH = 4712;
+
+ /** Illegal opcode. */
+ public static final short UNDEFINED = -1;
+
+ /** Illegal opcode. */
+ public static final short UNPREDICTABLE = -2;
+
+ /** Illegal opcode. */
+ public static final short RESERVED = -3;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short INVOKEVIRTUAL_QUICK = 214;
+ /** Mnemonic for an illegal opcode. */
+ public static final String ILLEGAL_OPCODE = "<illegal opcode>";
+
+ /** Mnemonic for an illegal type. */
+ public static final String ILLEGAL_TYPE = "<illegal type>";
+
+ /** Boolean data type.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
+ * Static Constraints in the Java Virtual Machine Specification</a> */
+ public static final byte T_BOOLEAN = 4;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short INVOKENONVIRTUAL_QUICK = 215;
+ /** Char data type.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
+ * Static Constraints in the Java Virtual Machine Specification</a> */
+ public static final byte T_CHAR = 5;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short INVOKESUPER_QUICK = 216;
+ /** Float data type.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
+ * Static Constraints in the Java Virtual Machine Specification</a> */
+ public static final byte T_FLOAT = 6;
+
+ /** Double data type.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
+ * Static Constraints in the Java Virtual Machine Specification</a> */
+ public static final byte T_DOUBLE = 7;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short INVOKESTATIC_QUICK = 217;
+ /** Byte data type.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
+ * Static Constraints in the Java Virtual Machine Specification</a> */
+ public static final byte T_BYTE = 8;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short INVOKEINTERFACE_QUICK = 218;
+ /** Short data type.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
+ * Static Constraints in the Java Virtual Machine Specification</a> */
+ public static final byte T_SHORT = 9;
+
+ /** Int data type.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
+ * Static Constraints in the Java Virtual Machine Specification</a> */
+ public static final byte T_INT = 10;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short INVOKEVIRTUALOBJECT_QUICK = 219;
+ /** Long data type.
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
+ * Static Constraints in the Java Virtual Machine Specification</a> */
+ public static final byte T_LONG = 11;
+
+ /** Void data type (non-standard). */
+ public static final byte T_VOID = 12; // Non-standard
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short NEW_QUICK = 221;
+ /** Array data type. */
+ public static final byte T_ARRAY = 13;
+
+ /** Object data type. */
+ public static final byte T_OBJECT = 14;
+
+ /** Reference data type (deprecated). */
+ public static final byte T_REFERENCE = 14; // Deprecated
+
+ /** Unknown data type. */
+ public static final byte T_UNKNOWN = 15;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short ANEWARRAY_QUICK = 222;
+ /** Address data type. */
+ public static final byte T_ADDRESS = 16;
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short MULTIANEWARRAY_QUICK = 223;
+ /** The primitive type names corresponding to the T_XX constants,
+ * e.g., TYPE_NAMES[T_INT] = "int"
+ */
+ private static final String[] TYPE_NAMES = {
+ ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE,
+ "boolean", "char", "float", "double", "byte", "short", "int", "long",
+ "void", "array", "object", "unknown", "address"
+ };
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short CHECKCAST_QUICK = 224;
+ /**
+ * The primitive type names corresponding to the T_XX constants,
+ * e.g., TYPE_NAMES[T_INT] = "int"
+ * @param index
+ * @return the type name
+ * @since 6.0
+ */
+ public static String getTypeName(final int index) {
+ return TYPE_NAMES[index];
+ }
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short INSTANCEOF_QUICK = 225;
-
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short INVOKEVIRTUAL_QUICK_W = 226;
+ /** The primitive class names corresponding to the T_XX constants,
+ * e.g., CLASS_TYPE_NAMES[T_INT] = "java.lang.Integer"
+ */
+ private static final String[] CLASS_TYPE_NAMES = {
+ ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE,
+ "java.lang.Boolean", "java.lang.Character", "java.lang.Float",
+ "java.lang.Double", "java.lang.Byte", "java.lang.Short",
+ "java.lang.Integer", "java.lang.Long", "java.lang.Void",
+ ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE
+ };
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short GETFIELD_QUICK_W = 227;
+ /**
+ * The primitive class names corresponding to the T_XX constants,
+ * e.g., CLASS_TYPE_NAMES[T_INT] = "java.lang.Integer"
+ * @param index
+ * @return the class name
+ * @since 6.0
+ */
+ public static String getClassTypeName(final int index) {
+ return CLASS_TYPE_NAMES[index];
+ }
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="https://web.archive.org/web/20120108031230/http://java.sun.com/docs/books/jvms/first_edition/html/Quick.doc.html">
- * Specification of _quick opcodes in the Java Virtual Machine Specification
- * (version 1)</a>
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se5.0/html/ChangesAppendix.doc.html#448885">
- * Why the _quick opcodes were removed from the second version of the Java
- * Virtual Machine Specification.</a>
- */
- public static final short PUTFIELD_QUICK_W = 228;
+ /** The signature characters corresponding to primitive types,
+ * e.g., SHORT_TYPE_NAMES[T_INT] = "I"
+ */
+ private static final String[] SHORT_TYPE_NAMES = {
+ ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE,
+ "Z", "C", "F", "D", "B", "S", "I", "J",
+ "V", ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE
+ };
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.2">
- * Reserved opcodes in the Java Virtual Machine Specification</a>
- */
- public static final short IMPDEP1 = 254;
+ /**
+ *
+ * @param index
+ * @return the short type name
+ * @since 6.0
+ */
+ public static String getShortTypeName(final int index) {
+ return SHORT_TYPE_NAMES[index];
+ }
+
- /**
- * JVM internal opcode.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.2">
- * Reserved opcodes in the Java Virtual Machine Specification</a>
- */
- public static final short IMPDEP2 = 255;
-
- /**
- * BCEL virtual instruction for pushing an arbitrary data type onto the
- * stack. Will be converted to the appropriate JVM opcode when the class is
- * dumped.
- */
- public static final short PUSH = 4711;
-
- /**
- * BCEL virtual instruction for either LOOKUPSWITCH or TABLESWITCH. Will be
- * converted to the appropriate JVM opcode when the class is dumped.
- */
- public static final short SWITCH = 4712;
-
- /**
- * Illegal opcode.
- */
- public static final short UNDEFINED = -1;
-
- /**
- * Illegal opcode.
- */
- public static final short UNPREDICTABLE = -2;
-
- /**
- * Illegal opcode.
- */
- public static final short RESERVED = -3;
-
- /**
- * Mnemonic for an illegal opcode.
- */
- public static final String ILLEGAL_OPCODE = "<illegal opcode>";
-
- /**
- * Mnemonic for an illegal type.
- */
- public static final String ILLEGAL_TYPE = "<illegal type>";
+ /**
+ * Number of byte code operands for each opcode, i.e., number of bytes after the tag byte
+ * itself. Indexed by opcode, so NO_OF_OPERANDS[BIPUSH] = the number of operands for a bipush
+ * instruction.
+ */
+ private static final short[] NO_OF_OPERANDS = {
+ 0/*nop*/, 0/*aconst_null*/, 0/*iconst_m1*/, 0/*iconst_0*/,
+ 0/*iconst_1*/, 0/*iconst_2*/, 0/*iconst_3*/, 0/*iconst_4*/,
+ 0/*iconst_5*/, 0/*lconst_0*/, 0/*lconst_1*/, 0/*fconst_0*/,
+ 0/*fconst_1*/, 0/*fconst_2*/, 0/*dconst_0*/, 0/*dconst_1*/,
+ 1/*bipush*/, 2/*sipush*/, 1/*ldc*/, 2/*ldc_w*/, 2/*ldc2_w*/,
+ 1/*iload*/, 1/*lload*/, 1/*fload*/, 1/*dload*/, 1/*aload*/,
+ 0/*iload_0*/, 0/*iload_1*/, 0/*iload_2*/, 0/*iload_3*/,
+ 0/*lload_0*/, 0/*lload_1*/, 0/*lload_2*/, 0/*lload_3*/,
+ 0/*fload_0*/, 0/*fload_1*/, 0/*fload_2*/, 0/*fload_3*/,
+ 0/*dload_0*/, 0/*dload_1*/, 0/*dload_2*/, 0/*dload_3*/,
+ 0/*aload_0*/, 0/*aload_1*/, 0/*aload_2*/, 0/*aload_3*/,
+ 0/*iaload*/, 0/*laload*/, 0/*faload*/, 0/*daload*/,
+ 0/*aaload*/, 0/*baload*/, 0/*caload*/, 0/*saload*/,
+ 1/*istore*/, 1/*lstore*/, 1/*fstore*/, 1/*dstore*/,
+ 1/*astore*/, 0/*istore_0*/, 0/*istore_1*/, 0/*istore_2*/,
+ 0/*istore_3*/, 0/*lstore_0*/, 0/*lstore_1*/, 0/*lstore_2*/,
+ 0/*lstore_3*/, 0/*fstore_0*/, 0/*fstore_1*/, 0/*fstore_2*/,
+ 0/*fstore_3*/, 0/*dstore_0*/, 0/*dstore_1*/, 0/*dstore_2*/,
+ 0/*dstore_3*/, 0/*astore_0*/, 0/*astore_1*/, 0/*astore_2*/,
+ 0/*astore_3*/, 0/*iastore*/, 0/*lastore*/, 0/*fastore*/,
+ 0/*dastore*/, 0/*aastore*/, 0/*bastore*/, 0/*castore*/,
+ 0/*sastore*/, 0/*pop*/, 0/*pop2*/, 0/*dup*/, 0/*dup_x1*/,
+ 0/*dup_x2*/, 0/*dup2*/, 0/*dup2_x1*/, 0/*dup2_x2*/, 0/*swap*/,
+ 0/*iadd*/, 0/*ladd*/, 0/*fadd*/, 0/*dadd*/, 0/*isub*/,
+ 0/*lsub*/, 0/*fsub*/, 0/*dsub*/, 0/*imul*/, 0/*lmul*/,
+ 0/*fmul*/, 0/*dmul*/, 0/*idiv*/, 0/*ldiv*/, 0/*fdiv*/,
+ 0/*ddiv*/, 0/*irem*/, 0/*lrem*/, 0/*frem*/, 0/*drem*/,
+ 0/*ineg*/, 0/*lneg*/, 0/*fneg*/, 0/*dneg*/, 0/*ishl*/,
+ 0/*lshl*/, 0/*ishr*/, 0/*lshr*/, 0/*iushr*/, 0/*lushr*/,
+ 0/*iand*/, 0/*land*/, 0/*ior*/, 0/*lor*/, 0/*ixor*/, 0/*lxor*/,
+ 2/*iinc*/, 0/*i2l*/, 0/*i2f*/, 0/*i2d*/, 0/*l2i*/, 0/*l2f*/,
+ 0/*l2d*/, 0/*f2i*/, 0/*f2l*/, 0/*f2d*/, 0/*d2i*/, 0/*d2l*/,
+ 0/*d2f*/, 0/*i2b*/, 0/*i2c*/, 0/*i2s*/, 0/*lcmp*/, 0/*fcmpl*/,
+ 0/*fcmpg*/, 0/*dcmpl*/, 0/*dcmpg*/, 2/*ifeq*/, 2/*ifne*/,
+ 2/*iflt*/, 2/*ifge*/, 2/*ifgt*/, 2/*ifle*/, 2/*if_icmpeq*/,
+ 2/*if_icmpne*/, 2/*if_icmplt*/, 2/*if_icmpge*/, 2/*if_icmpgt*/,
+ 2/*if_icmple*/, 2/*if_acmpeq*/, 2/*if_acmpne*/, 2/*goto*/,
+ 2/*jsr*/, 1/*ret*/, UNPREDICTABLE/*tableswitch*/, UNPREDICTABLE/*lookupswitch*/,
+ 0/*ireturn*/, 0/*lreturn*/, 0/*freturn*/,
+ 0/*dreturn*/, 0/*areturn*/, 0/*return*/,
+ 2/*getstatic*/, 2/*putstatic*/, 2/*getfield*/,
+ 2/*putfield*/, 2/*invokevirtual*/, 2/*invokespecial*/, 2/*invokestatic*/,
+ 4/*invokeinterface*/, 4/*invokedynamic*/, 2/*new*/,
+ 1/*newarray*/, 2/*anewarray*/,
+ 0/*arraylength*/, 0/*athrow*/, 2/*checkcast*/,
+ 2/*instanceof*/, 0/*monitorenter*/,
+ 0/*monitorexit*/, UNPREDICTABLE/*wide*/, 3/*multianewarray*/,
+ 2/*ifnull*/, 2/*ifnonnull*/, 4/*goto_w*/,
+ 4/*jsr_w*/, 0/*breakpoint*/, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, RESERVED/*impdep1*/, RESERVED/*impdep2*/
+ };
- /**
- * Boolean data type.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
- * Static Constraints in the Java Virtual Machine Specification</a>
- */
- public static final byte T_BOOLEAN = 4;
-
- /**
- * Char data type.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
- * Static Constraints in the Java Virtual Machine Specification</a>
- */
- public static final byte T_CHAR = 5;
-
- /**
- * Float data type.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
- * Static Constraints in the Java Virtual Machine Specification</a>
- */
- public static final byte T_FLOAT = 6;
-
- /**
- * Double data type.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
- * Static Constraints in the Java Virtual Machine Specification</a>
- */
- public static final byte T_DOUBLE = 7;
-
- /**
- * Byte data type.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
- * Static Constraints in the Java Virtual Machine Specification</a>
- */
- public static final byte T_BYTE = 8;
-
- /**
- * Short data type.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
- * Static Constraints in the Java Virtual Machine Specification</a>
- */
- public static final byte T_SHORT = 9;
+ /**
+ *
+ * @param index
+ * @return Number of byte code operands
+ * @since 6.0
+ */
+ public static short getNoOfOperands(final int index) {
+ return NO_OF_OPERANDS[index];
+ }
- /**
- * Int data type.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
- * Static Constraints in the Java Virtual Machine Specification</a>
- */
- public static final byte T_INT = 10;
-
- /**
- * Long data type.
- *
- * @see <a
- * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.9.1-120-P">
- * Static Constraints in the Java Virtual Machine Specification</a>
- */
- public static final byte T_LONG = 11;
-
- /**
- * Void data type (non-standard).
- */
- public static final byte T_VOID = 12; // Non-standard
-
- /**
- * Array data type.
- */
- public static final byte T_ARRAY = 13;
-
- /**
- * Object data type.
- */
- public static final byte T_OBJECT = 14;
-
- /**
- * Reference data type (deprecated).
- */
- public static final byte T_REFERENCE = 14; // Deprecated
-
- /**
- * Unknown data type.
- */
- public static final byte T_UNKNOWN = 15;
-
- /**
- * Address data type.
- */
- public static final byte T_ADDRESS = 16;
+ /**
+ * How the byte code operands are to be interpreted for each opcode.
+ * Indexed by opcode. TYPE_OF_OPERANDS[ILOAD] = an array of shorts
+ * describing the data types for the instruction.
+ */
+ private static final short[][] TYPE_OF_OPERANDS = {
+ {}/*nop*/, {}/*aconst_null*/, {}/*iconst_m1*/, {}/*iconst_0*/,
+ {}/*iconst_1*/, {}/*iconst_2*/, {}/*iconst_3*/, {}/*iconst_4*/,
+ {}/*iconst_5*/, {}/*lconst_0*/, {}/*lconst_1*/, {}/*fconst_0*/,
+ {}/*fconst_1*/, {}/*fconst_2*/, {}/*dconst_0*/, {}/*dconst_1*/,
+ {T_BYTE}/*bipush*/, {T_SHORT}/*sipush*/, {T_BYTE}/*ldc*/,
+ {T_SHORT}/*ldc_w*/, {T_SHORT}/*ldc2_w*/,
+ {T_BYTE}/*iload*/, {T_BYTE}/*lload*/, {T_BYTE}/*fload*/,
+ {T_BYTE}/*dload*/, {T_BYTE}/*aload*/, {}/*iload_0*/,
+ {}/*iload_1*/, {}/*iload_2*/, {}/*iload_3*/, {}/*lload_0*/,
+ {}/*lload_1*/, {}/*lload_2*/, {}/*lload_3*/, {}/*fload_0*/,
+ {}/*fload_1*/, {}/*fload_2*/, {}/*fload_3*/, {}/*dload_0*/,
+ {}/*dload_1*/, {}/*dload_2*/, {}/*dload_3*/, {}/*aload_0*/,
+ {}/*aload_1*/, {}/*aload_2*/, {}/*aload_3*/, {}/*iaload*/,
+ {}/*laload*/, {}/*faload*/, {}/*daload*/, {}/*aaload*/,
+ {}/*baload*/, {}/*caload*/, {}/*saload*/, {T_BYTE}/*istore*/,
+ {T_BYTE}/*lstore*/, {T_BYTE}/*fstore*/, {T_BYTE}/*dstore*/,
+ {T_BYTE}/*astore*/, {}/*istore_0*/, {}/*istore_1*/,
+ {}/*istore_2*/, {}/*istore_3*/, {}/*lstore_0*/, {}/*lstore_1*/,
+ {}/*lstore_2*/, {}/*lstore_3*/, {}/*fstore_0*/, {}/*fstore_1*/,
+ {}/*fstore_2*/, {}/*fstore_3*/, {}/*dstore_0*/, {}/*dstore_1*/,
+ {}/*dstore_2*/, {}/*dstore_3*/, {}/*astore_0*/, {}/*astore_1*/,
+ {}/*astore_2*/, {}/*astore_3*/, {}/*iastore*/, {}/*lastore*/,
+ {}/*fastore*/, {}/*dastore*/, {}/*aastore*/, {}/*bastore*/,
+ {}/*castore*/, {}/*sastore*/, {}/*pop*/, {}/*pop2*/, {}/*dup*/,
+ {}/*dup_x1*/, {}/*dup_x2*/, {}/*dup2*/, {}/*dup2_x1*/,
+ {}/*dup2_x2*/, {}/*swap*/, {}/*iadd*/, {}/*ladd*/, {}/*fadd*/,
+ {}/*dadd*/, {}/*isub*/, {}/*lsub*/, {}/*fsub*/, {}/*dsub*/,
+ {}/*imul*/, {}/*lmul*/, {}/*fmul*/, {}/*dmul*/, {}/*idiv*/,
+ {}/*ldiv*/, {}/*fdiv*/, {}/*ddiv*/, {}/*irem*/, {}/*lrem*/,
+ {}/*frem*/, {}/*drem*/, {}/*ineg*/, {}/*lneg*/, {}/*fneg*/,
+ {}/*dneg*/, {}/*ishl*/, {}/*lshl*/, {}/*ishr*/, {}/*lshr*/,
+ {}/*iushr*/, {}/*lushr*/, {}/*iand*/, {}/*land*/, {}/*ior*/,
+ {}/*lor*/, {}/*ixor*/, {}/*lxor*/, {T_BYTE, T_BYTE}/*iinc*/,
+ {}/*i2l*/, {}/*i2f*/, {}/*i2d*/, {}/*l2i*/, {}/*l2f*/, {}/*l2d*/,
+ {}/*f2i*/, {}/*f2l*/, {}/*f2d*/, {}/*d2i*/, {}/*d2l*/, {}/*d2f*/,
+ {}/*i2b*/, {}/*i2c*/, {}/*i2s*/, {}/*lcmp*/, {}/*fcmpl*/,
+ {}/*fcmpg*/, {}/*dcmpl*/, {}/*dcmpg*/, {T_SHORT}/*ifeq*/,
+ {T_SHORT}/*ifne*/, {T_SHORT}/*iflt*/, {T_SHORT}/*ifge*/,
+ {T_SHORT}/*ifgt*/, {T_SHORT}/*ifle*/, {T_SHORT}/*if_icmpeq*/,
+ {T_SHORT}/*if_icmpne*/, {T_SHORT}/*if_icmplt*/,
+ {T_SHORT}/*if_icmpge*/, {T_SHORT}/*if_icmpgt*/,
+ {T_SHORT}/*if_icmple*/, {T_SHORT}/*if_acmpeq*/,
+ {T_SHORT}/*if_acmpne*/, {T_SHORT}/*goto*/, {T_SHORT}/*jsr*/,
+ {T_BYTE}/*ret*/, {}/*tableswitch*/, {}/*lookupswitch*/,
+ {}/*ireturn*/, {}/*lreturn*/, {}/*freturn*/, {}/*dreturn*/,
+ {}/*areturn*/, {}/*return*/, {T_SHORT}/*getstatic*/,
+ {T_SHORT}/*putstatic*/, {T_SHORT}/*getfield*/,
+ {T_SHORT}/*putfield*/, {T_SHORT}/*invokevirtual*/,
+ {T_SHORT}/*invokespecial*/, {T_SHORT}/*invokestatic*/,
+ {T_SHORT, T_BYTE, T_BYTE}/*invokeinterface*/, {T_SHORT, T_BYTE, T_BYTE}/*invokedynamic*/,
+ {T_SHORT}/*new*/, {T_BYTE}/*newarray*/,
+ {T_SHORT}/*anewarray*/, {}/*arraylength*/, {}/*athrow*/,
+ {T_SHORT}/*checkcast*/, {T_SHORT}/*instanceof*/,
+ {}/*monitorenter*/, {}/*monitorexit*/, {T_BYTE}/*wide*/,
+ {T_SHORT, T_BYTE}/*multianewarray*/, {T_SHORT}/*ifnull*/,
+ {T_SHORT}/*ifnonnull*/, {T_INT}/*goto_w*/, {T_INT}/*jsr_w*/,
+ {}/*breakpoint*/, {}, {}, {}, {}, {}, {}, {},
+ {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
+ {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
+ {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
+ {}/*impdep1*/, {}/*impdep2*/
+ };
- /**
- * The primitive type names corresponding to the T_XX constants, e.g.,
- * TYPE_NAMES[T_INT] = "int"
- */
- private static final String[] TYPE_NAMES = {
- ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE,
- "boolean", "char", "float", "double", "byte", "short", "int", "long",
- "void", "array", "object", "unknown", "address"
- };
-
- /**
- * The primitive type names corresponding to the T_XX constants, e.g.,
- * TYPE_NAMES[T_INT] = "int"
- *
- * @param index
- * @return the type name
- * @since 6.0
- */
- public static String getTypeName(final int index) {
- return TYPE_NAMES[index];
- }
+ /**
+ * @since 6.0
+ */
+ public static short getOperandType(final int opcode, final int index) {
+ return TYPE_OF_OPERANDS[opcode][index];
+ }
- /**
- * The primitive class names corresponding to the T_XX constants, e.g.,
- * CLASS_TYPE_NAMES[T_INT] = "java.lang.Integer"
- */
- private static final String[] CLASS_TYPE_NAMES = {
- ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE,
- "java.lang.Boolean", "java.lang.Character", "java.lang.Float",
- "java.lang.Double", "java.lang.Byte", "java.lang.Short",
- "java.lang.Integer", "java.lang.Long", "java.lang.Void",
- ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE
- };
-
- /**
- * The primitive class names corresponding to the T_XX constants, e.g.,
- * CLASS_TYPE_NAMES[T_INT] = "java.lang.Integer"
- *
- * @param index
- * @return the class name
- * @since 6.0
- */
- public static String getClassTypeName(final int index) {
- return CLASS_TYPE_NAMES[index];
- }
-
- /**
- * The signature characters corresponding to primitive types, e.g.,
- * SHORT_TYPE_NAMES[T_INT] = "I"
- */
- private static final String[] SHORT_TYPE_NAMES = {
- ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE,
- "Z", "C", "F", "D", "B", "S", "I", "J",
- "V", ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE
- };
-
- /**
- *
- * @param index
- * @return the short type name
- * @since 6.0
- */
- public static String getShortTypeName(final int index) {
- return SHORT_TYPE_NAMES[index];
- }
+ /**
+ * @since 6.0
+ */
+ public static long getOperandTypeCount(final int opcode) {
+ return TYPE_OF_OPERANDS[opcode].length;
+ }
- /**
- * Number of byte code operands for each opcode, i.e., number of bytes after
- * the tag byte itself. Indexed by opcode, so NO_OF_OPERANDS[BIPUSH] = the
- * number of operands for a bipush instruction.
- */
- private static final short[] NO_OF_OPERANDS = {
- 0/*nop*/, 0/*aconst_null*/, 0/*iconst_m1*/, 0/*iconst_0*/,
- 0/*iconst_1*/, 0/*iconst_2*/, 0/*iconst_3*/, 0/*iconst_4*/,
- 0/*iconst_5*/, 0/*lconst_0*/, 0/*lconst_1*/, 0/*fconst_0*/,
- 0/*fconst_1*/, 0/*fconst_2*/, 0/*dconst_0*/, 0/*dconst_1*/,
- 1/*bipush*/, 2/*sipush*/, 1/*ldc*/, 2/*ldc_w*/, 2/*ldc2_w*/,
- 1/*iload*/, 1/*lload*/, 1/*fload*/, 1/*dload*/, 1/*aload*/,
- 0/*iload_0*/, 0/*iload_1*/, 0/*iload_2*/, 0/*iload_3*/,
- 0/*lload_0*/, 0/*lload_1*/, 0/*lload_2*/, 0/*lload_3*/,
- 0/*fload_0*/, 0/*fload_1*/, 0/*fload_2*/, 0/*fload_3*/,
- 0/*dload_0*/, 0/*dload_1*/, 0/*dload_2*/, 0/*dload_3*/,
- 0/*aload_0*/, 0/*aload_1*/, 0/*aload_2*/, 0/*aload_3*/,
- 0/*iaload*/, 0/*laload*/, 0/*faload*/, 0/*daload*/,
- 0/*aaload*/, 0/*baload*/, 0/*caload*/, 0/*saload*/,
- 1/*istore*/, 1/*lstore*/, 1/*fstore*/, 1/*dstore*/,
- 1/*astore*/, 0/*istore_0*/, 0/*istore_1*/, 0/*istore_2*/,
- 0/*istore_3*/, 0/*lstore_0*/, 0/*lstore_1*/, 0/*lstore_2*/,
- 0/*lstore_3*/, 0/*fstore_0*/, 0/*fstore_1*/, 0/*fstore_2*/,
- 0/*fstore_3*/, 0/*dstore_0*/, 0/*dstore_1*/, 0/*dstore_2*/,
- 0/*dstore_3*/, 0/*astore_0*/, 0/*astore_1*/, 0/*astore_2*/,
- 0/*astore_3*/, 0/*iastore*/, 0/*lastore*/, 0/*fastore*/,
- 0/*dastore*/, 0/*aastore*/, 0/*bastore*/, 0/*castore*/,
- 0/*sastore*/, 0/*pop*/, 0/*pop2*/, 0/*dup*/, 0/*dup_x1*/,
- 0/*dup_x2*/, 0/*dup2*/, 0/*dup2_x1*/, 0/*dup2_x2*/, 0/*swap*/,
- 0/*iadd*/, 0/*ladd*/, 0/*fadd*/, 0/*dadd*/, 0/*isub*/,
- 0/*lsub*/, 0/*fsub*/, 0/*dsub*/, 0/*imul*/, 0/*lmul*/,
- 0/*fmul*/, 0/*dmul*/, 0/*idiv*/, 0/*ldiv*/, 0/*fdiv*/,
- 0/*ddiv*/, 0/*irem*/, 0/*lrem*/, 0/*frem*/, 0/*drem*/,
- 0/*ineg*/, 0/*lneg*/, 0/*fneg*/, 0/*dneg*/, 0/*ishl*/,
- 0/*lshl*/, 0/*ishr*/, 0/*lshr*/, 0/*iushr*/, 0/*lushr*/,
- 0/*iand*/, 0/*land*/, 0/*ior*/, 0/*lor*/, 0/*ixor*/, 0/*lxor*/,
- 2/*iinc*/, 0/*i2l*/, 0/*i2f*/, 0/*i2d*/, 0/*l2i*/, 0/*l2f*/,
- 0/*l2d*/, 0/*f2i*/, 0/*f2l*/, 0/*f2d*/, 0/*d2i*/, 0/*d2l*/,
- 0/*d2f*/, 0/*i2b*/, 0/*i2c*/, 0/*i2s*/, 0/*lcmp*/, 0/*fcmpl*/,
- 0/*fcmpg*/, 0/*dcmpl*/, 0/*dcmpg*/, 2/*ifeq*/, 2/*ifne*/,
- 2/*iflt*/, 2/*ifge*/, 2/*ifgt*/, 2/*ifle*/, 2/*if_icmpeq*/,
- 2/*if_icmpne*/, 2/*if_icmplt*/, 2/*if_icmpge*/, 2/*if_icmpgt*/,
- 2/*if_icmple*/, 2/*if_acmpeq*/, 2/*if_acmpne*/, 2/*goto*/,
- 2/*jsr*/, 1/*ret*/, UNPREDICTABLE/*tableswitch*/, UNPREDICTABLE/*lookupswitch*/,
- 0/*ireturn*/, 0/*lreturn*/, 0/*freturn*/,
- 0/*dreturn*/, 0/*areturn*/, 0/*return*/,
- 2/*getstatic*/, 2/*putstatic*/, 2/*getfield*/,
- 2/*putfield*/, 2/*invokevirtual*/, 2/*invokespecial*/, 2/*invokestatic*/,
- 4/*invokeinterface*/, 4/*invokedynamic*/, 2/*new*/,
- 1/*newarray*/, 2/*anewarray*/,
- 0/*arraylength*/, 0/*athrow*/, 2/*checkcast*/,
- 2/*instanceof*/, 0/*monitorenter*/,
- 0/*monitorexit*/, UNPREDICTABLE/*wide*/, 3/*multianewarray*/,
- 2/*ifnull*/, 2/*ifnonnull*/, 4/*goto_w*/,
- 4/*jsr_w*/, 0/*breakpoint*/, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, RESERVED/*impdep1*/, RESERVED/*impdep2*/};
+ /**
+ * Names of opcodes. Indexed by opcode. OPCODE_NAMES[ALOAD] = "aload".
+ */
+ private static final String[] OPCODE_NAMES = {
+ "nop", "aconst_null", "iconst_m1", "iconst_0", "iconst_1",
+ "iconst_2", "iconst_3", "iconst_4", "iconst_5", "lconst_0",
+ "lconst_1", "fconst_0", "fconst_1", "fconst_2", "dconst_0",
+ "dconst_1", "bipush", "sipush", "ldc", "ldc_w", "ldc2_w", "iload",
+ "lload", "fload", "dload", "aload", "iload_0", "iload_1", "iload_2",
+ "iload_3", "lload_0", "lload_1", "lload_2", "lload_3", "fload_0",
+ "fload_1", "fload_2", "fload_3", "dload_0", "dload_1", "dload_2",
+ "dload_3", "aload_0", "aload_1", "aload_2", "aload_3", "iaload",
+ "laload", "faload", "daload", "aaload", "baload", "caload", "saload",
+ "istore", "lstore", "fstore", "dstore", "astore", "istore_0",
+ "istore_1", "istore_2", "istore_3", "lstore_0", "lstore_1",
+ "lstore_2", "lstore_3", "fstore_0", "fstore_1", "fstore_2",
+ "fstore_3", "dstore_0", "dstore_1", "dstore_2", "dstore_3",
+ "astore_0", "astore_1", "astore_2", "astore_3", "iastore", "lastore",
+ "fastore", "dastore", "aastore", "bastore", "castore", "sastore",
+ "pop", "pop2", "dup", "dup_x1", "dup_x2", "dup2", "dup2_x1",
+ "dup2_x2", "swap", "iadd", "ladd", "fadd", "dadd", "isub", "lsub",
+ "fsub", "dsub", "imul", "lmul", "fmul", "dmul", "idiv", "ldiv",
+ "fdiv", "ddiv", "irem", "lrem", "frem", "drem", "ineg", "lneg",
+ "fneg", "dneg", "ishl", "lshl", "ishr", "lshr", "iushr", "lushr",
+ "iand", "land", "ior", "lor", "ixor", "lxor", "iinc", "i2l", "i2f",
+ "i2d", "l2i", "l2f", "l2d", "f2i", "f2l", "f2d", "d2i", "d2l", "d2f",
+ "i2b", "i2c", "i2s", "lcmp", "fcmpl", "fcmpg",
+ "dcmpl", "dcmpg", "ifeq", "ifne", "iflt", "ifge", "ifgt", "ifle",
+ "if_icmpeq", "if_icmpne", "if_icmplt", "if_icmpge", "if_icmpgt",
+ "if_icmple", "if_acmpeq", "if_acmpne", "goto", "jsr", "ret",
+ "tableswitch", "lookupswitch", "ireturn", "lreturn", "freturn",
+ "dreturn", "areturn", "return", "getstatic", "putstatic", "getfield",
+ "putfield", "invokevirtual", "invokespecial", "invokestatic",
+ "invokeinterface", "invokedynamic", "new", "newarray", "anewarray",
+ "arraylength", "athrow", "checkcast", "instanceof", "monitorenter",
+ "monitorexit", "wide", "multianewarray", "ifnull", "ifnonnull",
+ "goto_w", "jsr_w", "breakpoint", ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
+ ILLEGAL_OPCODE, "impdep1", "impdep2"
+ };
- /**
- *
- * @param index
- * @return Number of byte code operands
- * @since 6.0
- */
- public static short getNoOfOperands(final int index) {
- return NO_OF_OPERANDS[index];
- }
+ /**
+ * @since 6.0
+ */
+ public static final int OPCODE_NAMES_LENGTH = OPCODE_NAMES.length;
+
+
+ /**
+ * @since 6.0
+ */
+ public static String getOpcodeName(final int index) {
+ return OPCODE_NAMES[index];
+ }
- /**
- * How the byte code operands are to be interpreted for each opcode. Indexed
- * by opcode. TYPE_OF_OPERANDS[ILOAD] = an array of shorts describing the
- * data types for the instruction.
- */
- private static final short[][] TYPE_OF_OPERANDS = {
- {}/*nop*/, {}/*aconst_null*/, {}/*iconst_m1*/, {}/*iconst_0*/,
- {}/*iconst_1*/, {}/*iconst_2*/, {}/*iconst_3*/, {}/*iconst_4*/,
- {}/*iconst_5*/, {}/*lconst_0*/, {}/*lconst_1*/, {}/*fconst_0*/,
- {}/*fconst_1*/, {}/*fconst_2*/, {}/*dconst_0*/, {}/*dconst_1*/,
- {T_BYTE}/*bipush*/, {T_SHORT}/*sipush*/, {T_BYTE}/*ldc*/,
- {T_SHORT}/*ldc_w*/, {T_SHORT}/*ldc2_w*/,
- {T_BYTE}/*iload*/, {T_BYTE}/*lload*/, {T_BYTE}/*fload*/,
- {T_BYTE}/*dload*/, {T_BYTE}/*aload*/, {}/*iload_0*/,
- {}/*iload_1*/, {}/*iload_2*/, {}/*iload_3*/, {}/*lload_0*/,
- {}/*lload_1*/, {}/*lload_2*/, {}/*lload_3*/, {}/*fload_0*/,
- {}/*fload_1*/, {}/*fload_2*/, {}/*fload_3*/, {}/*dload_0*/,
- {}/*dload_1*/, {}/*dload_2*/, {}/*dload_3*/, {}/*aload_0*/,
- {}/*aload_1*/, {}/*aload_2*/, {}/*aload_3*/, {}/*iaload*/,
- {}/*laload*/, {}/*faload*/, {}/*daload*/, {}/*aaload*/,
- {}/*baload*/, {}/*caload*/, {}/*saload*/, {T_BYTE}/*istore*/,
- {T_BYTE}/*lstore*/, {T_BYTE}/*fstore*/, {T_BYTE}/*dstore*/,
- {T_BYTE}/*astore*/, {}/*istore_0*/, {}/*istore_1*/,
- {}/*istore_2*/, {}/*istore_3*/, {}/*lstore_0*/, {}/*lstore_1*/,
- {}/*lstore_2*/, {}/*lstore_3*/, {}/*fstore_0*/, {}/*fstore_1*/,
- {}/*fstore_2*/, {}/*fstore_3*/, {}/*dstore_0*/, {}/*dstore_1*/,
- {}/*dstore_2*/, {}/*dstore_3*/, {}/*astore_0*/, {}/*astore_1*/,
- {}/*astore_2*/, {}/*astore_3*/, {}/*iastore*/, {}/*lastore*/,
- {}/*fastore*/, {}/*dastore*/, {}/*aastore*/, {}/*bastore*/,
- {}/*castore*/, {}/*sastore*/, {}/*pop*/, {}/*pop2*/, {}/*dup*/,
- {}/*dup_x1*/, {}/*dup_x2*/, {}/*dup2*/, {}/*dup2_x1*/,
- {}/*dup2_x2*/, {}/*swap*/, {}/*iadd*/, {}/*ladd*/, {}/*fadd*/,
- {}/*dadd*/, {}/*isub*/, {}/*lsub*/, {}/*fsub*/, {}/*dsub*/,
- {}/*imul*/, {}/*lmul*/, {}/*fmul*/, {}/*dmul*/, {}/*idiv*/,
- {}/*ldiv*/, {}/*fdiv*/, {}/*ddiv*/, {}/*irem*/, {}/*lrem*/,
- {}/*frem*/, {}/*drem*/, {}/*ineg*/, {}/*lneg*/, {}/*fneg*/,
- {}/*dneg*/, {}/*ishl*/, {}/*lshl*/, {}/*ishr*/, {}/*lshr*/,
- {}/*iushr*/, {}/*lushr*/, {}/*iand*/, {}/*land*/, {}/*ior*/,
- {}/*lor*/, {}/*ixor*/, {}/*lxor*/, {T_BYTE, T_BYTE}/*iinc*/,
- {}/*i2l*/, {}/*i2f*/, {}/*i2d*/, {}/*l2i*/, {}/*l2f*/, {}/*l2d*/,
- {}/*f2i*/, {}/*f2l*/, {}/*f2d*/, {}/*d2i*/, {}/*d2l*/, {}/*d2f*/,
- {}/*i2b*/, {}/*i2c*/, {}/*i2s*/, {}/*lcmp*/, {}/*fcmpl*/,
- {}/*fcmpg*/, {}/*dcmpl*/, {}/*dcmpg*/, {T_SHORT}/*ifeq*/,
- {T_SHORT}/*ifne*/, {T_SHORT}/*iflt*/, {T_SHORT}/*ifge*/,
- {T_SHORT}/*ifgt*/, {T_SHORT}/*ifle*/, {T_SHORT}/*if_icmpeq*/,
- {T_SHORT}/*if_icmpne*/, {T_SHORT}/*if_icmplt*/,
- {T_SHORT}/*if_icmpge*/, {T_SHORT}/*if_icmpgt*/,
- {T_SHORT}/*if_icmple*/, {T_SHORT}/*if_acmpeq*/,
- {T_SHORT}/*if_acmpne*/, {T_SHORT}/*goto*/, {T_SHORT}/*jsr*/,
- {T_BYTE}/*ret*/, {}/*tableswitch*/, {}/*lookupswitch*/,
- {}/*ireturn*/, {}/*lreturn*/, {}/*freturn*/, {}/*dreturn*/,
- {}/*areturn*/, {}/*return*/, {T_SHORT}/*getstatic*/,
- {T_SHORT}/*putstatic*/, {T_SHORT}/*getfield*/,
- {T_SHORT}/*putfield*/, {T_SHORT}/*invokevirtual*/,
- {T_SHORT}/*invokespecial*/, {T_SHORT}/*invokestatic*/,
- {T_SHORT, T_BYTE, T_BYTE}/*invokeinterface*/, {T_SHORT, T_BYTE, T_BYTE}/*invokedynamic*/,
- {T_SHORT}/*new*/, {T_BYTE}/*newarray*/,
- {T_SHORT}/*anewarray*/, {}/*arraylength*/, {}/*athrow*/,
- {T_SHORT}/*checkcast*/, {T_SHORT}/*instanceof*/,
- {}/*monitorenter*/, {}/*monitorexit*/, {T_BYTE}/*wide*/,
- {T_SHORT, T_BYTE}/*multianewarray*/, {T_SHORT}/*ifnull*/,
- {T_SHORT}/*ifnonnull*/, {T_INT}/*goto_w*/, {T_INT}/*jsr_w*/,
- {}/*breakpoint*/, {}, {}, {}, {}, {}, {}, {},
- {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
- {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
- {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
- {}/*impdep1*/, {}/*impdep2*/};
+ /**
+ * Number of words consumed on operand stack by instructions.
+ * Indexed by opcode. CONSUME_STACK[FALOAD] = number of words
+ * consumed from the stack by a faload instruction.
+ */
+ private static final int[] CONSUME_STACK = {
+ 0/*nop*/, 0/*aconst_null*/, 0/*iconst_m1*/, 0/*iconst_0*/, 0/*iconst_1*/,
+ 0/*iconst_2*/, 0/*iconst_3*/, 0/*iconst_4*/, 0/*iconst_5*/, 0/*lconst_0*/,
+ 0/*lconst_1*/, 0/*fconst_0*/, 0/*fconst_1*/, 0/*fconst_2*/, 0/*dconst_0*/,
+ 0/*dconst_1*/, 0/*bipush*/, 0/*sipush*/, 0/*ldc*/, 0/*ldc_w*/, 0/*ldc2_w*/, 0/*iload*/,
+ 0/*lload*/, 0/*fload*/, 0/*dload*/, 0/*aload*/, 0/*iload_0*/, 0/*iload_1*/, 0/*iload_2*/,
+ 0/*iload_3*/, 0/*lload_0*/, 0/*lload_1*/, 0/*lload_2*/, 0/*lload_3*/, 0/*fload_0*/,
+ 0/*fload_1*/, 0/*fload_2*/, 0/*fload_3*/, 0/*dload_0*/, 0/*dload_1*/, 0/*dload_2*/,
+ 0/*dload_3*/, 0/*aload_0*/, 0/*aload_1*/, 0/*aload_2*/, 0/*aload_3*/, 2/*iaload*/,
+ 2/*laload*/, 2/*faload*/, 2/*daload*/, 2/*aaload*/, 2/*baload*/, 2/*caload*/, 2/*saload*/,
+ 1/*istore*/, 2/*lstore*/, 1/*fstore*/, 2/*dstore*/, 1/*astore*/, 1/*istore_0*/,
+ 1/*istore_1*/, 1/*istore_2*/, 1/*istore_3*/, 2/*lstore_0*/, 2/*lstore_1*/,
+ 2/*lstore_2*/, 2/*lstore_3*/, 1/*fstore_0*/, 1/*fstore_1*/, 1/*fstore_2*/,
+ 1/*fstore_3*/, 2/*dstore_0*/, 2/*dstore_1*/, 2/*dstore_2*/, 2/*dstore_3*/,
+ 1/*astore_0*/, 1/*astore_1*/, 1/*astore_2*/, 1/*astore_3*/, 3/*iastore*/, 4/*lastore*/,
+ 3/*fastore*/, 4/*dastore*/, 3/*aastore*/, 3/*bastore*/, 3/*castore*/, 3/*sastore*/,
+ 1/*pop*/, 2/*pop2*/, 1/*dup*/, 2/*dup_x1*/, 3/*dup_x2*/, 2/*dup2*/, 3/*dup2_x1*/,
+ 4/*dup2_x2*/, 2/*swap*/, 2/*iadd*/, 4/*ladd*/, 2/*fadd*/, 4/*dadd*/, 2/*isub*/, 4/*lsub*/,
+ 2/*fsub*/, 4/*dsub*/, 2/*imul*/, 4/*lmul*/, 2/*fmul*/, 4/*dmul*/, 2/*idiv*/, 4/*ldiv*/,
+ 2/*fdiv*/, 4/*ddiv*/, 2/*irem*/, 4/*lrem*/, 2/*frem*/, 4/*drem*/, 1/*ineg*/, 2/*lneg*/,
+ 1/*fneg*/, 2/*dneg*/, 2/*ishl*/, 3/*lshl*/, 2/*ishr*/, 3/*lshr*/, 2/*iushr*/, 3/*lushr*/,
+ 2/*iand*/, 4/*land*/, 2/*ior*/, 4/*lor*/, 2/*ixor*/, 4/*lxor*/, 0/*iinc*/,
+ 1/*i2l*/, 1/*i2f*/, 1/*i2d*/, 2/*l2i*/, 2/*l2f*/, 2/*l2d*/, 1/*f2i*/, 1/*f2l*/,
+ 1/*f2d*/, 2/*d2i*/, 2/*d2l*/, 2/*d2f*/, 1/*i2b*/, 1/*i2c*/, 1/*i2s*/,
+ 4/*lcmp*/, 2/*fcmpl*/, 2/*fcmpg*/, 4/*dcmpl*/, 4/*dcmpg*/, 1/*ifeq*/, 1/*ifne*/,
+ 1/*iflt*/, 1/*ifge*/, 1/*ifgt*/, 1/*ifle*/, 2/*if_icmpeq*/, 2/*if_icmpne*/, 2/*if_icmplt*/,
+ 2 /*if_icmpge*/, 2/*if_icmpgt*/, 2/*if_icmple*/, 2/*if_acmpeq*/, 2/*if_acmpne*/,
+ 0/*goto*/, 0/*jsr*/, 0/*ret*/, 1/*tableswitch*/, 1/*lookupswitch*/, 1/*ireturn*/,
+ 2/*lreturn*/, 1/*freturn*/, 2/*dreturn*/, 1/*areturn*/, 0/*return*/, 0/*getstatic*/,
+ UNPREDICTABLE/*putstatic*/, 1/*getfield*/, UNPREDICTABLE/*putfield*/,
+ UNPREDICTABLE/*invokevirtual*/, UNPREDICTABLE/*invokespecial*/,
+ UNPREDICTABLE/*invokestatic*/,
+ UNPREDICTABLE/*invokeinterface*/, UNPREDICTABLE/*invokedynamic*/, 0/*new*/, 1/*newarray*/, 1/*anewarray*/,
+ 1/*arraylength*/, 1/*athrow*/, 1/*checkcast*/, 1/*instanceof*/, 1/*monitorenter*/,
+ 1/*monitorexit*/, 0/*wide*/, UNPREDICTABLE/*multianewarray*/, 1/*ifnull*/, 1/*ifnonnull*/,
+ 0/*goto_w*/, 0/*jsr_w*/, 0/*breakpoint*/, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNPREDICTABLE/*impdep1*/, UNPREDICTABLE/*impdep2*/
+ };
- /**
- * @since 6.0
- */
- public static short getOperandType(final int opcode, final int index) {
- return TYPE_OF_OPERANDS[opcode][index];
- }
-
- /**
- * @since 6.0
- */
- public static long getOperandTypeCount(final int opcode) {
- return TYPE_OF_OPERANDS[opcode].length;
- }
+ /**
+ *
+ * @param index
+ * @return Number of words consumed on operand stack
+ * @since 6.0
+ */
+ public static int getConsumeStack(final int index) {
+ return CONSUME_STACK[index];
+ }
- /**
- * Names of opcodes. Indexed by opcode. OPCODE_NAMES[ALOAD] = "aload".
- */
- private static final String[] OPCODE_NAMES = {
- "nop", "aconst_null", "iconst_m1", "iconst_0", "iconst_1",
- "iconst_2", "iconst_3", "iconst_4", "iconst_5", "lconst_0",
- "lconst_1", "fconst_0", "fconst_1", "fconst_2", "dconst_0",
- "dconst_1", "bipush", "sipush", "ldc", "ldc_w", "ldc2_w", "iload",
- "lload", "fload", "dload", "aload", "iload_0", "iload_1", "iload_2",
- "iload_3", "lload_0", "lload_1", "lload_2", "lload_3", "fload_0",
- "fload_1", "fload_2", "fload_3", "dload_0", "dload_1", "dload_2",
- "dload_3", "aload_0", "aload_1", "aload_2", "aload_3", "iaload",
- "laload", "faload", "daload", "aaload", "baload", "caload", "saload",
- "istore", "lstore", "fstore", "dstore", "astore", "istore_0",
- "istore_1", "istore_2", "istore_3", "lstore_0", "lstore_1",
- "lstore_2", "lstore_3", "fstore_0", "fstore_1", "fstore_2",
- "fstore_3", "dstore_0", "dstore_1", "dstore_2", "dstore_3",
- "astore_0", "astore_1", "astore_2", "astore_3", "iastore", "lastore",
- "fastore", "dastore", "aastore", "bastore", "castore", "sastore",
- "pop", "pop2", "dup", "dup_x1", "dup_x2", "dup2", "dup2_x1",
- "dup2_x2", "swap", "iadd", "ladd", "fadd", "dadd", "isub", "lsub",
- "fsub", "dsub", "imul", "lmul", "fmul", "dmul", "idiv", "ldiv",
- "fdiv", "ddiv", "irem", "lrem", "frem", "drem", "ineg", "lneg",
- "fneg", "dneg", "ishl", "lshl", "ishr", "lshr", "iushr", "lushr",
- "iand", "land", "ior", "lor", "ixor", "lxor", "iinc", "i2l", "i2f",
- "i2d", "l2i", "l2f", "l2d", "f2i", "f2l", "f2d", "d2i", "d2l", "d2f",
- "i2b", "i2c", "i2s", "lcmp", "fcmpl", "fcmpg",
- "dcmpl", "dcmpg", "ifeq", "ifne", "iflt", "ifge", "ifgt", "ifle",
- "if_icmpeq", "if_icmpne", "if_icmplt", "if_icmpge", "if_icmpgt",
- "if_icmple", "if_acmpeq", "if_acmpne", "goto", "jsr", "ret",
- "tableswitch", "lookupswitch", "ireturn", "lreturn", "freturn",
- "dreturn", "areturn", "return", "getstatic", "putstatic", "getfield",
- "putfield", "invokevirtual", "invokespecial", "invokestatic",
- "invokeinterface", "invokedynamic", "new", "newarray", "anewarray",
- "arraylength", "athrow", "checkcast", "instanceof", "monitorenter",
- "monitorexit", "wide", "multianewarray", "ifnull", "ifnonnull",
- "goto_w", "jsr_w", "breakpoint", ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, "impdep1", "impdep2"
- };
-
- /**
- * @since 6.0
- */
- public static final int OPCODE_NAMES_LENGTH = OPCODE_NAMES.length;
-
- /**
- * @since 6.0
- */
- public static String getOpcodeName(final int index) {
- return OPCODE_NAMES[index];
- }
- /**
- * Number of words consumed on operand stack by instructions. Indexed by
- * opcode. CONSUME_STACK[FALOAD] = number of words consumed from the stack
- * by a faload instruction.
- */
- private static final int[] CONSUME_STACK = {
- 0/*nop*/, 0/*aconst_null*/, 0/*iconst_m1*/, 0/*iconst_0*/, 0/*iconst_1*/,
- 0/*iconst_2*/, 0/*iconst_3*/, 0/*iconst_4*/, 0/*iconst_5*/, 0/*lconst_0*/,
- 0/*lconst_1*/, 0/*fconst_0*/, 0/*fconst_1*/, 0/*fconst_2*/, 0/*dconst_0*/,
- 0/*dconst_1*/, 0/*bipush*/, 0/*sipush*/, 0/*ldc*/, 0/*ldc_w*/, 0/*ldc2_w*/, 0/*iload*/,
- 0/*lload*/, 0/*fload*/, 0/*dload*/, 0/*aload*/, 0/*iload_0*/, 0/*iload_1*/, 0/*iload_2*/,
- 0/*iload_3*/, 0/*lload_0*/, 0/*lload_1*/, 0/*lload_2*/, 0/*lload_3*/, 0/*fload_0*/,
- 0/*fload_1*/, 0/*fload_2*/, 0/*fload_3*/, 0/*dload_0*/, 0/*dload_1*/, 0/*dload_2*/,
- 0/*dload_3*/, 0/*aload_0*/, 0/*aload_1*/, 0/*aload_2*/, 0/*aload_3*/, 2/*iaload*/,
- 2/*laload*/, 2/*faload*/, 2/*daload*/, 2/*aaload*/, 2/*baload*/, 2/*caload*/, 2/*saload*/,
- 1/*istore*/, 2/*lstore*/, 1/*fstore*/, 2/*dstore*/, 1/*astore*/, 1/*istore_0*/,
- 1/*istore_1*/, 1/*istore_2*/, 1/*istore_3*/, 2/*lstore_0*/, 2/*lstore_1*/,
- 2/*lstore_2*/, 2/*lstore_3*/, 1/*fstore_0*/, 1/*fstore_1*/, 1/*fstore_2*/,
- 1/*fstore_3*/, 2/*dstore_0*/, 2/*dstore_1*/, 2/*dstore_2*/, 2/*dstore_3*/,
- 1/*astore_0*/, 1/*astore_1*/, 1/*astore_2*/, 1/*astore_3*/, 3/*iastore*/, 4/*lastore*/,
- 3/*fastore*/, 4/*dastore*/, 3/*aastore*/, 3/*bastore*/, 3/*castore*/, 3/*sastore*/,
- 1/*pop*/, 2/*pop2*/, 1/*dup*/, 2/*dup_x1*/, 3/*dup_x2*/, 2/*dup2*/, 3/*dup2_x1*/,
- 4/*dup2_x2*/, 2/*swap*/, 2/*iadd*/, 4/*ladd*/, 2/*fadd*/, 4/*dadd*/, 2/*isub*/, 4/*lsub*/,
- 2/*fsub*/, 4/*dsub*/, 2/*imul*/, 4/*lmul*/, 2/*fmul*/, 4/*dmul*/, 2/*idiv*/, 4/*ldiv*/,
- 2/*fdiv*/, 4/*ddiv*/, 2/*irem*/, 4/*lrem*/, 2/*frem*/, 4/*drem*/, 1/*ineg*/, 2/*lneg*/,
- 1/*fneg*/, 2/*dneg*/, 2/*ishl*/, 3/*lshl*/, 2/*ishr*/, 3/*lshr*/, 2/*iushr*/, 3/*lushr*/,
- 2/*iand*/, 4/*land*/, 2/*ior*/, 4/*lor*/, 2/*ixor*/, 4/*lxor*/, 0/*iinc*/,
- 1/*i2l*/, 1/*i2f*/, 1/*i2d*/, 2/*l2i*/, 2/*l2f*/, 2/*l2d*/, 1/*f2i*/, 1/*f2l*/,
- 1/*f2d*/, 2/*d2i*/, 2/*d2l*/, 2/*d2f*/, 1/*i2b*/, 1/*i2c*/, 1/*i2s*/,
- 4/*lcmp*/, 2/*fcmpl*/, 2/*fcmpg*/, 4/*dcmpl*/, 4/*dcmpg*/, 1/*ifeq*/, 1/*ifne*/,
- 1/*iflt*/, 1/*ifge*/, 1/*ifgt*/, 1/*ifle*/, 2/*if_icmpeq*/, 2/*if_icmpne*/, 2/*if_icmplt*/,
- 2 /*if_icmpge*/, 2/*if_icmpgt*/, 2/*if_icmple*/, 2/*if_acmpeq*/, 2/*if_acmpne*/,
- 0/*goto*/, 0/*jsr*/, 0/*ret*/, 1/*tableswitch*/, 1/*lookupswitch*/, 1/*ireturn*/,
- 2/*lreturn*/, 1/*freturn*/, 2/*dreturn*/, 1/*areturn*/, 0/*return*/, 0/*getstatic*/,
- UNPREDICTABLE/*putstatic*/, 1/*getfield*/, UNPREDICTABLE/*putfield*/,
- UNPREDICTABLE/*invokevirtual*/, UNPREDICTABLE/*invokespecial*/,
- UNPREDICTABLE/*invokestatic*/,
- UNPREDICTABLE/*invokeinterface*/, UNPREDICTABLE/*invokedynamic*/, 0/*new*/, 1/*newarray*/, 1/*anewarray*/,
- 1/*arraylength*/, 1/*athrow*/, 1/*checkcast*/, 1/*instanceof*/, 1/*monitorenter*/,
- 1/*monitorexit*/, 0/*wide*/, UNPREDICTABLE/*multianewarray*/, 1/*ifnull*/, 1/*ifnonnull*/,
- 0/*goto_w*/, 0/*jsr_w*/, 0/*breakpoint*/, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNPREDICTABLE/*impdep1*/, UNPREDICTABLE/*impdep2*/};
+ /**
+ * Number of words produced onto operand stack by instructions.
+ * Indexed by opcode. CONSUME_STACK[DALOAD] = number of words
+ * consumed from the stack by a daload instruction.
+ */
+ private static final int[] PRODUCE_STACK = {
+ 0/*nop*/, 1/*aconst_null*/, 1/*iconst_m1*/, 1/*iconst_0*/, 1/*iconst_1*/,
+ 1/*iconst_2*/, 1/*iconst_3*/, 1/*iconst_4*/, 1/*iconst_5*/, 2/*lconst_0*/,
+ 2/*lconst_1*/, 1/*fconst_0*/, 1/*fconst_1*/, 1/*fconst_2*/, 2/*dconst_0*/,
+ 2/*dconst_1*/, 1/*bipush*/, 1/*sipush*/, 1/*ldc*/, 1/*ldc_w*/, 2/*ldc2_w*/, 1/*iload*/,
+ 2/*lload*/, 1/*fload*/, 2/*dload*/, 1/*aload*/, 1/*iload_0*/, 1/*iload_1*/, 1/*iload_2*/,
+ 1/*iload_3*/, 2/*lload_0*/, 2/*lload_1*/, 2/*lload_2*/, 2/*lload_3*/, 1/*fload_0*/,
+ 1/*fload_1*/, 1/*fload_2*/, 1/*fload_3*/, 2/*dload_0*/, 2/*dload_1*/, 2/*dload_2*/,
+ 2/*dload_3*/, 1/*aload_0*/, 1/*aload_1*/, 1/*aload_2*/, 1/*aload_3*/, 1/*iaload*/,
+ 2/*laload*/, 1/*faload*/, 2/*daload*/, 1/*aaload*/, 1/*baload*/, 1/*caload*/, 1/*saload*/,
+ 0/*istore*/, 0/*lstore*/, 0/*fstore*/, 0/*dstore*/, 0/*astore*/, 0/*istore_0*/,
+ 0/*istore_1*/, 0/*istore_2*/, 0/*istore_3*/, 0/*lstore_0*/, 0/*lstore_1*/,
+ 0/*lstore_2*/, 0/*lstore_3*/, 0/*fstore_0*/, 0/*fstore_1*/, 0/*fstore_2*/,
+ 0/*fstore_3*/, 0/*dstore_0*/, 0/*dstore_1*/, 0/*dstore_2*/, 0/*dstore_3*/,
+ 0/*astore_0*/, 0/*astore_1*/, 0/*astore_2*/, 0/*astore_3*/, 0/*iastore*/, 0/*lastore*/,
+ 0/*fastore*/, 0/*dastore*/, 0/*aastore*/, 0/*bastore*/, 0/*castore*/, 0/*sastore*/,
+ 0/*pop*/, 0/*pop2*/, 2/*dup*/, 3/*dup_x1*/, 4/*dup_x2*/, 4/*dup2*/, 5/*dup2_x1*/,
+ 6/*dup2_x2*/, 2/*swap*/, 1/*iadd*/, 2/*ladd*/, 1/*fadd*/, 2/*dadd*/, 1/*isub*/, 2/*lsub*/,
+ 1/*fsub*/, 2/*dsub*/, 1/*imul*/, 2/*lmul*/, 1/*fmul*/, 2/*dmul*/, 1/*idiv*/, 2/*ldiv*/,
+ 1/*fdiv*/, 2/*ddiv*/, 1/*irem*/, 2/*lrem*/, 1/*frem*/, 2/*drem*/, 1/*ineg*/, 2/*lneg*/,
+ 1/*fneg*/, 2/*dneg*/, 1/*ishl*/, 2/*lshl*/, 1/*ishr*/, 2/*lshr*/, 1/*iushr*/, 2/*lushr*/,
+ 1/*iand*/, 2/*land*/, 1/*ior*/, 2/*lor*/, 1/*ixor*/, 2/*lxor*/,
+ 0/*iinc*/, 2/*i2l*/, 1/*i2f*/, 2/*i2d*/, 1/*l2i*/, 1/*l2f*/, 2/*l2d*/, 1/*f2i*/,
+ 2/*f2l*/, 2/*f2d*/, 1/*d2i*/, 2/*d2l*/, 1/*d2f*/,
+ 1/*i2b*/, 1/*i2c*/, 1/*i2s*/, 1/*lcmp*/, 1/*fcmpl*/, 1/*fcmpg*/,
+ 1/*dcmpl*/, 1/*dcmpg*/, 0/*ifeq*/, 0/*ifne*/, 0/*iflt*/, 0/*ifge*/, 0/*ifgt*/, 0/*ifle*/,
+ 0/*if_icmpeq*/, 0/*if_icmpne*/, 0/*if_icmplt*/, 0/*if_icmpge*/, 0/*if_icmpgt*/,
+ 0/*if_icmple*/, 0/*if_acmpeq*/, 0/*if_acmpne*/, 0/*goto*/, 1/*jsr*/, 0/*ret*/,
+ 0/*tableswitch*/, 0/*lookupswitch*/, 0/*ireturn*/, 0/*lreturn*/, 0/*freturn*/,
+ 0/*dreturn*/, 0/*areturn*/, 0/*return*/, UNPREDICTABLE/*getstatic*/, 0/*putstatic*/,
+ UNPREDICTABLE/*getfield*/, 0/*putfield*/, UNPREDICTABLE/*invokevirtual*/,
+ UNPREDICTABLE/*invokespecial*/, UNPREDICTABLE/*invokestatic*/,
+ UNPREDICTABLE/*invokeinterface*/, UNPREDICTABLE/*invokedynamic*/, 1/*new*/, 1/*newarray*/, 1/*anewarray*/,
+ 1/*arraylength*/, 1/*athrow*/, 1/*checkcast*/, 1/*instanceof*/, 0/*monitorenter*/,
+ 0/*monitorexit*/, 0/*wide*/, 1/*multianewarray*/, 0/*ifnull*/, 0/*ifnonnull*/,
+ 0/*goto_w*/, 1/*jsr_w*/, 0/*breakpoint*/, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
+ UNDEFINED, UNPREDICTABLE/*impdep1*/, UNPREDICTABLE/*impdep2*/
+ };
- /**
- *
- * @param index
- * @return Number of words consumed on operand stack
- * @since 6.0
- */
- public static int getConsumeStack(final int index) {
- return CONSUME_STACK[index];
- }
+ /**
+ *
+ * @param index
+ * @return Number of words produced onto operand stack
+ * @since 6.0
+ */
+ public static int getProduceStack(final int index) {
+ return PRODUCE_STACK[index];
+ }
- /**
- * Number of words produced onto operand stack by instructions. Indexed by
- * opcode. CONSUME_STACK[DALOAD] = number of words consumed from the stack
- * by a daload instruction.
- */
- private static final int[] PRODUCE_STACK = {
- 0/*nop*/, 1/*aconst_null*/, 1/*iconst_m1*/, 1/*iconst_0*/, 1/*iconst_1*/,
- 1/*iconst_2*/, 1/*iconst_3*/, 1/*iconst_4*/, 1/*iconst_5*/, 2/*lconst_0*/,
- 2/*lconst_1*/, 1/*fconst_0*/, 1/*fconst_1*/, 1/*fconst_2*/, 2/*dconst_0*/,
- 2/*dconst_1*/, 1/*bipush*/, 1/*sipush*/, 1/*ldc*/, 1/*ldc_w*/, 2/*ldc2_w*/, 1/*iload*/,
- 2/*lload*/, 1/*fload*/, 2/*dload*/, 1/*aload*/, 1/*iload_0*/, 1/*iload_1*/, 1/*iload_2*/,
- 1/*iload_3*/, 2/*lload_0*/, 2/*lload_1*/, 2/*lload_2*/, 2/*lload_3*/, 1/*fload_0*/,
- 1/*fload_1*/, 1/*fload_2*/, 1/*fload_3*/, 2/*dload_0*/, 2/*dload_1*/, 2/*dload_2*/,
- 2/*dload_3*/, 1/*aload_0*/, 1/*aload_1*/, 1/*aload_2*/, 1/*aload_3*/, 1/*iaload*/,
- 2/*laload*/, 1/*faload*/, 2/*daload*/, 1/*aaload*/, 1/*baload*/, 1/*caload*/, 1/*saload*/,
- 0/*istore*/, 0/*lstore*/, 0/*fstore*/, 0/*dstore*/, 0/*astore*/, 0/*istore_0*/,
- 0/*istore_1*/, 0/*istore_2*/, 0/*istore_3*/, 0/*lstore_0*/, 0/*lstore_1*/,
- 0/*lstore_2*/, 0/*lstore_3*/, 0/*fstore_0*/, 0/*fstore_1*/, 0/*fstore_2*/,
- 0/*fstore_3*/, 0/*dstore_0*/, 0/*dstore_1*/, 0/*dstore_2*/, 0/*dstore_3*/,
- 0/*astore_0*/, 0/*astore_1*/, 0/*astore_2*/, 0/*astore_3*/, 0/*iastore*/, 0/*lastore*/,
- 0/*fastore*/, 0/*dastore*/, 0/*aastore*/, 0/*bastore*/, 0/*castore*/, 0/*sastore*/,
- 0/*pop*/, 0/*pop2*/, 2/*dup*/, 3/*dup_x1*/, 4/*dup_x2*/, 4/*dup2*/, 5/*dup2_x1*/,
- 6/*dup2_x2*/, 2/*swap*/, 1/*iadd*/, 2/*ladd*/, 1/*fadd*/, 2/*dadd*/, 1/*isub*/, 2/*lsub*/,
- 1/*fsub*/, 2/*dsub*/, 1/*imul*/, 2/*lmul*/, 1/*fmul*/, 2/*dmul*/, 1/*idiv*/, 2/*ldiv*/,
- 1/*fdiv*/, 2/*ddiv*/, 1/*irem*/, 2/*lrem*/, 1/*frem*/, 2/*drem*/, 1/*ineg*/, 2/*lneg*/,
- 1/*fneg*/, 2/*dneg*/, 1/*ishl*/, 2/*lshl*/, 1/*ishr*/, 2/*lshr*/, 1/*iushr*/, 2/*lushr*/,
- 1/*iand*/, 2/*land*/, 1/*ior*/, 2/*lor*/, 1/*ixor*/, 2/*lxor*/,
- 0/*iinc*/, 2/*i2l*/, 1/*i2f*/, 2/*i2d*/, 1/*l2i*/, 1/*l2f*/, 2/*l2d*/, 1/*f2i*/,
- 2/*f2l*/, 2/*f2d*/, 1/*d2i*/, 2/*d2l*/, 1/*d2f*/,
- 1/*i2b*/, 1/*i2c*/, 1/*i2s*/, 1/*lcmp*/, 1/*fcmpl*/, 1/*fcmpg*/,
- 1/*dcmpl*/, 1/*dcmpg*/, 0/*ifeq*/, 0/*ifne*/, 0/*iflt*/, 0/*ifge*/, 0/*ifgt*/, 0/*ifle*/,
- 0/*if_icmpeq*/, 0/*if_icmpne*/, 0/*if_icmplt*/, 0/*if_icmpge*/, 0/*if_icmpgt*/,
- 0/*if_icmple*/, 0/*if_acmpeq*/, 0/*if_acmpne*/, 0/*goto*/, 1/*jsr*/, 0/*ret*/,
- 0/*tableswitch*/, 0/*lookupswitch*/, 0/*ireturn*/, 0/*lreturn*/, 0/*freturn*/,
- 0/*dreturn*/, 0/*areturn*/, 0/*return*/, UNPREDICTABLE/*getstatic*/, 0/*putstatic*/,
- UNPREDICTABLE/*getfield*/, 0/*putfield*/, UNPREDICTABLE/*invokevirtual*/,
- UNPREDICTABLE/*invokespecial*/, UNPREDICTABLE/*invokestatic*/,
- UNPREDICTABLE/*invokeinterface*/, UNPREDICTABLE/*invokedynamic*/, 1/*new*/, 1/*newarray*/, 1/*anewarray*/,
- 1/*arraylength*/, 1/*athrow*/, 1/*checkcast*/, 1/*instanceof*/, 0/*monitorenter*/,
- 0/*monitorexit*/, 0/*wide*/, 1/*multianewarray*/, 0/*ifnull*/, 0/*ifnonnull*/,
- 0/*goto_w*/, 1/*jsr_w*/, 0/*breakpoint*/, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNPREDICTABLE/*impdep1*/, UNPREDICTABLE/*impdep2*/};
+ /** Attributes and their corresponding names.
+ */
+ public static final byte ATTR_UNKNOWN = -1;
+ public static final byte ATTR_SOURCE_FILE = 0;
+ public static final byte ATTR_CONSTANT_VALUE = 1;
+ public static final byte ATTR_CODE = 2;
+ public static final byte ATTR_EXCEPTIONS = 3;
+ public static final byte ATTR_LINE_NUMBER_TABLE = 4;
+ public static final byte ATTR_LOCAL_VARIABLE_TABLE = 5;
+ public static final byte ATTR_INNER_CLASSES = 6;
+ public static final byte ATTR_SYNTHETIC = 7;
+ public static final byte ATTR_DEPRECATED = 8;
+ public static final byte ATTR_PMG = 9;
+ public static final byte ATTR_SIGNATURE = 10;
+ public static final byte ATTR_STACK_MAP = 11;
+ public static final byte ATTR_RUNTIME_VISIBLE_ANNOTATIONS = 12;
+ public static final byte ATTR_RUNTIME_INVISIBLE_ANNOTATIONS = 13;
+ public static final byte ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = 14;
+ public static final byte ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = 15;
+ public static final byte ATTR_ANNOTATION_DEFAULT = 16;
+ public static final byte ATTR_LOCAL_VARIABLE_TYPE_TABLE = 17;
+ public static final byte ATTR_ENCLOSING_METHOD = 18;
+ public static final byte ATTR_STACK_MAP_TABLE = 19;
+ public static final byte ATTR_BOOTSTRAP_METHODS = 20;
+ public static final byte ATTR_METHOD_PARAMETERS = 21;
- /**
- *
- * @param index
- * @return Number of words produced onto operand stack
- * @since 6.0
- */
- public static int getProduceStack(final int index) {
- return PRODUCE_STACK[index];
- }
+ public static final short KNOWN_ATTRIBUTES = 22; // count of attributes
+
+ private static final String[] ATTRIBUTE_NAMES = {
+ "SourceFile", "ConstantValue", "Code", "Exceptions",
+ "LineNumberTable", "LocalVariableTable",
+ "InnerClasses", "Synthetic", "Deprecated",
+ "PMGClass", "Signature", "StackMap",
+ "RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations",
+ "RuntimeVisibleParameterAnnotations", "RuntimeInvisibleParameterAnnotations",
+ "AnnotationDefault", "LocalVariableTypeTable", "EnclosingMethod", "StackMapTable",
+ "BootstrapMethods", "MethodParameters"
+ };
+
+ /**
+ *
+ * @param index
+ * @return the attribute name
+ * @since 6.0
+ */
+ public static String getAttributeName(final int index) {
+ return ATTRIBUTE_NAMES[index];
+ }
- /**
- * Attributes and their corresponding names.
- */
- public static final byte ATTR_UNKNOWN = -1;
- public static final byte ATTR_SOURCE_FILE = 0;
- public static final byte ATTR_CONSTANT_VALUE = 1;
- public static final byte ATTR_CODE = 2;
- public static final byte ATTR_EXCEPTIONS = 3;
- public static final byte ATTR_LINE_NUMBER_TABLE = 4;
- public static final byte ATTR_LOCAL_VARIABLE_TABLE = 5;
- public static final byte ATTR_INNER_CLASSES = 6;
- public static final byte ATTR_SYNTHETIC = 7;
- public static final byte ATTR_DEPRECATED = 8;
- public static final byte ATTR_PMG = 9;
- public static final byte ATTR_SIGNATURE = 10;
- public static final byte ATTR_STACK_MAP = 11;
- public static final byte ATTR_RUNTIME_VISIBLE_ANNOTATIONS = 12;
- public static final byte ATTR_RUNTIME_INVISIBLE_ANNOTATIONS = 13;
- public static final byte ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = 14;
- public static final byte ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = 15;
- public static final byte ATTR_ANNOTATION_DEFAULT = 16;
- public static final byte ATTR_LOCAL_VARIABLE_TYPE_TABLE = 17;
- public static final byte ATTR_ENCLOSING_METHOD = 18;
- public static final byte ATTR_STACK_MAP_TABLE = 19;
- public static final byte ATTR_BOOTSTRAP_METHODS = 20;
- public static final byte ATTR_METHOD_PARAMETERS = 21;
+ /** Constants used in the StackMap attribute.
+ */
+ public static final byte ITEM_Bogus = 0;
+ public static final byte ITEM_Integer = 1;
+ public static final byte ITEM_Float = 2;
+ public static final byte ITEM_Double = 3;
+ public static final byte ITEM_Long = 4;
+ public static final byte ITEM_Null = 5;
+ public static final byte ITEM_InitObject = 6;
+ public static final byte ITEM_Object = 7;
+ public static final byte ITEM_NewObject = 8;
- public static final short KNOWN_ATTRIBUTES = 22; // count of attributes
-
- private static final String[] ATTRIBUTE_NAMES = {
- "SourceFile", "ConstantValue", "Code", "Exceptions",
- "LineNumberTable", "LocalVariableTable",
- "InnerClasses", "Synthetic", "Deprecated",
- "PMGClass", "Signature", "StackMap",
- "RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations",
- "RuntimeVisibleParameterAnnotations", "RuntimeInvisibleParameterAnnotations",
- "AnnotationDefault", "LocalVariableTypeTable", "EnclosingMethod", "StackMapTable",
- "BootstrapMethods", "MethodParameters"
- };
-
- /**
- *
- * @param index
- * @return the attribute name
- * @since 6.0
- */
- public static String getAttributeName(final int index) {
- return ATTRIBUTE_NAMES[index];
- }
+ private static final String[] ITEM_NAMES = {
+ "Bogus", "Integer", "Float", "Double", "Long",
+ "Null", "InitObject", "Object", "NewObject"
+ };
- /**
- * Constants used in the StackMap attribute.
- */
- public static final byte ITEM_Bogus = 0;
- public static final byte ITEM_Integer = 1;
- public static final byte ITEM_Float = 2;
- public static final byte ITEM_Double = 3;
- public static final byte ITEM_Long = 4;
- public static final byte ITEM_Null = 5;
- public static final byte ITEM_InitObject = 6;
- public static final byte ITEM_Object = 7;
- public static final byte ITEM_NewObject = 8;
-
- private static final String[] ITEM_NAMES = {
- "Bogus", "Integer", "Float", "Double", "Long",
- "Null", "InitObject", "Object", "NewObject"
- };
+ /**
+ *
+ * @param index
+ * @return the item name
+ * @since 6.0
+ */
+ public static String getItemName(final int index) {
+ return ITEM_NAMES[index];
+ }
- /**
- *
- * @param index
- * @return the item name
- * @since 6.0
- */
- public static String getItemName(final int index) {
- return ITEM_NAMES[index];
- }
+ /** Constants used to identify StackMapEntry types.
+ *
+ * For those types which can specify a range, the
+ * constant names the lowest value.
+ */
+ public static final int SAME_FRAME = 0;
+ public static final int SAME_LOCALS_1_STACK_ITEM_FRAME = 64;
+ public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED = 247;
+ public static final int CHOP_FRAME = 248;
+ public static final int SAME_FRAME_EXTENDED = 251;
+ public static final int APPEND_FRAME = 252;
+ public static final int FULL_FRAME = 255;
- /**
- * Constants used to identify StackMapEntry types.
- *
- * For those types which can specify a range, the constant names the lowest
- * value.
- */
- public static final int SAME_FRAME = 0;
- public static final int SAME_LOCALS_1_STACK_ITEM_FRAME = 64;
- public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED = 247;
- public static final int CHOP_FRAME = 248;
- public static final int SAME_FRAME_EXTENDED = 251;
- public static final int APPEND_FRAME = 252;
- public static final int FULL_FRAME = 255;
+ /** Constants that define the maximum value of
+ * those constants which store ranges. */
- /**
- * Constants that define the maximum value of those constants which store
- * ranges.
- */
- public static final int SAME_FRAME_MAX = 63;
- public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_MAX = 127;
- public static final int CHOP_FRAME_MAX = 250;
- public static final int APPEND_FRAME_MAX = 254;
+ public static final int SAME_FRAME_MAX = 63;
+ public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_MAX = 127;
+ public static final int CHOP_FRAME_MAX = 250;
+ public static final int APPEND_FRAME_MAX = 254;
+
// Constants defining the behavior of the Method Handles (JVMS 5.4.3.5)
- public static final byte REF_getField = 1;
- public static final byte REF_getStatic = 2;
- public static final byte REF_putField = 3;
- public static final byte REF_putStatic = 4;
- public static final byte REF_invokeVirtual = 5;
- public static final byte REF_invokeStatic = 6;
- public static final byte REF_invokeSpecial = 7;
- public static final byte REF_newInvokeSpecial = 8;
- public static final byte REF_invokeInterface = 9;
+
+ public static final byte REF_getField = 1;
+ public static final byte REF_getStatic = 2;
+ public static final byte REF_putField = 3;
+ public static final byte REF_putStatic = 4;
+ public static final byte REF_invokeVirtual = 5;
+ public static final byte REF_invokeStatic = 6;
+ public static final byte REF_invokeSpecial = 7;
+ public static final byte REF_newInvokeSpecial = 8;
+ public static final byte REF_invokeInterface = 9;
- /**
- * The names of the reference_kinds of a CONSTANT_MethodHandle_info.
- */
- private static final String[] METHODHANDLE_NAMES = {
- "", "getField", "getStatic", "putField", "putStatic", "invokeVirtual",
- "invokeStatic", "invokeSpecial", "newInvokeSpecial", "invokeInterface"};
+ /**
+ * The names of the reference_kinds of a CONSTANT_MethodHandle_info.
+ */
+ private static final String[] METHODHANDLE_NAMES = {
+ "", "getField", "getStatic", "putField", "putStatic", "invokeVirtual",
+ "invokeStatic", "invokeSpecial", "newInvokeSpecial", "invokeInterface" };
- /**
- *
- * @param index
- * @return the method handle name
- * @since 6.0
- */
- public static String getMethodHandleName(final int index) {
- return METHODHANDLE_NAMES[index];
- }
+ /**
+ *
+ * @param index
+ * @return the method handle name
+ * @since 6.0
+ */
+ public static String getMethodHandleName(final int index) {
+ return METHODHANDLE_NAMES[index];
+ }
- private Const() {
- } // not instantiable
+ private Const() { } // not instantiable
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/Repository.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/Repository.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,59 +25,59 @@
/**
* The repository maintains informations about class interdependencies, e.g.,
- * whether a class is a sub-class of another. Delegates actual class loading to
- * SyntheticRepository with current class path by default.
+ * whether a class is a sub-class of another. Delegates actual class loading
+ * to SyntheticRepository with current class path by default.
*
* @see com.sun.org.apache.bcel.internal.util.Repository
* @see SyntheticRepository
*
- * @version $Id: Repository.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class Repository {
private static com.sun.org.apache.bcel.internal.util.Repository repository
= SyntheticRepository.getInstance();
- /**
- * @return currently used repository instance
+
+ /** @return currently used repository instance
*/
public static com.sun.org.apache.bcel.internal.util.Repository getRepository() {
return repository;
}
- /**
- * Set repository instance to be used for class loading
+
+ /** Set repository instance to be used for class loading
*/
- public static void setRepository(final com.sun.org.apache.bcel.internal.util.Repository rep) {
+ public static void setRepository( final com.sun.org.apache.bcel.internal.util.Repository rep ) {
repository = rep;
}
- /**
- * Lookup class somewhere found on your CLASSPATH, or whereever the
+
+ /** Lookup class somewhere found on your CLASSPATH, or whereever the
* repository instance looks for it.
*
* @return class object for given fully qualified class name
- * @throws ClassNotFoundException if the class could not be found or parsed
- * correctly
+ * @throws ClassNotFoundException if the class could not be found or
+ * parsed correctly
*/
- public static JavaClass lookupClass(final String class_name)
- throws ClassNotFoundException {
+ public static JavaClass lookupClass( final String class_name ) throws ClassNotFoundException {
return repository.loadClass(class_name);
}
+
/**
* Try to find class source using the internal repository instance.
- *
* @see Class
* @return JavaClass object for given runtime class
- * @throws ClassNotFoundException if the class could not be found or parsed
- * correctly
+ * @throws ClassNotFoundException if the class could not be found or
+ * parsed correctly
*/
- public static JavaClass lookupClass(final Class<?> clazz)
- throws ClassNotFoundException {
+ public static JavaClass lookupClass( final Class<?> clazz ) throws ClassNotFoundException {
return repository.loadClass(clazz);
}
+
/**
* Clear the repository.
*/
@@ -85,149 +85,162 @@
repository.clear();
}
+
/**
- * Add clazz to repository if there isn't an equally named class already in
- * there.
+ * Add clazz to repository if there isn't an equally named class already in there.
*
* @return old entry in repository
*/
- public static JavaClass addClass(final JavaClass clazz) {
+ public static JavaClass addClass( final JavaClass clazz ) {
final JavaClass old = repository.findClass(clazz.getClassName());
repository.storeClass(clazz);
return old;
}
+
/**
* Remove class with given (fully qualified) name from repository.
*/
- public static void removeClass(final String clazz) {
+ public static void removeClass( final String clazz ) {
repository.removeClass(repository.findClass(clazz));
}
+
/**
* Remove given class from repository.
*/
- public static void removeClass(final JavaClass clazz) {
+ public static void removeClass( final JavaClass clazz ) {
repository.removeClass(clazz);
}
+
/**
- * @return list of super classes of clazz in ascending order, i.e., Object
- * is always the last element
+ * @return list of super classes of clazz in ascending order, i.e.,
+ * Object is always the last element
* @throws ClassNotFoundException if any of the superclasses can't be found
*/
- public static JavaClass[] getSuperClasses(final JavaClass clazz) throws ClassNotFoundException {
+ public static JavaClass[] getSuperClasses( final JavaClass clazz ) throws ClassNotFoundException {
return clazz.getSuperClasses();
}
+
/**
- * @return list of super classes of clazz in ascending order, i.e., Object
- * is always the last element.
+ * @return list of super classes of clazz in ascending order, i.e.,
+ * Object is always the last element.
* @throws ClassNotFoundException if the named class or any of its
- * superclasses can't be found
+ * superclasses can't be found
*/
- public static JavaClass[] getSuperClasses(final String class_name) throws ClassNotFoundException {
+ public static JavaClass[] getSuperClasses( final String class_name ) throws ClassNotFoundException {
final JavaClass jc = lookupClass(class_name);
return getSuperClasses(jc);
}
+
/**
- * @return all interfaces implemented by class and its super classes and the
- * interfaces that those interfaces extend, and so on. (Some people call
- * this a transitive hull).
- * @throws ClassNotFoundException if any of the class's superclasses or
- * superinterfaces can't be found
+ * @return all interfaces implemented by class and its super
+ * classes and the interfaces that those interfaces extend, and so on.
+ * (Some people call this a transitive hull).
+ * @throws ClassNotFoundException if any of the class's
+ * superclasses or superinterfaces can't be found
*/
- public static JavaClass[] getInterfaces(final JavaClass clazz) throws ClassNotFoundException {
+ public static JavaClass[] getInterfaces( final JavaClass clazz ) throws ClassNotFoundException {
return clazz.getAllInterfaces();
}
+
/**
- * @return all interfaces implemented by class and its super classes and the
- * interfaces that extend those interfaces, and so on
- * @throws ClassNotFoundException if the named class can't be found, or if
- * any of its superclasses or superinterfaces can't be found
+ * @return all interfaces implemented by class and its super
+ * classes and the interfaces that extend those interfaces, and so on
+ * @throws ClassNotFoundException if the named class can't be found,
+ * or if any of its superclasses or superinterfaces can't be found
*/
- public static JavaClass[] getInterfaces(final String class_name) throws ClassNotFoundException {
+ public static JavaClass[] getInterfaces( final String class_name ) throws ClassNotFoundException {
return getInterfaces(lookupClass(class_name));
}
+
/**
* Equivalent to runtime "instanceof" operator.
- *
* @return true, if clazz is an instance of super_class
- * @throws ClassNotFoundException if any superclasses or superinterfaces of
- * clazz can't be found
+ * @throws ClassNotFoundException if any superclasses or superinterfaces
+ * of clazz can't be found
*/
- public static boolean instanceOf(final JavaClass clazz, final JavaClass super_class)
+ public static boolean instanceOf( final JavaClass clazz, final JavaClass super_class )
throws ClassNotFoundException {
return clazz.instanceOf(super_class);
}
+
/**
* @return true, if clazz is an instance of super_class
- * @throws ClassNotFoundException if either clazz or super_class can't be
- * found
+ * @throws ClassNotFoundException if either clazz or super_class
+ * can't be found
*/
- public static boolean instanceOf(final String clazz, final String super_class)
+ public static boolean instanceOf( final String clazz, final String super_class )
throws ClassNotFoundException {
return instanceOf(lookupClass(clazz), lookupClass(super_class));
}
+
/**
* @return true, if clazz is an instance of super_class
* @throws ClassNotFoundException if super_class can't be found
*/
- public static boolean instanceOf(final JavaClass clazz, final String super_class)
+ public static boolean instanceOf( final JavaClass clazz, final String super_class )
throws ClassNotFoundException {
return instanceOf(clazz, lookupClass(super_class));
}
+
/**
* @return true, if clazz is an instance of super_class
* @throws ClassNotFoundException if clazz can't be found
*/
- public static boolean instanceOf(final String clazz, final JavaClass super_class)
+ public static boolean instanceOf( final String clazz, final JavaClass super_class )
throws ClassNotFoundException {
return instanceOf(lookupClass(clazz), super_class);
}
+
/**
* @return true, if clazz is an implementation of interface inter
- * @throws ClassNotFoundException if any superclasses or superinterfaces of
- * clazz can't be found
+ * @throws ClassNotFoundException if any superclasses or superinterfaces
+ * of clazz can't be found
*/
- public static boolean implementationOf(final JavaClass clazz, final JavaClass inter)
+ public static boolean implementationOf( final JavaClass clazz, final JavaClass inter )
throws ClassNotFoundException {
return clazz.implementationOf(inter);
}
+
/**
* @return true, if clazz is an implementation of interface inter
- * @throws ClassNotFoundException if clazz, inter, or any superclasses or
- * superinterfaces of clazz can't be found
+ * @throws ClassNotFoundException if clazz, inter, or any superclasses
+ * or superinterfaces of clazz can't be found
*/
- public static boolean implementationOf(final String clazz, final String inter)
+ public static boolean implementationOf( final String clazz, final String inter )
throws ClassNotFoundException {
return implementationOf(lookupClass(clazz), lookupClass(inter));
}
+
/**
* @return true, if clazz is an implementation of interface inter
- * @throws ClassNotFoundException if inter or any superclasses or
- * superinterfaces of clazz can't be found
+ * @throws ClassNotFoundException if inter or any superclasses
+ * or superinterfaces of clazz can't be found
*/
- public static boolean implementationOf(final JavaClass clazz, final String inter)
+ public static boolean implementationOf( final JavaClass clazz, final String inter )
throws ClassNotFoundException {
return implementationOf(clazz, lookupClass(inter));
}
+
/**
* @return true, if clazz is an implementation of interface inter
* @throws ClassNotFoundException if clazz or any superclasses or
- * superinterfaces of clazz can't be found
+ * superinterfaces of clazz can't be found
*/
- public static boolean implementationOf(final String clazz, final JavaClass inter)
+ public static boolean implementationOf( final String clazz, final JavaClass inter )
throws ClassNotFoundException {
return implementationOf(lookupClass(clazz), inter);
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/AccessFlags.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/AccessFlags.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,7 +25,8 @@
* Super class for all objects that have modifiers like private, final, ... I.e.
* classes, fields, and methods.
*
- * @version $Id: AccessFlags.java 1748636 2016-06-15 20:45:17Z dbrosius $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class AccessFlags {
@@ -35,7 +36,8 @@
}
/**
- * @param a inital access flags
+ * @param a
+ * inital access flags
*/
public AccessFlags(final int a) {
access_flags = a;
@@ -58,7 +60,8 @@
/**
* Set access flags aka "modifiers".
*
- * @param access_flags Access flags of the object.
+ * @param access_flags
+ * Access flags of the object.
*/
public final void setAccessFlags(final int access_flags) {
this.access_flags = access_flags;
@@ -67,7 +70,8 @@
/**
* Set access flags aka "modifiers".
*
- * @param access_flags Access flags of the object.
+ * @param access_flags
+ * Access flags of the object.
*/
public final void setModifiers(final int access_flags) {
setAccessFlags(access_flags);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Attribute.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Attribute.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -36,7 +36,7 @@
* <em>Synthetic</em> attributes are supported. The <em>Unknown</em>
* attribute stands for non-standard-attributes.
*
- * @version $Id: Attribute.java 1750029 2016-06-23 22:14:38Z sebb $
+ * @version $Id$
* @see ConstantValue
* @see SourceFile
* @see Code
@@ -48,6 +48,7 @@
* @see Synthetic
* @see Deprecated
* @see Signature
+ * @LastModified: Jun 2019
*/
public abstract class Attribute implements Cloneable, Node {
@@ -79,7 +80,8 @@
* @param file Output file stream
* @throws IOException
*/
- public void dump(final DataOutputStream file) throws IOException {
+ public void dump(final DataOutputStream file) throws IOException
+ {
file.writeShort(name_index);
file.writeInt(length);
}
@@ -92,9 +94,10 @@
* as "LineNumberTable", because those are handled internally.
*
* @param name the name of the attribute as stored in the class file
- * @param r the reader object
+ * @param r the reader object
*/
- public static void addAttributeReader(final String name, final UnknownAttributeReader r) {
+ public static void addAttributeReader(final String name, final UnknownAttributeReader r)
+ {
readers.put(name, r);
}
@@ -103,7 +106,8 @@
*
* @param name the name of the attribute as stored in the class file
*/
- public static void removeAttributeReader(final String name) {
+ public static void removeAttributeReader(final String name)
+ {
readers.remove(name);
}
@@ -122,7 +126,8 @@
* @throws ClassFormatException
*/
public static Attribute readAttribute(final DataInputStream file, final ConstantPool constant_pool)
- throws IOException, ClassFormatException {
+ throws IOException, ClassFormatException
+ {
return readAttribute((DataInput) file, constant_pool);
}
@@ -142,7 +147,8 @@
* @since 6.0
*/
public static Attribute readAttribute(final DataInput file, final ConstantPool constant_pool)
- throws IOException, ClassFormatException {
+ throws IOException, ClassFormatException
+ {
byte tag = Const.ATTR_UNKNOWN; // Unknown attribute
// Get class name from constant pool via `name_index' indirection
final int name_index = file.readUnsignedShort();
@@ -153,18 +159,22 @@
final int length = file.readInt();
// Compare strings to find known attribute
- for (byte i = 0; i < Const.KNOWN_ATTRIBUTES; i++) {
- if (name.equals(Const.getAttributeName(i))) {
+ for (byte i = 0; i < Const.KNOWN_ATTRIBUTES; i++)
+ {
+ if (name.equals(Const.getAttributeName(i)))
+ {
tag = i; // found!
break;
}
}
// Call proper constructor, depending on `tag'
- switch (tag) {
+ switch (tag)
+ {
case Const.ATTR_UNKNOWN:
final Object r = readers.get(name);
- if (r instanceof UnknownAttributeReader) {
+ if (r instanceof UnknownAttributeReader)
+ {
return ((UnknownAttributeReader) r).createAttribute(name_index, length, file, constant_pool);
}
return new Unknown(name_index, length, file, constant_pool);
@@ -191,7 +201,10 @@
case Const.ATTR_SIGNATURE:
return new Signature(name_index, length, file, constant_pool);
case Const.ATTR_STACK_MAP:
- return new StackMap(name_index, length, file, constant_pool);
+ // old style stack map: unneeded for JDK5 and below;
+ // illegal(?) for JDK6 and above. So just delete with a warning.
+ System.err.println("Warning: Obsolete StackMap attribute ignored.");
+ return new Unknown(name_index, length, file, constant_pool);
case Const.ATTR_RUNTIME_VISIBLE_ANNOTATIONS:
return new RuntimeVisibleAnnotations(name_index, length, file, constant_pool);
case Const.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS:
@@ -207,6 +220,8 @@
case Const.ATTR_ENCLOSING_METHOD:
return new EnclosingMethod(name_index, length, file, constant_pool);
case Const.ATTR_STACK_MAP_TABLE:
+ // read new style stack map: StackMapTable. The rest of the code
+ // calls this a StackMap for historical reasons.
return new StackMap(name_index, length, file, constant_pool);
case Const.ATTR_BOOTSTRAP_METHODS:
return new BootstrapMethods(name_index, length, file, constant_pool);
@@ -222,7 +237,8 @@
* @return Name of attribute
* @since 6.0
*/
- public String getName() {
+ public String getName()
+ {
final ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(name_index, Const.CONSTANT_Utf8);
return c.getBytes();
}
@@ -230,36 +246,40 @@
/**
* @return Length of attribute field in bytes.
*/
- public final int getLength() {
+ public final int getLength()
+ {
return length;
}
/**
* @param length length in bytes.
*/
- public final void setLength(final int length) {
+ public final void setLength(final int length)
+ {
this.length = length;
}
/**
* @param name_index of attribute.
*/
- public final void setNameIndex(final int name_index) {
+ public final void setNameIndex(final int name_index)
+ {
this.name_index = name_index;
}
/**
* @return Name index in constant pool of attribute name.
*/
- public final int getNameIndex() {
+ public final int getNameIndex()
+ {
return name_index;
}
/**
- * @return Tag of attribute, i.e., its type. Value may not be altered, thus
- * there is no setTag() method.
+ * @return Tag of attribute, i.e., its type. Value may not be altered, thus there is no setTag() method.
*/
- public final byte getTag() {
+ public final byte getTag()
+ {
return tag;
}
@@ -267,7 +287,8 @@
* @return Constant pool used by this object.
* @see ConstantPool
*/
- public final ConstantPool getConstantPool() {
+ public final ConstantPool getConstantPool()
+ {
return constant_pool;
}
@@ -275,7 +296,8 @@
* @param constant_pool Constant pool to be used for this object.
* @see ConstantPool
*/
- public final void setConstantPool(final ConstantPool constant_pool) {
+ public final void setConstantPool(final ConstantPool constant_pool)
+ {
this.constant_pool = constant_pool;
}
@@ -286,11 +308,15 @@
* @return shallow copy of this attribute
*/
@Override
- public Object clone() {
+ public Object clone()
+ {
Attribute attr = null;
- try {
+ try
+ {
attr = (Attribute) super.clone();
- } catch (final CloneNotSupportedException e) {
+ }
+ catch (final CloneNotSupportedException e)
+ {
throw new Error("Clone Not Supported"); // never happens
}
return attr;
@@ -305,7 +331,8 @@
* @return attribute name.
*/
@Override
- public String toString() {
+ public String toString()
+ {
return Const.getAttributeName(tag);
}
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/AttributeReader.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/AttributeReader.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,7 +27,7 @@
* method. These factory objects should implement this interface.
* @see Attribute
- * @version $Id: AttributeReader.java 1748467 2016-06-14 21:05:14Z ggregory $
+ * @version $Id$
*
* @deprecated Use UnknownAttributeReader instead
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ClassFormatException.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ClassFormatException.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* that the file is malformed or otherwise cannot be interpreted as a
* class file.
*
- * @version $Id: ClassFormatException.java 1748973 2016-06-18 12:14:42Z sebb $
+ * @version $Id$
*/
public class ClassFormatException extends RuntimeException {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ClassParser.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ClassParser.java Wed Jun 26 12:12:25 2019 +0530
@@ -43,7 +43,7 @@
* JVM specification 1.0</a>. See this paper for
* further details about the structure of a bytecode file.
*
- * @version $Id: ClassParser.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public final class ClassParser {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Code.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Code.java Wed Jun 26 12:12:25 2019 +0530
@@ -39,7 +39,7 @@
* is used for debugging purposes and <em>LocalVariableTable</em> which
* contains information about the local variables.
*
- * @version $Id: Code.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Attribute
* @see CodeException
* @see LineNumberTable
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/CodeException.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/CodeException.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -31,8 +31,9 @@
* attribute and is used only there. It contains a range in which a
* particular exception handler is active.
*
- * @version $Id: CodeException.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Code
+ * @LastModified: Jun 2019
*/
public final class CodeException implements Cloneable, Node {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Constant.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Constant.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,30 +22,33 @@
import java.io.DataInput;
import java.io.DataOutputStream;
import java.io.IOException;
+import java.util.Objects;
import com.sun.org.apache.bcel.internal.Const;
import com.sun.org.apache.bcel.internal.util.BCELComparator;
/**
- * Abstract superclass for classes to represent the different constant types in
- * the constant pool of a class file. The classes keep closely to the JVM
- * specification.
+ * Abstract superclass for classes to represent the different constant types
+ * in the constant pool of a class file. The classes keep closely to
+ * the JVM specification.
*
- * @version $Id: Constant.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class Constant implements Cloneable, Node {
private static BCELComparator bcelComparator = new BCELComparator() {
@Override
- public boolean equals(final Object o1, final Object o2) {
+ public boolean equals( final Object o1, final Object o2 ) {
final Constant THIS = (Constant) o1;
final Constant THAT = (Constant) o2;
- return THIS.toString().equals(THAT.toString());
+ return Objects.equals(THIS.toString(), THAT.toString());
}
+
@Override
- public int hashCode(final Object o) {
+ public int hashCode( final Object o ) {
final Constant THIS = (Constant) o;
return THIS.toString().hashCode();
}
@@ -61,10 +64,12 @@
*/
private byte tag;
+
Constant(final byte tag) {
this.tag = tag;
}
+
/**
* Called by objects that are traversing the nodes of the tree implicitely
* defined by the contents of a Java class. I.e., the hierarchy of methods,
@@ -73,9 +78,11 @@
* @param v Visitor object
*/
@Override
- public abstract void accept(Visitor v);
+ public abstract void accept( Visitor v );
+
- public abstract void dump(DataOutputStream file) throws IOException;
+ public abstract void dump( DataOutputStream file ) throws IOException;
+
/**
* @return Tag of constant, i.e., its type. No setTag() method to avoid
@@ -85,6 +92,7 @@
return tag;
}
+
/**
* @return String representation.
*/
@@ -93,6 +101,7 @@
return Const.getConstantName(tag) + "[" + tag + "]";
}
+
/**
* @return deep copy of this constant
*/
@@ -105,6 +114,7 @@
return null;
}
+
@Override
public Object clone() {
try {
@@ -114,47 +124,55 @@
}
}
+
/**
* Read one constant from the given input, the type depends on a tag byte.
*
- * @param input Input stream
+ * @param dataInput Input stream
* @return Constant object
+ * @throws IOException if an I/O error occurs reading from the given {@code dataInput}.
+ * @throws ClassFormatException if the next byte is not recognized
* @since 6.0 made public
*/
- public static Constant readConstant(final DataInput input) throws IOException,
- ClassFormatException {
- final byte b = input.readByte(); // Read tag byte
+ public static Constant readConstant(final DataInput dataInput) throws IOException, ClassFormatException {
+ final byte b = dataInput.readByte(); // Read tag byte
switch (b) {
- case Const.CONSTANT_Class:
- return new ConstantClass(input);
- case Const.CONSTANT_Fieldref:
- return new ConstantFieldref(input);
- case Const.CONSTANT_Methodref:
- return new ConstantMethodref(input);
- case Const.CONSTANT_InterfaceMethodref:
- return new ConstantInterfaceMethodref(input);
- case Const.CONSTANT_String:
- return new ConstantString(input);
- case Const.CONSTANT_Integer:
- return new ConstantInteger(input);
- case Const.CONSTANT_Float:
- return new ConstantFloat(input);
- case Const.CONSTANT_Long:
- return new ConstantLong(input);
- case Const.CONSTANT_Double:
- return new ConstantDouble(input);
- case Const.CONSTANT_NameAndType:
- return new ConstantNameAndType(input);
- case Const.CONSTANT_Utf8:
- return ConstantUtf8.getInstance(input);
- case Const.CONSTANT_MethodHandle:
- return new ConstantMethodHandle(input);
- case Const.CONSTANT_MethodType:
- return new ConstantMethodType(input);
- case Const.CONSTANT_InvokeDynamic:
- return new ConstantInvokeDynamic(input);
- default:
- throw new ClassFormatException("Invalid byte tag in constant pool: " + b);
+ case Const.CONSTANT_Class:
+ return new ConstantClass(dataInput);
+ case Const.CONSTANT_Fieldref:
+ return new ConstantFieldref(dataInput);
+ case Const.CONSTANT_Methodref:
+ return new ConstantMethodref(dataInput);
+ case Const.CONSTANT_InterfaceMethodref:
+ return new ConstantInterfaceMethodref(dataInput);
+ case Const.CONSTANT_String:
+ return new ConstantString(dataInput);
+ case Const.CONSTANT_Integer:
+ return new ConstantInteger(dataInput);
+ case Const.CONSTANT_Float:
+ return new ConstantFloat(dataInput);
+ case Const.CONSTANT_Long:
+ return new ConstantLong(dataInput);
+ case Const.CONSTANT_Double:
+ return new ConstantDouble(dataInput);
+ case Const.CONSTANT_NameAndType:
+ return new ConstantNameAndType(dataInput);
+ case Const.CONSTANT_Utf8:
+ return ConstantUtf8.getInstance(dataInput);
+ case Const.CONSTANT_MethodHandle:
+ return new ConstantMethodHandle(dataInput);
+ case Const.CONSTANT_MethodType:
+ return new ConstantMethodType(dataInput);
+ case Const.CONSTANT_Dynamic:
+ return new ConstantDynamic(dataInput);
+ case Const.CONSTANT_InvokeDynamic:
+ return new ConstantInvokeDynamic(dataInput);
+ case Const.CONSTANT_Module:
+ return new ConstantModule(dataInput);
+ case Const.CONSTANT_Package:
+ return new ConstantPackage(dataInput);
+ default:
+ throw new ClassFormatException("Invalid byte tag in constant pool: " + b);
}
}
@@ -165,28 +183,31 @@
return bcelComparator;
}
+
/**
* @param comparator Comparison strategy object
*/
- public static void setComparator(final BCELComparator comparator) {
+ public static void setComparator( final BCELComparator comparator ) {
bcelComparator = comparator;
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default two
- * Constant objects are said to be equal when the result of toString() is
- * equal.
+ * Return value as defined by given BCELComparator strategy.
+ * By default two Constant objects are said to be equal when
+ * the result of toString() is equal.
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(final Object obj) {
+ public boolean equals( final Object obj ) {
return bcelComparator.equals(this, obj);
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default
- * return the hashcode of the result of toString().
+ * Return value as defined by given BCELComparator strategy.
+ * By default return the hashcode of the result of toString().
*
* @see java.lang.Object#hashCode()
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantCP.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantCP.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -27,13 +27,14 @@
/**
* Abstract super class for Fieldref, Methodref, InterfaceMethodref and
- * InvokeDynamic constants.
+ * InvokeDynamic constants.
*
- * @version $Id: ConstantCP.java 1747278 2016-06-07 17:28:43Z britter $
- * @see ConstantFieldref
- * @see ConstantMethodref
- * @see ConstantInterfaceMethodref
- * @see ConstantInvokeDynamic
+ * @version $Id$
+ * @see ConstantFieldref
+ * @see ConstantMethodref
+ * @see ConstantInterfaceMethodref
+ * @see ConstantInvokeDynamic
+ * @LastModified: Jun 2019
*/
public abstract class ConstantCP extends Constant {
@@ -53,10 +54,11 @@
this(c.getTag(), c.getClassIndex(), c.getNameAndTypeIndex());
}
+
/**
* Initialize instance from file data.
*
- * @param tag Constant type tag
+ * @param tag Constant type tag
* @param file Input stream
* @throws IOException
*/
@@ -64,6 +66,7 @@
this(tag, file.readUnsignedShort(), file.readUnsignedShort());
}
+
/**
* @param class_index Reference to the class containing the field
* @param name_and_type_index and the field signature
@@ -74,6 +77,7 @@
this.name_and_type_index = name_and_type_index;
}
+
/**
* Dump constant field reference to file stream in binary format.
*
@@ -81,12 +85,13 @@
* @throws IOException
*/
@Override
- public final void dump(final DataOutputStream file) throws IOException {
+ public final void dump( final DataOutputStream file ) throws IOException {
file.writeByte(super.getTag());
file.writeShort(class_index);
file.writeShort(name_and_type_index);
}
+
/**
* @return Reference (index) to class this constant refers to.
*/
@@ -94,13 +99,15 @@
return class_index;
}
+
/**
* @param class_index points to Constant_class
*/
- public final void setClassIndex(final int class_index) {
+ public final void setClassIndex( final int class_index ) {
this.class_index = class_index;
}
+
/**
* @return Reference (index) to signature of the field.
*/
@@ -108,20 +115,23 @@
return name_and_type_index;
}
+
/**
* @param name_and_type_index points to Constant_NameAndType
*/
- public final void setNameAndTypeIndex(final int name_and_type_index) {
+ public final void setNameAndTypeIndex( final int name_and_type_index ) {
this.name_and_type_index = name_and_type_index;
}
+
/**
* @return Class this field belongs to.
*/
- public String getClass(final ConstantPool cp) {
+ public String getClass( final ConstantPool cp ) {
return cp.constantToString(class_index, Const.CONSTANT_Class);
}
+
/**
* @return String representation.
*
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantClass.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantClass.java Wed Jun 26 12:12:25 2019 +0530
@@ -31,7 +31,6 @@
* This class is derived from the abstract {@link Constant}
* and represents a reference to a (external) class.
*
- * @version $Id: ConstantClass.java 1749603 2016-06-21 20:50:19Z ggregory $
* @see Constant
*/
public final class ConstantClass extends Constant implements ConstantObject {
@@ -48,13 +47,13 @@
/**
- * Initialize instance from file data.
+ * Constructs an instance from file data.
*
- * @param file Input stream
- * @throws IOException
+ * @param dataInput Input stream
+ * @throws IOException if an I/O error occurs reading from the given {@code dataInput}.
*/
- ConstantClass(final DataInput file) throws IOException {
- this(file.readUnsignedShort());
+ ConstantClass(final DataInput dataInput) throws IOException {
+ this(dataInput.readUnsignedShort());
}
@@ -82,10 +81,10 @@
/**
- * Dump constant class to file stream in binary format.
+ * Dumps constant class to file stream in binary format.
*
* @param file Output file stream
- * @throws IOException
+ * @throws IOException if an I/O error occurs writing to the DataOutputStream.
*/
@Override
public final void dump( final DataOutputStream file ) throws IOException {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantDouble.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantDouble.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -30,9 +30,9 @@
* This class is derived from the abstract {@link Constant}
* and represents a reference to a Double object.
*
- * @version $Id: ConstantDouble.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see Constant
- * @LastModified: Nov 2017
+ * @LastModified: Jun 2019
*/
public final class ConstantDouble extends Constant implements ConstantObject {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantDynamic.java Wed Jun 26 12:12:25 2019 +0530
@@ -0,0 +1,94 @@
+/*
+ * reserved comment block
+ * DO NOT REMOVE OR ALTER!
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.org.apache.bcel.internal.classfile;
+
+import java.io.DataInput;
+import java.io.IOException;
+
+import com.sun.org.apache.bcel.internal.Const;
+
+/**
+ * This class is derived from the abstract {@link Constant}
+ * and represents a reference to a dynamically computed constant.
+ *
+ * @see Constant
+ * @see <a href="https://bugs.openjdk.java.net/secure/attachment/74618/constant-dynamic.html">
+ * Change request for JEP 309</a>
+ * @since 6.3
+ */
+public final class ConstantDynamic extends ConstantCP {
+
+ /**
+ * Initialize from another object.
+ */
+ public ConstantDynamic(final ConstantDynamic c) {
+ this(c.getBootstrapMethodAttrIndex(), c.getNameAndTypeIndex());
+ }
+
+
+ /**
+ * Initialize instance from file data.
+ *
+ * @param file Input stream
+ * @throws IOException
+ */
+ ConstantDynamic(final DataInput file) throws IOException {
+ this(file.readShort(), file.readShort());
+ }
+
+
+ public ConstantDynamic(final int bootstrap_method_attr_index, final int name_and_type_index) {
+ super(Const.CONSTANT_Dynamic, bootstrap_method_attr_index, name_and_type_index);
+ }
+
+
+ /**
+ * Called by objects that are traversing the nodes of the tree implicitly
+ * defined by the contents of a Java class. I.e., the hierarchy of methods,
+ * fields, attributes, etc. spawns a tree of objects.
+ *
+ * @param v Visitor object
+ */
+ @Override
+ public void accept( final Visitor v ) {
+ v.visitConstantDynamic(this);
+ }
+
+ /**
+ * @return Reference (index) to bootstrap method this constant refers to.
+ *
+ * Note that this method is a functional duplicate of getClassIndex
+ * for use by ConstantInvokeDynamic.
+ * @since 6.0
+ */
+ public final int getBootstrapMethodAttrIndex() {
+ return super.getClassIndex(); // AKA bootstrap_method_attr_index
+ }
+
+ /**
+ * @return String representation
+ */
+ @Override
+ public final String toString() {
+ return super.toString().replace("class_index", "bootstrap_method_attr_index");
+ }
+}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantFieldref.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantFieldref.java Wed Jun 26 12:12:25 2019 +0530
@@ -29,7 +29,7 @@
/**
* This class represents a constant pool reference to a field.
*
- * @version $Id: ConstantFieldref.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public final class ConstantFieldref extends ConstantCP {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantFloat.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantFloat.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -30,9 +30,9 @@
* This class is derived from the abstract {@link Constant}
* and represents a reference to a float object.
*
- * @version $Id: ConstantFloat.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see Constant
- * @LastModified: Nov 2017
+ * @LastModified: Jun 2019
*/
public final class ConstantFloat extends Constant implements ConstantObject {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantInteger.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantInteger.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -30,8 +30,9 @@
* This class is derived from the abstract {@link Constant}
* and represents a reference to an int object.
*
- * @version $Id: ConstantInteger.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see Constant
+ * @LastModified: Jun 2019
*/
public final class ConstantInteger extends Constant implements ConstantObject {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantInterfaceMethodref.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantInterfaceMethodref.java Wed Jun 26 12:12:25 2019 +0530
@@ -29,7 +29,7 @@
/**
* This class represents a constant pool reference to an interface method.
*
- * @version $Id: ConstantInterfaceMethodref.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public final class ConstantInterfaceMethodref extends ConstantCP {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantLong.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantLong.java Wed Jun 26 12:12:25 2019 +0530
@@ -30,7 +30,7 @@
* This class is derived from the abstract {@link Constant}
* and represents a reference to a long object.
*
- * @version $Id: ConstantLong.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see Constant
*/
public final class ConstantLong extends Constant implements ConstantObject {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantMethodref.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantMethodref.java Wed Jun 26 12:12:25 2019 +0530
@@ -29,7 +29,7 @@
/**
* This class represents a constant pool reference to a method.
*
- * @version $Id: ConstantMethodref.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public final class ConstantMethodref extends ConstantCP {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantModule.java Wed Jun 26 12:12:25 2019 +0530
@@ -0,0 +1,138 @@
+/*
+ * reserved comment block
+ * DO NOT REMOVE OR ALTER!
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.org.apache.bcel.internal.classfile;
+
+import java.io.DataInput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import com.sun.org.apache.bcel.internal.Const;
+
+/**
+ * This class is derived from the abstract {@link Constant}
+ * and represents a reference to a module.
+ *
+ * <p>Note: Early access Java 9 support- currently subject to change</p>
+ *
+ * @see Constant
+ * @since 6.1
+ */
+public final class ConstantModule extends Constant implements ConstantObject {
+
+ private int name_index;
+
+
+ /**
+ * Initialize from another object.
+ */
+ public ConstantModule(final ConstantModule c) {
+ this(c.getNameIndex());
+ }
+
+
+ /**
+ * Initialize instance from file data.
+ *
+ * @param file Input stream
+ * @throws IOException
+ */
+ ConstantModule(final DataInput file) throws IOException {
+ this(file.readUnsignedShort());
+ }
+
+
+ /**
+ * @param name_index Name index in constant pool. Should refer to a
+ * ConstantUtf8.
+ */
+ public ConstantModule(final int name_index) {
+ super(Const.CONSTANT_Module);
+ this.name_index = name_index;
+ }
+
+
+ /**
+ * Called by objects that are traversing the nodes of the tree implicitly
+ * defined by the contents of a Java class. I.e., the hierarchy of methods,
+ * fields, attributes, etc. spawns a tree of objects.
+ *
+ * @param v Visitor object
+ */
+ @Override
+ public void accept( final Visitor v ) {
+ v.visitConstantModule(this);
+ }
+
+
+ /**
+ * Dump constant module to file stream in binary format.
+ *
+ * @param file Output file stream
+ * @throws IOException
+ */
+ @Override
+ public final void dump( final DataOutputStream file ) throws IOException {
+ file.writeByte(super.getTag());
+ file.writeShort(name_index);
+ }
+
+
+ /**
+ * @return Name index in constant pool of module name.
+ */
+ public final int getNameIndex() {
+ return name_index;
+ }
+
+
+ /**
+ * @param name_index the name index in the constant pool of this Constant Module
+ */
+ public final void setNameIndex( final int name_index ) {
+ this.name_index = name_index;
+ }
+
+
+ /** @return String object
+ */
+ @Override
+ public Object getConstantValue( final ConstantPool cp ) {
+ final Constant c = cp.getConstant(name_index, Const.CONSTANT_Utf8);
+ return ((ConstantUtf8) c).getBytes();
+ }
+
+
+ /** @return dereferenced string
+ */
+ public String getBytes( final ConstantPool cp ) {
+ return (String) getConstantValue(cp);
+ }
+
+
+ /**
+ * @return String representation.
+ */
+ @Override
+ public final String toString() {
+ return super.toString() + "(name_index = " + name_index + ")";
+ }
+}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantNameAndType.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantNameAndType.java Wed Jun 26 12:12:25 2019 +0530
@@ -32,7 +32,7 @@
* and represents a reference to the name and signature
* of a field or method.
*
- * @version $Id: ConstantNameAndType.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see Constant
*/
public final class ConstantNameAndType extends Constant {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantObject.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantObject.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* This interface denotes those constants that have a "natural" value,
* such as ConstantLong, ConstantString, etc..
*
- * @version $Id: ConstantObject.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see Constant
*/
public interface ConstantObject {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantPackage.java Wed Jun 26 12:12:25 2019 +0530
@@ -0,0 +1,138 @@
+/*
+ * reserved comment block
+ * DO NOT REMOVE OR ALTER!
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.org.apache.bcel.internal.classfile;
+
+import java.io.DataInput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import com.sun.org.apache.bcel.internal.Const;
+
+/**
+ * This class is derived from the abstract {@link Constant}
+ * and represents a reference to a package.
+ *
+ * <p>Note: Early access Java 9 support- currently subject to change</p>
+ *
+ * @see Constant
+ * @since 6.1
+ */
+public final class ConstantPackage extends Constant implements ConstantObject {
+
+ private int name_index;
+
+
+ /**
+ * Initialize from another object.
+ */
+ public ConstantPackage(final ConstantPackage c) {
+ this(c.getNameIndex());
+ }
+
+
+ /**
+ * Initialize instance from file data.
+ *
+ * @param file Input stream
+ * @throws IOException
+ */
+ ConstantPackage(final DataInput file) throws IOException {
+ this(file.readUnsignedShort());
+ }
+
+
+ /**
+ * @param name_index Name index in constant pool. Should refer to a
+ * ConstantUtf8.
+ */
+ public ConstantPackage(final int name_index) {
+ super(Const.CONSTANT_Package);
+ this.name_index = name_index;
+ }
+
+
+ /**
+ * Called by objects that are traversing the nodes of the tree implicitely
+ * defined by the contents of a Java class. I.e., the hierarchy of methods,
+ * fields, attributes, etc. spawns a tree of objects.
+ *
+ * @param v Visitor object
+ */
+ @Override
+ public void accept( final Visitor v ) {
+ v.visitConstantPackage(this);
+ }
+
+
+ /**
+ * Dump constant package to file stream in binary format.
+ *
+ * @param file Output file stream
+ * @throws IOException
+ */
+ @Override
+ public final void dump( final DataOutputStream file ) throws IOException {
+ file.writeByte(super.getTag());
+ file.writeShort(name_index);
+ }
+
+
+ /**
+ * @return Name index in constant pool of package name.
+ */
+ public final int getNameIndex() {
+ return name_index;
+ }
+
+
+ /**
+ * @param name_index the name index in the constant pool of this Constant Package
+ */
+ public final void setNameIndex( final int name_index ) {
+ this.name_index = name_index;
+ }
+
+
+ /** @return String object
+ */
+ @Override
+ public Object getConstantValue( final ConstantPool cp ) {
+ final Constant c = cp.getConstant(name_index, Const.CONSTANT_Utf8);
+ return ((ConstantUtf8) c).getBytes();
+ }
+
+
+ /** @return dereferenced string
+ */
+ public String getBytes( final ConstantPool cp ) {
+ return (String) getConstantValue(cp);
+ }
+
+
+ /**
+ * @return String representation.
+ */
+ @Override
+ public final String toString() {
+ return super.toString() + "(name_index = " + name_index + ")";
+ }
+}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantPool.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantPool.java Wed Jun 26 12:12:25 2019 +0530
@@ -35,7 +35,7 @@
* programatically should see <a href="../generic/ConstantPoolGen.html">
* ConstantPoolGen</a>.
- * @version $Id: ConstantPool.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Constant
* @see com.sun.org.apache.bcel.internal.generic.ConstantPoolGen
*/
@@ -135,7 +135,7 @@
case Const.CONSTANT_NameAndType:
str = constantToString(((ConstantNameAndType) c).getNameIndex(),
Const.CONSTANT_Utf8)
- + ":" + constantToString(((ConstantNameAndType) c).getSignatureIndex(),
+ + " " + constantToString(((ConstantNameAndType) c).getSignatureIndex(),
Const.CONSTANT_Utf8);
break;
case Const.CONSTANT_InterfaceMethodref:
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantString.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantString.java Wed Jun 26 12:12:25 2019 +0530
@@ -31,7 +31,7 @@
* This class is derived from the abstract {@link Constant}
* and represents a reference to a String object.
*
- * @version $Id: ConstantString.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Constant
*/
public final class ConstantString extends Constant implements ConstantObject {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantUtf8.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantUtf8.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -32,8 +32,9 @@
* This class is derived from the abstract {@link Constant}
* and represents a reference to a Utf8 encoded string.
*
- * @version $Id: ConstantUtf8.java 1750029 2016-06-23 22:14:38Z sebb $
+ * @version $Id$
* @see Constant
+ * @LastModified: Jun 2019
*/
public final class ConstantUtf8 extends Constant {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantValue.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantValue.java Wed Jun 26 12:12:25 2019 +0530
@@ -32,7 +32,7 @@
* value, i.e., a default value for initializing a class field.
* This class is instantiated by the <em>Attribute.readAttribute()</em> method.
*
- * @version $Id: ConstantValue.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Attribute
*/
public final class ConstantValue extends Attribute {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Deprecated.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Deprecated.java Wed Jun 26 12:12:25 2019 +0530
@@ -28,16 +28,17 @@
/**
* This class is derived from <em>Attribute</em> and denotes that this is a
- * deprecated method. It is instantiated from the
- * <em>Attribute.readAttribute()</em> method.
+ * deprecated method.
+ * It is instantiated from the <em>Attribute.readAttribute()</em> method.
*
- * @version $Id: Deprecated.java 1749603 2016-06-21 20:50:19Z ggregory $
- * @see Attribute
+ * @version $Id$
+ * @see Attribute
*/
public final class Deprecated extends Attribute {
private byte[] bytes;
+
/**
* Initialize from another object. Note that both objects use the same
* references (shallow copy). Use clone() for a physical copy.
@@ -46,6 +47,7 @@
this(c.getNameIndex(), c.getLength(), c.getBytes(), c.getConstantPool());
}
+
/**
* @param name_index Index in constant pool to CONSTANT_Utf8
* @param length Content length in bytes
@@ -57,6 +59,7 @@
this.bytes = bytes;
}
+
/**
* Construct object from input stream.
*
@@ -76,6 +79,7 @@
}
}
+
/**
* Called by objects that are traversing the nodes of the tree implicitely
* defined by the contents of a Java class. I.e., the hierarchy of methods,
@@ -84,10 +88,11 @@
* @param v Visitor object
*/
@Override
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
v.visitDeprecated(this);
}
+
/**
* Dump source file attribute to file stream in binary format.
*
@@ -95,13 +100,14 @@
* @throws IOException
*/
@Override
- public final void dump(final DataOutputStream file) throws IOException {
+ public final void dump( final DataOutputStream file ) throws IOException {
super.dump(file);
if (super.getLength() > 0) {
file.write(bytes, 0, super.getLength());
}
}
+
/**
* @return data bytes.
*/
@@ -109,13 +115,15 @@
return bytes;
}
+
/**
* @param bytes the raw bytes that represents this byte array
*/
- public final void setBytes(final byte[] bytes) {
+ public final void setBytes( final byte[] bytes ) {
this.bytes = bytes;
}
+
/**
* @return attribute name
*/
@@ -124,11 +132,12 @@
return Const.getAttributeName(Const.ATTR_DEPRECATED);
}
+
/**
* @return deep copy of this attribute
*/
@Override
- public Attribute copy(final ConstantPool _constant_pool) {
+ public Attribute copy( final ConstantPool _constant_pool ) {
final Deprecated c = (Deprecated) clone();
if (bytes != null) {
c.bytes = new byte[bytes.length];
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/DescendingVisitor.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/DescendingVisitor.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,10 +26,10 @@
* applied to all components of a JavaClass object. I.e. this class supplies the
* traversal strategy, other classes can make use of it.
*
- * @version $Id: DescendingVisitor.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
-public class DescendingVisitor implements Visitor {
-
+public class DescendingVisitor implements Visitor
+{
private final JavaClass clazz;
private final Visitor visitor;
@@ -39,17 +39,21 @@
/**
* @return container of current entitity, i.e., predecessor during traversal
*/
- public Object predecessor() {
+ public Object predecessor()
+ {
return predecessor(0);
}
/**
- * @param level nesting level, i.e., 0 returns the direct predecessor
+ * @param level
+ * nesting level, i.e., 0 returns the direct predecessor
* @return container of current entitity, i.e., predecessor during traversal
*/
- public Object predecessor(final int level) {
+ public Object predecessor(final int level)
+ {
final int size = stack.size();
- if ((size < 2) || (level < 0)) {
+ if ((size < 2) || (level < 0))
+ {
return null;
}
return stack.elementAt(size - (level + 2)); // size - 1 == current
@@ -58,15 +62,19 @@
/**
* @return current object
*/
- public Object current() {
+ public Object current()
+ {
return stack.peek();
}
/**
- * @param clazz Class to traverse
- * @param visitor visitor object to apply to all components
+ * @param clazz
+ * Class to traverse
+ * @param visitor
+ * visitor object to apply to all components
*/
- public DescendingVisitor(final JavaClass clazz, final Visitor visitor) {
+ public DescendingVisitor(final JavaClass clazz, final Visitor visitor)
+ {
this.clazz = clazz;
this.visitor = visitor;
}
@@ -74,12 +82,14 @@
/**
* Start traversal.
*/
- public void visit() {
+ public void visit()
+ {
clazz.accept(this);
}
@Override
- public void visitJavaClass(final JavaClass _clazz) {
+ public void visitJavaClass(final JavaClass _clazz)
+ {
stack.push(_clazz);
_clazz.accept(visitor);
final Field[] fields = _clazz.getFields();
@@ -102,7 +112,8 @@
* @since 6.0
*/
@Override
- public void visitAnnotation(final Annotations annotation) {
+ public void visitAnnotation(final Annotations annotation)
+ {
stack.push(annotation);
annotation.accept(visitor);
final AnnotationEntry[] entries = annotation.getAnnotationEntries();
@@ -116,14 +127,16 @@
* @since 6.0
*/
@Override
- public void visitAnnotationEntry(final AnnotationEntry annotationEntry) {
+ public void visitAnnotationEntry(final AnnotationEntry annotationEntry)
+ {
stack.push(annotationEntry);
annotationEntry.accept(visitor);
stack.pop();
}
@Override
- public void visitField(final Field field) {
+ public void visitField(final Field field)
+ {
stack.push(field);
field.accept(visitor);
final Attribute[] attributes = field.getAttributes();
@@ -134,14 +147,16 @@
}
@Override
- public void visitConstantValue(final ConstantValue cv) {
+ public void visitConstantValue(final ConstantValue cv)
+ {
stack.push(cv);
cv.accept(visitor);
stack.pop();
}
@Override
- public void visitMethod(final Method method) {
+ public void visitMethod(final Method method)
+ {
stack.push(method);
method.accept(visitor);
final Attribute[] attributes = method.getAttributes();
@@ -152,14 +167,16 @@
}
@Override
- public void visitExceptionTable(final ExceptionTable table) {
+ public void visitExceptionTable(final ExceptionTable table)
+ {
stack.push(table);
table.accept(visitor);
stack.pop();
}
@Override
- public void visitCode(final Code code) {
+ public void visitCode(final Code code)
+ {
stack.push(code);
code.accept(visitor);
final CodeException[] table = code.getExceptionTable();
@@ -174,14 +191,16 @@
}
@Override
- public void visitCodeException(final CodeException ce) {
+ public void visitCodeException(final CodeException ce)
+ {
stack.push(ce);
ce.accept(visitor);
stack.pop();
}
@Override
- public void visitLineNumberTable(final LineNumberTable table) {
+ public void visitLineNumberTable(final LineNumberTable table)
+ {
stack.push(table);
table.accept(visitor);
final LineNumber[] numbers = table.getLineNumberTable();
@@ -192,14 +211,16 @@
}
@Override
- public void visitLineNumber(final LineNumber number) {
+ public void visitLineNumber(final LineNumber number)
+ {
stack.push(number);
number.accept(visitor);
stack.pop();
}
@Override
- public void visitLocalVariableTable(final LocalVariableTable table) {
+ public void visitLocalVariableTable(final LocalVariableTable table)
+ {
stack.push(table);
table.accept(visitor);
final LocalVariable[] vars = table.getLocalVariableTable();
@@ -210,7 +231,8 @@
}
@Override
- public void visitStackMap(final StackMap table) {
+ public void visitStackMap(final StackMap table)
+ {
stack.push(table);
table.accept(visitor);
final StackMapEntry[] vars = table.getStackMap();
@@ -221,26 +243,31 @@
}
@Override
- public void visitStackMapEntry(final StackMapEntry var) {
+ public void visitStackMapEntry(final StackMapEntry var)
+ {
stack.push(var);
var.accept(visitor);
stack.pop();
}
@Override
- public void visitLocalVariable(final LocalVariable var) {
+ public void visitLocalVariable(final LocalVariable var)
+ {
stack.push(var);
var.accept(visitor);
stack.pop();
}
@Override
- public void visitConstantPool(final ConstantPool cp) {
+ public void visitConstantPool(final ConstantPool cp)
+ {
stack.push(cp);
cp.accept(visitor);
final Constant[] constants = cp.getConstantPool();
- for (int i = 1; i < constants.length; i++) {
- if (constants[i] != null) {
+ for (int i = 1; i < constants.length; i++)
+ {
+ if (constants[i] != null)
+ {
constants[i].accept(this);
}
}
@@ -248,35 +275,40 @@
}
@Override
- public void visitConstantClass(final ConstantClass constant) {
+ public void visitConstantClass(final ConstantClass constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
}
@Override
- public void visitConstantDouble(final ConstantDouble constant) {
+ public void visitConstantDouble(final ConstantDouble constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
}
@Override
- public void visitConstantFieldref(final ConstantFieldref constant) {
+ public void visitConstantFieldref(final ConstantFieldref constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
}
@Override
- public void visitConstantFloat(final ConstantFloat constant) {
+ public void visitConstantFloat(final ConstantFloat constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
}
@Override
- public void visitConstantInteger(final ConstantInteger constant) {
+ public void visitConstantInteger(final ConstantInteger constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
@@ -284,7 +316,8 @@
@Override
public void visitConstantInterfaceMethodref(
- final ConstantInterfaceMethodref constant) {
+ final ConstantInterfaceMethodref constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
@@ -295,49 +328,56 @@
*/
@Override
public void visitConstantInvokeDynamic(
- final ConstantInvokeDynamic constant) {
+ final ConstantInvokeDynamic constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
}
@Override
- public void visitConstantLong(final ConstantLong constant) {
+ public void visitConstantLong(final ConstantLong constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
}
@Override
- public void visitConstantMethodref(final ConstantMethodref constant) {
+ public void visitConstantMethodref(final ConstantMethodref constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
}
@Override
- public void visitConstantNameAndType(final ConstantNameAndType constant) {
+ public void visitConstantNameAndType(final ConstantNameAndType constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
}
@Override
- public void visitConstantString(final ConstantString constant) {
+ public void visitConstantString(final ConstantString constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
}
@Override
- public void visitConstantUtf8(final ConstantUtf8 constant) {
+ public void visitConstantUtf8(final ConstantUtf8 constant)
+ {
stack.push(constant);
constant.accept(visitor);
stack.pop();
}
@Override
- public void visitInnerClasses(final InnerClasses ic) {
+ public void visitInnerClasses(final InnerClasses ic)
+ {
stack.push(ic);
ic.accept(visitor);
final InnerClass[] ics = ic.getInnerClasses();
@@ -348,7 +388,8 @@
}
@Override
- public void visitInnerClass(final InnerClass inner) {
+ public void visitInnerClass(final InnerClass inner)
+ {
stack.push(inner);
inner.accept(visitor);
stack.pop();
@@ -358,7 +399,8 @@
* @since 6.0
*/
@Override
- public void visitBootstrapMethods(final BootstrapMethods bm) {
+ public void visitBootstrapMethods(final BootstrapMethods bm)
+ {
stack.push(bm);
bm.accept(visitor);
// BootstrapMethod[] bms = bm.getBootstrapMethods();
@@ -370,35 +412,40 @@
}
@Override
- public void visitDeprecated(final Deprecated attribute) {
+ public void visitDeprecated(final Deprecated attribute)
+ {
stack.push(attribute);
attribute.accept(visitor);
stack.pop();
}
@Override
- public void visitSignature(final Signature attribute) {
+ public void visitSignature(final Signature attribute)
+ {
stack.push(attribute);
attribute.accept(visitor);
stack.pop();
}
@Override
- public void visitSourceFile(final SourceFile attribute) {
+ public void visitSourceFile(final SourceFile attribute)
+ {
stack.push(attribute);
attribute.accept(visitor);
stack.pop();
}
@Override
- public void visitSynthetic(final Synthetic attribute) {
+ public void visitSynthetic(final Synthetic attribute)
+ {
stack.push(attribute);
attribute.accept(visitor);
stack.pop();
}
@Override
- public void visitUnknown(final Unknown attribute) {
+ public void visitUnknown(final Unknown attribute)
+ {
stack.push(attribute);
attribute.accept(visitor);
stack.pop();
@@ -408,7 +455,8 @@
* @since 6.0
*/
@Override
- public void visitAnnotationDefault(final AnnotationDefault obj) {
+ public void visitAnnotationDefault(final AnnotationDefault obj)
+ {
stack.push(obj);
obj.accept(visitor);
stack.pop();
@@ -418,7 +466,8 @@
* @since 6.0
*/
@Override
- public void visitEnclosingMethod(final EnclosingMethod obj) {
+ public void visitEnclosingMethod(final EnclosingMethod obj)
+ {
stack.push(obj);
obj.accept(visitor);
stack.pop();
@@ -428,13 +477,10 @@
* @since 6.0
*/
@Override
- public void visitLocalVariableTypeTable(final LocalVariableTypeTable obj) {
+ public void visitLocalVariableTypeTable(final LocalVariableTypeTable obj)
+ {
stack.push(obj);
obj.accept(visitor);
- LocalVariable[] vars = obj.getLocalVariableTypeTable();
- for (LocalVariable var : vars) {
- var.accept(this);
- }
stack.pop();
}
@@ -442,7 +488,8 @@
* @since 6.0
*/
@Override
- public void visitParameterAnnotation(final ParameterAnnotations obj) {
+ public void visitParameterAnnotation(final ParameterAnnotations obj)
+ {
stack.push(obj);
obj.accept(visitor);
stack.pop();
@@ -452,15 +499,14 @@
* @since 6.0
*/
@Override
- public void visitMethodParameters(final MethodParameters obj) {
+ public void visitMethodParameters(final MethodParameters obj)
+ {
stack.push(obj);
obj.accept(visitor);
stack.pop();
}
- /**
- * @since 6.0
- */
+ /** @since 6.0 */
@Override
public void visitConstantMethodType(final ConstantMethodType obj) {
stack.push(obj);
@@ -468,9 +514,7 @@
stack.pop();
}
- /**
- * @since 6.0
- */
+ /** @since 6.0 */
@Override
public void visitConstantMethodHandle(final ConstantMethodHandle obj) {
stack.push(obj);
@@ -478,9 +522,7 @@
stack.pop();
}
- /**
- * @since 6.0
- */
+ /** @since 6.0 */
@Override
public void visitParameterAnnotationEntry(final ParameterAnnotationEntry obj) {
stack.push(obj);
@@ -488,4 +530,27 @@
stack.pop();
}
+ /** @since 6.1 */
+ @Override
+ public void visitConstantPackage(final ConstantPackage obj) {
+ stack.push(obj);
+ obj.accept(visitor);
+ stack.pop();
+ }
+
+ /** @since 6.1 */
+ @Override
+ public void visitConstantModule(final ConstantModule obj) {
+ stack.push(obj);
+ obj.accept(visitor);
+ stack.pop();
+ }
+
+ /** @since 6.3 */
+ @Override
+ public void visitConstantDynamic(final ConstantDynamic obj) {
+ stack.push(obj);
+ obj.accept(visitor);
+ stack.pop();
+ }
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ElementValue.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ElementValue.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,6 +1,5 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -28,6 +27,7 @@
/**
* @version $Id: ElementValue
* @since 6.0
+ * @LastModified: Jun 2019
*/
public abstract class ElementValue
{
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/EmptyVisitor.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/EmptyVisitor.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* with the DescendingVisitor class, e.g. By courtesy of David Spencer.
*
* @see DescendingVisitor
- * @version $Id: EmptyVisitor.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class EmptyVisitor implements Visitor
{
@@ -300,4 +300,26 @@
@Override
public void visitParameterAnnotationEntry(final ParameterAnnotationEntry parameterAnnotationEntry) {
}
+
+ /**
+ * @since 6.1
+ */
+ @Override
+ public void visitConstantPackage(final ConstantPackage constantPackage) {
+ }
+
+ /**
+ * @since 6.1
+ */
+ @Override
+ public void visitConstantModule(final ConstantModule constantModule) {
+ }
+
+
+ /**
+ * @since 6.3
+ */
+ @Override
+ public void visitConstantDynamic(final ConstantDynamic obj) {
+ }
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ExceptionTable.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ExceptionTable.java Wed Jun 26 12:12:25 2019 +0530
@@ -35,7 +35,7 @@
* attribute using the name <em>Exceptions</em> (which is inconsistent
* with the other classes).
*
- * @version $Id: ExceptionTable.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Code
*/
public final class ExceptionTable extends Attribute {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Field.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Field.java Wed Jun 26 12:12:25 2019 +0530
@@ -23,6 +23,7 @@
import java.io.DataInput;
import java.io.IOException;
+import java.util.Objects;
import com.sun.org.apache.bcel.internal.Const;
import com.sun.org.apache.bcel.internal.generic.Type;
@@ -32,7 +33,7 @@
* This class represents the field info structure, i.e., the representation
* for a variable in the class. See JVM specification for details.
*
- * @version $Id: Field.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public final class Field extends FieldOrMethod {
@@ -42,8 +43,8 @@
public boolean equals( final Object o1, final Object o2 ) {
final Field THIS = (Field) o1;
final Field THAT = (Field) o2;
- return THIS.getName().equals(THAT.getName())
- && THIS.getSignature().equals(THAT.getSignature());
+ return Objects.equals(THIS.getName(), THAT.getName())
+ && Objects.equals(THIS.getSignature(), THAT.getSignature());
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/FieldOrMethod.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/FieldOrMethod.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -29,7 +29,8 @@
/**
* Abstract super class for fields and methods.
*
- * @version $Id: FieldOrMethod.java 1750029 2016-06-23 22:14:38Z sebb $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class FieldOrMethod extends AccessFlags implements Cloneable, Node {
private int name_index; // Points to field name in constant pool
@@ -48,6 +49,7 @@
FieldOrMethod() {
}
+
/**
* Initialize from another object. Note that both objects use the same
* references (shallow copy). Use clone() for a physical copy.
@@ -57,25 +59,23 @@
c.getAttributes(), c.getConstantPool());
}
+
/**
* Construct object from file stream.
*
* @param file Input stream
* @throws IOException
* @throws ClassFormatException
- * @deprecated (6.0) Use
- * {@link #FieldOrMethod(java.io.DataInput, ConstantPool)} instead.
+ * @deprecated (6.0) Use {@link #FieldOrMethod(java.io.DataInput, ConstantPool)} instead.
*/
@java.lang.Deprecated
- protected FieldOrMethod(final DataInputStream file,
- final ConstantPool constant_pool) throws IOException,
+ protected FieldOrMethod(final DataInputStream file, final ConstantPool constant_pool) throws IOException,
ClassFormatException {
this((DataInput) file, constant_pool);
}
/**
* Construct object from file stream.
- *
* @param file Input stream
* @throws IOException
* @throws ClassFormatException
@@ -84,13 +84,15 @@
final ConstantPool constant_pool) throws IOException, ClassFormatException {
this(file.readUnsignedShort(), file.readUnsignedShort(), file.readUnsignedShort(), null,
constant_pool);
- attributes_count = file.readUnsignedShort();
+ final int attributes_count = file.readUnsignedShort();
attributes = new Attribute[attributes_count];
for (int i = 0; i < attributes_count; i++) {
attributes[i] = Attribute.readAttribute(file, constant_pool);
}
+ this.attributes_count = attributes_count; // init deprecated field
}
+
/**
* @param access_flags Access rights of method
* @param name_index Points to field name in constant pool
@@ -107,6 +109,7 @@
setAttributes(attributes);
}
+
/**
* Dump object to file stream on binary format.
*
@@ -118,12 +121,14 @@
file.writeShort(name_index);
file.writeShort(signature_index);
file.writeShort(attributes_count);
-
- for(int i=0; i < attributes_count; i++) {
- attributes[i].dump(file);
+ if (attributes != null) {
+ for (final Attribute attribute : attributes) {
+ attribute.dump(file);
+ }
}
}
+
/**
* @return Collection of object attributes.
*/
@@ -131,14 +136,16 @@
return attributes;
}
+
/**
* @param attributes Collection of object attributes.
*/
- public final void setAttributes(final Attribute[] attributes) {
+ public final void setAttributes( final Attribute[] attributes ) {
this.attributes = attributes;
- this.attributes_count = attributes != null ? attributes.length : 0;
+ this.attributes_count = attributes != null ? attributes.length : 0; // init deprecated field
}
+
/**
* @return Constant pool used by this object.
*/
@@ -146,13 +153,15 @@
return constant_pool;
}
+
/**
* @param constant_pool Constant pool to be used for this object.
*/
- public final void setConstantPool(final ConstantPool constant_pool) {
+ public final void setConstantPool( final ConstantPool constant_pool ) {
this.constant_pool = constant_pool;
}
+
/**
* @return Index in constant pool of object's name.
*/
@@ -160,13 +169,15 @@
return name_index;
}
+
/**
* @param name_index Index in constant pool of object's name.
*/
- public final void setNameIndex(final int name_index) {
+ public final void setNameIndex( final int name_index ) {
this.name_index = name_index;
}
+
/**
* @return Index in constant pool of field signature.
*/
@@ -174,13 +185,15 @@
return signature_index;
}
+
/**
* @param signature_index Index in constant pool of field signature.
*/
- public final void setSignatureIndex(final int signature_index) {
+ public final void setSignatureIndex( final int signature_index ) {
this.signature_index = signature_index;
}
+
/**
* @return Name of object, i.e., method name or field name
*/
@@ -190,6 +203,7 @@
return c.getBytes();
}
+
/**
* @return String representation of object's type signature (java style)
*/
@@ -199,23 +213,24 @@
return c.getBytes();
}
+
/**
* @return deep copy of this field
*/
- protected FieldOrMethod copy_(final ConstantPool _constant_pool) {
+ protected FieldOrMethod copy_( final ConstantPool _constant_pool ) {
FieldOrMethod c = null;
try {
- c = (FieldOrMethod) clone();
- } catch (final CloneNotSupportedException e) {
+ c = (FieldOrMethod)clone();
+ } catch(final CloneNotSupportedException e) {
// ignored, but will cause NPE ...
}
- c.constant_pool = constant_pool;
- c.attributes = new Attribute[attributes_count];
- c.attributes_count = attributes_count;
+ c.constant_pool = constant_pool;
+ c.attributes = new Attribute[attributes.length];
+ c.attributes_count = attributes_count; // init deprecated field
- for (int i = 0; i < attributes_count; i++) {
+ for (int i = 0; i < attributes.length; i++) {
c.attributes[i] = attributes[i].copy(constant_pool);
}
@@ -244,11 +259,15 @@
*
* @since 6.0
*/
- public final String getGenericSignature() {
- if (!searchedForSignatureAttribute) {
+ public final String getGenericSignature()
+ {
+ if (!searchedForSignatureAttribute)
+ {
boolean found = false;
- for (int i = 0; !found && i < attributes.length; i++) {
- if (attributes[i] instanceof Signature) {
+ for (int i = 0; !found && i < attributes.length; i++)
+ {
+ if (attributes[i] instanceof Signature)
+ {
signatureAttributeString = ((Signature) attributes[i])
.getSignature();
found = true;
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/InnerClass.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/InnerClass.java Wed Jun 26 12:12:25 2019 +0530
@@ -32,7 +32,7 @@
* indices of the inner and outer classes, the name and the attributes
* of the inner class.
*
- * @version $Id: InnerClass.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see InnerClasses
*/
public final class InnerClass implements Cloneable, Node {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/InnerClasses.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/InnerClasses.java Wed Jun 26 12:12:25 2019 +0530
@@ -33,7 +33,7 @@
* to the source file of this class.
* It is instantiated from the <em>Attribute.readAttribute()</em> method.
*
- * @version $Id: InnerClasses.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Attribute
*/
public final class InnerClasses extends Attribute {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/JavaClass.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/JavaClass.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,9 +26,10 @@
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.Objects;
+import java.util.StringTokenizer;
import java.util.List;
import java.util.Set;
-import java.util.StringTokenizer;
import java.util.TreeSet;
import com.sun.org.apache.bcel.internal.Const;
@@ -36,7 +37,6 @@
import com.sun.org.apache.bcel.internal.util.BCELComparator;
import com.sun.org.apache.bcel.internal.util.ClassQueue;
import com.sun.org.apache.bcel.internal.util.SyntheticRepository;
-import jdk.xml.internal.SecuritySupport;
/**
* Represents a Java class, i.e., the data structures, constant pool, fields,
@@ -45,9 +45,10 @@
* details. The intent of this class is to represent a parsed or otherwise
* existing class file. Those interested in programatically generating classes
* should see the <a href="../generic/ClassGen.html">ClassGen</a> class.
- *
- * @version $Id: JavaClass.java 1750227 2016-06-25 21:47:10Z ggregory $
+
+ * @version $Id$
* @see com.sun.org.apache.bcel.internal.generic.ClassGen
+ * @LastModified: Jun 2019
*/
public class JavaClass extends AccessFlags implements Cloneable, Node, Comparable<JavaClass> {
@@ -78,25 +79,28 @@
private static BCELComparator bcelComparator = new BCELComparator() {
@Override
- public boolean equals(final Object o1, final Object o2) {
+ public boolean equals( final Object o1, final Object o2 ) {
final JavaClass THIS = (JavaClass) o1;
final JavaClass THAT = (JavaClass) o2;
- return THIS.getClassName().equals(THAT.getClassName());
+ return Objects.equals(THIS.getClassName(), THAT.getClassName());
}
+
@Override
- public int hashCode(final Object o) {
+ public int hashCode( final Object o ) {
final JavaClass THIS = (JavaClass) o;
return THIS.getClassName().hashCode();
}
};
/**
- * In cases where we go ahead and create something, use the default
- * SyntheticRepository, because we don't know any better.
+ * In cases where we go ahead and create something,
+ * use the default SyntheticRepository, because we
+ * don't know any better.
*/
private transient com.sun.org.apache.bcel.internal.util.Repository repository
= SyntheticRepository.getInstance();
+
/**
* Constructor gets all contents as arguments.
*
@@ -177,6 +181,7 @@
}
}
+
/**
* Constructor gets all contents as arguments.
*
@@ -200,15 +205,16 @@
constant_pool, interfaces, fields, methods, attributes, HEAP);
}
+
/**
- * Called by objects that are traversing the nodes of the tree implicitly
+ * Called by objects that are traversing the nodes of the tree implicitely
* defined by the contents of a Java class. I.e., the hierarchy of methods,
* fields, attributes, etc. spawns a tree of objects.
*
* @param v Visitor object
*/
@Override
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
v.visitJavaClass(this);
}
@@ -223,7 +229,7 @@
if (parent != null) {
final File dir = new File(parent);
if (!dir.mkdirs()) { // either was not created or already existed
- if (!SecuritySupport.isDirectory(dir)) {
+ if (!dir.isDirectory()) {
throw new IOException("Could not create the directory " + dir);
}
}
@@ -233,16 +239,18 @@
}
}
+
/**
* Dump class to a file named file_name.
*
* @param _file_name Output file name
* @throws IOException
*/
- public void dump(final String _file_name) throws IOException {
+ public void dump( final String _file_name ) throws IOException {
dump(new File(_file_name));
}
+
/**
* @return class in binary format
*/
@@ -263,15 +271,6 @@
return s.toByteArray();
}
- /**
- * Dump Java class to output stream in binary format.
- *
- * @param file Output stream
- * @throws IOException
- */
- public void dump(final OutputStream file) throws IOException {
- dump(new DataOutputStream(file));
- }
/**
* Dump Java class to output stream in binary format.
@@ -279,7 +278,18 @@
* @param file Output stream
* @throws IOException
*/
- private void dump(final DataOutputStream file) throws IOException {
+ public void dump( final OutputStream file ) throws IOException {
+ dump(new DataOutputStream(file));
+ }
+
+
+ /**
+ * Dump Java class to output stream in binary format.
+ *
+ * @param file Output stream
+ * @throws IOException
+ */
+ public void dump( final DataOutputStream file ) throws IOException {
file.writeInt(Const.JVM_CLASSFILE_MAGIC);
file.writeShort(minor);
file.writeShort(major);
@@ -310,6 +320,7 @@
file.flush();
}
+
/**
* @return Attributes of the class.
*/
@@ -336,6 +347,7 @@
return class_name;
}
+
/**
* @return Package name.
*/
@@ -343,6 +355,7 @@
return package_name;
}
+
/**
* @return Class name index.
*/
@@ -350,6 +363,7 @@
return class_name_index;
}
+
/**
* @return Constant pool.
*/
@@ -357,15 +371,17 @@
return constant_pool;
}
+
/**
- * @return Fields, i.e., variables of the class. Like the JVM spec mandates
- * for the classfile format, these fields are those specific to this class,
- * and not those of the superclass or superinterfaces.
+ * @return Fields, i.e., variables of the class. Like the JVM spec
+ * mandates for the classfile format, these fields are those specific to
+ * this class, and not those of the superclass or superinterfaces.
*/
public Field[] getFields() {
return fields;
}
+
/**
* @return File name of class, aka SourceFile attribute value
*/
@@ -373,6 +389,7 @@
return file_name;
}
+
/**
* @return Names of implemented interfaces.
*/
@@ -380,6 +397,7 @@
return interface_names;
}
+
/**
* @return Indices in constant pool of implemented interfaces.
*/
@@ -387,6 +405,7 @@
return interfaces;
}
+
/**
* @return Major number of class file version.
*/
@@ -394,6 +413,7 @@
return major;
}
+
/**
* @return Methods of the class.
*/
@@ -401,10 +421,12 @@
return methods;
}
+
/**
- * @return A {@link Method} corresponding to java.lang.reflect.Method if any
+ * @return A {@link Method} corresponding to
+ * java.lang.reflect.Method if any
*/
- public Method getMethod(final java.lang.reflect.Method m) {
+ public Method getMethod( final java.lang.reflect.Method m ) {
for (final Method method : methods) {
if (m.getName().equals(method.getName()) && (m.getModifiers() == method.getModifiers())
&& Type.getSignature(m).equals(method.getSignature())) {
@@ -414,6 +436,7 @@
return null;
}
+
/**
* @return Minor number of class file version.
*/
@@ -421,6 +444,7 @@
return minor;
}
+
/**
* @return sbsolute path to file where this class was read from
*/
@@ -428,11 +452,11 @@
return source_file_name;
}
+
/**
- * returns the super class name of this class. In the case that this class
- * is java.lang.Object, it will return itself (java.lang.Object). This is
- * probably incorrect but isn't fixed at this time to not break existing
- * clients.
+ * returns the super class name of this class. In the case that this class is
+ * java.lang.Object, it will return itself (java.lang.Object). This is probably incorrect
+ * but isn't fixed at this time to not break existing clients.
*
* @return Superclass name.
*/
@@ -440,6 +464,7 @@
return superclass_name;
}
+
/**
* @return Class name index.
*/
@@ -450,101 +475,115 @@
/**
* @param attributes .
*/
- public void setAttributes(final Attribute[] attributes) {
+ public void setAttributes( final Attribute[] attributes ) {
this.attributes = attributes;
}
+
/**
* @param class_name .
*/
- public void setClassName(final String class_name) {
+ public void setClassName( final String class_name ) {
this.class_name = class_name;
}
+
/**
* @param class_name_index .
*/
- public void setClassNameIndex(final int class_name_index) {
+ public void setClassNameIndex( final int class_name_index ) {
this.class_name_index = class_name_index;
}
+
/**
* @param constant_pool .
*/
- public void setConstantPool(final ConstantPool constant_pool) {
+ public void setConstantPool( final ConstantPool constant_pool ) {
this.constant_pool = constant_pool;
}
+
/**
* @param fields .
*/
- public void setFields(final Field[] fields) {
+ public void setFields( final Field[] fields ) {
this.fields = fields;
}
+
/**
* Set File name of class, aka SourceFile attribute value
*/
- public void setFileName(final String file_name) {
+ public void setFileName( final String file_name ) {
this.file_name = file_name;
}
+
/**
* @param interface_names .
*/
- public void setInterfaceNames(final String[] interface_names) {
+ public void setInterfaceNames( final String[] interface_names ) {
this.interface_names = interface_names;
}
+
/**
* @param interfaces .
*/
- public void setInterfaces(final int[] interfaces) {
+ public void setInterfaces( final int[] interfaces ) {
this.interfaces = interfaces;
}
+
/**
* @param major .
*/
- public void setMajor(final int major) {
+ public void setMajor( final int major ) {
this.major = major;
}
+
/**
* @param methods .
*/
- public void setMethods(final Method[] methods) {
+ public void setMethods( final Method[] methods ) {
this.methods = methods;
}
+
/**
* @param minor .
*/
- public void setMinor(final int minor) {
+ public void setMinor( final int minor ) {
this.minor = minor;
}
+
/**
* Set absolute path to file this class was read from.
*/
- public void setSourceFileName(final String source_file_name) {
+ public void setSourceFileName( final String source_file_name ) {
this.source_file_name = source_file_name;
}
+
/**
* @param superclass_name .
*/
- public void setSuperclassName(final String superclass_name) {
+ public void setSuperclassName( final String superclass_name ) {
this.superclass_name = superclass_name;
}
+
/**
* @param superclass_name_index .
*/
- public void setSuperclassNameIndex(final int superclass_name_index) {
+ public void setSuperclassNameIndex( final int superclass_name_index ) {
this.superclass_name_index = superclass_name_index;
}
+
/**
* @return String representing class contents.
*/
@@ -555,7 +594,7 @@
final StringBuilder buf = new StringBuilder(128);
buf.append(access).append(Utility.classOrInterface(super.getAccessFlags())).append(" ").append(
class_name).append(" extends ").append(
- Utility.compactClassName(superclass_name, false)).append('\n');
+ Utility.compactClassName(superclass_name, false)).append('\n');
final int size = interfaces.length;
if (size > 0) {
buf.append("implements\t\t");
@@ -580,7 +619,7 @@
}
}
final AnnotationEntry[] annotations = getAnnotationEntries();
- if (annotations != null && annotations.length > 0) {
+ if (annotations!=null && annotations.length>0) {
buf.append("\nAnnotation(s):\n");
for (final AnnotationEntry annotation : annotations) {
buf.append(indent(annotation));
@@ -601,7 +640,8 @@
return buf.toString();
}
- private static String indent(final Object obj) {
+
+ private static String indent( final Object obj ) {
final StringTokenizer tok = new StringTokenizer(obj.toString(), "\n");
final StringBuilder buf = new StringBuilder();
while (tok.hasMoreTokens()) {
@@ -610,6 +650,7 @@
return buf.toString();
}
+
/**
* @return deep copy of this class
*/
@@ -638,10 +679,12 @@
return c;
}
+
public final boolean isSuper() {
return (super.getAccessFlags() & Const.ACC_SUPER) != 0;
}
+
public final boolean isClass() {
return (super.getAccessFlags() & Const.ACC_INTERFACE) == 0;
}
@@ -667,62 +710,62 @@
return;
}
for (final Attribute attribute : this.attributes) {
- if (attribute instanceof InnerClasses) {
- final InnerClass[] innerClasses = ((InnerClasses) attribute).getInnerClasses();
- for (final InnerClass innerClasse : innerClasses) {
- boolean innerClassAttributeRefersToMe = false;
- String inner_class_name = constant_pool.getConstantString(innerClasse.getInnerClassIndex(),
- Const.CONSTANT_Class);
- inner_class_name = Utility.compactClassName(inner_class_name);
- if (inner_class_name.equals(getClassName())) {
- innerClassAttributeRefersToMe = true;
- }
- if (innerClassAttributeRefersToMe) {
- this.isNested = true;
- if (innerClasse.getInnerNameIndex() == 0) {
- this.isAnonymous = true;
- }
- }
- }
- }
+ if (attribute instanceof InnerClasses) {
+ final InnerClass[] innerClasses = ((InnerClasses) attribute).getInnerClasses();
+ for (final InnerClass innerClasse : innerClasses) {
+ boolean innerClassAttributeRefersToMe = false;
+ String inner_class_name = constant_pool.getConstantString(innerClasse.getInnerClassIndex(),
+ Const.CONSTANT_Class);
+ inner_class_name = Utility.compactClassName(inner_class_name);
+ if (inner_class_name.equals(getClassName())) {
+ innerClassAttributeRefersToMe = true;
+ }
+ if (innerClassAttributeRefersToMe) {
+ this.isNested = true;
+ if (innerClasse.getInnerNameIndex() == 0) {
+ this.isAnonymous = true;
+ }
+ }
+ }
+ }
}
this.computedNestedTypeStatus = true;
}
- /**
- * @return returns either HEAP (generated), FILE, or ZIP
+
+ /** @return returns either HEAP (generated), FILE, or ZIP
*/
public final byte getSource() {
return source;
}
+
+ /********************* New repository functionality *********************/
/**
- * ******************* New repository functionality ********************
- */
- /**
- * Gets the ClassRepository which holds its definition. By default this is
- * the same as SyntheticRepository.getInstance();
+ * Gets the ClassRepository which holds its definition. By default
+ * this is the same as SyntheticRepository.getInstance();
*/
public com.sun.org.apache.bcel.internal.util.Repository getRepository() {
return repository;
}
+
/**
- * Sets the ClassRepository which loaded the JavaClass. Should be called
- * immediately after parsing is done.
+ * Sets the ClassRepository which loaded the JavaClass.
+ * Should be called immediately after parsing is done.
*/
public void setRepository(final com.sun.org.apache.bcel.internal.util.Repository repository) {
this.repository = repository;
}
- /**
- * Equivalent to runtime "instanceof" operator.
+
+ /** Equivalent to runtime "instanceof" operator.
*
* @return true if this JavaClass is derived from the super class
- * @throws ClassNotFoundException if superclasses or superinterfaces of this
- * object can't be found
+ * @throws ClassNotFoundException if superclasses or superinterfaces
+ * of this object can't be found
*/
- public final boolean instanceOf(final JavaClass super_class) throws ClassNotFoundException {
+ public final boolean instanceOf( final JavaClass super_class ) throws ClassNotFoundException {
if (this.equals(super_class)) {
return true;
}
@@ -738,12 +781,13 @@
return false;
}
+
/**
* @return true, if this class is an implementation of interface inter
- * @throws ClassNotFoundException if superclasses or superinterfaces of this
- * class can't be found
+ * @throws ClassNotFoundException if superclasses or superinterfaces
+ * of this class can't be found
*/
- public boolean implementationOf(final JavaClass inter) throws ClassNotFoundException {
+ public boolean implementationOf( final JavaClass inter ) throws ClassNotFoundException {
if (!inter.isInterface()) {
throw new IllegalArgumentException(inter.getClassName() + " is no interface");
}
@@ -759,9 +803,10 @@
return false;
}
+
/**
- * @return the superclass for this JavaClass object, or null if this is
- * java.lang.Object
+ * @return the superclass for this JavaClass object, or null if this
+ * is java.lang.Object
* @throws ClassNotFoundException if the superclass can't be found
*/
public JavaClass getSuperClass() throws ClassNotFoundException {
@@ -771,6 +816,7 @@
return repository.loadClass(getSuperclassName());
}
+
/**
* @return list of super classes of this class in ascending order, i.e.,
* java.lang.Object is always the last element
@@ -785,6 +831,7 @@
return allSuperClasses.toArray(new JavaClass[allSuperClasses.size()]);
}
+
/**
* Get interfaces directly implemented by this JavaClass.
*/
@@ -797,6 +844,7 @@
return classes;
}
+
/**
* Get all interfaces implemented by this JavaClass (transitively).
*/
@@ -822,6 +870,7 @@
return allInterfaces.toArray(new JavaClass[allInterfaces.size()]);
}
+
/**
* @return Comparison strategy object
*/
@@ -829,38 +878,42 @@
return bcelComparator;
}
+
/**
* @param comparator Comparison strategy object
*/
- public static void setComparator(final BCELComparator comparator) {
+ public static void setComparator( final BCELComparator comparator ) {
bcelComparator = comparator;
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default two
- * JavaClass objects are said to be equal when their class names are equal.
+ * Return value as defined by given BCELComparator strategy.
+ * By default two JavaClass objects are said to be equal when
+ * their class names are equal.
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(final Object obj) {
+ public boolean equals( final Object obj ) {
return bcelComparator.equals(this, obj);
}
+
/**
- * Return the natural ordering of two JavaClasses. This ordering is based on
- * the class name
- *
+ * Return the natural ordering of two JavaClasses.
+ * This ordering is based on the class name
* @since 6.0
*/
@Override
- public int compareTo(final JavaClass obj) {
+ public int compareTo( final JavaClass obj ) {
return getClassName().compareTo(obj.getClassName());
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default
- * return the hashcode of the class name.
+ * Return value as defined by given BCELComparator strategy.
+ * By default return the hashcode of the class name.
*
* @see java.lang.Object#hashCode()
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/LineNumber.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/LineNumber.java Wed Jun 26 12:12:25 2019 +0530
@@ -30,7 +30,7 @@
* the source that corresponds to a relative address in the byte code. This
* is used for debugging purposes.
*
- * @version $Id: LineNumber.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see LineNumberTable
*/
public final class LineNumber implements Cloneable, Node {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/LineNumberTable.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/LineNumberTable.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,13 +26,14 @@
import jdk.xml.internal.SecuritySupport;
/**
- * This class represents a table of line numbers for debugging purposes. This
- * attribute is used by the <em>Code</em> attribute. It contains pairs of PCs
- * and line numbers.
+ * This class represents a table of line numbers for debugging
+ * purposes. This attribute is used by the <em>Code</em> attribute. It
+ * contains pairs of PCs and line numbers.
*
- * @version $Id: LineNumberTable.java 1749603 2016-06-21 20:50:19Z ggregory $
- * @see Code
+ * @version $Id$
+ * @see Code
* @see LineNumber
+ * @LastModified: Jun 2019
*/
public final class LineNumberTable extends Attribute {
@@ -63,7 +64,6 @@
/**
* Construct object from input stream.
- *
* @param name_index Index of name
* @param length Content length in bytes
* @param input Input stream
@@ -88,7 +88,7 @@
* @param v Visitor object
*/
@Override
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
v.visitLineNumberTable(this);
}
@@ -99,7 +99,7 @@
* @throws IOEXception if an I/O Exception occurs in writeShort
*/
@Override
- public final void dump(final DataOutputStream file) throws IOException {
+ public final void dump( final DataOutputStream file ) throws IOException {
super.dump(file);
file.writeShort(line_number_table.length);
for (final LineNumber lineNumber : line_number_table) {
@@ -117,7 +117,7 @@
/**
* @param line_number_table the line number entries for this table
*/
- public final void setLineNumberTable(final LineNumber[] line_number_table) {
+ public final void setLineNumberTable( final LineNumber[] line_number_table ) {
this.line_number_table = line_number_table;
}
@@ -150,7 +150,7 @@
* @param pos byte code offset
* @return corresponding line in source code
*/
- public int getSourceLine(final int pos) {
+ public int getSourceLine( final int pos ) {
int l = 0;
int r = line_number_table.length - 1;
if (r < 0) {
@@ -192,7 +192,7 @@
* @return deep copy of this attribute
*/
@Override
- public Attribute copy(final ConstantPool _constant_pool) {
+ public Attribute copy( final ConstantPool _constant_pool ) {
// TODO could use the lower level constructor and thereby allow
// line_number_table to be made final
final LineNumberTable c = (LineNumberTable) clone();
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/LocalVariable.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/LocalVariable.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -30,8 +30,9 @@
* This class represents a local variable within a method. It contains its
* scope, name, signature and index on the method's frame.
*
- * @version $Id: LocalVariable.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see LocalVariableTable
+ * @LastModified: Jun 2019
*/
public final class LocalVariable implements Cloneable, Node {
@@ -43,6 +44,7 @@
* this method's frame.
*/
private ConstantPool constant_pool;
+ private int orig_index; // never changes; used to match up with LocalVariableTypeTable entries
/**
@@ -52,6 +54,7 @@
public LocalVariable(final LocalVariable c) {
this(c.getStartPC(), c.getLength(), c.getNameIndex(), c.getSignatureIndex(), c.getIndex(),
c.getConstantPool());
+ this.orig_index = c.getOrigIndex();
}
@@ -82,6 +85,28 @@
this.signature_index = signature_index;
this.index = index;
this.constant_pool = constant_pool;
+ this.orig_index = index;
+ }
+
+
+ /**
+ * @param start_pc Range in which the variable
+ * @param length ... is valid
+ * @param name_index Index in constant pool of variable name
+ * @param signature_index Index of variable's signature
+ * @param index Variable is `index'th local variable on the method's frame
+ * @param constant_pool Array of constants
+ * @param orig_index Variable is `index'th local variable on the method's frame prior to any changes
+ */
+ public LocalVariable(final int start_pc, final int length, final int name_index, final int signature_index, final int index,
+ final ConstantPool constant_pool, final int orig_index) {
+ this.start_pc = start_pc;
+ this.length = length;
+ this.name_index = name_index;
+ this.signature_index = signature_index;
+ this.index = index;
+ this.constant_pool = constant_pool;
+ this.orig_index = orig_index;
}
@@ -174,6 +199,14 @@
/**
+ * @return index of register where variable was originally stored
+ */
+ public final int getOrigIndex() {
+ return orig_index;
+ }
+
+
+ /**
* @return Start of range where he variable is valid
*/
public final int getStartPC() {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/LocalVariableTable.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/LocalVariableTable.java Wed Jun 26 12:12:25 2019 +0530
@@ -31,7 +31,7 @@
* This class represents colection of local variables in a
* method. This attribute is contained in the <em>Code</em> attribute.
*
- * @version $Id: LocalVariableTable.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Code
* @see LocalVariable
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/LocalVariableTypeTable.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/LocalVariableTypeTable.java Wed Jun 26 12:12:25 2019 +0530
@@ -23,9 +23,11 @@
import java.io.DataInput;
import java.io.DataOutputStream;
import java.io.IOException;
+
import com.sun.org.apache.bcel.internal.Const;
// The new table is used when generic types are about...
+
//LocalVariableTable_attribute {
// u2 attribute_name_index;
// u4 attribute_length;
@@ -37,6 +39,7 @@
// u2 index;
// } local_variable_table[local_variable_table_length];
// }
+
//LocalVariableTypeTable_attribute {
// u2 attribute_name_index;
// u4 attribute_length;
@@ -50,6 +53,7 @@
// } local_variable_type_table[local_variable_type_table_length];
// }
// J5TODO: Needs some testing !
+
/**
* @since 6.0
*/
@@ -61,14 +65,12 @@
this(c.getNameIndex(), c.getLength(), c.getLocalVariableTypeTable(), c.getConstantPool());
}
- public LocalVariableTypeTable(final int name_index, final int length,
- final LocalVariable[] local_variable_table, final ConstantPool constant_pool) {
+ public LocalVariableTypeTable(final int name_index, final int length, final LocalVariable[] local_variable_table, final ConstantPool constant_pool) {
super(Const.ATTR_LOCAL_VARIABLE_TYPE_TABLE, name_index, length, constant_pool);
this.local_variable_type_table = local_variable_table;
}
- LocalVariableTypeTable(final int nameIdx, final int len, final DataInput input,
- final ConstantPool cpool) throws IOException {
+ LocalVariableTypeTable(final int nameIdx, final int len, final DataInput input, final ConstantPool cpool) throws IOException {
this(nameIdx, len, (LocalVariable[]) null, cpool);
final int local_variable_type_table_length = input.readUnsignedShort();
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Method.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Method.java Wed Jun 26 12:12:25 2019 +0530
@@ -22,32 +22,34 @@
import java.io.DataInput;
import java.io.IOException;
+import java.util.Objects;
import com.sun.org.apache.bcel.internal.Const;
import com.sun.org.apache.bcel.internal.generic.Type;
import com.sun.org.apache.bcel.internal.util.BCELComparator;
/**
- * This class represents the method info structure, i.e., the representation for
- * a method in the class. See JVM specification for details. A method has access
- * flags, a name, a signature and a number of attributes.
+ * This class represents the method info structure, i.e., the representation
+ * for a method in the class. See JVM specification for details.
+ * A method has access flags, a name, a signature and a number of attributes.
*
- * @version $Id: Method.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public final class Method extends FieldOrMethod {
private static BCELComparator bcelComparator = new BCELComparator() {
@Override
- public boolean equals(final Object o1, final Object o2) {
+ public boolean equals( final Object o1, final Object o2 ) {
final Method THIS = (Method) o1;
final Method THAT = (Method) o2;
- return THIS.getName().equals(THAT.getName())
- && THIS.getSignature().equals(THAT.getSignature());
+ return Objects.equals(THIS.getName(), THAT.getName())
+ && Objects.equals(THIS.getSignature(), THAT.getSignature());
}
+
@Override
- public int hashCode(final Object o) {
+ public int hashCode( final Object o ) {
final Method THIS = (Method) o;
return THIS.getSignature().hashCode() ^ THIS.getName().hashCode();
}
@@ -63,6 +65,7 @@
public Method() {
}
+
/**
* Initialize from another object. Note that both objects use the same
* references (shallow copy). Use clone() for a physical copy.
@@ -71,9 +74,9 @@
super(c);
}
+
/**
* Construct object from file stream.
- *
* @param file Input stream
* @throws IOException
* @throws ClassFormatException
@@ -83,6 +86,7 @@
super(file, constant_pool);
}
+
/**
* @param access_flags Access rights of method
* @param name_index Points to field name in constant pool
@@ -95,6 +99,7 @@
super(access_flags, name_index, signature_index, attributes, constant_pool);
}
+
/**
* Called by objects that are traversing the nodes of the tree implicitely
* defined by the contents of a Java class. I.e., the hierarchy of methods,
@@ -103,10 +108,11 @@
* @param v Visitor object
*/
@Override
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
v.visitMethod(this);
}
+
/**
* @return Code attribute of method, if any
*/
@@ -119,6 +125,7 @@
return null;
}
+
/**
* @return ExceptionTable attribute of method, if any, i.e., list all
* exceptions the method may throw not exception handlers!
@@ -132,9 +139,9 @@
return null;
}
- /**
- * @return LocalVariableTable of code attribute if any, i.e. the call is
- * forwarded to the Code atribute.
+
+ /** @return LocalVariableTable of code attribute if any, i.e. the call is forwarded
+ * to the Code atribute.
*/
public final LocalVariableTable getLocalVariableTable() {
final Code code = getCode();
@@ -144,9 +151,9 @@
return code.getLocalVariableTable();
}
- /**
- * @return LineNumberTable of code attribute if any, i.e. the call is
- * forwarded to the Code atribute.
+
+ /** @return LineNumberTable of code attribute if any, i.e. the call is forwarded
+ * to the Code atribute.
*/
public final LineNumberTable getLineNumberTable() {
final Code code = getCode();
@@ -156,9 +163,10 @@
return code.getLineNumberTable();
}
+
/**
- * Return string representation close to declaration format, e.g.
- * 'public static void main(String[] args) throws IOException'
+ * Return string representation close to declaration format,
+ * `public static void main(String[] args) throws IOException', e.g.
*
* @return String representation of the method.
*/
@@ -188,13 +196,15 @@
return buf.toString();
}
+
/**
* @return deep copy of this method
*/
- public final Method copy(final ConstantPool _constant_pool) {
+ public final Method copy( final ConstantPool _constant_pool ) {
return (Method) copy_(_constant_pool);
}
+
/**
* @return return type of method
*/
@@ -202,6 +212,7 @@
return Type.getReturnType(getSignature());
}
+
/**
* @return array of method argument types
*/
@@ -209,6 +220,7 @@
return Type.getArgumentTypes(getSignature());
}
+
/**
* @return Comparison strategy object
*/
@@ -216,28 +228,31 @@
return bcelComparator;
}
+
/**
* @param comparator Comparison strategy object
*/
- public static void setComparator(final BCELComparator comparator) {
+ public static void setComparator( final BCELComparator comparator ) {
bcelComparator = comparator;
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default two
- * method objects are said to be equal when their names and signatures are
- * equal.
+ * Return value as defined by given BCELComparator strategy.
+ * By default two method objects are said to be equal when
+ * their names and signatures are equal.
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(final Object obj) {
+ public boolean equals( final Object obj ) {
return bcelComparator.equals(this, obj);
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default
- * return the hashcode of the method's name XOR signature.
+ * Return value as defined by given BCELComparator strategy.
+ * By default return the hashcode of the method's name XOR signature.
*
* @see java.lang.Object#hashCode()
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Node.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Node.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,7 +24,7 @@
/**
* Denote class to have an accept method();
*
- * @version $Id: Node.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface Node {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/PMGClass.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/PMGClass.java Wed Jun 26 12:12:25 2019 +0530
@@ -31,7 +31,7 @@
* This class is derived from <em>Attribute</em> and represents a reference
* to a PMG attribute.
*
- * @version $Id: PMGClass.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Attribute
*/
public final class PMGClass extends Attribute {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Signature.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Signature.java Wed Jun 26 12:12:25 2019 +0530
@@ -32,7 +32,7 @@
* This class is derived from <em>Attribute</em> and represents a reference
* to a GJ attribute.
*
- * @version $Id: Signature.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Attribute
*/
public final class Signature extends Attribute {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/SourceFile.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/SourceFile.java Wed Jun 26 12:12:25 2019 +0530
@@ -33,7 +33,7 @@
* should appear per classfile. The intention of this class is that it is
* instantiated from the <em>Attribute.readAttribute()</em> method.
*
- * @version $Id: SourceFile.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Attribute
*/
public final class SourceFile extends Attribute {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/StackMap.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/StackMap.java Wed Jun 26 12:12:25 2019 +0530
@@ -36,7 +36,7 @@
* within the Code attribute of a method. See CLDC specification
* 5.3.1.2
*
- * @version $Id: StackMap.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Code
* @see StackMapEntry
* @see StackMapType
@@ -78,7 +78,7 @@
/**
- * Dump line number table attribute to file stream in binary format.
+ * Dump stack map table attribute to file stream in binary format.
*
* @param file Output file stream
* @throws IOException
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/StackMapEntry.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/StackMapEntry.java Wed Jun 26 12:12:25 2019 +0530
@@ -31,7 +31,7 @@
* local variables and the the of stack items at a given byte code offset.
* See CLDC specification 5.3.1.2
*
- * @version $Id: StackMapEntry.java 1750029 2016-06-23 22:14:38Z sebb $
+ * @version $Id$
* @see StackMap
* @see StackMapType
*/
@@ -51,8 +51,8 @@
* @param input Input stream
* @throws IOException
*/
- StackMapEntry(final DataInput input, final ConstantPool constant_pool) throws IOException {
- this(input.readByte() & 0xFF, -1, null, null, constant_pool);
+ StackMapEntry(final DataInput input, final ConstantPool constantPool) throws IOException {
+ this(input.readByte() & 0xFF, -1, null, null, constantPool);
if (frame_type >= Const.SAME_FRAME && frame_type <= Const.SAME_FRAME_MAX) {
byte_code_offset = frame_type - Const.SAME_FRAME;
@@ -60,11 +60,11 @@
frame_type <= Const.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
byte_code_offset = frame_type - Const.SAME_LOCALS_1_STACK_ITEM_FRAME;
types_of_stack_items = new StackMapType[1];
- types_of_stack_items[0] = new StackMapType(input, constant_pool);
+ types_of_stack_items[0] = new StackMapType(input, constantPool);
} else if (frame_type == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
byte_code_offset = input.readShort();
types_of_stack_items = new StackMapType[1];
- types_of_stack_items[0] = new StackMapType(input, constant_pool);
+ types_of_stack_items[0] = new StackMapType(input, constantPool);
} else if (frame_type >= Const.CHOP_FRAME && frame_type <= Const.CHOP_FRAME_MAX) {
byte_code_offset = input.readShort();
} else if (frame_type == Const.SAME_FRAME_EXTENDED) {
@@ -74,19 +74,19 @@
final int number_of_locals = frame_type - 251;
types_of_locals = new StackMapType[number_of_locals];
for (int i = 0; i < number_of_locals; i++) {
- types_of_locals[i] = new StackMapType(input, constant_pool);
+ types_of_locals[i] = new StackMapType(input, constantPool);
}
} else if (frame_type == Const.FULL_FRAME) {
byte_code_offset = input.readShort();
final int number_of_locals = input.readShort();
types_of_locals = new StackMapType[number_of_locals];
for (int i = 0; i < number_of_locals; i++) {
- types_of_locals[i] = new StackMapType(input, constant_pool);
+ types_of_locals[i] = new StackMapType(input, constantPool);
}
final int number_of_stack_items = input.readShort();
types_of_stack_items = new StackMapType[number_of_stack_items];
for (int i = 0; i < number_of_stack_items; i++) {
- types_of_stack_items[i] = new StackMapType(input, constant_pool);
+ types_of_stack_items[i] = new StackMapType(input, constantPool);
}
} else {
/* Can't happen */
@@ -97,42 +97,42 @@
/**
* DO NOT USE
*
- * @param byte_code_offset
- * @param number_of_locals NOT USED
- * @param types_of_locals array of {@link StackMapType}s of locals
- * @param number_of_stack_items NOT USED
- * @param types_of_stack_items array ot {@link StackMapType}s of stack items
- * @param constant_pool the constant pool
+ * @param byteCodeOffset
+ * @param numberOfLocals NOT USED
+ * @param typesOfLocals array of {@link StackMapType}s of locals
+ * @param numberOfStackItems NOT USED
+ * @param typesOfStackItems array ot {@link StackMapType}s of stack items
+ * @param constantPool the constant pool
* @deprecated Since 6.0, use {@link #StackMapEntry(int, int, StackMapType[], StackMapType[], ConstantPool)}
* instead
*/
@java.lang.Deprecated
- public StackMapEntry(final int byte_code_offset, final int number_of_locals,
- final StackMapType[] types_of_locals, final int number_of_stack_items,
- final StackMapType[] types_of_stack_items, final ConstantPool constant_pool) {
- this.byte_code_offset = byte_code_offset;
- this.types_of_locals = types_of_locals != null ? types_of_locals : new StackMapType[0];
- this.types_of_stack_items = types_of_stack_items != null ? types_of_stack_items : new StackMapType[0];
- this.constant_pool = constant_pool;
+ public StackMapEntry(final int byteCodeOffset, final int numberOfLocals,
+ final StackMapType[] typesOfLocals, final int numberOfStackItems,
+ final StackMapType[] typesOfStackItems, final ConstantPool constantPool) {
+ this.byte_code_offset = byteCodeOffset;
+ this.types_of_locals = typesOfLocals != null ? typesOfLocals : new StackMapType[0];
+ this.types_of_stack_items = typesOfStackItems != null ? typesOfStackItems : new StackMapType[0];
+ this.constant_pool = constantPool;
}
/**
* Create an instance
*
* @param tag the frame_type to use
- * @param byte_code_offset
- * @param types_of_locals array of {@link StackMapType}s of locals
- * @param types_of_stack_items array ot {@link StackMapType}s of stack items
- * @param constant_pool the constant pool
+ * @param byteCodeOffset
+ * @param typesOfLocals array of {@link StackMapType}s of locals
+ * @param typesOfStackItems array ot {@link StackMapType}s of stack items
+ * @param constantPool the constant pool
*/
- public StackMapEntry(final int tag, final int byte_code_offset,
- final StackMapType[] types_of_locals,
- final StackMapType[] types_of_stack_items, final ConstantPool constant_pool) {
+ public StackMapEntry(final int tag, final int byteCodeOffset,
+ final StackMapType[] typesOfLocals,
+ final StackMapType[] typesOfStackItems, final ConstantPool constantPool) {
this.frame_type = tag;
- this.byte_code_offset = byte_code_offset;
- this.types_of_locals = types_of_locals != null ? types_of_locals : new StackMapType[0];
- this.types_of_stack_items = types_of_stack_items != null ? types_of_stack_items : new StackMapType[0];
- this.constant_pool = constant_pool;
+ this.byte_code_offset = byteCodeOffset;
+ this.types_of_locals = typesOfLocals != null ? typesOfLocals : new StackMapType[0];
+ this.types_of_stack_items = typesOfStackItems != null ? typesOfStackItems : new StackMapType[0];
+ this.constant_pool = constantPool;
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/StackMapType.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/StackMapType.java Wed Jun 26 12:12:25 2019 +0530
@@ -31,7 +31,7 @@
* This class represents the type of a local variable or item on stack
* used in the StackMap entries.
*
- * @version $Id: StackMapType.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see StackMapEntry
* @see StackMap
* @see Const
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Synthetic.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Synthetic.java Wed Jun 26 12:12:25 2019 +0530
@@ -36,7 +36,7 @@
* is intended to be instantiated from the
* <em>Attribute.readAttribute()</em> method.
*
- * @version $Id: Synthetic.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Attribute
*/
public final class Synthetic extends Attribute {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Unknown.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Unknown.java Wed Jun 26 12:12:25 2019 +0530
@@ -38,7 +38,7 @@
* {@link Attribute#addAttributeReader(String, UnknownAttributeReader)}.
*
- * @version $Id: Unknown.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Attribute
* @see UnknownAttributeReader
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/UnknownAttributeReader.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/UnknownAttributeReader.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,7 +27,7 @@
* method. These factory objects should implement this interface.
*
* @see Attribute
- * @version $Id: UnknownAttributeReader.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @since 6.0
*/
public interface UnknownAttributeReader {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Utility.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Utility.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -42,32 +42,32 @@
/**
* Utility functions that do not really belong to any class in particular.
*
- * @version $Id: Utility.java 1751107 2016-07-03 02:41:18Z dbrosius $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
// @since 6.0 methods are no longer final
public abstract class Utility {
- private static int unwrap(final ThreadLocal<Integer> tl) {
- return tl.get().intValue();
+ private static int unwrap( final ThreadLocal<Integer> tl ) {
+ return tl.get();
}
- private static void wrap(final ThreadLocal<Integer> tl, final int value) {
- tl.set(Integer.valueOf(value));
+
+ private static void wrap( final ThreadLocal<Integer> tl, final int value ) {
+ tl.set(value);
}
private static ThreadLocal<Integer> consumed_chars = new ThreadLocal<Integer>() {
@Override
protected Integer initialValue() {
- return Integer.valueOf(0);
+ return 0;
}
};/* How many chars have been consumed
* during parsing in signatureToString().
* Read by methodSignatureToString().
* Set by side effect,but only internally.
*/
-
private static boolean wide = false; /* The `WIDE' instruction is used in the
* byte code to allow 16-bit wide indices
* for local variables. This opcode
@@ -82,25 +82,27 @@
/**
* Convert bit field of flags into string such as `static final'.
*
- * @param access_flags Access flags
+ * @param access_flags Access flags
* @return String representation of flags
*/
- public static String accessToString(final int access_flags) {
+ public static String accessToString( final int access_flags ) {
return accessToString(access_flags, false);
}
+
/**
* Convert bit field of flags into string such as `static final'.
*
* Special case: Classes compiled with new compilers and with the
- * `ACC_SUPER' flag would be said to be "synchronized". This is because SUN
- * used the same value for the flags `ACC_SUPER' and `ACC_SYNCHRONIZED'.
+ * `ACC_SUPER' flag would be said to be "synchronized". This is
+ * because SUN used the same value for the flags `ACC_SUPER' and
+ * `ACC_SYNCHRONIZED'.
*
- * @param access_flags Access flags
- * @param for_class access flags are for class qualifiers ?
+ * @param access_flags Access flags
+ * @param for_class access flags are for class qualifiers ?
* @return String representation of flags
*/
- public static String accessToString(final int access_flags, final boolean for_class) {
+ public static String accessToString( final int access_flags, final boolean for_class ) {
final StringBuilder buf = new StringBuilder();
int p = 0;
for (int i = 0; p < Const.MAX_ACC_FLAG; i++) { // Loop through known flags
@@ -120,33 +122,34 @@
return buf.toString().trim();
}
+
/**
* @param access_flags the class flags
*
* @return "class" or "interface", depending on the ACC_INTERFACE flag
*/
- public static String classOrInterface(final int access_flags) {
+ public static String classOrInterface( final int access_flags ) {
return ((access_flags & Const.ACC_INTERFACE) != 0) ? "interface" : "class";
}
+
/**
* Disassemble a byte array of JVM byte codes starting from code line
* `index' and return the disassembled string representation. Decode only
- * `num' opcodes (including their operands), use -1 if you want to decompile
- * everything.
+ * `num' opcodes (including their operands), use -1 if you want to
+ * decompile everything.
*
- * @param code byte code array
- * @param constant_pool Array of constants
- * @param index offset in `code' array
+ * @param code byte code array
+ * @param constant_pool Array of constants
+ * @param index offset in `code' array
* <EM>(number of opcodes, not bytes!)</EM>
- * @param length number of opcodes to decompile, -1 for all
- * @param verbose be verbose, e.g. print constant pool index
+ * @param length number of opcodes to decompile, -1 for all
+ * @param verbose be verbose, e.g. print constant pool index
* @return String representation of byte codes
*/
- public static String codeToString(final byte[] code, final ConstantPool constant_pool,
- final int index, final int length, final boolean verbose) {
- // Should be sufficient // CHECKSTYLE IGNORE MagicNumber
- final StringBuilder buf = new StringBuilder(code.length * 20);
+ public static String codeToString( final byte[] code, final ConstantPool constant_pool, final int index,
+ final int length, final boolean verbose ) {
+ final StringBuilder buf = new StringBuilder(code.length * 20); // Should be sufficient // CHECKSTYLE IGNORE MagicNumber
try (ByteSequence stream = new ByteSequence(code)) {
for (int i = 0; i < index; i++) {
codeToString(stream, constant_pool, verbose);
@@ -154,9 +157,7 @@
for (int i = 0; stream.available() > 0; i++) {
if ((length < 0) || (i < length)) {
final String indices = fillup(stream.getIndex() + ":", 6, true, ' ');
- buf.append(indices)
- .append(codeToString(stream, constant_pool, verbose))
- .append('\n');
+ buf.append(indices).append(codeToString(stream, constant_pool, verbose)).append('\n');
}
}
} catch (final IOException e) {
@@ -165,21 +166,22 @@
return buf.toString();
}
- public static String codeToString(final byte[] code, final ConstantPool constant_pool,
- final int index, final int length) {
+
+ public static String codeToString( final byte[] code, final ConstantPool constant_pool, final int index, final int length ) {
return codeToString(code, constant_pool, index, length, true);
}
+
/**
- * Disassemble a stream of byte codes and return the string representation.
+ * Disassemble a stream of byte codes and return the
+ * string representation.
*
- * @param bytes stream of bytes
- * @param constant_pool Array of constants
- * @param verbose be verbose, e.g. print constant pool index
+ * @param bytes stream of bytes
+ * @param constant_pool Array of constants
+ * @param verbose be verbose, e.g. print constant pool index
* @return String representation of byte code
*
- * @throws IOException if a failure from reading from the bytes argument
- * occurs
+ * @throws IOException if a failure from reading from the bytes argument occurs
*/
@SuppressWarnings("fallthrough") // by design for case Const.INSTANCEOF
public static String codeToString(final ByteSequence bytes, final ConstantPool constant_pool,
@@ -253,7 +255,7 @@
}
buf.append(")");
}
- break;
+ break;
/* Two address bytes + offset from start of byte stream form the
* jump target
*/
@@ -327,14 +329,14 @@
index = bytes.readUnsignedShort();
buf.append("\t\t").append(
constant_pool.constantToString(index, Const.CONSTANT_Fieldref)).append(
- verbose ? " (" + index + ")" : "");
+ verbose ? " (" + index + ")" : "");
break;
/* Operands are references to classes in constant pool
*/
case Const.NEW:
case Const.CHECKCAST:
buf.append("\t");
- //$FALL-THROUGH$
+ //$FALL-THROUGH$
case Const.INSTANCEOF:
index = bytes.readUnsignedShort();
buf.append("\t<").append(
@@ -364,7 +366,7 @@
final int nargs = bytes.readUnsignedByte(); // historical, redundant
buf.append("\t").append(
constant_pool
- .constantToString(index, Const.CONSTANT_InterfaceMethodref))
+ .constantToString(index, Const.CONSTANT_InterfaceMethodref))
.append(verbose ? " (" + index + ")\t" : "").append(nargs).append("\t")
.append(bytes.readUnsignedByte()); // Last byte is a reserved space
break;
@@ -372,9 +374,9 @@
index = bytes.readUnsignedShort();
buf.append("\t").append(
constant_pool
- .constantToString(index, Const.CONSTANT_InvokeDynamic))
+ .constantToString(index, Const.CONSTANT_InvokeDynamic))
.append(verbose ? " (" + index + ")\t" : "")
- .append(bytes.readUnsignedByte()) // Thrid byte is a reserved space
+ .append(bytes.readUnsignedByte()) // Thrid byte is a reserved space
.append(bytes.readUnsignedByte()); // Last byte is a reserved space
break;
/* Operands are references to items in constant pool
@@ -398,8 +400,8 @@
index = bytes.readUnsignedShort();
buf.append("\t\t<").append(
compactClassName(constant_pool.getConstantString(index,
- Const.CONSTANT_Class), false)).append(">").append(
- verbose ? " (" + index + ")" : "");
+ Const.CONSTANT_Class), false)).append(">").append(
+ verbose ? " (" + index + ")" : "");
break;
/* Multidimensional array of references.
*/
@@ -408,10 +410,10 @@
final int dimensions = bytes.readUnsignedByte();
buf.append("\t<").append(
compactClassName(constant_pool.getConstantString(index,
- Const.CONSTANT_Class), false)).append(">\t").append(dimensions)
+ Const.CONSTANT_Class), false)).append(">\t").append(dimensions)
.append(verbose ? " (" + index + ")" : "");
}
- break;
+ break;
/* Increment local variable.
*/
case Const.IINC:
@@ -448,11 +450,13 @@
return buf.toString();
}
- public static String codeToString(final ByteSequence bytes, final ConstantPool constant_pool)
+
+ public static String codeToString( final ByteSequence bytes, final ConstantPool constant_pool )
throws IOException {
return codeToString(bytes, constant_pool, true);
}
+
/**
* Shorten long class names, <em>java/lang/String</em> becomes
* <em>String</em>.
@@ -460,21 +464,23 @@
* @param str The long class name
* @return Compacted class name
*/
- public static String compactClassName(final String str) {
+ public static String compactClassName( final String str ) {
return compactClassName(str, true);
}
+
/**
* Shorten long class name <em>str</em>, i.e., chop off the <em>prefix</em>,
- * if the class name starts with this string and the flag <em>chopit</em> is
- * true. Slashes <em>/</em> are converted to dots <em>.</em>.
+ * if the
+ * class name starts with this string and the flag <em>chopit</em> is true.
+ * Slashes <em>/</em> are converted to dots <em>.</em>.
*
* @param str The long class name
* @param prefix The prefix the get rid off
* @param chopit Flag that determines whether chopping is executed or not
* @return Compacted class name
*/
- public static String compactClassName(String str, final String prefix, final boolean chopit) {
+ public static String compactClassName( String str, final String prefix, final boolean chopit ) {
final int len = prefix.length();
str = str.replace('/', '.'); // Is `/' on all systems, even DOS
if (chopit) {
@@ -486,53 +492,58 @@
return str;
}
+
/**
* Shorten long class names, <em>java/lang/String</em> becomes
- * <em>java.lang.String</em>, e.g.. If <em>chopit</em> is <em>true</em> the
- * prefix <em>java.lang</em>
+ * <em>java.lang.String</em>,
+ * e.g.. If <em>chopit</em> is <em>true</em> the prefix <em>java.lang</em>
* is also removed.
*
* @param str The long class name
* @param chopit Flag that determines whether chopping is executed or not
* @return Compacted class name
*/
- public static String compactClassName(final String str, final boolean chopit) {
+ public static String compactClassName( final String str, final boolean chopit ) {
return compactClassName(str, "java.lang.", chopit);
}
+
/**
* @return `flag' with bit `i' set to 1
*/
- public static int setBit(final int flag, final int i) {
+ public static int setBit( final int flag, final int i ) {
return flag | pow2(i);
}
+
/**
* @return `flag' with bit `i' set to 0
*/
- public static int clearBit(final int flag, final int i) {
+ public static int clearBit( final int flag, final int i ) {
final int bit = pow2(i);
return (flag & bit) == 0 ? flag : flag ^ bit;
}
+
/**
* @return true, if bit `i' in `flag' is set
*/
- public static boolean isSet(final int flag, final int i) {
+ public static boolean isSet( final int flag, final int i ) {
return (flag & pow2(i)) != 0;
}
+
/**
- * Converts string containing the method return and argument types to a byte
- * code method signature.
+ * Converts string containing the method return and argument types
+ * to a byte code method signature.
*
- * @param ret Return type of method
- * @param argv Types of method arguments
+ * @param ret Return type of method
+ * @param argv Types of method arguments
* @return Byte code representation of method signature
*
* @throws ClassFormatException if the signature is for Void
*/
- public static String methodTypeToSignature(final String ret, final String[] argv)
+ public static String methodTypeToSignature( final String ret, final String[] argv )
throws ClassFormatException {
final StringBuilder buf = new StringBuilder("(");
String str;
@@ -550,23 +561,25 @@
return buf.toString();
}
+
/**
- * @param signature Method signature
+ * @param signature Method signature
* @return Array of argument types
- * @throws ClassFormatException
+ * @throws ClassFormatException
*/
- public static String[] methodSignatureArgumentTypes(final String signature)
+ public static String[] methodSignatureArgumentTypes( final String signature )
throws ClassFormatException {
return methodSignatureArgumentTypes(signature, true);
}
+
/**
- * @param signature Method signature
+ * @param signature Method signature
* @param chopit Shorten class names ?
* @return Array of argument types
- * @throws ClassFormatException
+ * @throws ClassFormatException
*/
- public static String[] methodSignatureArgumentTypes(final String signature, final boolean chopit)
+ public static String[] methodSignatureArgumentTypes( final String signature, final boolean chopit )
throws ClassFormatException {
final List<String> vec = new ArrayList<>();
int index;
@@ -586,24 +599,24 @@
return vec.toArray(new String[vec.size()]);
}
+
/**
- * @param signature Method signature
+ * @param signature Method signature
* @return return type of method
- * @throws ClassFormatException
+ * @throws ClassFormatException
*/
- public static String methodSignatureReturnType(final String signature)
- throws ClassFormatException {
+ public static String methodSignatureReturnType( final String signature ) throws ClassFormatException {
return methodSignatureReturnType(signature, true);
}
+
/**
- * @param signature Method signature
+ * @param signature Method signature
* @param chopit Shorten class names ?
* @return return type of method
- * @throws ClassFormatException
+ * @throws ClassFormatException
*/
- public static String methodSignatureReturnType(final String signature,
- final boolean chopit) throws ClassFormatException {
+ public static String methodSignatureReturnType( final String signature, final boolean chopit ) throws ClassFormatException {
int index;
String type;
try {
@@ -616,6 +629,7 @@
return type;
}
+
/**
* Converts method signature to string with all class names compacted.
*
@@ -624,27 +638,27 @@
* @param access flags of method
* @return Human readable signature
*/
- public static String methodSignatureToString(final String signature,
- final String name, final String access) {
+ public static String methodSignatureToString( final String signature, final String name, final String access ) {
return methodSignatureToString(signature, name, access, true);
}
- public static String methodSignatureToString(final String signature,
- final String name, final String access, final boolean chopit) {
+
+ public static String methodSignatureToString( final String signature, final String name, final String access, final boolean chopit ) {
return methodSignatureToString(signature, name, access, chopit, null);
}
+
/**
- * A returntype signature represents the return value from a method. It is a
- * series of bytes in the following grammar:
+ * A returntype signature represents the return value from a method.
+ * It is a series of bytes in the following grammar:
*
* <pre>
* <return_signature> ::= <field_type> | V
* </pre>
*
- * The character V indicates that the method returns no value. Otherwise,
- * the signature indicates the type of the return value. An argument
- * signature represents an argument passed to a method:
+ * The character V indicates that the method returns no value. Otherwise, the
+ * signature indicates the type of the return value.
+ * An argument signature represents an argument passed to a method:
*
* <pre>
* <argument_signature> ::= <field_type>
@@ -661,17 +675,16 @@
* `void main(String[])' and throws a `ClassFormatException' when the parsed
* type is invalid.
*
- * @param signature Method signature
- * @param name Method name
- * @param access Method access rights
+ * @param signature Method signature
+ * @param name Method name
+ * @param access Method access rights
* @param chopit
* @param vars
* @return Java type declaration
- * @throws ClassFormatException
+ * @throws ClassFormatException
*/
- public static String methodSignatureToString(final String signature, final String name,
- final String access, final boolean chopit, final LocalVariableTable vars)
- throws ClassFormatException {
+ public static String methodSignatureToString( final String signature, final String name,
+ final String access, final boolean chopit, final LocalVariableTable vars ) throws ClassFormatException {
final StringBuilder buf = new StringBuilder("(");
String type;
int index;
@@ -715,21 +728,22 @@
type + " " + name + buf.toString();
}
+
// Guess what this does
- private static int pow2(final int n) {
+ private static int pow2( final int n ) {
return 1 << n;
}
+
/**
- * Replace all occurrences of <em>old</em> in <em>str</em> with
- * <em>new</em>.
+ * Replace all occurrences of <em>old</em> in <em>str</em> with <em>new</em>.
*
* @param str String to permute
* @param old String to be replaced
* @param new_ Replacement string
* @return new String object
*/
- public static String replace(String str, final String old, final String new_) {
+ public static String replace( String str, final String old, final String new_ ) {
int index;
int old_index;
try {
@@ -751,16 +765,18 @@
return str;
}
+
/**
* Converts signature to string with all class names compacted.
*
* @param signature to convert
* @return Human readable signature
*/
- public static String signatureToString(final String signature) {
+ public static String signatureToString( final String signature ) {
return signatureToString(signature, true);
}
+
/**
* The field signature represents the value of an argument to a function or
* the value of a variable. It is a series of bytes generated by the
@@ -790,12 +806,12 @@
* `String[]' and throws a `ClassFormatException' when the parsed type is
* invalid.
*
- * @param signature Class signature
+ * @param signature Class signature
* @param chopit Flag that determines whether chopping is executed or not
* @return Java type declaration
* @throws ClassFormatException
*/
- public static String signatureToString(final String signature, final boolean chopit) {
+ public static String signatureToString( final String signature, final boolean chopit ) {
//corrected concurrent private static field acess
wrap(consumed_chars, 1); // This is the default, read just one char like `B'
try {
@@ -837,6 +853,7 @@
if (index < 0) {
throw new ClassFormatException("Invalid signature: " + signature);
}
+
// check to see if there are any TypeArguments
final int bracketIndex = signature.substring(0, index).indexOf('<');
if (bracketIndex < 0) {
@@ -844,12 +861,20 @@
wrap(consumed_chars, index + 1); // "Lblabla;" `L' and `;' are removed
return compactClassName(signature.substring(1, index), chopit);
}
+ // but make sure we are not looking past the end of the current item
+ fromIndex = signature.indexOf(';');
+ if (fromIndex < 0) {
+ throw new ClassFormatException("Invalid signature: " + signature);
+ }
+ if (fromIndex < bracketIndex) {
+ // just a class identifier
+ wrap(consumed_chars, fromIndex + 1); // "Lblabla;" `L' and `;' are removed
+ return compactClassName(signature.substring(1, fromIndex), chopit);
+ }
// we have TypeArguments; build up partial result
// as we recurse for each TypeArgument
- final StringBuilder type = new StringBuilder(
- compactClassName(signature.substring(1, bracketIndex), chopit))
- .append("<");
+ final StringBuilder type = new StringBuilder(compactClassName(signature.substring(1, bracketIndex), chopit)).append("<");
int consumed_chars = bracketIndex + 1; // Shadows global var
// check for wildcards
@@ -859,37 +884,63 @@
} else if (signature.charAt(consumed_chars) == '-') {
type.append("? super ");
consumed_chars++;
- } else if (signature.charAt(consumed_chars) == '*') {
- // must be at end of signature
- if (signature.charAt(consumed_chars + 1) != '>') {
- throw new ClassFormatException("Invalid signature: " + signature);
- }
- if (signature.charAt(consumed_chars + 2) != ';') {
- throw new ClassFormatException("Invalid signature: " + signature);
- }
- wrap(Utility.consumed_chars, consumed_chars + 3); // remove final "*>;"
- return type + "?>...";
}
// get the first TypeArgument
- type.append(signatureToString(signature.substring(consumed_chars), chopit));
- // update our consumed count by the number of characters the for type argument
- consumed_chars = unwrap(Utility.consumed_chars) + consumed_chars;
- wrap(Utility.consumed_chars, consumed_chars);
-
- // are there more TypeArguments?
- while (signature.charAt(consumed_chars) != '>') {
- type.append(", ").append(signatureToString(signature.substring(consumed_chars), chopit));
+ if (signature.charAt(consumed_chars) == '*') {
+ type.append("?");
+ consumed_chars++;
+ } else {
+ type.append(signatureToString(signature.substring(consumed_chars), chopit));
// update our consumed count by the number of characters the for type argument
consumed_chars = unwrap(Utility.consumed_chars) + consumed_chars;
wrap(Utility.consumed_chars, consumed_chars);
}
- if (signature.charAt(consumed_chars + 1) != ';') {
+ // are there more TypeArguments?
+ while (signature.charAt(consumed_chars) != '>') {
+ type.append(", ");
+ // check for wildcards
+ if (signature.charAt(consumed_chars) == '+') {
+ type.append("? extends ");
+ consumed_chars++;
+ } else if (signature.charAt(consumed_chars) == '-') {
+ type.append("? super ");
+ consumed_chars++;
+ }
+ if (signature.charAt(consumed_chars) == '*') {
+ type.append("?");
+ consumed_chars++;
+ } else {
+ type.append(signatureToString(signature.substring(consumed_chars), chopit));
+ // update our consumed count by the number of characters the for type argument
+ consumed_chars = unwrap(Utility.consumed_chars) + consumed_chars;
+ wrap(Utility.consumed_chars, consumed_chars);
+ }
+ }
+
+ // process the closing ">"
+ consumed_chars++;
+ type.append(">");
+
+ if (signature.charAt(consumed_chars) == '.') {
+ // we have a ClassTypeSignatureSuffix
+ type.append(".");
+ // convert SimpleClassTypeSignature to fake ClassTypeSignature
+ // and then recurse to parse it
+ type.append(signatureToString("L" + signature.substring(consumed_chars+1), chopit));
+ // update our consumed count by the number of characters the for type argument
+ // note that this count includes the "L" we added, but that is ok
+ // as it accounts for the "." we didn't consume
+ consumed_chars = unwrap(Utility.consumed_chars) + consumed_chars;
+ wrap(Utility.consumed_chars, consumed_chars);
+ return type.toString();
+ }
+ if (signature.charAt(consumed_chars) != ';') {
throw new ClassFormatException("Invalid signature: " + signature);
}
- wrap(Utility.consumed_chars, consumed_chars + 2); // remove final ">;"
- return type.append(">").toString();
+ wrap(Utility.consumed_chars, consumed_chars + 1); // remove final ";"
+ return type.toString();
}
case 'S':
return "short";
@@ -924,22 +975,20 @@
}
}
- /**
- * Parse Java type such as "char", or "java.lang.String[]" and return the
- * signature in byte code format, e.g. "C" or "[Ljava/lang/String;"
- * respectively.
+
+ /** Parse Java type such as "char", or "java.lang.String[]" and return the
+ * signature in byte code format, e.g. "C" or "[Ljava/lang/String;" respectively.
*
- * @param type Java type
+ * @param type Java type
* @return byte code signature
*/
- public static String getSignature(String type) {
+ public static String getSignature( String type ) {
final StringBuilder buf = new StringBuilder();
final char[] chars = type.toCharArray();
boolean char_found = false;
boolean delim = false;
int index = -1;
- loop:
- for (int i = 0; i < chars.length; i++) {
+ loop: for (int i = 0; i < chars.length; i++) {
switch (chars[i]) {
case ' ':
case '\t':
@@ -985,7 +1034,8 @@
return buf.toString();
}
- private static int countBrackets(final String brackets) {
+
+ private static int countBrackets( final String brackets ) {
final char[] chars = brackets.toCharArray();
int count = 0;
boolean open = false;
@@ -1015,17 +1065,17 @@
return count;
}
+
/**
- * Return type of method signature as a byte value as defined in
- * <em>Constants</em>
+ * Return type of method signature as a byte value as defined in <em>Constants</em>
*
- * @param signature in format described above
+ * @param signature in format described above
* @return type of method signature
- * @see Const
+ * @see Const
*
* @throws ClassFormatException if signature is not a method signature
*/
- public static byte typeOfMethodSignature(final String signature) throws ClassFormatException {
+ public static byte typeOfMethodSignature( final String signature ) throws ClassFormatException {
int index;
try {
if (signature.charAt(0) != '(') {
@@ -1038,16 +1088,17 @@
}
}
+
/**
* Return type of signature as a byte value as defined in <em>Constants</em>
*
- * @param signature in format described above
+ * @param signature in format described above
* @return type of signature
- * @see Const
+ * @see Const
*
* @throws ClassFormatException if signature isn't a known type
*/
- public static byte typeOfSignature(final String signature) throws ClassFormatException {
+ public static byte typeOfSignature( final String signature ) throws ClassFormatException {
try {
switch (signature.charAt(0)) {
case 'B':
@@ -1085,11 +1136,10 @@
}
}
- /**
- * Map opcode names to opcode numbers. E.g., return Constants.ALOAD for
- * "aload"
+
+ /** Map opcode names to opcode numbers. E.g., return Constants.ALOAD for "aload"
*/
- public static short searchOpcode(String name) {
+ public static short searchOpcode( String name ) {
name = name.toLowerCase(Locale.ENGLISH);
for (short i = 0; i < Const.OPCODE_NAMES_LENGTH; i++) {
if (Const.getOpcodeName(i).equals(name)) {
@@ -1099,22 +1149,23 @@
return -1;
}
+
/**
* Convert (signed) byte to (unsigned) short value, i.e., all negative
* values become positive.
*/
- private static short byteToShort(final byte b) {
+ private static short byteToShort( final byte b ) {
return (b < 0) ? (short) (256 + b) : (short) b;
}
- /**
- * Convert bytes into hexadecimal string
+
+ /** Convert bytes into hexadecimal string
*
* @param bytes an array of bytes to convert to hexadecimal
*
* @return bytes as hexadecimal string, e.g. 00 fa 12 ...
*/
- public static String toHexString(final byte[] bytes) {
+ public static String toHexString( final byte[] bytes ) {
final StringBuilder buf = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
final short b = byteToShort(bytes[i]);
@@ -1130,6 +1181,7 @@
return buf.toString();
}
+
/**
* Return a string for an integer justified left or right and filled up with
* `fill' characters if necessary.
@@ -1140,14 +1192,13 @@
* @param fill fill character
* @return formatted int
*/
- public static String format(final int i, final int length,
- final boolean left_justify, final char fill) {
+ public static String format( final int i, final int length, final boolean left_justify, final char fill ) {
return fillup(Integer.toString(i), length, left_justify, fill);
}
+
/**
- * Fillup char with up to length characters with char `fill' and justify it
- * left or right.
+ * Fillup char with up to length characters with char `fill' and justify it left or right.
*
* @param str string to format
* @param length length of desired string
@@ -1155,8 +1206,7 @@
* @param fill fill character
* @return formatted string
*/
- public static String fillup(final String str, final int length,
- final boolean left_justify, final char fill) {
+ public static String fillup( final String str, final int length, final boolean left_justify, final char fill ) {
final int len = length - str.length();
final char[] buf = new char[(len < 0) ? 0 : len];
for (int j = 0; j < buf.length; j++) {
@@ -1168,7 +1218,8 @@
return new String(buf) + str;
}
- static boolean equals(final byte[] a, final byte[] b) {
+
+ static boolean equals( final byte[] a, final byte[] b ) {
int size;
if ((size = a.length) != b.length) {
return false;
@@ -1181,23 +1232,28 @@
return true;
}
- public static void printArray(final PrintStream out, final Object[] obj) {
+
+ public static void printArray( final PrintStream out, final Object[] obj ) {
out.println(printArray(obj, true));
}
- public static void printArray(final PrintWriter out, final Object[] obj) {
+
+ public static void printArray( final PrintWriter out, final Object[] obj ) {
out.println(printArray(obj, true));
}
- public static String printArray(final Object[] obj) {
+
+ public static String printArray( final Object[] obj ) {
return printArray(obj, true);
}
- public static String printArray(final Object[] obj, final boolean braces) {
+
+ public static String printArray( final Object[] obj, final boolean braces ) {
return printArray(obj, braces, false);
}
- public static String printArray(final Object[] obj, final boolean braces, final boolean quote) {
+
+ public static String printArray( final Object[] obj, final boolean braces, final boolean quote ) {
if (obj == null) {
return null;
}
@@ -1221,32 +1277,32 @@
return buf.toString();
}
+
/**
* @param ch the character to test if it's part of an identifier
*
* @return true, if character is one of (a, ... z, A, ... Z, 0, ... 9, _)
*/
- public static boolean isJavaIdentifierPart(final char ch) {
+ public static boolean isJavaIdentifierPart( final char ch ) {
return ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z'))
|| ((ch >= '0') && (ch <= '9')) || (ch == '_');
}
+
/**
- * Encode byte array it into Java identifier string, i.e., a string that
- * only contains the following characters: (a, ... z, A, ... Z, 0, ... 9, _,
- * $). The encoding algorithm itself is not too clever: if the current
- * byte's ASCII value already is a valid Java identifier part, leave it as
- * it is. Otherwise it writes the escape character($) followed by:
+ * Encode byte array it into Java identifier string, i.e., a string
+ * that only contains the following characters: (a, ... z, A, ... Z,
+ * 0, ... 9, _, $). The encoding algorithm itself is not too
+ * clever: if the current byte's ASCII value already is a valid Java
+ * identifier part, leave it as it is. Otherwise it writes the
+ * escape character($) followed by:
*
* <ul>
- * <li> the ASCII value as a hexadecimal string, if the value is not in the
- * range 200..247</li>
- * <li>a Java identifier char not used in a lowercase hexadecimal string, if
- * the value is in the range 200..247</li>
+ * <li> the ASCII value as a hexadecimal string, if the value is not in the range 200..247</li>
+ * <li>a Java identifier char not used in a lowercase hexadecimal string, if the value is in the range 200..247</li>
* </ul>
*
- * <p>
- * This operation inflates the original byte array by roughly 40-50%</p>
+ * <p>This operation inflates the original byte array by roughly 40-50%</p>
*
* @param bytes the byte array to convert
* @param compress use gzip to minimize string
@@ -1271,6 +1327,7 @@
return caw.toString();
}
+
/**
* Decode a string back to a byte array.
*
@@ -1308,7 +1365,6 @@
private static int[] CHAR_MAP = new int[FREE_CHARS];
private static int[] MAP_CHAR = new int[256]; // Reverse map
private static final char ESCAPE_CHAR = '$';
-
static {
int j = 0;
for (int i = 'A'; i <= 'Z'; i++) {
@@ -1329,8 +1385,8 @@
}
/**
- * Decode characters into bytes. Used by <a
- * href="Utility.html#decode(java.lang.String, boolean)">decode()</a>
+ * Decode characters into bytes.
+ * Used by <a href="Utility.html#decode(java.lang.String, boolean)">decode()</a>
*/
private static class JavaReader extends FilterReader {
@@ -1338,6 +1394,7 @@
super(in);
}
+
@Override
public int read() throws IOException {
final int b = in.read();
@@ -1354,7 +1411,7 @@
return -1;
}
final char[] tmp = {
- (char) i, (char) j
+ (char) i, (char) j
};
final int s = Integer.parseInt(new String(tmp), 16);
return s;
@@ -1362,8 +1419,9 @@
return MAP_CHAR[i];
}
+
@Override
- public int read(final char[] cbuf, final int off, final int len) throws IOException {
+ public int read( final char[] cbuf, final int off, final int len ) throws IOException {
for (int i = 0; i < len; i++) {
cbuf[off + i] = (char) read();
}
@@ -1372,8 +1430,8 @@
}
/**
- * Encode bytes into valid java identifier characters. Used by <a
- * href="Utility.html#encode(byte[], boolean)">encode()</a>
+ * Encode bytes into valid java identifier characters.
+ * Used by <a href="Utility.html#encode(byte[], boolean)">encode()</a>
*/
private static class JavaWriter extends FilterWriter {
@@ -1381,8 +1439,9 @@
super(out);
}
+
@Override
- public void write(final int b) throws IOException {
+ public void write( final int b ) throws IOException {
if (isJavaIdentifierPart((char) b) && (b != ESCAPE_CHAR)) {
out.write(b);
} else {
@@ -1403,23 +1462,26 @@
}
}
+
@Override
- public void write(final char[] cbuf, final int off, final int len) throws IOException {
+ public void write( final char[] cbuf, final int off, final int len ) throws IOException {
for (int i = 0; i < len; i++) {
write(cbuf[off + i]);
}
}
+
@Override
- public void write(final String str, final int off, final int len) throws IOException {
+ public void write( final String str, final int off, final int len ) throws IOException {
write(str.toCharArray(), off, len);
}
}
+
/**
* Escape all occurences of newline chars '\n', quotes \", etc.
*/
- public static String convertString(final String label) {
+ public static String convertString( final String label ) {
final char[] ch = label.toCharArray();
final StringBuilder buf = new StringBuilder();
for (final char element : ch) {
@@ -1446,4 +1508,5 @@
}
return buf.toString();
}
+
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Visitor.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Visitor.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* that implements this interface can traverse the contents of a Java class just
* by calling the `accept' method which all classes have.
*
- * @version $Id: Visitor.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface Visitor
{
@@ -150,4 +150,21 @@
* @since 6.0
*/
void visitParameterAnnotationEntry(ParameterAnnotationEntry obj);
+
+ /**
+ * @since 6.1
+ */
+ void visitConstantPackage(ConstantPackage constantPackage);
+
+ /**
+ * @since 6.1
+ */
+ void visitConstantModule(ConstantModule constantModule);
+
+ /**
+ * @since 6.3
+ */
+ default void visitConstantDynamic(ConstantDynamic constantDynamic) {
+ // empty
+ }
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/AALOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/AALOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* AALOAD - Load reference from array
* <PRE>Stack: ..., arrayref, index -> value</PRE>
*
- * @version $Id: AALOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class AALOAD extends ArrayInstruction implements StackProducer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/AASTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/AASTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* AASTORE - Store into reference array
* <PRE>Stack: ..., arrayref, index, value -> ...</PRE>
*
- * @version $Id: AASTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class AASTORE extends ArrayInstruction implements StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ACONST_NULL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ACONST_NULL.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* ACONST_NULL - Push null reference
* <PRE>Stack: ... -> ..., null</PRE>
*
- * @version $Id: ACONST_NULL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class ACONST_NULL extends Instruction implements PushInstruction, TypedInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ALOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ALOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,6 +1,5 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -27,18 +26,20 @@
* ALOAD - Load reference from local variable
* <PRE>Stack: ... -> ..., objectref</PRE>
*
- * @version $Id: ALOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class ALOAD extends LoadInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
ALOAD() {
super(Const.ALOAD, Const.ALOAD_0);
}
+
/** Load reference from local variable
* @param n index of local variable
*/
@@ -46,6 +47,7 @@
super(Const.ALOAD, Const.ALOAD_0, n);
}
+
/**
* Call corresponding visitor method(s). The order is:
* Call visitor methods of implemented interfaces first, then
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ANEWARRAY.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ANEWARRAY.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,14 +27,14 @@
* ANEWARRAY - Create new array of references
* <PRE>Stack: ..., count -> ..., arrayref</PRE>
*
- * @version $Id: ANEWARRAY.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class ANEWARRAY extends CPInstruction implements LoadClass, AllocationInstruction,
ExceptionThrower, StackConsumer, StackProducer {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
ANEWARRAY() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ARETURN.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ARETURN.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* ARETURN - Return reference from method
* <PRE>Stack: ..., objectref -> <empty></PRE>
*
- * @version $Id: ARETURN.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class ARETURN extends ReturnInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ARRAYLENGTH.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ARRAYLENGTH.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,8 +26,8 @@
* ARRAYLENGTH - Get length of array
* <PRE>Stack: ..., arrayref -> ..., length</PRE>
*
- * @version $Id: ARRAYLENGTH.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class ARRAYLENGTH extends Instruction
implements ExceptionThrower, StackProducer, StackConsumer /* since 6.0 */ {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ASTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ASTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,6 +1,5 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,37 +25,38 @@
* ASTORE - Store reference into local variable
* <PRE>Stack ..., objectref -> ... </PRE>
*
- * @version $Id: ASTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class ASTORE extends StoreInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
ASTORE() {
super(Const.ASTORE, Const.ASTORE_0);
}
- /**
- * Store reference into local variable
- *
+
+ /** Store reference into local variable
* @param n index of local variable
*/
public ASTORE(final int n) {
super(Const.ASTORE, Const.ASTORE_0, n);
}
+
/**
- * Call corresponding visitor method(s). The order is: Call visitor methods
- * of implemented interfaces first, then call methods according to the class
- * hierarchy in descending order, i.e., the most specific visitXXX() call
- * comes last.
+ * Call corresponding visitor method(s). The order is:
+ * Call visitor methods of implemented interfaces first, then
+ * call methods according to the class hierarchy in descending order,
+ * i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
@Override
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
super.accept(v);
v.visitASTORE(this);
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ATHROW.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ATHROW.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,8 +26,8 @@
* ATHROW - Throw exception
* <PRE>Stack: ..., objectref -> objectref</PRE>
*
- * @version $Id: ATHROW.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class ATHROW extends Instruction implements UnconditionalBranch, ExceptionThrower {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/AllocationInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/AllocationInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,7 +24,7 @@
/**
* Denote family of instructions that allocates space in the heap.
*
- * @version $Id: AllocationInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface AllocationInstruction {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/AnnotationEntryGen.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/AnnotationEntryGen.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,6 +1,5 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -41,6 +40,7 @@
/**
* @since 6.0
+ * @LastModified: Jun 2019
*/
public class AnnotationEntryGen {
private int typeIndex;
@@ -263,8 +263,8 @@
return newAttributes.toArray(new Attribute[newAttributes.size()]);
} catch (final IOException e) {
- System.err.println("IOException whilst processing annotations. " +
- e.getMessage());
+ System.err.println("IOException whilst processing annotations");
+ e.printStackTrace();
}
return null;
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ArithmeticInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ArithmeticInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,14 +26,14 @@
/**
* Super class for the family of arithmetic instructions.
*
- * @version $Id: ArithmeticInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public abstract class ArithmeticInstruction extends Instruction implements TypedInstruction,
StackProducer, StackConsumer {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
ArithmeticInstruction() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ArrayInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ArrayInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,14 +26,14 @@
/**
* Super class for instructions dealing with array access such as IALOAD.
*
- * @version $Id: ArrayInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public abstract class ArrayInstruction extends Instruction implements ExceptionThrower,
TypedInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
ArrayInstruction() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ArrayType.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ArrayType.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,14 @@
/**
* Denotes array type, such as int[][]
*
- * @version $Id: ArrayType.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public final class ArrayType extends ReferenceType {
private int dimensions;
private Type basic_type;
+
/**
* Convenience constructor for array type, e.g. int[]
*
@@ -41,6 +42,7 @@
this(BasicType.getType(type), dimensions);
}
+
/**
* Convenience constructor for reference array type, e.g. Object[]
*
@@ -50,6 +52,7 @@
this(ObjectType.getInstance(class_name), dimensions);
}
+
/**
* Constructor for array of given type
*
@@ -81,6 +84,7 @@
super.setSignature(buf.toString());
}
+
/**
* @return basic type of array, i.e., for int[][][] the basic type is int
*/
@@ -88,9 +92,9 @@
return basic_type;
}
+
/**
- * @return element type of array, i.e., for int[][][] the element type is
- * int[][]
+ * @return element type of array, i.e., for int[][][] the element type is int[][]
*/
public Type getElementType() {
if (dimensions == 1) {
@@ -99,26 +103,26 @@
return new ArrayType(basic_type, dimensions - 1);
}
- /**
- * @return number of dimensions of array
+
+ /** @return number of dimensions of array
*/
public int getDimensions() {
return dimensions;
}
- /**
- * @return a hash code value for the object.
+
+ /** @return a hash code value for the object.
*/
@Override
public int hashCode() {
return basic_type.hashCode() ^ dimensions;
}
- /**
- * @return true if both type objects refer to the same array type.
+
+ /** @return true if both type objects refer to the same array type.
*/
@Override
- public boolean equals(final Object _type) {
+ public boolean equals( final Object _type ) {
if (_type instanceof ArrayType) {
final ArrayType array = (ArrayType) _type;
return (array.dimensions == dimensions) && array.basic_type.equals(basic_type);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BALOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BALOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,27 +24,27 @@
* BALOAD - Load byte or boolean from array
* <PRE>Stack: ..., arrayref, index -> ..., value</PRE>
*
- * @version $Id: BALOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class BALOAD extends ArrayInstruction implements StackProducer {
- /**
- * Load byte or boolean from array
+ /** Load byte or boolean from array
*/
public BALOAD() {
super(com.sun.org.apache.bcel.internal.Const.BALOAD);
}
+
/**
- * Call corresponding visitor method(s). The order is: Call visitor methods
- * of implemented interfaces first, then call methods according to the class
- * hierarchy in descending order, i.e., the most specific visitXXX() call
- * comes last.
+ * Call corresponding visitor method(s). The order is:
+ * Call visitor methods of implemented interfaces first, then
+ * call methods according to the class hierarchy in descending order,
+ * i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
@Override
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
v.visitStackProducer(this);
v.visitExceptionThrower(this);
v.visitTypedInstruction(this);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BASTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BASTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -21,30 +21,30 @@
package com.sun.org.apache.bcel.internal.generic;
/**
- * BASTORE - Store into byte or boolean array
+ * BASTORE - Store into byte or boolean array
* <PRE>Stack: ..., arrayref, index, value -> ...</PRE>
*
- * @version $Id: BASTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class BASTORE extends ArrayInstruction implements StackConsumer {
- /**
- * Store byte or boolean into array
+ /** Store byte or boolean into array
*/
public BASTORE() {
super(com.sun.org.apache.bcel.internal.Const.BASTORE);
}
+
/**
- * Call corresponding visitor method(s). The order is: Call visitor methods
- * of implemented interfaces first, then call methods according to the class
- * hierarchy in descending order, i.e., the most specific visitXXX() call
- * comes last.
+ * Call corresponding visitor method(s). The order is:
+ * Call visitor methods of implemented interfaces first, then
+ * call methods according to the class hierarchy in descending order,
+ * i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
@Override
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
v.visitStackConsumer(this);
v.visitExceptionThrower(this);
v.visitTypedInstruction(this);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BIPUSH.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BIPUSH.java Wed Jun 26 12:12:25 2019 +0530
@@ -29,76 +29,82 @@
*
* <PRE>Stack: ... -> ..., value</PRE>
*
- * @version $Id: BIPUSH.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class BIPUSH extends Instruction implements ConstantPushInstruction {
private byte b;
+
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
BIPUSH() {
}
- /**
- * Push byte on stack
+
+ /** Push byte on stack
*/
public BIPUSH(final byte b) {
super(com.sun.org.apache.bcel.internal.Const.BIPUSH, (short) 2);
this.b = b;
}
+
/**
* Dump instruction as byte code to stream out.
*/
@Override
- public void dump(final DataOutputStream out) throws IOException {
+ public void dump( final DataOutputStream out ) throws IOException {
super.dump(out);
out.writeByte(b);
}
+
/**
* @return mnemonic for instruction
*/
@Override
- public String toString(final boolean verbose) {
+ public String toString( final boolean verbose ) {
return super.toString(verbose) + " " + b;
}
+
/**
* Read needed data (e.g. index) from file.
*/
@Override
- protected void initFromFile(final ByteSequence bytes, final boolean wide) throws IOException {
+ protected void initFromFile( final ByteSequence bytes, final boolean wide ) throws IOException {
super.setLength(2);
b = bytes.readByte();
}
+
@Override
public Number getValue() {
return Integer.valueOf(b);
}
- /**
- * @return Type.BYTE
+
+ /** @return Type.BYTE
*/
@Override
- public Type getType(final ConstantPoolGen cp) {
+ public Type getType( final ConstantPoolGen cp ) {
return Type.BYTE;
}
+
/**
- * Call corresponding visitor method(s). The order is: Call visitor methods
- * of implemented interfaces first, then call methods according to the class
- * hierarchy in descending order, i.e., the most specific visitXXX() call
- * comes last.
+ * Call corresponding visitor method(s). The order is:
+ * Call visitor methods of implemented interfaces first, then
+ * call methods according to the class hierarchy in descending order,
+ * i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
@Override
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
v.visitPushInstruction(this);
v.visitStackProducer(this);
v.visitTypedInstruction(this);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BREAKPOINT.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BREAKPOINT.java Wed Jun 26 12:12:25 2019 +0530
@@ -23,7 +23,7 @@
/**
* BREAKPOINT, JVM dependent, ignored by default
*
- * @version $Id: BREAKPOINT.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class BREAKPOINT extends Instruction {
@@ -31,16 +31,17 @@
super(com.sun.org.apache.bcel.internal.Const.BREAKPOINT, (short) 1);
}
+
/**
- * Call corresponding visitor method(s). The order is: Call visitor methods
- * of implemented interfaces first, then call methods according to the class
- * hierarchy in descending order, i.e., the most specific visitXXX() call
- * comes last.
+ * Call corresponding visitor method(s). The order is:
+ * Call visitor methods of implemented interfaces first, then
+ * call methods according to the class hierarchy in descending order,
+ * i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
@Override
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
v.visitBREAKPOINT(this);
}
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BasicType.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BasicType.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
/**
* Denotes basic type such as int.
*
- * @version $Id: BasicType.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public final class BasicType extends Type {
@@ -42,8 +42,9 @@
}
}
+
// @since 6.0 no longer final
- public static BasicType getType(final byte type) {
+ public static BasicType getType( final byte type ) {
switch (type) {
case Const.T_VOID:
return VOID;
@@ -68,19 +69,19 @@
}
}
- /**
- * @return a hash code value for the object.
+
+ /** @return a hash code value for the object.
*/
@Override
public int hashCode() {
return super.getType();
}
- /**
- * @return true if both type objects refer to the same type
+
+ /** @return true if both type objects refer to the same type
*/
@Override
- public boolean equals(final Object _type) {
+ public boolean equals( final Object _type ) {
return (_type instanceof BasicType) ? ((BasicType) _type).getType() == this.getType() : false;
}
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BranchHandle.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BranchHandle.java Wed Jun 26 12:12:25 2019 +0530
@@ -23,13 +23,13 @@
/**
* BranchHandle is returned by specialized InstructionList.append() whenever a
* BranchInstruction is appended. This is useful when the target of this
- * instruction is not known at time of creation and must be set later via
- * setTarget().
+ * instruction is not known at time of creation and must be set later
+ * via setTarget().
*
* @see InstructionHandle
* @see Instruction
* @see InstructionList
- * @version $Id: BranchHandle.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public final class BranchHandle extends InstructionHandle {
@@ -37,33 +37,16 @@
// See BCEL-273
private BranchInstruction bi; // An alias in fact, but saves lots of casts
+
private BranchHandle(final BranchInstruction i) {
super(i);
bi = i;
}
- /**
- * Factory methods.
+ /** Factory method.
*/
- private static BranchHandle bh_list = null; // List of reusable handles
-
- static BranchHandle getBranchHandle(final BranchInstruction i) {
- if (bh_list == null) {
- return new BranchHandle(i);
- }
- final BranchHandle bh = bh_list;
- bh_list = (BranchHandle) bh.getNext();
- bh.setInstruction(i);
- return bh;
- }
-
- /**
- * Handle adds itself to the list of resuable handles.
- */
- @Override
- protected void addHandle() {
- super.setNext(bh_list);
- bh_list = this;
+ static BranchHandle getBranchHandle( final BranchInstruction i ) {
+ return new BranchHandle(i);
}
@@ -76,34 +59,39 @@
return bi.getPosition();
}
+
@Override
- void setPosition(final int pos) {
+ void setPosition( final int pos ) {
// Original code: i_position = bi.position = pos;
bi.setPosition(pos);
super.setPosition(pos);
}
+
@Override
- protected int updatePosition(final int offset, final int max_offset) {
+ protected int updatePosition( final int offset, final int max_offset ) {
final int x = bi.updatePosition(offset, max_offset);
super.setPosition(bi.getPosition());
return x;
}
+
/**
* Pass new target to instruction.
*/
- public void setTarget(final InstructionHandle ih) {
+ public void setTarget( final InstructionHandle ih ) {
bi.setTarget(ih);
}
+
/**
* Update target of instruction.
*/
- public void updateTarget(final InstructionHandle old_ih, final InstructionHandle new_ih) {
+ public void updateTarget( final InstructionHandle old_ih, final InstructionHandle new_ih ) {
bi.updateTarget(old_ih, new_ih);
}
+
/**
* @return target of instruction.
*/
@@ -111,12 +99,12 @@
return bi.getTarget();
}
+
/**
- * Set new contents. Old instruction is disposed and may not be used
- * anymore.
+ * Set new contents. Old instruction is disposed and may not be used anymore.
*/
@Override // This is only done in order to apply the additional type check; could be merged with super impl.
- public void setInstruction(final Instruction i) { // TODO could be package-protected?
+ public void setInstruction( final Instruction i ) { // TODO could be package-protected?
super.setInstruction(i);
if (!(i instanceof BranchInstruction)) {
throw new ClassGenException("Assigning " + i
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BranchInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BranchInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,6 +1,5 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,12 +25,13 @@
import com.sun.org.apache.bcel.internal.util.ByteSequence;
/**
- * Abstract super class for branching instructions like GOTO, IFEQ, etc.. Branch
- * instructions may have a variable length, namely GOTO, JSR, LOOKUPSWITCH and
- * TABLESWITCH.
+ * Abstract super class for branching instructions like GOTO, IFEQ, etc..
+ * Branch instructions may have a variable length, namely GOTO, JSR,
+ * LOOKUPSWITCH and TABLESWITCH.
*
* @see InstructionList
- * @version $Id: BranchInstruction.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class BranchInstruction extends Instruction implements InstructionTargeter {
@@ -46,9 +46,8 @@
BranchInstruction() {
}
- /**
- * Common super constructor
- *
+
+ /** Common super constructor
* @param opcode Instruction opcode
* @param target instruction to branch to
*/
@@ -57,13 +56,13 @@
setTarget(target);
}
+
/**
* Dump instruction as byte code to stream out.
- *
* @param out Output stream
*/
@Override
- public void dump(final DataOutputStream out) throws IOException {
+ public void dump( final DataOutputStream out ) throws IOException {
out.writeByte(super.getOpcode());
index = getTargetOffset();
if (!isValidShort(index)) {
@@ -72,11 +71,12 @@
out.writeShort(index); // May be negative, i.e., point backwards
}
+
/**
* @param _target branch target
- * @return the offset to `target' relative to this instruction
+ * @return the offset to `target' relative to this instruction
*/
- protected int getTargetOffset(final InstructionHandle _target) {
+ protected int getTargetOffset( final InstructionHandle _target ) {
if (_target == null) {
throw new ClassGenException("Target of " + super.toString(true)
+ " is invalid null handle");
@@ -89,6 +89,7 @@
return t - position;
}
+
/**
* @return the offset to this instruction's target
*/
@@ -96,37 +97,36 @@
return getTargetOffset(target);
}
+
/**
- * Called by InstructionList.setPositions when setting the position for
- * every instruction. In the presence of variable length instructions
- * `setPositions' performs multiple passes over the instruction list to
- * calculate the correct (byte) positions and offsets by calling this
- * function.
+ * Called by InstructionList.setPositions when setting the position for every
+ * instruction. In the presence of variable length instructions `setPositions'
+ * performs multiple passes over the instruction list to calculate the
+ * correct (byte) positions and offsets by calling this function.
*
- * @param offset additional offset caused by preceding (variable length)
- * instructions
- * @param max_offset the maximum offset that may be caused by these
- * instructions
- * @return additional offset caused by possible change of this instruction's
- * length
+ * @param offset additional offset caused by preceding (variable length) instructions
+ * @param max_offset the maximum offset that may be caused by these instructions
+ * @return additional offset caused by possible change of this instruction's length
*/
- protected int updatePosition(final int offset, final int max_offset) {
+ protected int updatePosition( final int offset, final int max_offset ) {
position += offset;
return 0;
}
+
/**
* Long output format:
*
- * <position in byte code> <name of opcode> "["<opcode
- * number>"]" "("<length of instruction>")" "<"<target
- * instruction>">" "@"<branch target offset>
+ * <position in byte code>
+ * <name of opcode> "["<opcode number>"]"
+ * "("<length of instruction>")"
+ * "<"<target instruction>">" "@"<branch target offset>
*
* @param verbose long/short format switch
* @return mnemonic for instruction
*/
@Override
- public String toString(final boolean verbose) {
+ public String toString( final boolean verbose ) {
final String s = super.toString(verbose);
String t = "null";
if (verbose) {
@@ -153,20 +153,22 @@
return s + " -> " + t;
}
+
/**
- * Read needed data (e.g. index) from file. Conversion to a
- * InstructionHandle is done in InstructionList(byte[]).
+ * Read needed data (e.g. index) from file. Conversion to a InstructionHandle
+ * is done in InstructionList(byte[]).
*
* @param bytes input stream
* @param wide wide prefix?
* @see InstructionList
*/
@Override
- protected void initFromFile(final ByteSequence bytes, final boolean wide) throws IOException {
+ protected void initFromFile( final ByteSequence bytes, final boolean wide ) throws IOException {
super.setLength(3);
index = bytes.readShort();
}
+
/**
* @return target offset in byte code
*/
@@ -174,6 +176,7 @@
return index;
}
+
/**
* @return target of branch instruction
*/
@@ -181,22 +184,22 @@
return target;
}
+
/**
* Set branch target
- *
* @param target branch target
*/
- public void setTarget(final InstructionHandle target) {
+ public void setTarget( final InstructionHandle target ) {
notifyTarget(this.target, target, this);
this.target = target;
}
+
/**
- * Used by BranchInstruction, LocalVariableGen, CodeExceptionGen,
- * LineNumberGen
+ * Used by BranchInstruction, LocalVariableGen, CodeExceptionGen, LineNumberGen
*/
- static void notifyTarget(final InstructionHandle old_ih, final InstructionHandle new_ih,
- final InstructionTargeter t) {
+ static void notifyTarget( final InstructionHandle old_ih, final InstructionHandle new_ih,
+ final InstructionTargeter t ) {
if (old_ih != null) {
old_ih.removeTargeter(t);
}
@@ -205,12 +208,13 @@
}
}
+
/**
* @param old_ih old target
* @param new_ih new target
*/
@Override
- public void updateTarget(final InstructionHandle old_ih, final InstructionHandle new_ih) {
+ public void updateTarget( final InstructionHandle old_ih, final InstructionHandle new_ih ) {
if (target == old_ih) {
setTarget(new_ih);
} else {
@@ -218,14 +222,16 @@
}
}
+
/**
* @return true, if ih is target of this instruction
*/
@Override
- public boolean containsTarget(final InstructionHandle ih) {
+ public boolean containsTarget( final InstructionHandle ih ) {
return target == ih;
}
+
/**
* Inform target that it's not targeted anymore.
*/
@@ -236,6 +242,7 @@
position = -1;
}
+
/**
* @return the position
* @since 6.0
@@ -244,6 +251,7 @@
return position;
}
+
/**
* @param position the position to set
* @since 6.0
@@ -252,6 +260,7 @@
this.position = position;
}
+
/**
* @param index the index to set
* @since 6.0
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CALOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CALOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* CALOAD - Load char from array
* <PRE>Stack: ..., arrayref, index -> ..., value</PRE>
*
- * @version $Id: CALOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class CALOAD extends ArrayInstruction implements StackProducer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CASTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CASTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* CASTORE - Store into char array
* <PRE>Stack: ..., arrayref, index, value -> ...</PRE>
*
- * @version $Id: CASTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class CASTORE extends ArrayInstruction implements StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CHECKCAST.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CHECKCAST.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,14 +27,14 @@
* CHECKCAST - Check whether object is of given type
* <PRE>Stack: ..., objectref -> ..., objectref</PRE>
*
- * @version $Id: CHECKCAST.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class CHECKCAST extends CPInstruction implements LoadClass, ExceptionThrower, StackProducer,
StackConsumer {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
CHECKCAST() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CPInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CPInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,6 +1,5 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -29,27 +28,30 @@
import com.sun.org.apache.bcel.internal.util.ByteSequence;
/**
- * Abstract super class for instructions that use an index into the constant
- * pool such as LDC, INVOKEVIRTUAL, etc.
+ * Abstract super class for instructions that use an index into the
+ * constant pool such as LDC, INVOKEVIRTUAL, etc.
*
* @see ConstantPoolGen
* @see LDC
* @see INVOKEVIRTUAL
*
- * @version $Id: CPInstruction.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class CPInstruction extends Instruction implements TypedInstruction,
IndexedInstruction {
private int index; // index to constant pool
+
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
CPInstruction() {
}
+
/**
* @param index to constant pool
*/
@@ -58,36 +60,38 @@
setIndex(index);
}
+
/**
* Dump instruction as byte code to stream out.
- *
* @param out Output stream
*/
@Override
- public void dump(final DataOutputStream out) throws IOException {
+ public void dump( final DataOutputStream out ) throws IOException {
out.writeByte(super.getOpcode());
out.writeShort(index);
}
+
/**
* Long output format:
*
- * <name of opcode> "["<opcode number>"]" "("<length of
- * instruction>")" "<"< constant pool index>">"
+ * <name of opcode> "["<opcode number>"]"
+ * "("<length of instruction>")" "<"< constant pool index>">"
*
* @param verbose long/short format switch
* @return mnemonic for instruction
*/
@Override
- public String toString(final boolean verbose) {
+ public String toString( final boolean verbose ) {
return super.toString(verbose) + " " + index;
}
+
/**
* @return mnemonic for instruction with symbolic references resolved
*/
@Override
- public String toString(final ConstantPool cp) {
+ public String toString( final ConstantPool cp ) {
final Constant c = cp.getConstant(index);
String str = cp.constantToString(c);
if (c instanceof ConstantClass) {
@@ -96,18 +100,19 @@
return com.sun.org.apache.bcel.internal.Const.getOpcodeName(super.getOpcode()) + " " + str;
}
+
/**
* Read needed data (i.e., index) from file.
- *
* @param bytes input stream
* @param wide wide prefix?
*/
@Override
- protected void initFromFile(final ByteSequence bytes, final boolean wide) throws IOException {
+ protected void initFromFile( final ByteSequence bytes, final boolean wide ) throws IOException {
setIndex(bytes.readUnsignedShort());
super.setLength(3);
}
+
/**
* @return index in constant pool referred by this instruction.
*/
@@ -116,24 +121,24 @@
return index;
}
+
/**
* Set the index to constant pool.
- *
- * @param index in constant pool.
+ * @param index in constant pool.
*/
@Override
- public void setIndex(final int index) { // TODO could be package-protected?
+ public void setIndex( final int index ) { // TODO could be package-protected?
if (index < 0) {
throw new ClassGenException("Negative index value: " + index);
}
this.index = index;
}
- /**
- * @return type related with this instruction.
+
+ /** @return type related with this instruction.
*/
@Override
- public Type getType(final ConstantPoolGen cpg) {
+ public Type getType( final ConstantPoolGen cpg ) {
final ConstantPool cp = cpg.getConstantPool();
String name = cp.getConstantString(index, com.sun.org.apache.bcel.internal.Const.CONSTANT_Class);
if (!name.startsWith("[")) {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ClassGen.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ClassGen.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,6 +1,5 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,6 +21,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import com.sun.org.apache.bcel.internal.Const;
import com.sun.org.apache.bcel.internal.classfile.AccessFlags;
@@ -42,7 +42,8 @@
* existing java class (file).
*
* @see JavaClass
- * @version $Id: ClassGen.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class ClassGen extends AccessFlags implements Cloneable {
@@ -66,21 +67,22 @@
private static BCELComparator _cmp = new BCELComparator() {
@Override
- public boolean equals(final Object o1, final Object o2) {
+ public boolean equals( final Object o1, final Object o2 ) {
final ClassGen THIS = (ClassGen) o1;
final ClassGen THAT = (ClassGen) o2;
- return THIS.getClassName().equals(THAT.getClassName());
+ return Objects.equals(THIS.getClassName(), THAT.getClassName());
}
+
@Override
- public int hashCode(final Object o) {
+ public int hashCode( final Object o ) {
final ClassGen THIS = (ClassGen) o;
return THIS.getClassName().hashCode();
}
};
- /**
- * Convenience constructor to set up some important values initially.
+
+ /** Convenience constructor to set up some important values initially.
*
* @param class_name fully qualified class name
* @param super_class_name fully qualified superclass name
@@ -110,8 +112,8 @@
}
}
- /**
- * Convenience constructor to set up some important values initially.
+
+ /** Convenience constructor to set up some important values initially.
*
* @param class_name fully qualified class name
* @param super_class_name fully qualified superclass name
@@ -125,9 +127,9 @@
new ConstantPoolGen());
}
+
/**
* Initialize with existing class.
- *
* @param clazz JavaClass object (e.g. read from file)
*/
public ClassGen(final JavaClass clazz) {
@@ -168,28 +170,34 @@
/**
* Look for attributes representing annotations and unpack them.
*/
- private AnnotationEntryGen[] unpackAnnotations(final Attribute[] attrs) {
+ private AnnotationEntryGen[] unpackAnnotations(final Attribute[] attrs)
+ {
final List<AnnotationEntryGen> annotationGenObjs = new ArrayList<>();
for (final Attribute attr : attrs) {
- if (attr instanceof RuntimeVisibleAnnotations) {
+ if (attr instanceof RuntimeVisibleAnnotations)
+ {
final RuntimeVisibleAnnotations rva = (RuntimeVisibleAnnotations) attr;
final AnnotationEntry[] annos = rva.getAnnotationEntries();
for (final AnnotationEntry a : annos) {
annotationGenObjs.add(new AnnotationEntryGen(a,
getConstantPool(), false));
}
- } else if (attr instanceof RuntimeInvisibleAnnotations) {
- final RuntimeInvisibleAnnotations ria = (RuntimeInvisibleAnnotations) attr;
- final AnnotationEntry[] annos = ria.getAnnotationEntries();
- for (final AnnotationEntry a : annos) {
- annotationGenObjs.add(new AnnotationEntryGen(a,
- getConstantPool(), false));
+ }
+ else
+ if (attr instanceof RuntimeInvisibleAnnotations)
+ {
+ final RuntimeInvisibleAnnotations ria = (RuntimeInvisibleAnnotations) attr;
+ final AnnotationEntry[] annos = ria.getAnnotationEntries();
+ for (final AnnotationEntry a : annos) {
+ annotationGenObjs.add(new AnnotationEntryGen(a,
+ getConstantPool(), false));
+ }
}
- }
}
return annotationGenObjs.toArray(new AnnotationEntryGen[annotationGenObjs.size()]);
}
+
/**
* @return the (finally) built up Java class object.
*/
@@ -197,15 +205,15 @@
final int[] interfaces = getInterfaces();
final Field[] fields = getFields();
final Method[] methods = getMethods();
- Attribute[] attributes;
+ Attribute[] attributes = null;
if (annotation_vec.isEmpty()) {
attributes = getAttributes();
} else {
// TODO: Sometime later, trash any attributes called 'RuntimeVisibleAnnotations' or 'RuntimeInvisibleAnnotations'
- final Attribute[] annAttributes = AnnotationEntryGen.getAnnotationAttributes(cp, getAnnotationEntries());
- attributes = new Attribute[attribute_vec.size() + annAttributes.length];
+ final Attribute[] annAttributes = AnnotationEntryGen.getAnnotationAttributes(cp, getAnnotationEntries());
+ attributes = new Attribute[attribute_vec.size()+annAttributes.length];
attribute_vec.toArray(attributes);
- System.arraycopy(annAttributes, 0, attributes, attribute_vec.size(), annAttributes.length);
+ System.arraycopy(annAttributes,0,attributes,attribute_vec.size(),annAttributes.length);
}
// Must be last since the above calls may still add something to it
final ConstantPool _cp = this.cp.getFinalConstantPool();
@@ -213,24 +221,25 @@
super.getAccessFlags(), _cp, interfaces, fields, methods, attributes);
}
+
/**
* Add an interface to this class, i.e., this class has to implement it.
- *
* @param name interface to implement (fully qualified class name)
*/
- public final void addInterface(final String name) {
+ public void addInterface( final String name ) {
interface_vec.add(name);
}
+
/**
* Remove an interface from this class.
- *
* @param name interface to remove (fully qualified name)
*/
- public void removeInterface(final String name) {
+ public void removeInterface( final String name ) {
interface_vec.remove(name);
}
+
/**
* @return major version number of class file
*/
@@ -238,21 +247,19 @@
return major;
}
- /**
- * Set major version number of class file, default value is 45 (JDK 1.1)
- *
+
+ /** Set major version number of class file, default value is 45 (JDK 1.1)
* @param major major version number
*/
- public void setMajor(final int major) { // TODO could be package-protected - only called by test code
+ public void setMajor( final int major ) { // TODO could be package-protected - only called by test code
this.major = major;
}
- /**
- * Set minor version number of class file, default value is 3 (JDK 1.1)
- *
+
+ /** Set minor version number of class file, default value is 3 (JDK 1.1)
* @param minor minor version number
*/
- public void setMinor(final int minor) { // TODO could be package-protected - only called by test code
+ public void setMinor( final int minor ) { // TODO could be package-protected - only called by test code
this.minor = minor;
}
@@ -263,37 +270,36 @@
return minor;
}
+
/**
* Add an attribute to this class.
- *
* @param a attribute to add
*/
- public final void addAttribute(final Attribute a) {
+ public void addAttribute( final Attribute a ) {
attribute_vec.add(a);
}
- public final void addAnnotationEntry(final AnnotationEntryGen a) {
+ public void addAnnotationEntry(final AnnotationEntryGen a) {
annotation_vec.add(a);
}
+
/**
* Add a method to this class.
- *
* @param m method to add
*/
- public final void addMethod(final Method m) {
+ public void addMethod( final Method m ) {
method_vec.add(m);
}
+
/**
* Convenience method.
*
- * Add an empty constructor to this class that does nothing but calling
- * super().
- *
+ * Add an empty constructor to this class that does nothing but calling super().
* @param access_flags rights for constructor
*/
- public void addEmptyConstructor(final int access_flags) {
+ public void addEmptyConstructor( final int access_flags ) {
final InstructionList il = new InstructionList();
il.append(InstructionConst.THIS); // Push `this'
il.append(new INVOKESPECIAL(cp.addMethodref(super_class_name, "<init>", "()V")));
@@ -304,23 +310,24 @@
addMethod(mg.getMethod());
}
+
/**
* Add a field to this class.
- *
* @param f field to add
*/
- public final void addField(final Field f) {
+ public void addField( final Field f ) {
field_vec.add(f);
}
- public boolean containsField(final Field f) {
+
+ public boolean containsField( final Field f ) {
return field_vec.contains(f);
}
- /**
- * @return field object with given name, or null
+
+ /** @return field object with given name, or null
*/
- public Field containsField(final String name) {
+ public Field containsField( final String name ) {
for (final Field f : field_vec) {
if (f.getName().equals(name)) {
return f;
@@ -329,10 +336,10 @@
return null;
}
- /**
- * @return method object with given name and signature, or null
+
+ /** @return method object with given name and signature, or null
*/
- public Method containsMethod(final String name, final String signature) {
+ public Method containsMethod( final String name, final String signature ) {
for (final Method m : method_vec) {
if (m.getName().equals(name) && m.getSignature().equals(signature)) {
return m;
@@ -341,29 +348,29 @@
return null;
}
+
/**
* Remove an attribute from this class.
- *
* @param a attribute to remove
*/
- public void removeAttribute(final Attribute a) {
+ public void removeAttribute( final Attribute a ) {
attribute_vec.remove(a);
}
+
/**
* Remove a method from this class.
- *
* @param m method to remove
*/
- public void removeMethod(final Method m) {
+ public void removeMethod( final Method m ) {
method_vec.remove(m);
}
- /**
- * Replace given method with new one. If the old one does not exist add the
- * new_ method to the class anyway.
+
+ /** Replace given method with new one. If the old one does not exist
+ * add the new_ method to the class anyway.
*/
- public void replaceMethod(final Method old, final Method new_) {
+ public void replaceMethod( final Method old, final Method new_ ) {
if (new_ == null) {
throw new ClassGenException("Replacement method must not be null");
}
@@ -375,11 +382,11 @@
}
}
- /**
- * Replace given field with new one. If the old one does not exist add the
- * new_ field to the class anyway.
+
+ /** Replace given field with new one. If the old one does not exist
+ * add the new_ field to the class anyway.
*/
- public void replaceField(final Field old, final Field new_) {
+ public void replaceField( final Field old, final Field new_ ) {
if (new_ == null) {
throw new ClassGenException("Replacement method must not be null");
}
@@ -391,56 +398,66 @@
}
}
+
/**
* Remove a field to this class.
- *
* @param f field to remove
*/
- public void removeField(final Field f) {
+ public void removeField( final Field f ) {
field_vec.remove(f);
}
+
public String getClassName() {
return class_name;
}
+
public String getSuperclassName() {
return super_class_name;
}
+
public String getFileName() {
return file_name;
}
- public void setClassName(final String name) {
+
+ public void setClassName( final String name ) {
class_name = name.replace('/', '.');
class_name_index = cp.addClass(name);
}
- public void setSuperclassName(final String name) {
+
+ public void setSuperclassName( final String name ) {
super_class_name = name.replace('/', '.');
superclass_name_index = cp.addClass(name);
}
+
public Method[] getMethods() {
return method_vec.toArray(new Method[method_vec.size()]);
}
- public void setMethods(final Method[] methods) {
+
+ public void setMethods( final Method[] methods ) {
method_vec.clear();
for (final Method method : methods) {
addMethod(method);
}
}
- public void setMethodAt(final Method method, final int pos) {
+
+ public void setMethodAt( final Method method, final int pos ) {
method_vec.set(pos, method);
}
- public Method getMethodAt(final int pos) {
+
+ public Method getMethodAt( final int pos ) {
return method_vec.get(pos);
}
+
public String[] getInterfaceNames() {
final int size = interface_vec.size();
final String[] interfaces = new String[size];
@@ -448,6 +465,7 @@
return interfaces;
}
+
public int[] getInterfaces() {
final int size = interface_vec.size();
final int[] interfaces = new int[size];
@@ -457,10 +475,12 @@
return interfaces;
}
+
public Field[] getFields() {
return field_vec.toArray(new Field[field_vec.size()]);
}
+
public Attribute[] getAttributes() {
return attribute_vec.toArray(new Attribute[attribute_vec.size()]);
}
@@ -470,59 +490,65 @@
return annotation_vec.toArray(new AnnotationEntryGen[annotation_vec.size()]);
}
+
public ConstantPoolGen getConstantPool() {
return cp;
}
- public void setConstantPool(final ConstantPoolGen constant_pool) {
+
+ public void setConstantPool( final ConstantPoolGen constant_pool ) {
cp = constant_pool;
}
- public void setClassNameIndex(final int class_name_index) {
+
+ public void setClassNameIndex( final int class_name_index ) {
this.class_name_index = class_name_index;
class_name = cp.getConstantPool().getConstantString(class_name_index,
Const.CONSTANT_Class).replace('/', '.');
}
- public void setSuperclassNameIndex(final int superclass_name_index) {
+
+ public void setSuperclassNameIndex( final int superclass_name_index ) {
this.superclass_name_index = superclass_name_index;
super_class_name = cp.getConstantPool().getConstantString(superclass_name_index,
Const.CONSTANT_Class).replace('/', '.');
}
+
public int getSuperclassNameIndex() {
return superclass_name_index;
}
+
public int getClassNameIndex() {
return class_name_index;
}
private List<ClassObserver> observers;
- /**
- * Add observer for this object.
+
+ /** Add observer for this object.
*/
- public void addObserver(final ClassObserver o) {
+ public void addObserver( final ClassObserver o ) {
if (observers == null) {
observers = new ArrayList<>();
}
observers.add(o);
}
- /**
- * Remove observer for this object.
+
+ /** Remove observer for this object.
*/
- public void removeObserver(final ClassObserver o) {
+ public void removeObserver( final ClassObserver o ) {
if (observers != null) {
observers.remove(o);
}
}
- /**
- * Call notify() method on all observers. This method is not called
- * automatically whenever the state has changed, but has to be called by the
- * user after he has finished editing the object.
+
+ /** Call notify() method on all observers. This method is not called
+ * automatically whenever the state has changed, but has to be
+ * called by the user after he has finished editing the object.
*/
public void update() {
if (observers != null) {
@@ -532,6 +558,7 @@
}
}
+
@Override
public Object clone() {
try {
@@ -541,6 +568,7 @@
}
}
+
/**
* @return Comparison strategy object
*/
@@ -548,27 +576,31 @@
return _cmp;
}
+
/**
* @param comparator Comparison strategy object
*/
- public static void setComparator(final BCELComparator comparator) {
+ public static void setComparator( final BCELComparator comparator ) {
_cmp = comparator;
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default two
- * ClassGen objects are said to be equal when their class names are equal.
+ * Return value as defined by given BCELComparator strategy.
+ * By default two ClassGen objects are said to be equal when
+ * their class names are equal.
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(final Object obj) {
+ public boolean equals( final Object obj ) {
return _cmp.equals(this, obj);
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default
- * return the hashcode of the class name.
+ * Return value as defined by given BCELComparator strategy.
+ * By default return the hashcode of the class name.
*
* @see java.lang.Object#hashCode()
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ClassGenException.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ClassGenException.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Thrown on internal errors. Extends RuntimeException so it hasn't to be declared
* in the throws clause every time.
*
- * @version $Id: ClassGenException.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class ClassGenException extends RuntimeException {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ClassObserver.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ClassObserver.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Implement this interface if you're interested in changes to a ClassGen object
* and register yourself with addObserver().
*
- * @version $Id: ClassObserver.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface ClassObserver {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CodeExceptionGen.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CodeExceptionGen.java Wed Jun 26 12:12:25 2019 +0530
@@ -23,7 +23,7 @@
import com.sun.org.apache.bcel.internal.classfile.CodeException;
/**
- * This class represents an exception handler, i.e., specifies the region where
+ * This class represents an exception handler, i.e., specifies the region where
* a handler is active and an instruction where the actual handling is done.
* pool as parameters. Opposed to the JVM specification the end of the handled
* region is set to be inclusive, i.e. all instructions between start and end
@@ -31,10 +31,10 @@
* The end of the region is automatically mapped to be exclusive when calling
* getCodeException(), i.e., there is no difference semantically.
*
- * @version $Id: CodeExceptionGen.java 1749603 2016-06-21 20:50:19Z ggregory $
- * @see MethodGen
- * @see CodeException
- * @see InstructionHandle
+ * @version $Id$
+ * @see MethodGen
+ * @see CodeException
+ * @see InstructionHandle
*/
public final class CodeExceptionGen implements InstructionTargeter, Cloneable {
@@ -43,9 +43,10 @@
private InstructionHandle handler_pc;
private ObjectType catch_type;
+
/**
- * Add an exception handler, i.e., specify region where a handler is active
- * and an instruction where the actual handling is done.
+ * Add an exception handler, i.e., specify region where a handler is active and an
+ * instruction where the actual handling is done.
*
* @param start_pc Start of handled region (inclusive)
* @param end_pc End of handled region (inclusive)
@@ -60,16 +61,17 @@
this.catch_type = catch_type;
}
+
/**
* Get CodeException object.<BR>
*
- * This relies on that the instruction list has already been dumped to byte
- * code or or that the `setPositions' methods has been called for the
- * instruction list.
+ * This relies on that the instruction list has already been dumped
+ * to byte code or or that the `setPositions' methods has been
+ * called for the instruction list.
*
* @param cp constant pool
*/
- public CodeException getCodeException(final ConstantPoolGen cp) {
+ public CodeException getCodeException( final ConstantPoolGen cp ) {
return new CodeException(start_pc.getPosition(), end_pc.getPosition()
+ end_pc.getInstruction().getLength(), handler_pc.getPosition(),
(catch_type == null) ? 0 : cp.addClass(catch_type));
@@ -79,7 +81,7 @@
/* Set start of handler
* @param start_pc Start of handled region (inclusive)
*/
- public void setStartPC(final InstructionHandle start_pc) { // TODO could be package-protected?
+ public void setStartPC( final InstructionHandle start_pc ) { // TODO could be package-protected?
BranchInstruction.notifyTarget(this.start_pc, start_pc, this);
this.start_pc = start_pc;
}
@@ -88,7 +90,7 @@
/* Set end of handler
* @param end_pc End of handled region (inclusive)
*/
- public void setEndPC(final InstructionHandle end_pc) { // TODO could be package-protected?
+ public void setEndPC( final InstructionHandle end_pc ) { // TODO could be package-protected?
BranchInstruction.notifyTarget(this.end_pc, end_pc, this);
this.end_pc = end_pc;
}
@@ -97,17 +99,18 @@
/* Set handler code
* @param handler_pc Start of handler
*/
- public void setHandlerPC(final InstructionHandle handler_pc) { // TODO could be package-protected?
+ public void setHandlerPC( final InstructionHandle handler_pc ) { // TODO could be package-protected?
BranchInstruction.notifyTarget(this.handler_pc, handler_pc, this);
this.handler_pc = handler_pc;
}
+
/**
* @param old_ih old target, either start or end
* @param new_ih new target
*/
@Override
- public void updateTarget(final InstructionHandle old_ih, final InstructionHandle new_ih) {
+ public void updateTarget( final InstructionHandle old_ih, final InstructionHandle new_ih ) {
boolean targeted = false;
if (start_pc == old_ih) {
targeted = true;
@@ -127,54 +130,55 @@
}
}
+
/**
* @return true, if ih is target of this handler
*/
@Override
- public boolean containsTarget(final InstructionHandle ih) {
+ public boolean containsTarget( final InstructionHandle ih ) {
return (start_pc == ih) || (end_pc == ih) || (handler_pc == ih);
}
- /**
- * Sets the type of the Exception to catch. Set 'null' for ANY.
- */
- public void setCatchType(final ObjectType catch_type) {
+
+ /** Sets the type of the Exception to catch. Set 'null' for ANY. */
+ public void setCatchType( final ObjectType catch_type ) {
this.catch_type = catch_type;
}
- /**
- * Gets the type of the Exception to catch, 'null' for ANY.
- */
+
+ /** Gets the type of the Exception to catch, 'null' for ANY. */
public ObjectType getCatchType() {
return catch_type;
}
- /**
- * @return start of handled region (inclusive)
+
+ /** @return start of handled region (inclusive)
*/
public InstructionHandle getStartPC() {
return start_pc;
}
- /**
- * @return end of handled region (inclusive)
+
+ /** @return end of handled region (inclusive)
*/
public InstructionHandle getEndPC() {
return end_pc;
}
- /**
- * @return start of handler
+
+ /** @return start of handler
*/
public InstructionHandle getHandlerPC() {
return handler_pc;
}
+
@Override
public String toString() {
return "CodeExceptionGen(" + start_pc + ", " + end_pc + ", " + handler_pc + ")";
}
+
@Override
public Object clone() {
try {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CompoundInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/CompoundInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -32,7 +32,7 @@
* The interface provides the possibilty for the user to write
* `templates' or `macros' for such reuseable code patterns.
*
- * @version $Id: CompoundInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see PUSH
* @see SWITCH
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ConstantPoolGen.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ConstantPoolGen.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -40,16 +40,18 @@
import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
/**
- * This class is used to build up a constant pool. The user adds constants via
- * `addXXX' methods, `addString', `addClass', etc.. These methods return an
- * index into the constant pool. Finally, `getFinalConstantPool()' returns the
- * constant pool built up. Intermediate versions of the constant pool can be
+ * This class is used to build up a constant pool. The user adds
+ * constants via `addXXX' methods, `addString', `addClass',
+ * etc.. These methods return an index into the constant
+ * pool. Finally, `getFinalConstantPool()' returns the constant pool
+ * built up. Intermediate versions of the constant pool can be
* obtained with `getConstantPool()'. A constant pool has capacity for
- * Constants.MAX_SHORT entries. Note that the first (0) is used by the JVM and
- * that Double and Long constants need two slots.
+ * Constants.MAX_SHORT entries. Note that the first (0) is used by the
+ * JVM and that Double and Long constants need two slots.
*
- * @version $Id: ConstantPoolGen.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Constant
+ * @LastModified: Jun 2019
*/
public class ConstantPoolGen {
@@ -67,11 +69,13 @@
final int index;
+
Index(final int i) {
index = i;
}
}
+
/**
* Initialize with given array of constants.
*
@@ -88,6 +92,7 @@
index = cs.length;
}
+
for (int i = 1; i < index; i++) {
final Constant c = constants[i];
if (c instanceof ConstantString) {
@@ -134,7 +139,7 @@
// since name can't begin with digit, can use
// METHODREF_DELIM with out fear of duplicates.
} else {
- final ConstantClass clazz = (ConstantClass) constants[m.getClassIndex()];
+ final ConstantClass clazz = (ConstantClass) constants[m.getClassIndex()];
u8 = (ConstantUtf8) constants[clazz.getNameIndex()];
class_name = u8.getBytes().replace('/', '.');
}
@@ -183,6 +188,7 @@
}
}
+
/**
* Initialize with given constant pool.
*/
@@ -190,6 +196,7 @@
this(cp.getConstantPool());
}
+
/**
* Create empty constant pool.
*/
@@ -198,8 +205,8 @@
constants = new Constant[size];
}
- /**
- * Resize internal array of constants.
+
+ /** Resize internal array of constants.
*/
protected void adjustSize() {
if (index + 3 >= size) {
@@ -212,25 +219,26 @@
private final Map<String, Index> string_table = new HashMap<>();
+
/**
* Look for ConstantString in ConstantPool containing String `str'.
*
* @param str String to search for
* @return index on success, -1 otherwise
*/
- public int lookupString(final String str) {
+ public int lookupString( final String str ) {
final Index index = string_table.get(str);
return (index != null) ? index.index : -1;
}
+
/**
- * Add a new String constant to the ConstantPool, if it is not already in
- * there.
+ * Add a new String constant to the ConstantPool, if it is not already in there.
*
* @param str String to add
* @return index of entry
*/
- public int addString(final String str) {
+ public int addString( final String str ) {
int ret;
if ((ret = lookupString(str)) != -1) {
return ret; // Already in CP
@@ -248,18 +256,20 @@
private final Map<String, Index> class_table = new HashMap<>();
+
/**
* Look for ConstantClass in ConstantPool named `str'.
*
* @param str String to search for
* @return index on success, -1 otherwise
*/
- public int lookupClass(final String str) {
+ public int lookupClass( final String str ) {
final Index index = class_table.get(str.replace('.', '/'));
return (index != null) ? index.index : -1;
}
- private int addClass_(final String clazz) {
+
+ private int addClass_( final String clazz ) {
int ret;
if ((ret = lookupClass(clazz)) != -1) {
return ret; // Already in CP
@@ -274,45 +284,48 @@
return ret;
}
+
/**
- * Add a new Class reference to the ConstantPool, if it is not already in
- * there.
+ * Add a new Class reference to the ConstantPool, if it is not already in there.
*
* @param str Class to add
* @return index of entry
*/
- public int addClass(final String str) {
+ public int addClass( final String str ) {
return addClass_(str.replace('.', '/'));
}
+
/**
* Add a new Class reference to the ConstantPool for a given type.
*
* @param type Class to add
* @return index of entry
*/
- public int addClass(final ObjectType type) {
+ public int addClass( final ObjectType type ) {
return addClass(type.getClassName());
}
+
/**
- * Add a reference to an array class (e.g. String[][]) as needed by
- * MULTIANEWARRAY instruction, e.g. to the ConstantPool.
+ * Add a reference to an array class (e.g. String[][]) as needed by MULTIANEWARRAY
+ * instruction, e.g. to the ConstantPool.
*
* @param type type of array class
* @return index of entry
*/
- public int addArrayClass(final ArrayType type) {
+ public int addArrayClass( final ArrayType type ) {
return addClass_(type.getSignature());
}
+
/**
* Look for ConstantInteger in ConstantPool.
*
* @param n integer number to look for
* @return index on success, -1 otherwise
*/
- public int lookupInteger(final int n) {
+ public int lookupInteger( final int n ) {
for (int i = 1; i < index; i++) {
if (constants[i] instanceof ConstantInteger) {
final ConstantInteger c = (ConstantInteger) constants[i];
@@ -324,14 +337,14 @@
return -1;
}
+
/**
- * Add a new Integer constant to the ConstantPool, if it is not already in
- * there.
+ * Add a new Integer constant to the ConstantPool, if it is not already in there.
*
* @param n integer number to add
* @return index of entry
*/
- public int addInteger(final int n) {
+ public int addInteger( final int n ) {
int ret;
if ((ret = lookupInteger(n)) != -1) {
return ret; // Already in CP
@@ -342,13 +355,14 @@
return ret;
}
+
/**
* Look for ConstantFloat in ConstantPool.
*
* @param n Float number to look for
* @return index on success, -1 otherwise
*/
- public int lookupFloat(final float n) {
+ public int lookupFloat( final float n ) {
final int bits = Float.floatToIntBits(n);
for (int i = 1; i < index; i++) {
if (constants[i] instanceof ConstantFloat) {
@@ -361,14 +375,14 @@
return -1;
}
+
/**
- * Add a new Float constant to the ConstantPool, if it is not already in
- * there.
+ * Add a new Float constant to the ConstantPool, if it is not already in there.
*
* @param n Float number to add
* @return index of entry
*/
- public int addFloat(final float n) {
+ public int addFloat( final float n ) {
int ret;
if ((ret = lookupFloat(n)) != -1) {
return ret; // Already in CP
@@ -381,25 +395,26 @@
private final Map<String, Index> utf8_table = new HashMap<>();
+
/**
* Look for ConstantUtf8 in ConstantPool.
*
* @param n Utf8 string to look for
* @return index on success, -1 otherwise
*/
- public int lookupUtf8(final String n) {
+ public int lookupUtf8( final String n ) {
final Index index = utf8_table.get(n);
return (index != null) ? index.index : -1;
}
+
/**
- * Add a new Utf8 constant to the ConstantPool, if it is not already in
- * there.
+ * Add a new Utf8 constant to the ConstantPool, if it is not already in there.
*
* @param n Utf8 string to add
* @return index of entry
*/
- public int addUtf8(final String n) {
+ public int addUtf8( final String n ) {
int ret;
if ((ret = lookupUtf8(n)) != -1) {
return ret; // Already in CP
@@ -413,13 +428,14 @@
return ret;
}
+
/**
* Look for ConstantLong in ConstantPool.
*
* @param n Long number to look for
* @return index on success, -1 otherwise
*/
- public int lookupLong(final long n) {
+ public int lookupLong( final long n ) {
for (int i = 1; i < index; i++) {
if (constants[i] instanceof ConstantLong) {
final ConstantLong c = (ConstantLong) constants[i];
@@ -431,14 +447,14 @@
return -1;
}
+
/**
- * Add a new long constant to the ConstantPool, if it is not already in
- * there.
+ * Add a new long constant to the ConstantPool, if it is not already in there.
*
* @param n Long number to add
* @return index of entry
*/
- public int addLong(final long n) {
+ public int addLong( final long n ) {
int ret;
if ((ret = lookupLong(n)) != -1) {
return ret; // Already in CP
@@ -450,13 +466,14 @@
return ret;
}
+
/**
* Look for ConstantDouble in ConstantPool.
*
* @param n Double number to look for
* @return index on success, -1 otherwise
*/
- public int lookupDouble(final double n) {
+ public int lookupDouble( final double n ) {
final long bits = Double.doubleToLongBits(n);
for (int i = 1; i < index; i++) {
if (constants[i] instanceof ConstantDouble) {
@@ -469,14 +486,14 @@
return -1;
}
+
/**
- * Add a new double constant to the ConstantPool, if it is not already in
- * there.
+ * Add a new double constant to the ConstantPool, if it is not already in there.
*
* @param n Double number to add
* @return index of entry
*/
- public int addDouble(final double n) {
+ public int addDouble( final double n ) {
int ret;
if ((ret = lookupDouble(n)) != -1) {
return ret; // Already in CP
@@ -490,6 +507,7 @@
private final Map<String, Index> n_a_t_table = new HashMap<>();
+
/**
* Look for ConstantNameAndType in ConstantPool.
*
@@ -497,11 +515,12 @@
* @param signature of variable/method
* @return index on success, -1 otherwise
*/
- public int lookupNameAndType(final String name, final String signature) {
+ public int lookupNameAndType( final String name, final String signature ) {
final Index _index = n_a_t_table.get(name + NAT_DELIM + signature);
return (_index != null) ? _index.index : -1;
}
+
/**
* Add a new NameAndType constant to the ConstantPool if it is not already
* in there.
@@ -510,7 +529,7 @@
* @param signature signature string to add
* @return index of entry
*/
- public int addNameAndType(final String name, final String signature) {
+ public int addNameAndType( final String name, final String signature ) {
int ret;
int name_index;
int signature_index;
@@ -531,6 +550,7 @@
private final Map<String, Index> cp_table = new HashMap<>();
+
/**
* Look for ConstantMethodref in ConstantPool.
*
@@ -539,26 +559,28 @@
* @param signature return and argument types
* @return index on success, -1 otherwise
*/
- public int lookupMethodref(final String class_name, final String method_name, final String signature) {
+ public int lookupMethodref( final String class_name, final String method_name, final String signature ) {
final Index index = cp_table.get(class_name + METHODREF_DELIM + method_name
+ METHODREF_DELIM + signature);
return (index != null) ? index.index : -1;
}
- public int lookupMethodref(final MethodGen method) {
+
+ public int lookupMethodref( final MethodGen method ) {
return lookupMethodref(method.getClassName(), method.getName(), method.getSignature());
}
+
/**
- * Add a new Methodref constant to the ConstantPool, if it is not already in
- * there.
+ * Add a new Methodref constant to the ConstantPool, if it is not already
+ * in there.
*
* @param class_name class name string to add
* @param method_name method name string to add
* @param signature method signature string to add
* @return index of entry
*/
- public int addMethodref(final String class_name, final String method_name, final String signature) {
+ public int addMethodref( final String class_name, final String method_name, final String signature ) {
int ret;
int class_index;
int name_and_type_index;
@@ -577,10 +599,12 @@
return ret;
}
- public int addMethodref(final MethodGen method) {
+
+ public int addMethodref( final MethodGen method ) {
return addMethodref(method.getClassName(), method.getName(), method.getSignature());
}
+
/**
* Look for ConstantInterfaceMethodref in ConstantPool.
*
@@ -589,27 +613,29 @@
* @param signature return and argument types
* @return index on success, -1 otherwise
*/
- public int lookupInterfaceMethodref(final String class_name, final String method_name, final String signature) {
+ public int lookupInterfaceMethodref( final String class_name, final String method_name, final String signature ) {
final Index index = cp_table.get(class_name + IMETHODREF_DELIM + method_name
+ IMETHODREF_DELIM + signature);
return (index != null) ? index.index : -1;
}
- public int lookupInterfaceMethodref(final MethodGen method) {
+
+ public int lookupInterfaceMethodref( final MethodGen method ) {
return lookupInterfaceMethodref(method.getClassName(), method.getName(), method
.getSignature());
}
+
/**
- * Add a new InterfaceMethodref constant to the ConstantPool, if it is not
- * already in there.
+ * Add a new InterfaceMethodref constant to the ConstantPool, if it is not already
+ * in there.
*
* @param class_name class name string to add
* @param method_name method name string to add
* @param signature signature string to add
* @return index of entry
*/
- public int addInterfaceMethodref(final String class_name, final String method_name, final String signature) {
+ public int addInterfaceMethodref( final String class_name, final String method_name, final String signature ) {
int ret;
int class_index;
int name_and_type_index;
@@ -628,10 +654,12 @@
return ret;
}
- public int addInterfaceMethodref(final MethodGen method) {
+
+ public int addInterfaceMethodref( final MethodGen method ) {
return addInterfaceMethodref(method.getClassName(), method.getName(), method.getSignature());
}
+
/**
* Look for ConstantFieldref in ConstantPool.
*
@@ -640,22 +668,23 @@
* @param signature return and argument types
* @return index on success, -1 otherwise
*/
- public int lookupFieldref(final String class_name, final String field_name, final String signature) {
+ public int lookupFieldref( final String class_name, final String field_name, final String signature ) {
final Index index = cp_table.get(class_name + FIELDREF_DELIM + field_name
+ FIELDREF_DELIM + signature);
return (index != null) ? index.index : -1;
}
+
/**
- * Add a new Fieldref constant to the ConstantPool, if it is not already in
- * there.
+ * Add a new Fieldref constant to the ConstantPool, if it is not already
+ * in there.
*
* @param class_name class name string to add
* @param field_name field name string to add
* @param signature signature string to add
* @return index of entry
*/
- public int addFieldref(final String class_name, final String field_name, final String signature) {
+ public int addFieldref( final String class_name, final String field_name, final String signature ) {
int ret;
int class_index;
int name_and_type_index;
@@ -674,24 +703,27 @@
return ret;
}
+
/**
* @param i index in constant pool
* @return constant pool entry at index i
*/
- public Constant getConstant(final int i) {
+ public Constant getConstant( final int i ) {
return constants[i];
}
+
/**
* Use with care!
*
* @param i index in constant pool
* @param c new constant pool entry at index i
*/
- public void setConstant(final int i, final Constant c) {
+ public void setConstant( final int i, final Constant c ) {
constants[i] = c;
}
+
/**
* @return intermediate constant pool
*/
@@ -699,6 +731,7 @@
return new ConstantPool(constants);
}
+
/**
* @return current size of constant pool
*/
@@ -706,6 +739,7 @@
return index;
}
+
/**
* @return constant pool with proper length
*/
@@ -715,6 +749,7 @@
return new ConstantPool(cs);
}
+
/**
* @return String representation.
*/
@@ -727,10 +762,10 @@
return buf.toString();
}
- /**
- * Import constant from another ConstantPool and return new index.
+
+ /** Import constant from another ConstantPool and return new index.
*/
- public int addConstant(final Constant c, final ConstantPoolGen cp) {
+ public int addConstant( final Constant c, final ConstantPoolGen cp ) {
final Constant[] constants = cp.getConstantPool().getConstantPool();
switch (c.getTag()) {
case Const.CONSTANT_String: {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ConstantPushInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ConstantPushInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Denotes a push instruction that produces a literal on the stack
* such as SIPUSH, BIPUSH, ICONST, etc.
*
- * @version $Id: ConstantPushInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see ICONST
* @see SIPUSH
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ConversionInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ConversionInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,14 +26,14 @@
/**
* Super class for the x2y family of instructions.
*
- * @version $Id: ConversionInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public abstract class ConversionInstruction extends Instruction implements TypedInstruction,
StackProducer, StackConsumer {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
ConversionInstruction() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/D2F.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/D2F.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* D2F - Convert double to float
* <PRE>Stack: ..., value.word1, value.word2 -> ..., result</PRE>
*
- * @version $Id: D2F.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class D2F extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/D2I.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/D2I.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* D2I - Convert double to int
* <PRE>Stack: ..., value.word1, value.word2 -> ..., result</PRE>
*
- * @version $Id: D2I.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class D2I extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/D2L.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/D2L.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* D2L - Convert double to long
* <PRE>Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: D2L.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class D2L extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DADD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DADD.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -></PRE>
* ..., result.word1, result1.word2
*
- * @version $Id: DADD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DADD extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DALOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DALOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DALOAD - Load double from array
* <PRE>Stack: ..., arrayref, index -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: DALOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DALOAD extends ArrayInstruction implements StackProducer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DASTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DASTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DASTORE - Store into double array
* <PRE>Stack: ..., arrayref, index, value.word1, value.word2 -> ...</PRE>
*
- * @version $Id: DASTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DASTORE extends ArrayInstruction implements StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DCMPG.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DCMPG.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DCMPG - Compare doubles: value1 > value2
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -> ..., result</PRE>
*
- * @version $Id: DCMPG.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DCMPG extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DCMPL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DCMPL.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DCMPL - Compare doubles: value1 < value2
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -> ..., result</PRE>
*
- * @version $Id: DCMPL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DCMPL extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DCONST.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DCONST.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,8 +25,8 @@
*
* <PRE>Stack: ... -> ..., </PRE>
*
- * @version $Id: DCONST.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Nov 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class DCONST extends Instruction implements ConstantPushInstruction {
@@ -34,8 +34,8 @@
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
DCONST() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DDIV.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DDIV.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -></PRE>
* ..., result.word1, result.word2
*
- * @version $Id: DDIV.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DDIV extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DLOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DLOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,13 @@
* DLOAD - Load double from local variable
* <PRE>Stack ... -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: DLOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DLOAD extends LoadInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
DLOAD() {
super(com.sun.org.apache.bcel.internal.Const.DLOAD, com.sun.org.apache.bcel.internal.Const.DLOAD_0);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DMUL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DMUL.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -></PRE>
* ..., result.word1, result.word2
*
- * @version $Id: DMUL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DMUL extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DNEG.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DNEG.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DNEG - Negate double
* <PRE>Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: DNEG.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DNEG extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DREM.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DREM.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -></PRE>
* ..., result.word1, result.word2
*
- * @version $Id: DREM.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DREM extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DRETURN.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DRETURN.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DRETURN - Return double from method
* <PRE>Stack: ..., value.word1, value.word2 -> <empty></PRE>
*
- * @version $Id: DRETURN.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DRETURN extends ReturnInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DSTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DSTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,13 @@
* DSTORE - Store double into local variable
* <pre>Stack: ..., value.word1, value.word2 -> ... </PRE>
*
- * @version $Id: DSTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DSTORE extends StoreInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
DSTORE() {
super(com.sun.org.apache.bcel.internal.Const.DSTORE, com.sun.org.apache.bcel.internal.Const.DSTORE_0);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DSUB.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DSUB.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -></PRE>
* ..., result.word1, result.word2
*
- * @version $Id: DSUB.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DSUB extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DUP - Duplicate top operand stack word
* <PRE>Stack: ..., word -> ..., word, word</PRE>
*
- * @version $Id: DUP.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DUP extends StackInstruction implements PushInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP2.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP2.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DUP2 - Duplicate two top operand stack words
* <PRE>Stack: ..., word2, word1 -> ..., word2, word1, word2, word1</PRE>
*
- * @version $Id: DUP2.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DUP2 extends StackInstruction implements PushInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP2_X1.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP2_X1.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DUP2_X1 - Duplicate two top operand stack words and put three down
* <PRE>Stack: ..., word3, word2, word1 -> ..., word2, word1, word3, word2, word1</PRE>
*
- * @version $Id: DUP2_X1.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DUP2_X1 extends StackInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP2_X2.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP2_X2.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DUP2_X2 - Duplicate two top operand stack words and put four down
* <PRE>Stack: ..., word4, word3, word2, word1 -> ..., word2, word1, word4, word3, word2, word1</PRE>
*
- * @version $Id: DUP2_X2.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DUP2_X2 extends StackInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP_X1.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP_X1.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DUP_X1 - Duplicate top operand stack word and put two down
* <PRE>Stack: ..., word2, word1 -> ..., word1, word2, word1</PRE>
*
- * @version $Id: DUP_X1.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DUP_X1 extends StackInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP_X2.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DUP_X2.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* DUP_X2 - Duplicate top operand stack word and put three down
* <PRE>Stack: ..., word3, word2, word1 -> ..., word1, word3, word2, word1</PRE>
*
- * @version $Id: DUP_X2.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class DUP_X2 extends StackInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ElementValueGen.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ElementValueGen.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -34,6 +34,7 @@
/**
* @since 6.0
+ * @LastModified: Jun 2019
*/
public abstract class ElementValueGen
{
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/EmptyVisitor.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/EmptyVisitor.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,7 +24,7 @@
/**
* Supplies empty method bodies to be overridden by subclasses.
*
- * @version $Id: EmptyVisitor.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public abstract class EmptyVisitor implements Visitor {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ExceptionThrower.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ExceptionThrower.java Wed Jun 26 12:12:25 2019 +0530
@@ -38,7 +38,7 @@
* "Throwable" object; so this term is equally used for "Exception"
* and "Error" objects.
*
- * @version $Id: ExceptionThrower.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface ExceptionThrower {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/F2D.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/F2D.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* F2D - Convert float to double
* <PRE>Stack: ..., value -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: F2D.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class F2D extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/F2I.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/F2I.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* F2I - Convert float to int
* <PRE>Stack: ..., value -> ..., result</PRE>
*
- * @version $Id: F2I.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class F2I extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/F2L.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/F2L.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* F2L - Convert float to long
* <PRE>Stack: ..., value -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: F2L.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class F2L extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FADD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FADD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* FADD - Add floats
* <PRE>Stack: ..., value1, value2 -> result</PRE>
*
- * @version $Id: FADD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FADD extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FALOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FALOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* FALOAD - Load float from array
* <PRE>Stack: ..., arrayref, index -> ..., value</PRE>
*
- * @version $Id: FALOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FALOAD extends ArrayInstruction implements StackProducer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FASTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FASTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* FASTORE - Store into float array
* <PRE>Stack: ..., arrayref, index, value -> ...</PRE>
*
- * @version $Id: FASTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FASTORE extends ArrayInstruction implements StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FCMPG.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FCMPG.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* FCMPG - Compare floats: value1 > value2
* <PRE>Stack: ..., value1, value2 -> ..., result</PRE>
*
- * @version $Id: FCMPG.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FCMPG extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FCMPL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FCMPL.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* FCMPL - Compare floats: value1 < value2
* <PRE>Stack: ..., value1, value2 -> ..., result</PRE>
*
- * @version $Id: FCMPL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FCMPL extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FCONST.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FCONST.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,8 +25,8 @@
*
* <PRE>Stack: ... -> ..., </PRE>
*
- * @version $Id: FCONST.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Nov 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class FCONST extends Instruction implements ConstantPushInstruction {
@@ -34,8 +34,8 @@
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
FCONST() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FDIV.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FDIV.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* FDIV - Divide floats
* <PRE>Stack: ..., value1, value2 -> result</PRE>
*
- * @version $Id: FDIV.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FDIV extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FLOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FLOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,13 @@
* FLOAD - Load float from local variable
* <PRE>Stack ... -> ..., result</PRE>
*
- * @version $Id: FLOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FLOAD extends LoadInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
FLOAD() {
super(com.sun.org.apache.bcel.internal.Const.FLOAD, com.sun.org.apache.bcel.internal.Const.FLOAD_0);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FMUL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FMUL.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* FMUL - Multiply floats
* <PRE>Stack: ..., value1, value2 -> result</PRE>
*
- * @version $Id: FMUL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FMUL extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FNEG.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FNEG.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* FNEG - Negate float
* <PRE>Stack: ..., value -> ..., result</PRE>
*
- * @version $Id: FNEG.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FNEG extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FREM.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FREM.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* FREM - Remainder of floats
* <PRE>Stack: ..., value1, value2 -> result</PRE>
*
- * @version $Id: FREM.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FREM extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FRETURN.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FRETURN.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* FRETURN - Return float from method
* <PRE>Stack: ..., value -> <empty></PRE>
*
- * @version $Id: FRETURN.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FRETURN extends ReturnInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FSTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FSTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,13 @@
* FSTORE - Store float into local variable
* <PRE>Stack: ..., value -> ... </PRE>
*
- * @version $Id: FSTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FSTORE extends StoreInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
FSTORE() {
super(com.sun.org.apache.bcel.internal.Const.FSTORE, com.sun.org.apache.bcel.internal.Const.FSTORE_0);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FSUB.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FSUB.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* FSUB - Substract floats
* <PRE>Stack: ..., value1, value2 -> result</PRE>
*
- * @version $Id: FSUB.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class FSUB extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FieldGen.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FieldGen.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import com.sun.org.apache.bcel.internal.Const;
import com.sun.org.apache.bcel.internal.classfile.AnnotationEntry;
@@ -35,12 +36,13 @@
import com.sun.org.apache.bcel.internal.util.BCELComparator;
/**
- * Template class for building up a field. The only extraordinary thing one can
- * do is to add a constant value attribute to a field (which must of course be
- * compatible with to the declared type).
+ * Template class for building up a field. The only extraordinary thing
+ * one can do is to add a constant value attribute to a field (which must of
+ * course be compatible with to the declared type).
*
- * @version $Id: FieldGen.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Field
+ * @LastModified: Jun 2019
*/
public class FieldGen extends FieldGenOrMethodGen {
@@ -48,27 +50,29 @@
private static BCELComparator bcelComparator = new BCELComparator() {
@Override
- public boolean equals(final Object o1, final Object o2) {
+ public boolean equals( final Object o1, final Object o2 ) {
final FieldGen THIS = (FieldGen) o1;
final FieldGen THAT = (FieldGen) o2;
- return THIS.getName().equals(THAT.getName())
- && THIS.getSignature().equals(THAT.getSignature());
+ return Objects.equals(THIS.getName(), THAT.getName())
+ && Objects.equals(THIS.getSignature(), THAT.getSignature());
}
+
@Override
- public int hashCode(final Object o) {
+ public int hashCode( final Object o ) {
final FieldGen THIS = (FieldGen) o;
return THIS.getSignature().hashCode() ^ THIS.getName().hashCode();
}
};
+
/**
- * Declare a field. If it is static (isStatic() == true) and has a basic
- * type like int or String it may have an initial value associated with it
- * as defined by setInitValue().
+ * Declare a field. If it is static (isStatic() == true) and has a
+ * basic type like int or String it may have an initial value
+ * associated with it as defined by setInitValue().
*
* @param access_flags access qualifiers
- * @param type field type
+ * @param type field type
* @param name field name
* @param cp constant pool
*/
@@ -79,12 +83,12 @@
setConstantPool(cp);
}
+
/**
* Instantiate from existing field.
*
* @param field Field object
- * @param cp constant pool (must contain the same entries as the field's
- * constant pool)
+ * @param cp constant pool (must contain the same entries as the field's constant pool)
*/
public FieldGen(final Field field, final ConstantPoolGen cp) {
this(field.getAccessFlags(), Type.getType(field.getSignature()), field.getName(), cp);
@@ -93,10 +97,10 @@
if (attr instanceof ConstantValue) {
setValue(((ConstantValue) attr).getConstantValueIndex());
} else if (attr instanceof Annotations) {
- final Annotations runtimeAnnotations = (Annotations) attr;
+ final Annotations runtimeAnnotations = (Annotations)attr;
final AnnotationEntry[] annotationEntries = runtimeAnnotations.getAnnotationEntries();
for (final AnnotationEntry element : annotationEntries) {
- addAnnotationEntry(new AnnotationEntryGen(element, cp, false));
+ addAnnotationEntry(new AnnotationEntryGen(element,cp,false));
}
} else {
addAttribute(attr);
@@ -104,87 +108,98 @@
}
}
- private void setValue(final int index) {
+
+ private void setValue( final int index ) {
final ConstantPool cp = super.getConstantPool().getConstantPool();
final Constant c = cp.getConstant(index);
value = ((ConstantObject) c).getConstantValue(cp);
}
+
/**
- * Set (optional) initial value of field, otherwise it will be set to
- * null/0/false by the JVM automatically.
+ * Set (optional) initial value of field, otherwise it will be set to null/0/false
+ * by the JVM automatically.
*/
- public void setInitValue(final String str) {
- checkType(ObjectType.getInstance("java.lang.String"));
+ public void setInitValue( final String str ) {
+ checkType( ObjectType.getInstance("java.lang.String"));
if (str != null) {
value = str;
}
}
- public void setInitValue(final long l) {
+
+ public void setInitValue( final long l ) {
checkType(Type.LONG);
if (l != 0L) {
- value = l;
+ value = Long.valueOf(l);
}
}
- public void setInitValue(final int i) {
+
+ public void setInitValue( final int i ) {
checkType(Type.INT);
if (i != 0) {
- value = i;
+ value = Integer.valueOf(i);
}
}
- public void setInitValue(final short s) {
+
+ public void setInitValue( final short s ) {
checkType(Type.SHORT);
if (s != 0) {
- value = (int) s;
+ value = Integer.valueOf(s);
}
}
- public void setInitValue(final char c) {
+
+ public void setInitValue( final char c ) {
checkType(Type.CHAR);
if (c != 0) {
- value = (int) c;
+ value = Integer.valueOf(c);
}
}
- public void setInitValue(final byte b) {
+
+ public void setInitValue( final byte b ) {
checkType(Type.BYTE);
if (b != 0) {
- value = (int) b;
+ value = Integer.valueOf(b);
}
}
- public void setInitValue(final boolean b) {
+
+ public void setInitValue( final boolean b ) {
checkType(Type.BOOLEAN);
if (b) {
- value = 1;
+ value = Integer.valueOf(1);
}
}
- public void setInitValue(final float f) {
+
+ public void setInitValue( final float f ) {
checkType(Type.FLOAT);
if (f != 0.0) {
value = f;
}
}
- public void setInitValue(final double d) {
+
+ public void setInitValue( final double d ) {
checkType(Type.DOUBLE);
if (d != 0.0) {
value = d;
}
}
- /**
- * Remove any initial value.
+
+ /** Remove any initial value.
*/
public void cancelInitValue() {
value = null;
}
- private void checkType(final Type atype) {
+
+ private void checkType( final Type atype ) {
final Type superType = super.getType();
if (superType == null) {
throw new ClassGenException("You haven't defined the type of the field yet");
@@ -197,6 +212,7 @@
}
}
+
/**
* Get field object after having set up all necessary values.
*/
@@ -216,11 +232,12 @@
}
private void addAnnotationsAsAttribute(final ConstantPoolGen cp) {
- final Attribute[] attrs = AnnotationEntryGen.getAnnotationAttributes(cp, super.getAnnotationEntries());
+ final Attribute[] attrs = AnnotationEntryGen.getAnnotationAttributes(cp, super.getAnnotationEntries());
for (final Attribute attr : attrs) {
addAttribute(attr);
}
- }
+ }
+
private int addConstant() {
switch (super.getType().getType()) { // sic
@@ -243,6 +260,7 @@
}
}
+
@Override
public String getSignature() {
return super.getType().getSignature();
@@ -250,38 +268,39 @@
private List<FieldObserver> observers;
- /**
- * Add observer for this object.
+
+ /** Add observer for this object.
*/
- public void addObserver(final FieldObserver o) {
+ public void addObserver( final FieldObserver o ) {
if (observers == null) {
observers = new ArrayList<>();
}
observers.add(o);
}
- /**
- * Remove observer for this object.
+
+ /** Remove observer for this object.
*/
- public void removeObserver(final FieldObserver o) {
+ public void removeObserver( final FieldObserver o ) {
if (observers != null) {
observers.remove(o);
}
}
- /**
- * Call notify() method on all observers. This method is not called
- * automatically whenever the state has changed, but has to be called by the
- * user after he has finished editing the object.
+
+ /** Call notify() method on all observers. This method is not called
+ * automatically whenever the state has changed, but has to be
+ * called by the user after he has finished editing the object.
*/
public void update() {
if (observers != null) {
- for (final FieldObserver observer : observers) {
+ for (final FieldObserver observer : observers ) {
observer.notify(this);
}
}
}
+
public String getInitValue() {
if (value != null) {
return value.toString();
@@ -289,9 +308,10 @@
return null;
}
+
/**
- * Return string representation close to declaration format, `public static
- * final short MAX = 100', e.g..
+ * Return string representation close to declaration format,
+ * `public static final short MAX = 100', e.g..
*
* @return String representation of field
*/
@@ -313,15 +333,16 @@
return buf.toString();
}
- /**
- * @return deep copy of this field
+
+ /** @return deep copy of this field
*/
- public FieldGen copy(final ConstantPoolGen cp) {
+ public FieldGen copy( final ConstantPoolGen cp ) {
final FieldGen fg = (FieldGen) clone();
fg.setConstantPool(cp);
return fg;
}
+
/**
* @return Comparison strategy object
*/
@@ -329,28 +350,31 @@
return bcelComparator;
}
+
/**
* @param comparator Comparison strategy object
*/
- public static void setComparator(final BCELComparator comparator) {
+ public static void setComparator( final BCELComparator comparator ) {
bcelComparator = comparator;
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default two
- * FieldGen objects are said to be equal when their names and signatures are
- * equal.
+ * Return value as defined by given BCELComparator strategy.
+ * By default two FieldGen objects are said to be equal when
+ * their names and signatures are equal.
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(final Object obj) {
+ public boolean equals( final Object obj ) {
return bcelComparator.equals(this, obj);
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default
- * return the hashcode of the field's name XOR signature.
+ * Return value as defined by given BCELComparator strategy.
+ * By default return the hashcode of the field's name XOR signature.
*
* @see java.lang.Object#hashCode()
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FieldGenOrMethodGen.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FieldGenOrMethodGen.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -27,11 +27,11 @@
import com.sun.org.apache.bcel.internal.classfile.Attribute;
/**
- * Super class for FieldGen and MethodGen objects, since they have some methods
- * in common!
+ * Super class for FieldGen and MethodGen objects, since they have
+ * some methods in common!
*
- * @version $Id: FieldGenOrMethodGen.java 1749603 2016-06-21 20:50:19Z ggregory
- * $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class FieldGenOrMethodGen extends AccessFlags implements NamedAndTyped, Cloneable {
@@ -42,11 +42,13 @@
private final List<Attribute> attribute_vec = new ArrayList<>();
// @since 6.0
- private final List<AnnotationEntryGen> annotation_vec = new ArrayList<>();
+ private final List<AnnotationEntryGen> annotation_vec= new ArrayList<>();
+
protected FieldGenOrMethodGen() {
}
+
/**
* @since 6.0
*/
@@ -55,47 +57,53 @@
}
@Override
- public void setType(final Type type) { // TODO could be package-protected?
+ public void setType( final Type type ) { // TODO could be package-protected?
if (type.getType() == Const.T_ADDRESS) {
throw new IllegalArgumentException("Type can not be " + type);
}
this.type = type;
}
+
@Override
public Type getType() {
return type;
}
- /**
- * @return name of method/field.
+
+ /** @return name of method/field.
*/
@Override
public String getName() {
return name;
}
+
@Override
- public void setName(final String name) { // TODO could be package-protected?
+ public void setName( final String name ) { // TODO could be package-protected?
this.name = name;
}
+
public ConstantPoolGen getConstantPool() {
return cp;
}
- public void setConstantPool(final ConstantPoolGen cp) { // TODO could be package-protected?
+
+ public void setConstantPool( final ConstantPoolGen cp ) { // TODO could be package-protected?
this.cp = cp;
}
+
/**
- * Add an attribute to this method. Currently, the JVM knows about the
- * `Code', `ConstantValue', `Synthetic' and `Exceptions' attributes. Other
- * attributes will be ignored by the JVM but do no harm.
+ * Add an attribute to this method. Currently, the JVM knows about
+ * the `Code', `ConstantValue', `Synthetic' and `Exceptions'
+ * attributes. Other attributes will be ignored by the JVM but do no
+ * harm.
*
* @param a attribute to be added
*/
- public void addAttribute(final Attribute a) {
+ public void addAttribute( final Attribute a ) {
attribute_vec.add(a);
}
@@ -107,10 +115,11 @@
annotation_vec.add(ag);
}
+
/**
* Remove an attribute.
*/
- public void removeAttribute(final Attribute a) {
+ public void removeAttribute( final Attribute a ) {
attribute_vec.remove(a);
}
@@ -122,6 +131,7 @@
annotation_vec.remove(ag);
}
+
/**
* Remove all attributes.
*/
@@ -137,6 +147,7 @@
annotation_vec.clear();
}
+
/**
* @return all attributes of this method.
*/
@@ -148,15 +159,16 @@
public AnnotationEntryGen[] getAnnotationEntries() {
final AnnotationEntryGen[] annotations = new AnnotationEntryGen[annotation_vec.size()];
- annotation_vec.toArray(annotations);
- return annotations;
- }
+ annotation_vec.toArray(annotations);
+ return annotations;
+ }
- /**
- * @return signature of method/field.
+
+ /** @return signature of method/field.
*/
public abstract String getSignature();
+
@Override
public Object clone() {
try {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FieldInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FieldInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
/**
* Super class for the GET/PUTxxx family of instructions.
*
- * @version $Id: FieldInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public abstract class FieldInstruction extends FieldOrMethod {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
FieldInstruction() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FieldObserver.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FieldObserver.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Imnplement this interface if you're interested in changes to a FieldGen object
* and register yourself with addObserver().
*
- * @version $Id: FieldObserver.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface FieldObserver {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FieldOrMethod.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FieldOrMethod.java Wed Jun 26 12:12:25 2019 +0530
@@ -31,13 +31,13 @@
* Super class for InvokeInstruction and FieldInstruction, since they have
* some methods in common!
*
- * @version $Id: FieldOrMethod.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public abstract class FieldOrMethod extends CPInstruction implements LoadClass {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
FieldOrMethod() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/GETFIELD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/GETFIELD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,47 +25,52 @@
/**
* GETFIELD - Fetch field from object
- * <PRE>Stack: ..., objectref -> ..., value</PRE> OR
+ * <PRE>Stack: ..., objectref -> ..., value</PRE>
+ * OR
* <PRE>Stack: ..., objectref -> ..., value.word1, value.word2</PRE>
*
- * @version $Id: GETFIELD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class GETFIELD extends FieldInstruction implements ExceptionThrower, StackConsumer,
StackProducer {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
GETFIELD() {
}
+
public GETFIELD(final int index) {
super(Const.GETFIELD, index);
}
+
@Override
- public int produceStack(final ConstantPoolGen cpg) {
+ public int produceStack( final ConstantPoolGen cpg ) {
return getFieldSize(cpg);
}
+
@Override
public Class<?>[] getExceptions() {
return ExceptionConst.createExceptions(ExceptionConst.EXCS.EXCS_FIELD_AND_METHOD_RESOLUTION,
- ExceptionConst.NULL_POINTER_EXCEPTION,
- ExceptionConst.INCOMPATIBLE_CLASS_CHANGE_ERROR);
+ ExceptionConst.NULL_POINTER_EXCEPTION,
+ ExceptionConst.INCOMPATIBLE_CLASS_CHANGE_ERROR);
}
+
/**
- * Call corresponding visitor method(s). The order is: Call visitor methods
- * of implemented interfaces first, then call methods according to the class
- * hierarchy in descending order, i.e., the most specific visitXXX() call
- * comes last.
+ * Call corresponding visitor method(s). The order is:
+ * Call visitor methods of implemented interfaces first, then
+ * call methods according to the class hierarchy in descending order,
+ * i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
@Override
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
v.visitExceptionThrower(this);
v.visitStackConsumer(this);
v.visitStackProducer(this);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/GETSTATIC.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/GETSTATIC.java Wed Jun 26 12:12:25 2019 +0530
@@ -30,13 +30,13 @@
* OR
* <PRE>Stack: ..., -> ..., value.word1, value.word2</PRE>
*
- * @version $Id: GETSTATIC.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class GETSTATIC extends FieldInstruction implements PushInstruction, ExceptionThrower {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
GETSTATIC() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/GOTO.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/GOTO.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,13 +27,13 @@
/**
* GOTO - Branch always (to relative offset, not absolute address)
*
- * @version $Id: GOTO.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public class GOTO extends GotoInstruction implements VariableLengthInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
GOTO() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/GOTO_W.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/GOTO_W.java Wed Jun 26 12:12:25 2019 +0530
@@ -29,13 +29,13 @@
/**
* GOTO_W - Branch always (to relative offset, not absolute address)
*
- * @version $Id: GOTO_W.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class GOTO_W extends GotoInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
GOTO_W() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/GotoInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/GotoInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,7 +24,7 @@
/**
* Super class for GOTO
*
- * @version $Id: GotoInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public abstract class GotoInstruction extends BranchInstruction implements UnconditionalBranch {
@@ -34,8 +34,8 @@
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
GotoInstruction() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2B.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2B.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* I2B - Convert int to byte
* <PRE>Stack: ..., value -> ..., result</PRE>
*
- * @version $Id: I2B.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class I2B extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2C.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2C.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* I2C - Convert int to char
* <PRE>Stack: ..., value -> ..., result</PRE>
*
- * @version $Id: I2C.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class I2C extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2D.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2D.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* I2D - Convert int to double
* <PRE>Stack: ..., value -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: I2D.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class I2D extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2F.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2F.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* I2F - Convert int to float
* <PRE>Stack: ..., value -> ..., result</PRE>
*
- * @version $Id: I2F.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class I2F extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2L.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2L.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* I2L - Convert int to long
* <PRE>Stack: ..., value -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: I2L.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class I2L extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2S.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/I2S.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* I2S - Convert int to short
* <PRE>Stack: ..., value -> ..., result</PRE>
*
- * @version $Id: I2S.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class I2S extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IADD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IADD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* IADD - Add ints
* <PRE>Stack: ..., value1, value2 -> result</PRE>
*
- * @version $Id: IADD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IADD extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IALOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IALOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* IALOAD - Load int from array
* <PRE>Stack: ..., arrayref, index -> ..., value</PRE>
*
- * @version $Id: IALOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IALOAD extends ArrayInstruction implements StackProducer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IAND.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IAND.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* IAND - Bitwise AND int
* <PRE>Stack: ..., value1, value2 -> ..., result</PRE>
*
- * @version $Id: IAND.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IAND extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IASTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IASTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* IASTORE - Store into int array
* <PRE>Stack: ..., arrayref, index, value -> ...</PRE>
*
- * @version $Id: IASTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IASTORE extends ArrayInstruction implements StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ICONST.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ICONST.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,19 +24,21 @@
*
* <PRE>Stack: ... -> ..., </PRE>
*
- * @version $Id: ICONST.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class ICONST extends Instruction implements ConstantPushInstruction {
private int value;
+
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
ICONST() {
}
+
public ICONST(final int i) {
super(com.sun.org.apache.bcel.internal.Const.ICONST_0, (short) 1);
if ((i >= -1) && (i <= 5)) {
@@ -47,29 +49,31 @@
value = i;
}
+
@Override
public Number getValue() {
return Integer.valueOf(value);
}
- /**
- * @return Type.INT
+
+ /** @return Type.INT
*/
@Override
- public Type getType(final ConstantPoolGen cp) {
+ public Type getType( final ConstantPoolGen cp ) {
return Type.INT;
}
+
/**
- * Call corresponding visitor method(s). The order is: Call visitor methods
- * of implemented interfaces first, then call methods according to the class
- * hierarchy in descending order, i.e., the most specific visitXXX() call
- * comes last.
+ * Call corresponding visitor method(s). The order is:
+ * Call visitor methods of implemented interfaces first, then
+ * call methods according to the class hierarchy in descending order,
+ * i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
@Override
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
v.visitPushInstruction(this);
v.visitStackProducer(this);
v.visitTypedInstruction(this);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IDIV.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IDIV.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,8 +26,8 @@
* IDIV - Divide ints
* <PRE>Stack: ..., value1, value2 -> result</PRE>
*
- * @version $Id: IDIV.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class IDIV extends ArithmeticInstruction implements ExceptionThrower {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFEQ.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFEQ.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value -> ...</PRE>
*
- * @version $Id: IFEQ.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IFEQ extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IFEQ() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFGE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFGE.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value -> ...</PRE>
*
- * @version $Id: IFGE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IFGE extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IFGE() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFGT.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFGT.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value -> ...</PRE>
*
- * @version $Id: IFGT.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IFGT extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IFGT() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFLE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFLE.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value -> ...</PRE>
*
- * @version $Id: IFLE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IFLE extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IFLE() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFLT.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFLT.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value -> ...</PRE>
*
- * @version $Id: IFLT.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IFLT extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IFLT() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFNE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFNE.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value -> ...</PRE>
*
- * @version $Id: IFNE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IFNE extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IFNE() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFNONNULL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFNONNULL.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., reference -> ...</PRE>
*
- * @version $Id: IFNONNULL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IFNONNULL extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IFNONNULL() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFNULL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IFNULL.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., reference -> ...</PRE>
*
- * @version $Id: IFNULL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IFNULL extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IFNULL() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ACMPEQ.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ACMPEQ.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value1, value2 -> ...</PRE>
*
- * @version $Id: IF_ACMPEQ.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IF_ACMPEQ extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IF_ACMPEQ() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ACMPNE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ACMPNE.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value1, value2 -> ...</PRE>
*
- * @version $Id: IF_ACMPNE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IF_ACMPNE extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IF_ACMPNE() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPEQ.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPEQ.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value1, value2 -> ...</PRE>
*
- * @version $Id: IF_ICMPEQ.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IF_ICMPEQ extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IF_ICMPEQ() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPGE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPGE.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value1, value2 -> ...</PRE>
*
- * @version $Id: IF_ICMPGE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IF_ICMPGE extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IF_ICMPGE() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPGT.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPGT.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value1, value2 -> ...</PRE>
*
- * @version $Id: IF_ICMPGT.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IF_ICMPGT extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IF_ICMPGT() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPLE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPLE.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value1, value2 -> ...</PRE>
*
- * @version $Id: IF_ICMPLE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IF_ICMPLE extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IF_ICMPLE() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPLT.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPLT.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value1, value2 -> ...</PRE>
*
- * @version $Id: IF_ICMPLT.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IF_ICMPLT extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IF_ICMPLT() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPNE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IF_ICMPNE.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,13 +26,13 @@
*
* <PRE>Stack: ..., value1, value2 -> ...</PRE>
*
- * @version $Id: IF_ICMPNE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IF_ICMPNE extends IfInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IF_ICMPNE() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IINC.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IINC.java Wed Jun 26 12:12:25 2019 +0530
@@ -29,7 +29,7 @@
/**
* IINC - Increment local variable by constant
*
- * @version $Id: IINC.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IINC extends LocalVariableInstruction {
@@ -38,8 +38,8 @@
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IINC() {
}
@@ -79,7 +79,12 @@
private void setWide() {
- wide = (super.getIndex() > com.sun.org.apache.bcel.internal.Const.MAX_BYTE) || (Math.abs(c) > Byte.MAX_VALUE);
+ wide = super.getIndex() > com.sun.org.apache.bcel.internal.Const.MAX_BYTE;
+ if (c > 0) {
+ wide = wide || (c > Byte.MAX_VALUE);
+ } else {
+ wide = wide || (c < Byte.MIN_VALUE);
+ }
if (wide) {
super.setLength(6); // wide byte included
} else {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ILOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ILOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,13 @@
* ILOAD - Load int from local variable onto stack
* <PRE>Stack: ... -> ..., result</PRE>
*
- * @version $Id: ILOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class ILOAD extends LoadInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
ILOAD() {
super(com.sun.org.apache.bcel.internal.Const.ILOAD, com.sun.org.apache.bcel.internal.Const.ILOAD_0);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IMPDEP1.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IMPDEP1.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,7 +24,7 @@
/**
* IMPDEP1 - Implementation dependent
*
- * @version $Id: IMPDEP1.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IMPDEP1 extends Instruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IMPDEP2.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IMPDEP2.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,7 +24,7 @@
/**
* IMPDEP2 - Implementation dependent
*
- * @version $Id: IMPDEP2.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IMPDEP2 extends Instruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IMUL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IMUL.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* IMUL - Multiply ints
* <PRE>Stack: ..., value1, value2 -> result</PRE>
*
- * @version $Id: IMUL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IMUL extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INEG.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INEG.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* INEG - Negate int
* <PRE>Stack: ..., value -> ..., result</PRE>
*
- * @version $Id: INEG.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class INEG extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INSTANCEOF.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INSTANCEOF.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,14 +27,14 @@
* INSTANCEOF - Determine if object is of given type
* <PRE>Stack: ..., objectref -> ..., result</PRE>
*
- * @version $Id: INSTANCEOF.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class INSTANCEOF extends CPInstruction implements LoadClass, ExceptionThrower,
StackProducer, StackConsumer {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
INSTANCEOF() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEDYNAMIC.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEDYNAMIC.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -40,13 +40,13 @@
* <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokedynamic">
* The invokedynamic instruction in The Java Virtual Machine Specification</a>
* @since 6.0
- * @LastModified: Nov 2017
+ * @LastModified: Jun 2019
*/
public class INVOKEDYNAMIC extends InvokeInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
INVOKEDYNAMIC() {
}
@@ -137,4 +137,19 @@
final ConstantInvokeDynamic cid = (ConstantInvokeDynamic) cp.getConstant(super.getIndex(), Const.CONSTANT_InvokeDynamic);
return ((ConstantNameAndType) cp.getConstant(cid.getNameAndTypeIndex())).getName(cp);
}
+
+
+ /**
+ * Since InvokeDynamic doesn't refer to a reference type, just return java.lang.Object,
+ * as that is the only type we can say for sure the reference will be.
+ *
+ * @param cpg
+ * the ConstantPoolGen used to create the instruction
+ * @return an ObjectType for java.lang.Object
+ * @since 6.1
+ */
+ @Override
+ public ReferenceType getReferenceType(final ConstantPoolGen cpg) {
+ return new ObjectType(Object.class.getName());
+ }
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEINTERFACE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEINTERFACE.java Wed Jun 26 12:12:25 2019 +0530
@@ -33,7 +33,7 @@
* INVOKEINTERFACE - Invoke interface method
* <PRE>Stack: ..., objectref, [arg1, [arg2 ...]] -> ...</PRE>
*
- * @version $Id: INVOKEINTERFACE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see
* <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokeinterface">
* The invokeinterface instruction in The Java Virtual Machine Specification</a>
@@ -44,8 +44,8 @@
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
INVOKEINTERFACE() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESPECIAL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESPECIAL.java Wed Jun 26 12:12:25 2019 +0530
@@ -33,7 +33,7 @@
*
* <PRE>Stack: ..., objectref, [arg1, [arg2 ...]] -> ...</PRE>
*
- * @version $Id: INVOKESPECIAL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see
* <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokespecial">
* The invokespecial instruction in The Java Virtual Machine Specification</a>
@@ -41,8 +41,8 @@
public class INVOKESPECIAL extends InvokeInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
INVOKESPECIAL() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESTATIC.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESTATIC.java Wed Jun 26 12:12:25 2019 +0530
@@ -32,7 +32,7 @@
*
* <PRE>Stack: ..., [arg1, [arg2 ...]] -> ...</PRE>
*
- * @version $Id: INVOKESTATIC.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see
* <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokestatic">
* The invokestatic instruction in The Java Virtual Machine Specification</a>
@@ -40,8 +40,8 @@
public class INVOKESTATIC extends InvokeInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
INVOKESTATIC() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEVIRTUAL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEVIRTUAL.java Wed Jun 26 12:12:25 2019 +0530
@@ -32,7 +32,7 @@
*
* <PRE>Stack: ..., objectref, [arg1, [arg2 ...]] -> ...</PRE>
*
- * @version $Id: INVOKEVIRTUAL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see
* <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokevirtual">
* The invokevirtual instruction in The Java Virtual Machine Specification</a>
@@ -40,8 +40,8 @@
public class INVOKEVIRTUAL extends InvokeInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
INVOKEVIRTUAL() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IOR.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IOR.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* IOR - Bitwise OR int
* <PRE>Stack: ..., value1, value2 -> ..., result</PRE>
*
- * @version $Id: IOR.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IOR extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IREM.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IREM.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,8 +26,8 @@
* IREM - Remainder of int
* <PRE>Stack: ..., value1, value2 -> result</PRE>
*
- * @version $Id: IREM.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class IREM extends ArithmeticInstruction implements ExceptionThrower {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IRETURN.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IRETURN.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* IRETURN - Return int from method
* <PRE>Stack: ..., value -> <empty></PRE>
*
- * @version $Id: IRETURN.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IRETURN extends ReturnInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ISHL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ISHL.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* ISHL - Arithmetic shift left int
* <PRE>Stack: ..., value1, value2 -> ..., result</PRE>
*
- * @version $Id: ISHL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class ISHL extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ISHR.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ISHR.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* ISHR - Arithmetic shift right int
* <PRE>Stack: ..., value1, value2 -> ..., result</PRE>
*
- * @version $Id: ISHR.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class ISHR extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ISTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ISTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,13 @@
* ISTORE - Store int from stack into local variable
* <PRE>Stack: ..., value -> ... </PRE>
*
- * @version $Id: ISTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class ISTORE extends StoreInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
ISTORE() {
super(com.sun.org.apache.bcel.internal.Const.ISTORE, com.sun.org.apache.bcel.internal.Const.ISTORE_0);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ISUB.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ISUB.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* ISUB - Substract ints
* <PRE>Stack: ..., value1, value2 -> result</PRE>
*
- * @version $Id: ISUB.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class ISUB extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IUSHR.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IUSHR.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* IUSHR - Logical shift right int
* <PRE>Stack: ..., value1, value2 -> ..., result</PRE>
*
- * @version $Id: IUSHR.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IUSHR extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IXOR.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IXOR.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* IXOR - Bitwise XOR int
* <PRE>Stack: ..., value1, value2 -> ..., result</PRE>
*
- * @version $Id: IXOR.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class IXOR extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IfInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IfInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,13 +24,13 @@
/**
* Super class for the IFxxx family of instructions.
*
- * @version $Id: IfInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public abstract class IfInstruction extends BranchInstruction implements StackConsumer {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
IfInstruction() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IndexedInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/IndexedInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Denote entity that refers to an index, e.g. local variable instructions,
* RET, CPInstruction, etc.
*
- * @version $Id: IndexedInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface IndexedInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Instruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Instruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -29,7 +29,8 @@
/**
* Abstract super class for all Java byte codes.
*
- * @version $Id: Instruction.java 1750029 2016-06-23 22:14:38Z sebb $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class Instruction implements Cloneable {
@@ -38,50 +39,54 @@
private static InstructionComparator cmp = InstructionComparator.DEFAULT;
+
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
Instruction() {
}
+
public Instruction(final short opcode, final short length) {
this.length = length;
this.opcode = opcode;
}
+
/**
* Dump instruction as byte code to stream out.
- *
* @param out Output stream
*/
- public void dump(final DataOutputStream out) throws IOException {
+ public void dump( final DataOutputStream out ) throws IOException {
out.writeByte(opcode); // Common for all instructions
}
- /**
- * @return name of instruction, i.e., opcode name
+
+ /** @return name of instruction, i.e., opcode name
*/
public String getName() {
return Const.getOpcodeName(opcode);
}
+
/**
* Long output format:
*
- * <name of opcode> "["<opcode number>"]" "("<length of
- * instruction>")"
+ * <name of opcode> "["<opcode number>"]"
+ * "("<length of instruction>")"
*
* @param verbose long/short format switch
* @return mnemonic for instruction
*/
- public String toString(final boolean verbose) {
+ public String toString( final boolean verbose ) {
if (verbose) {
return getName() + "[" + opcode + "](" + length + ")";
}
return getName();
}
+
/**
* @return mnemonic for instruction in verbose format
*/
@@ -90,17 +95,19 @@
return toString(true);
}
+
/**
* @return mnemonic for instruction with sumbolic references resolved
*/
- public String toString(final ConstantPool cp) {
+ public String toString( final ConstantPool cp ) {
return toString(false);
}
+
/**
- * Use with caution, since `BranchInstruction's have a `target' reference
- * which is not copied correctly (only basic types are). This also applies
- * for `Select' instructions with their multiple branch targets.
+ * Use with caution, since `BranchInstruction's have a `target' reference which
+ * is not copied correctly (only basic types are). This also applies for
+ * `Select' instructions with their multiple branch targets.
*
* @see BranchInstruction
* @return (shallow) copy of an instruction
@@ -120,30 +127,30 @@
return i;
}
+
/**
* Read needed data (e.g. index) from file.
*
* @param bytes byte sequence to read from
* @param wide "wide" instruction flag
- * @throws IOException may be thrown if the implementation needs to read
- * data from the file
+ * @throws IOException may be thrown if the implementation needs to read data from the file
*/
- protected void initFromFile(final ByteSequence bytes, final boolean wide) throws IOException {
+ protected void initFromFile( final ByteSequence bytes, final boolean wide ) throws IOException {
}
+
/**
* Read an instruction from (byte code) input stream and return the
* appropiate object.
* <p>
* If the Instruction is defined in {@link InstructionConst}, then the
* singleton instance is returned.
- *
* @param bytes input stream bytes
* @return instruction object being read
* @see InstructionConst#getInstruction(int)
*/
// @since 6.0 no longer final
- public static Instruction readInstruction(final ByteSequence bytes) throws IOException {
+ public static Instruction readInstruction( final ByteSequence bytes ) throws IOException {
boolean wide = false;
short opcode = (short) bytes.readUnsignedByte();
Instruction obj = null;
@@ -463,27 +470,29 @@
}
/**
- * This method also gives right results for instructions whose effect on the
- * stack depends on the constant pool entry they reference.
- *
- * @return Number of words consumed from stack by this instruction, or
- * Constants.UNPREDICTABLE, if this can not be computed statically
+ * This method also gives right results for instructions whose
+ * effect on the stack depends on the constant pool entry they
+ * reference.
+ * @return Number of words consumed from stack by this instruction,
+ * or Constants.UNPREDICTABLE, if this can not be computed statically
*/
- public int consumeStack(final ConstantPoolGen cpg) {
+ public int consumeStack( final ConstantPoolGen cpg ) {
return Const.getConsumeStack(opcode);
}
+
/**
- * This method also gives right results for instructions whose effect on the
- * stack depends on the constant pool entry they reference.
- *
- * @return Number of words produced onto stack by this instruction, or
- * Constants.UNPREDICTABLE, if this can not be computed statically
+ * This method also gives right results for instructions whose
+ * effect on the stack depends on the constant pool entry they
+ * reference.
+ * @return Number of words produced onto stack by this instruction,
+ * or Constants.UNPREDICTABLE, if this can not be computed statically
*/
- public int produceStack(final ConstantPoolGen cpg) {
+ public int produceStack( final ConstantPoolGen cpg ) {
return Const.getProduceStack(opcode);
}
+
/**
* @return this instructions opcode
*/
@@ -491,6 +500,7 @@
return opcode;
}
+
/**
* @return length (in bytes) of instruction
*/
@@ -498,75 +508,71 @@
return length;
}
- /**
- * Needed in readInstruction and subclasses in this package
- */
- final void setOpcode(final short opcode) {
- this.opcode = opcode;
- }
/**
* Needed in readInstruction and subclasses in this package
- *
+ */
+ final void setOpcode( final short opcode ) {
+ this.opcode = opcode;
+ }
+
+
+ /**
+ * Needed in readInstruction and subclasses in this package
* @since 6.0
*/
- final void setLength(final int length) {
+ final void setLength( final int length ) {
this.length = (short) length; // TODO check range?
}
- /**
- * Some instructions may be reused, so don't do anything by default.
+
+ /** Some instructions may be reused, so don't do anything by default.
*/
void dispose() {
}
+
/**
- * Call corresponding visitor method(s). The order is: Call visitor methods
- * of implemented interfaces first, then call methods according to the class
- * hierarchy in descending order, i.e., the most specific visitXXX() call
- * comes last.
+ * Call corresponding visitor method(s). The order is:
+ * Call visitor methods of implemented interfaces first, then
+ * call methods according to the class hierarchy in descending order,
+ * i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
- public abstract void accept(Visitor v);
+ public abstract void accept( Visitor v );
+
- /**
- * Get Comparator object used in the equals() method to determine equality
- * of instructions.
+ /** Get Comparator object used in the equals() method to determine
+ * equality of instructions.
*
* @return currently used comparator for equals()
- * @deprecated (6.0) use the built in comparator, or wrap this class in
- * another object that implements these methods
+ * @deprecated (6.0) use the built in comparator, or wrap this class in another object that implements these methods
*/
@Deprecated
public static InstructionComparator getComparator() {
return cmp;
}
- /**
- * Set comparator to be used for equals().
- *
- * @deprecated (6.0) use the built in comparator, or wrap this class in
- * another object that implements these methods
+
+ /** Set comparator to be used for equals().
+ * @deprecated (6.0) use the built in comparator, or wrap this class in another object that implements these methods
*/
@Deprecated
- public static void setComparator(final InstructionComparator c) {
+ public static void setComparator( final InstructionComparator c ) {
cmp = c;
}
- /**
- * Check for equality, delegated to comparator
- *
+
+ /** Check for equality, delegated to comparator
* @return true if that is an Instruction and has the same opcode
*/
@Override
- public boolean equals(final Object that) {
+ public boolean equals( final Object that ) {
return (that instanceof Instruction) ? cmp.equals(this, (Instruction) that) : false;
}
- /**
- * calculate the hashCode of this object
- *
+ /** calculate the hashCode of this object
* @return the hashCode
* @since 6.0
*/
@@ -577,7 +583,6 @@
/**
* Check if the value can fit in a byte (signed)
- *
* @param value the value to check
* @return true if the value is in range
* @since 6.0
@@ -588,7 +593,6 @@
/**
* Check if the value can fit in a short (signed)
- *
* @param value the value to check
* @return true if the value is in range
* @since 6.0
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionComparator.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionComparator.java Wed Jun 26 12:12:25 2019 +0530
@@ -31,7 +31,7 @@
* instructions must have the same target.
*
* @see Instruction
- * @version $Id: InstructionComparator.java 1749597 2016-06-21 20:28:51Z ggregory $
+ * @version $Id$
*/
public interface InstructionComparator {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionConst.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionConst.java Wed Jun 26 12:12:25 2019 +0530
@@ -37,7 +37,7 @@
* The Instructions can also accessed directly under their names, so
* it's possible to write il.append(Instruction.ICONST_0);
*
- * @version $Id: InstructionConst.java 1695415 2015-08-12 01:02:39Z chas $
+ * @version $Id: InstructionConstants.java 1695415 2015-08-12 01:02:39Z chas $
*/
public final class InstructionConst {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,23 +22,24 @@
import com.sun.org.apache.bcel.internal.Const;
/**
- * Instances of this class may be used, e.g., to generate typed versions of
- * instructions. Its main purpose is to be used as the byte code generating
- * backend of a compiler. You can subclass it to add your own create methods.
+ * Instances of this class may be used, e.g., to generate typed
+ * versions of instructions. Its main purpose is to be used as the
+ * byte code generating backend of a compiler. You can subclass it to
+ * add your own create methods.
* <p>
- * Note: The static createXXX methods return singleton instances from the
- * {@link InstructionConst} class.
+ * Note: The static createXXX methods return singleton instances
+ * from the {@link InstructionConst} class.
*
- * @version $Id: InstructionFactory.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Const
* @see InstructionConst
- * @LastModified: Nov 2017
+ * @LastModified: Jun 2019
*/
public class InstructionFactory {
// N.N. These must agree with the order of Constants.T_CHAR through T_LONG
private static final String[] short_names = {
- "C", "F", "D", "B", "S", "I", "L"
+ "C", "F", "D", "B", "S", "I", "L"
};
private ClassGen cg;
@@ -49,33 +50,33 @@
this.cp = cp;
}
- /**
- * Initialize with ClassGen object
+
+ /** Initialize with ClassGen object
*/
public InstructionFactory(final ClassGen cg) {
this(cg, cg.getConstantPool());
}
- /**
- * Initialize just with ConstantPoolGen object
+
+ /** Initialize just with ConstantPoolGen object
*/
public InstructionFactory(final ConstantPoolGen cp) {
this(null, cp);
}
- /**
- * Create an invoke instruction. (Except for invokedynamic.)
+
+ /** Create an invoke instruction. (Except for invokedynamic.)
*
* @param class_name name of the called class
* @param name name of the called method
* @param ret_type return type of method
* @param arg_types argument types of method
- * @param kind how to invoke, i.e., INVOKEINTERFACE, INVOKESTATIC,
- * INVOKEVIRTUAL, or INVOKESPECIAL
+ * @param kind how to invoke, i.e., INVOKEINTERFACE, INVOKESTATIC, INVOKEVIRTUAL,
+ * or INVOKESPECIAL
* @see Const
*/
- public InvokeInstruction createInvoke(final String class_name, final String name, final Type ret_type,
- final Type[] arg_types, final short kind) {
+ public InvokeInstruction createInvoke( final String class_name, final String name,
+ final Type ret_type, final Type[] arg_types, final short kind ) {
int index;
int nargs = 0;
final String signature = Type.getMethodSignature(ret_type, arg_types);
@@ -103,8 +104,7 @@
}
}
- /**
- * Create an invokedynamic instruction.
+ /** Create an invokedynamic instruction.
*
* @param bootstrap_index index into the bootstrap_methods array
* @param name name of the called method
@@ -112,30 +112,30 @@
* @param arg_types argument types of method
* @see Constants
*/
- /*
- * createInvokeDynamic only needed if instrumention code wants to generate
- * a new invokedynamic instruction. I don't think we need. (markro)
- *
- public InvokeInstruction createInvokeDynamic( int bootstrap_index, String name, Type ret_type,
- Type[] arg_types) {
- int index;
- int nargs = 0;
- String signature = Type.getMethodSignature(ret_type, arg_types);
- for (int i = 0; i < arg_types.length; i++) {
- nargs += arg_types[i].getSize();
- }
- // UNDONE - needs to be added to ConstantPoolGen
- //index = cp.addInvokeDynamic(bootstrap_index, name, signature);
- index = 0;
- return new INVOKEDYNAMIC(index);
- }
- */
- /**
- * Create a call to the most popular System.out.println() method.
+/*
+ * createInvokeDynamic only needed if instrumention code wants to generate
+ * a new invokedynamic instruction. I don't think we need. (markro)
+ *
+ public InvokeInstruction createInvokeDynamic( int bootstrap_index, String name, Type ret_type,
+ Type[] arg_types) {
+ int index;
+ int nargs = 0;
+ String signature = Type.getMethodSignature(ret_type, arg_types);
+ for (int i = 0; i < arg_types.length; i++) {
+ nargs += arg_types[i].getSize();
+ }
+ // UNDONE - needs to be added to ConstantPoolGen
+ //index = cp.addInvokeDynamic(bootstrap_index, name, signature);
+ index = 0;
+ return new INVOKEDYNAMIC(index);
+ }
+ */
+
+ /** Create a call to the most popular System.out.println() method.
*
* @param s the string to print
*/
- public InstructionList createPrintln(final String s) {
+ public InstructionList createPrintln( final String s ) {
final InstructionList il = new InstructionList();
final int out = cp.addFieldref("java.lang.System", "out", "Ljava/io/PrintStream;");
final int println = cp.addMethodref("java.io.PrintStream", "println", "(Ljava/lang/String;)V");
@@ -145,12 +145,11 @@
return il;
}
- /**
- * Uses PUSH to push a constant value onto the stack.
- *
+
+ /** Uses PUSH to push a constant value onto the stack.
* @param value must be of type Number, Boolean, Character or String
*/
- public Instruction createConstant(final Object value) {
+ public Instruction createConstant( final Object value ) {
PUSH push;
if (value instanceof Number) {
push = new PUSH(cp, (Number) value);
@@ -173,6 +172,7 @@
final String class_name;
final String name;
+
MethodObject(final String c, final String n, final Type r, final Type[] a) {
class_name = c;
name = n;
@@ -181,53 +181,56 @@
}
}
- private InvokeInstruction createInvoke(final MethodObject m, final short kind) {
+
+ private InvokeInstruction createInvoke( final MethodObject m, final short kind ) {
return createInvoke(m.class_name, m.name, m.result_type, m.arg_types, kind);
}
private static final MethodObject[] append_mos = {
- new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[]{
- Type.STRING
- }),
- new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[]{
- Type.OBJECT
- }),
- null,
- null, // indices 2, 3
- new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[]{
- Type.BOOLEAN
- }),
- new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[]{
- Type.CHAR
- }),
- new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[]{
- Type.FLOAT
- }),
- new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[]{
- Type.DOUBLE
- }),
- new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[]{
- Type.INT
- }),
- new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, // No append(byte)
- new Type[]{
- Type.INT
- }),
- new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, // No append(short)
- new Type[]{
- Type.INT
- }),
- new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[]{
- Type.LONG
- })
+ new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[] {
+ Type.STRING
+ }),
+ new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[] {
+ Type.OBJECT
+ }),
+ null,
+ null, // indices 2, 3
+ new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[] {
+ Type.BOOLEAN
+ }),
+ new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[] {
+ Type.CHAR
+ }),
+ new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[] {
+ Type.FLOAT
+ }),
+ new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[] {
+ Type.DOUBLE
+ }),
+ new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[] {
+ Type.INT
+ }),
+ new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, // No append(byte)
+ new Type[] {
+ Type.INT
+ }),
+ new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, // No append(short)
+ new Type[] {
+ Type.INT
+ }),
+ new MethodObject("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[] {
+ Type.LONG
+ })
};
- private static boolean isString(final Type type) {
- return (type instanceof ObjectType)
- && ((ObjectType) type).getClassName().equals("java.lang.String");
+
+ private static boolean isString( final Type type ) {
+ return (type instanceof ObjectType) &&
+ ((ObjectType) type).getClassName().equals("java.lang.String");
}
- public Instruction createAppend(final Type type) {
+
+ public Instruction createAppend( final Type type ) {
final byte t = type.getType();
if (isString(type)) {
return createInvoke(append_mos[0], Const.INVOKEVIRTUAL);
@@ -250,16 +253,17 @@
}
}
- /**
- * Create a field instruction.
+
+ /** Create a field instruction.
*
* @param class_name name of the accessed class
* @param name name of the referenced field
- * @param type type of field
+ * @param type type of field
* @param kind how to access, i.e., GETFIELD, PUTFIELD, GETSTATIC, PUTSTATIC
* @see Const
*/
- public FieldInstruction createFieldAccess(final String class_name, final String name, final Type type, final short kind) {
+ public FieldInstruction createFieldAccess( final String class_name,
+ final String name, final Type type, final short kind ) {
int index;
final String signature = type.getSignature();
index = cp.addFieldref(class_name, name, signature);
@@ -277,17 +281,17 @@
}
}
- /**
- * Create reference to `this'
+
+ /** Create reference to `this'
*/
public static Instruction createThis() {
return new ALOAD(0);
}
- /**
- * Create typed return
+
+ /** Create typed return
*/
- public static ReturnInstruction createReturn(final Type type) {
+ public static ReturnInstruction createReturn( final Type type ) {
switch (type.getType()) {
case Const.T_ARRAY:
case Const.T_OBJECT:
@@ -311,7 +315,8 @@
}
}
- private static ArithmeticInstruction createBinaryIntOp(final char first, final String op) {
+
+ private static ArithmeticInstruction createBinaryIntOp( final char first, final String op ) {
switch (first) {
case '-':
return InstructionConst.ISUB;
@@ -338,7 +343,8 @@
}
}
- private static ArithmeticInstruction createBinaryLongOp(final char first, final String op) {
+
+ private static ArithmeticInstruction createBinaryLongOp( final char first, final String op ) {
switch (first) {
case '-':
return InstructionConst.LSUB;
@@ -365,7 +371,8 @@
}
}
- private static ArithmeticInstruction createBinaryFloatOp(final char op) {
+
+ private static ArithmeticInstruction createBinaryFloatOp( final char op ) {
switch (op) {
case '-':
return InstructionConst.FSUB;
@@ -382,7 +389,8 @@
}
}
- private static ArithmeticInstruction createBinaryDoubleOp(final char op) {
+
+ private static ArithmeticInstruction createBinaryDoubleOp( final char op ) {
switch (op) {
case '-':
return InstructionConst.DSUB;
@@ -399,12 +407,13 @@
}
}
+
/**
* Create binary operation for simple basic types, such as int and float.
*
* @param op operation, such as "+", "*", "<<", etc.
*/
- public static ArithmeticInstruction createBinaryOperation(final String op, final Type type) {
+ public static ArithmeticInstruction createBinaryOperation( final String op, final Type type ) {
final char first = op.charAt(0);
switch (type.getType()) {
case Const.T_BYTE:
@@ -423,38 +432,43 @@
}
}
+
/**
* @param size size of operand, either 1 (int, e.g.) or 2 (double)
*/
- public static StackInstruction createPop(final int size) {
+ public static StackInstruction createPop( final int size ) {
return (size == 2) ? InstructionConst.POP2 : InstructionConst.POP;
}
+
/**
* @param size size of operand, either 1 (int, e.g.) or 2 (double)
*/
- public static StackInstruction createDup(final int size) {
+ public static StackInstruction createDup( final int size ) {
return (size == 2) ? InstructionConst.DUP2 : InstructionConst.DUP;
}
+
/**
* @param size size of operand, either 1 (int, e.g.) or 2 (double)
*/
- public static StackInstruction createDup_2(final int size) {
+ public static StackInstruction createDup_2( final int size ) {
return (size == 2) ? InstructionConst.DUP2_X2 : InstructionConst.DUP_X2;
}
+
/**
* @param size size of operand, either 1 (int, e.g.) or 2 (double)
*/
- public static StackInstruction createDup_1(final int size) {
+ public static StackInstruction createDup_1( final int size ) {
return (size == 2) ? InstructionConst.DUP2_X1 : InstructionConst.DUP_X1;
}
+
/**
* @param index index of local variable
*/
- public static LocalVariableInstruction createStore(final Type type, final int index) {
+ public static LocalVariableInstruction createStore( final Type type, final int index ) {
switch (type.getType()) {
case Const.T_BOOLEAN:
case Const.T_CHAR:
@@ -476,10 +490,11 @@
}
}
+
/**
* @param index index of local variable
*/
- public static LocalVariableInstruction createLoad(final Type type, final int index) {
+ public static LocalVariableInstruction createLoad( final Type type, final int index ) {
switch (type.getType()) {
case Const.T_BOOLEAN:
case Const.T_CHAR:
@@ -501,10 +516,11 @@
}
}
+
/**
* @param type type of elements of array, i.e., array.getElementType()
*/
- public static ArrayInstruction createArrayLoad(final Type type) {
+ public static ArrayInstruction createArrayLoad( final Type type ) {
switch (type.getType()) {
case Const.T_BOOLEAN:
case Const.T_BYTE:
@@ -529,10 +545,11 @@
}
}
+
/**
* @param type type of elements of array, i.e., array.getElementType()
*/
- public static ArrayInstruction createArrayStore(final Type type) {
+ public static ArrayInstruction createArrayStore( final Type type ) {
switch (type.getType()) {
case Const.T_BOOLEAN:
case Const.T_BYTE:
@@ -562,7 +579,7 @@
* instruction, e.g., if the operands are basic types and CHECKCAST if they
* are reference types.
*/
- public Instruction createCast(final Type src_type, final Type dest_type) {
+ public Instruction createCast( final Type src_type, final Type dest_type ) {
if ((src_type instanceof BasicType) && (dest_type instanceof BasicType)) {
final byte dest = dest_type.getType();
byte src = src_type.getType();
@@ -589,41 +606,49 @@
}
}
- public GETFIELD createGetField(final String class_name, final String name, final Type t) {
+
+ public GETFIELD createGetField( final String class_name, final String name, final Type t ) {
return new GETFIELD(cp.addFieldref(class_name, name, t.getSignature()));
}
- public GETSTATIC createGetStatic(final String class_name, final String name, final Type t) {
+
+ public GETSTATIC createGetStatic( final String class_name, final String name, final Type t ) {
return new GETSTATIC(cp.addFieldref(class_name, name, t.getSignature()));
}
- public PUTFIELD createPutField(final String class_name, final String name, final Type t) {
+
+ public PUTFIELD createPutField( final String class_name, final String name, final Type t ) {
return new PUTFIELD(cp.addFieldref(class_name, name, t.getSignature()));
}
- public PUTSTATIC createPutStatic(final String class_name, final String name, final Type t) {
+
+ public PUTSTATIC createPutStatic( final String class_name, final String name, final Type t ) {
return new PUTSTATIC(cp.addFieldref(class_name, name, t.getSignature()));
}
- public CHECKCAST createCheckCast(final ReferenceType t) {
+
+ public CHECKCAST createCheckCast( final ReferenceType t ) {
if (t instanceof ArrayType) {
return new CHECKCAST(cp.addArrayClass((ArrayType) t));
}
return new CHECKCAST(cp.addClass((ObjectType) t));
}
- public INSTANCEOF createInstanceOf(final ReferenceType t) {
+
+ public INSTANCEOF createInstanceOf( final ReferenceType t ) {
if (t instanceof ArrayType) {
return new INSTANCEOF(cp.addArrayClass((ArrayType) t));
}
return new INSTANCEOF(cp.addClass((ObjectType) t));
}
- public NEW createNew(final ObjectType t) {
+
+ public NEW createNew( final ObjectType t ) {
return new NEW(cp.addClass(t));
}
- public NEW createNew(final String s) {
+
+ public NEW createNew( final String s ) {
return createNew(ObjectType.getInstance(s));
}
@@ -633,7 +658,7 @@
* @return an instruction that creates the corresponding array at runtime,
* i.e. is an AllocationInstruction
*/
- public Instruction createNewArray(final Type t, final short dim) {
+ public Instruction createNewArray( final Type t, final short dim ) {
if (dim == 1) {
if (t instanceof ObjectType) {
return new ANEWARRAY(cp.addClass((ObjectType) t));
@@ -655,7 +680,7 @@
/**
* Create "null" value for reference types, 0 for basic types like int
*/
- public static Instruction createNull(final Type type) {
+ public static Instruction createNull( final Type type ) {
switch (type.getType()) {
case Const.T_ARRAY:
case Const.T_OBJECT:
@@ -683,7 +708,8 @@
* Create branch instruction by given opcode, except LOOKUPSWITCH and
* TABLESWITCH. For those you should use the SWITCH compound instruction.
*/
- public static BranchInstruction createBranchInstruction(final short opcode, final InstructionHandle target) {
+ public static BranchInstruction createBranchInstruction( final short opcode,
+ final InstructionHandle target ) {
switch (opcode) {
case Const.IFEQ:
return new IFEQ(target);
@@ -730,18 +756,22 @@
}
}
- public void setClassGen(final ClassGen c) {
+
+ public void setClassGen( final ClassGen c ) {
cg = c;
}
+
public ClassGen getClassGen() {
return cg;
}
- public void setConstantPool(final ConstantPoolGen c) {
+
+ public void setConstantPool( final ConstantPoolGen c ) {
cp = c;
}
+
public ConstantPoolGen getConstantPool() {
return cp;
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionHandle.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionHandle.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -32,13 +32,14 @@
* an InstructionList. Instruction objects may be used more than once within a
* list, this is useful because it saves memory and may be much faster.
*
- * Within an InstructionList an InstructionHandle object is wrapped around all
- * instructions, i.e., it implements a cell in a doubly-linked list. From the
- * outside only the next and the previous instruction (handle) are accessible.
- * One can traverse the list via an Enumeration returned by
+ * Within an InstructionList an InstructionHandle object is wrapped
+ * around all instructions, i.e., it implements a cell in a
+ * doubly-linked list. From the outside only the next and the
+ * previous instruction (handle) are accessible. One
+ * can traverse the list via an Enumeration returned by
* InstructionList.elements().
*
- * @version $Id: InstructionHandle.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Instruction
* @see BranchHandle
* @see InstructionList
@@ -54,23 +55,37 @@
private Set<InstructionTargeter> targeters;
private Map<Object, Object> attributes;
+
+ /**
+ * Does nothing.
+ *
+ * @deprecated Does nothing as of 6.3.1.
+ */
+ @Deprecated
+ protected void addHandle() {
+ // noop
+ }
+
public final InstructionHandle getNext() {
return next;
}
+
public final InstructionHandle getPrev() {
return prev;
}
+
public final Instruction getInstruction() {
return instruction;
}
+
/**
- * Replace current instruction contained in this handle. Old instruction is
- * disposed using Instruction.dispose().
+ * Replace current instruction contained in this handle.
+ * Old instruction is disposed using Instruction.dispose().
*/
- public void setInstruction(final Instruction i) { // Overridden in BranchHandle TODO could be package-protected?
+ public void setInstruction( final Instruction i ) { // Overridden in BranchHandle TODO could be package-protected?
if (i == null) {
throw new ClassGenException("Assigning null to handle");
}
@@ -83,91 +98,71 @@
instruction = i;
}
+
/**
- * Temporarily swap the current instruction, without disturbing anything.
- * Meant to be used by a debugger, implementing breakpoints. Current
- * instruction is returned.
+ * Temporarily swap the current instruction, without disturbing
+ * anything. Meant to be used by a debugger, implementing
+ * breakpoints. Current instruction is returned.
* <p>
* Warning: if this is used on a BranchHandle then some methods such as
- * getPosition() will still refer to the original cached instruction,
- * whereas other BH methods may affect the cache and the replacement
- * instruction.
+ * getPosition() will still refer to the original cached instruction, whereas
+ * other BH methods may affect the cache and the replacement instruction.
*/
// See BCEL-273
// TODO remove this method in any redesign of BCEL
- public Instruction swapInstruction(final Instruction i) {
+ public Instruction swapInstruction( final Instruction i ) {
final Instruction oldInstruction = instruction;
instruction = i;
return oldInstruction;
}
- /*private*/
- protected InstructionHandle(final Instruction i) {
+ /*private*/protected InstructionHandle(final Instruction i) {
setInstruction(i);
}
- private static InstructionHandle ih_list = null; // List of reusable handles
-
- /**
- * Factory method.
+ /** Factory method.
*/
- static InstructionHandle getInstructionHandle(final Instruction i) {
- if (ih_list == null) {
- return new InstructionHandle(i);
- }
- final InstructionHandle ih = ih_list;
- ih_list = ih.next;
- ih.setInstruction(i);
- return ih;
+ static InstructionHandle getInstructionHandle( final Instruction i ) {
+ return new InstructionHandle(i);
}
+
/**
- * Called by InstructionList.setPositions when setting the position for
- * every instruction. In the presence of variable length instructions
- * `setPositions()' performs multiple passes over the instruction list to
- * calculate the correct (byte) positions and offsets by calling this
- * function.
+ * Called by InstructionList.setPositions when setting the position for every
+ * instruction. In the presence of variable length instructions `setPositions()'
+ * performs multiple passes over the instruction list to calculate the
+ * correct (byte) positions and offsets by calling this function.
*
- * @param offset additional offset caused by preceding (variable length)
- * instructions
- * @param max_offset the maximum offset that may be caused by these
- * instructions
- * @return additional offset caused by possible change of this instruction's
- * length
+ * @param offset additional offset caused by preceding (variable length) instructions
+ * @param max_offset the maximum offset that may be caused by these instructions
+ * @return additional offset caused by possible change of this instruction's length
*/
- protected int updatePosition(final int offset, final int max_offset) {
+ protected int updatePosition( final int offset, final int max_offset ) {
i_position += offset;
return 0;
}
- /**
- * @return the position, i.e., the byte code offset of the contained
- * instruction. This is accurate only after InstructionList.setPositions()
- * has been called.
+
+ /** @return the position, i.e., the byte code offset of the contained
+ * instruction. This is accurate only after
+ * InstructionList.setPositions() has been called.
*/
public int getPosition() {
return i_position;
}
- /**
- * Set the position, i.e., the byte code offset of the contained
+
+ /** Set the position, i.e., the byte code offset of the contained
* instruction.
*/
- void setPosition(final int pos) {
+ void setPosition( final int pos ) {
i_position = pos;
}
- /**
- * Overridden in BranchHandle
- */
- protected void addHandle() {
- next = ih_list;
- ih_list = this;
- }
/**
- * Delete contents, i.e., remove user access and make handle reusable.
+ * Delete contents, i.e., remove user access.
*/
void dispose() {
next = prev = null;
@@ -176,11 +171,10 @@
i_position = -1;
attributes = null;
removeAllTargeters();
- addHandle();
}
- /**
- * Remove all targeters, if any.
+
+ /** Remove all targeters, if any.
*/
public void removeAllTargeters() {
if (targeters != null) {
@@ -188,19 +182,21 @@
}
}
+
/**
* Denote this handle isn't referenced anymore by t.
*/
- public void removeTargeter(final InstructionTargeter t) {
+ public void removeTargeter( final InstructionTargeter t ) {
if (targeters != null) {
targeters.remove(t);
}
}
+
/**
* Denote this handle is being referenced by t.
*/
- public void addTargeter(final InstructionTargeter t) {
+ public void addTargeter( final InstructionTargeter t ) {
if (targeters == null) {
targeters = new HashSet<>();
}
@@ -208,10 +204,12 @@
targeters.add(t);
}
+
public boolean hasTargeters() {
return (targeters != null) && (targeters.size() > 0);
}
+
/**
* @return null, if there are no targeters
*/
@@ -224,59 +222,59 @@
return t;
}
- /**
- * @return a (verbose) string representation of the contained instruction.
+
+ /** @return a (verbose) string representation of the contained instruction.
*/
- public String toString(final boolean verbose) {
+ public String toString( final boolean verbose ) {
return Utility.format(i_position, 4, false, ' ') + ": " + instruction.toString(verbose);
}
- /**
- * @return a string representation of the contained instruction.
+
+ /** @return a string representation of the contained instruction.
*/
@Override
public String toString() {
return toString(true);
}
- /**
- * Add an attribute to an instruction handle.
+
+ /** Add an attribute to an instruction handle.
*
* @param key the key object to store/retrieve the attribute
* @param attr the attribute to associate with this handle
*/
- public void addAttribute(final Object key, final Object attr) {
+ public void addAttribute( final Object key, final Object attr ) {
if (attributes == null) {
attributes = new HashMap<>(3);
}
attributes.put(key, attr);
}
- /**
- * Delete an attribute of an instruction handle.
+
+ /** Delete an attribute of an instruction handle.
*
* @param key the key object to retrieve the attribute
*/
- public void removeAttribute(final Object key) {
+ public void removeAttribute( final Object key ) {
if (attributes != null) {
attributes.remove(key);
}
}
- /**
- * Get attribute of an instruction handle.
+
+ /** Get attribute of an instruction handle.
*
* @param key the key object to store/retrieve the attribute
*/
- public Object getAttribute(final Object key) {
+ public Object getAttribute( final Object key ) {
if (attributes != null) {
return attributes.get(key);
}
return null;
}
- /**
- * @return all attributes associated with this handle
+
+ /** @return all attributes associated with this handle
*/
public Collection<Object> getAttributes() {
if (attributes == null) {
@@ -285,15 +283,16 @@
return attributes.values();
}
- /**
- * Convenience method, simply calls accept() on the contained instruction.
+
+ /** Convenience method, simply calls accept() on the contained instruction.
*
* @param v Visitor object
*/
- public void accept(final Visitor v) {
+ public void accept( final Visitor v ) {
instruction.accept(v);
}
+
/**
* @param next the next to set
* @ since 6.0
@@ -303,6 +302,7 @@
return next;
}
+
/**
* @param prev the prev to set
* @ since 6.0
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionList.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionList.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
-/*
+ /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -44,12 +44,14 @@
* A list is finally dumped to a byte code array with <a
* href="#getByteCode()">getByteCode</a>.
*
- * @version $Id: InstructionList.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see Instruction
* @see InstructionHandle
* @see BranchHandle
+ * @LastModified: Jun 2019
*/
public class InstructionList implements Iterable<InstructionHandle> {
+
private InstructionHandle start = null;
private InstructionHandle end = null;
private int length = 0; // number of elements in list
@@ -191,12 +193,11 @@
for (int i = 0; i < count; i++) {
if (ihs[i] instanceof BranchHandle) {
final BranchInstruction bi = (BranchInstruction) ihs[i].getInstruction();
- int target = bi.getPosition() + bi.getIndex(); /*
- * Byte code position: relative -> absolute.
+ int target = bi.getPosition() + bi.getIndex();
+ /*
+ * Byte code position: relative -> absolute.
*/
-
// Search for target position
-
InstructionHandle ih = findHandle(ihs, pos, count, target);
if (ih == null) {
throw new ClassGenException("Couldn't find target for branch: " + bi);
@@ -433,7 +434,6 @@
} else {
start = il.start; // Update start ...
}
-
length += il.length; // Update length
il.clear();
return ret;
@@ -468,7 +468,6 @@
ih.setPrev(null);
start = ih;
}
-
length++;
}
@@ -843,26 +842,26 @@
if (i instanceof BranchInstruction) { // target instruction within list?
Instruction inst = ((BranchInstruction) i).getTarget().getInstruction();
if (!contains(inst)) {
- throw new ClassGenException("Branch target of " +
- Const.getOpcodeName(i.getOpcode()) + ":" +
- inst + " not in instruction list");
+ throw new ClassGenException("Branch target of "
+ + Const.getOpcodeName(i.getOpcode()) + ":"
+ + inst + " not in instruction list");
}
if (i instanceof Select) {
final InstructionHandle[] targets = ((Select) i).getTargets();
for (final InstructionHandle target : targets) {
inst = target.getInstruction();
if (!contains(inst)) {
- throw new ClassGenException("Branch target of " +
- Const.getOpcodeName(i.getOpcode()) + ":" +
- inst + " not in instruction list");
+ throw new ClassGenException("Branch target of "
+ + Const.getOpcodeName(i.getOpcode()) + ":"
+ + inst + " not in instruction list");
}
}
}
if (!(ih instanceof BranchHandle)) {
throw new ClassGenException(
- "Branch instruction " +
- Const.getOpcodeName(i.getOpcode()) + ":" +
- inst + " not contained in BranchHandle.");
+ "Branch instruction "
+ + Const.getOpcodeName(i.getOpcode()) + ":"
+ + inst + " not contained in BranchHandle.");
}
}
}
@@ -871,11 +870,9 @@
* Pass 1: Set position numbers and sum up the maximum number of bytes an instruction may be shifted.
*/
for (InstructionHandle ih = start; ih != null; ih = ih.getNext()) {
-
final Instruction i = ih.getInstruction();
ih.setPosition(index);
pos[count++] = index;
-
/*
* Get an estimate about how many additional bytes may be added,
* because BranchInstructions may have variable length depending on the target offset
@@ -908,7 +905,6 @@
index = count = 0;
for (InstructionHandle ih = start; ih != null; ih = ih.getNext()) {
final Instruction i = ih.getInstruction();
-
ih.setPosition(index);
pos[count++] = index;
index += i.getLength();
@@ -1040,7 +1036,8 @@
final Map<InstructionHandle, InstructionHandle> map = new HashMap<>();
final InstructionList il = new InstructionList();
/*
- * Pass 1: Make copies of all instructions, append them to the new list and associate old instruction references with the new ones, i.e., a 1:1 mapping.
+ * Pass 1: Make copies of all instructions, append them to the new list
+ * and associate old instruction references with the new ones, i.e., a 1:1 mapping.
*/
for (InstructionHandle ih = start; ih != null; ih = ih.getNext()) {
final Instruction i = ih.getInstruction();
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionListObserver.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionListObserver.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Implement this interface if you're interested in changes to an InstructionList object
* and register yourself with addObserver().
*
- * @version $Id: InstructionListObserver.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface InstructionListObserver {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionTargeter.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionTargeter.java Wed Jun 26 12:12:25 2019 +0530
@@ -28,7 +28,7 @@
* @see BranchHandle
* @see LocalVariableGen
* @see CodeExceptionGen
- * @version $Id: InstructionTargeter.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface InstructionTargeter {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InvokeInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InvokeInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,6 +1,5 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -31,14 +30,15 @@
/**
* Super class for the INVOKExxx family of instructions.
*
- * @version $Id: InvokeInstruction.java 1752106 2016-07-10 20:02:39Z britter $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class InvokeInstruction extends FieldOrMethod implements ExceptionThrower,
StackConsumer, StackProducer {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
InvokeInstruction() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/JSR.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/JSR.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,13 +27,13 @@
/**
* JSR - Jump to subroutine
*
- * @version $Id: JSR.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public class JSR extends JsrInstruction implements VariableLengthInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
JSR() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/JSR_W.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/JSR_W.java Wed Jun 26 12:12:25 2019 +0530
@@ -29,13 +29,13 @@
/**
* JSR_W - Jump to subroutine
*
- * @version $Id: JSR_W.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class JSR_W extends JsrInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
JSR_W() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/JsrInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/JsrInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,7 +24,7 @@
/**
* Super class for JSR - Jump to subroutine
*
- * @version $Id: JsrInstruction.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public abstract class JsrInstruction extends BranchInstruction implements UnconditionalBranch,
TypedInstruction, StackProducer {
@@ -35,8 +35,8 @@
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
JsrInstruction() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/L2D.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/L2D.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* L2D - Convert long to double
* <PRE>Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: L2D.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class L2D extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/L2F.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/L2F.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* L2F - Convert long to float
* <PRE>Stack: ..., value.word1, value.word2 -> ..., result</PRE>
*
- * @version $Id: L2F.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class L2F extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/L2I.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/L2I.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* L2I - Convert long to int
* <PRE>Stack: ..., value.word1, value.word2 -> ..., result</PRE>
*
- * @version $Id: L2I.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class L2I extends ConversionInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LADD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LADD.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -></PRE>
* ..., result.word1, result.word2
*
- * @version $Id: LADD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LADD extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LALOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LALOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* LALOAD - Load long from array
* <PRE>Stack: ..., arrayref, index -> ..., value1, value2</PRE>
*
- * @version $Id: LALOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LALOAD extends ArrayInstruction implements StackProducer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LAND.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LAND.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -></PRE>
* ..., result.word1, result.word2
*
- * @version $Id: LAND.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LAND extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LASTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LASTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* LASTORE - Store into long array
* <PRE>Stack: ..., arrayref, index, value.word1, value.word2 -> ...</PRE>
*
- * @version $Id: LASTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LASTORE extends ArrayInstruction implements StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LCMP.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LCMP.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -> ..., result <= -1, 0, 1></PRE>
*
*
- * @version $Id: LCMP.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LCMP extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LCONST.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LCONST.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
*
* <PRE>Stack: ... -> ..., </PRE>
*
- * @version $Id: LCONST.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LCONST extends Instruction implements ConstantPushInstruction {
@@ -33,8 +33,8 @@
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
LCONST() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -31,14 +31,14 @@
*
* <PRE>Stack: ... -> ..., item</PRE>
*
- * @version $Id: LDC.java 1749603 2016-06-21 20:50:19Z ggregory $
- * @LastModified: Nov 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class LDC extends CPInstruction implements PushInstruction, ExceptionThrower {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
LDC() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC2_W.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC2_W.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,14 +25,14 @@
*
* <PRE>Stack: ... -> ..., item.word1, item.word2</PRE>
*
- * @version $Id: LDC2_W.java 1749603 2016-06-21 20:50:19Z ggregory $
- * @LastModified: Nov 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class LDC2_W extends CPInstruction implements PushInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
LDC2_W() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC_W.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC_W.java Wed Jun 26 12:12:25 2019 +0530
@@ -30,13 +30,13 @@
*
* <PRE>Stack: ... -> ..., item.word1, item.word2</PRE>
*
- * @version $Id: LDC_W.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LDC_W extends LDC {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
LDC_W() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDIV.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDIV.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -27,8 +27,8 @@
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -></PRE>
* ..., result.word1, result.word2
*
- * @version $Id: LDIV.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class LDIV extends ArithmeticInstruction implements ExceptionThrower {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LLOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LLOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,13 @@
* LLOAD - Load long from local variable
*<PRE>Stack ... -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: LLOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LLOAD extends LoadInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
LLOAD() {
super(com.sun.org.apache.bcel.internal.Const.LLOAD, com.sun.org.apache.bcel.internal.Const.LLOAD_0);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LMUL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LMUL.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -></PRE>
* ..., result.word1, result.word2
*
- * @version $Id: LMUL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LMUL extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LNEG.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LNEG.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* LNEG - Negate long
* <PRE>Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: LNEG.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LNEG extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LOOKUPSWITCH.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LOOKUPSWITCH.java Wed Jun 26 12:12:25 2019 +0530
@@ -29,14 +29,14 @@
/**
* LOOKUPSWITCH - Switch with unordered set of values
*
- * @version $Id: LOOKUPSWITCH.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see SWITCH
*/
public class LOOKUPSWITCH extends Select {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
LOOKUPSWITCH() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LOR.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LOR.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* LOR - Bitwise OR long
* <PRE>Stack: ..., value1, value2 -> ..., result</PRE>
*
- * @version $Id: LOR.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LOR extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LREM.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LREM.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,8 +26,8 @@
* LREM - Remainder of long
* <PRE>Stack: ..., value1, value2 -> result</PRE>
*
- * @version $Id: LREM.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class LREM extends ArithmeticInstruction implements ExceptionThrower {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LRETURN.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LRETURN.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* LRETURN - Return long from method
* <PRE>Stack: ..., value.word1, value.word2 -> <empty></PRE>
*
- * @version $Id: LRETURN.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LRETURN extends ReturnInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LSHL.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LSHL.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* LSHL - Arithmetic shift left long
* <PRE>Stack: ..., value1.word1, value1.word2, value2 -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: LSHL.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LSHL extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LSHR.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LSHR.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* LSHR - Arithmetic shift right long
* <PRE>Stack: ..., value1.word1, value1.word2, value2 -> ..., result.word1, result.word2</PRE>
*
- * @version $Id: LSHR.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LSHR extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LSTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LSTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,13 @@
* LSTORE - Store long into local variable
* <PRE>Stack: ..., value.word1, value.word2 -> ... </PRE>
*
- * @version $Id: LSTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LSTORE extends StoreInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
LSTORE() {
super(com.sun.org.apache.bcel.internal.Const.LSTORE, com.sun.org.apache.bcel.internal.Const.LSTORE_0);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LSUB.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LSUB.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -></PRE>
* ..., result.word1, result.word2
*
- * @version $Id: LSUB.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LSUB extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LUSHR.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LUSHR.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* LUSHR - Logical shift right long
* <PRE>Stack: ..., value1, value2 -> ..., result</PRE>
*
- * @version $Id: LUSHR.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LUSHR extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LXOR.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LXOR.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* LXOR - Bitwise XOR long
* <PRE>Stack: ..., value1, value2 -> ..., result</PRE>
*
- * @version $Id: LXOR.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class LXOR extends ArithmeticInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LineNumberGen.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LineNumberGen.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,7 +27,7 @@
* This class represents a line number within a method, i.e., give an instruction
* a line number corresponding to the source code line.
*
- * @version $Id: LineNumberGen.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see LineNumber
* @see MethodGen
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LoadClass.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LoadClass.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Denotes that an instruction may start the process of loading and resolving
* the referenced class in the Virtual Machine.
*
- * @version $Id: LoadClass.java 1749597 2016-06-21 20:28:51Z ggregory $
+ * @version $Id$
*/
public interface LoadClass {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LoadInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LoadInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,13 @@
* Denotes an unparameterized instruction to load a value from a local
* variable, e.g. ILOAD.
*
- * @version $Id: LoadInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public abstract class LoadInstruction extends LocalVariableInstruction implements PushInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
* tag and length are defined in readInstruction and initFromFile, respectively.
*/
LoadInstruction(final short canon_tag, final short c_tag) {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableGen.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableGen.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,13 @@
/**
* This class represents a local variable within a method. It contains its
- * scope, name and type. The generated LocalVariable object can be obtained with
- * getLocalVariable which needs the instruction list and the constant pool as
- * parameters.
+ * scope, name and type. The generated LocalVariable object can be obtained
+ * with getLocalVariable which needs the instruction list and the constant
+ * pool as parameters.
*
- * @version $Id: LocalVariableGen.java 1749603 2016-06-21 20:50:19Z ggregory $
- * @see LocalVariable
- * @see MethodGen
+ * @version $Id$
+ * @see LocalVariable
+ * @see MethodGen
*/
public class LocalVariableGen implements InstructionTargeter, NamedAndTyped, Cloneable {
@@ -40,21 +40,22 @@
private Type type;
private InstructionHandle start;
private InstructionHandle end;
+ private int orig_index; // never changes; used to match up with LocalVariableTypeTable entries
+ private boolean live_to_end;
+
/**
- * Generate a local variable that with index `index'. Note that double and
- * long variables need two indexs. Index indices have to be provided by the
- * user.
+ * Generate a local variable that with index `index'. Note that double and long
+ * variables need two indexs. Index indices have to be provided by the user.
*
* @param index index of local variable
* @param name its name
* @param type its type
- * @param start from where the instruction is valid (null means from the
- * start)
+ * @param start from where the instruction is valid (null means from the start)
* @param end until where the instruction is valid (null means to the end)
*/
- public LocalVariableGen(final int index, final String name, final Type type,
- final InstructionHandle start, final InstructionHandle end) {
+ public LocalVariableGen(final int index, final String name, final Type type, final InstructionHandle start,
+ final InstructionHandle end) {
if ((index < 0) || (index > Const.MAX_SHORT)) {
throw new ClassGenException("Invalid index index: " + index);
}
@@ -63,90 +64,137 @@
this.index = index;
setStart(start);
setEnd(end);
+ this.orig_index = index;
+ this.live_to_end = end == null;
}
+
+ /**
+ * Generate a local variable that with index `index'. Note that double and long
+ * variables need two indexs. Index indices have to be provided by the user.
+ *
+ * @param index index of local variable
+ * @param name its name
+ * @param type its type
+ * @param start from where the instruction is valid (null means from the start)
+ * @param end until where the instruction is valid (null means to the end)
+ * @param orig_index index of local variable prior to any changes to index
+ */
+ public LocalVariableGen(final int index, final String name, final Type type, final InstructionHandle start,
+ final InstructionHandle end, final int orig_index) {
+ this(index, name, type, start, end);
+ this.orig_index = orig_index;
+ }
+
+
/**
* Get LocalVariable object.
*
- * This relies on that the instruction list has already been dumped to byte
- * code or or that the `setPositions' methods has been called for the
- * instruction list.
+ * This relies on that the instruction list has already been dumped to byte code or
+ * or that the `setPositions' methods has been called for the instruction list.
*
- * Note that for local variables whose scope end at the last instruction of
- * the method's code, the JVM specification is ambiguous: both a
- * start_pc+length ending at the last instruction and start_pc+length ending
- * at first index beyond the end of the code are valid.
+ * Note that due to the conversion from byte code offset to InstructionHandle,
+ * it is impossible to tell the difference between a live range that ends BEFORE
+ * the last insturction of the method or a live range that ends AFTER the last
+ * instruction of the method. Hence the live_to_end flag to differentiate
+ * between these two cases.
*
* @param cp constant pool
*/
- public LocalVariable getLocalVariable(final ConstantPoolGen cp) {
+ public LocalVariable getLocalVariable( final ConstantPoolGen cp ) {
int start_pc = 0;
int length = 0;
if ((start != null) && (end != null)) {
start_pc = start.getPosition();
length = end.getPosition() - start_pc;
- if (end.getNext() == null) {
+ if ((end.getNext() == null) && live_to_end) {
length += end.getInstruction().getLength();
}
}
final int name_index = cp.addUtf8(name);
final int signature_index = cp.addUtf8(type.getSignature());
return new LocalVariable(start_pc, length, name_index, signature_index, index, cp
- .getConstantPool());
+ .getConstantPool(), orig_index);
}
- public void setIndex(final int index) {
+
+ public void setIndex( final int index ) {
this.index = index;
}
+
public int getIndex() {
return index;
}
+
+ public int getOrigIndex() {
+ return orig_index;
+ }
+
+
+ public void setLiveToEnd( final boolean live_to_end) {
+ this.live_to_end = live_to_end;
+ }
+
+
+ public boolean getLiveToEnd() {
+ return live_to_end;
+ }
+
+
@Override
- public void setName(final String name) {
+ public void setName( final String name ) {
this.name = name;
}
+
@Override
public String getName() {
return name;
}
+
@Override
- public void setType(final Type type) {
+ public void setType( final Type type ) {
this.type = type;
}
+
@Override
public Type getType() {
return type;
}
+
public InstructionHandle getStart() {
return start;
}
+
public InstructionHandle getEnd() {
return end;
}
- public void setStart(final InstructionHandle start) { // TODO could be package-protected?
+
+ public void setStart( final InstructionHandle start ) { // TODO could be package-protected?
BranchInstruction.notifyTarget(this.start, start, this);
this.start = start;
}
- public void setEnd(final InstructionHandle end) { // TODO could be package-protected?
+
+ public void setEnd( final InstructionHandle end ) { // TODO could be package-protected?
BranchInstruction.notifyTarget(this.end, end, this);
this.end = end;
}
+
/**
* @param old_ih old target, either start or end
* @param new_ih new target
*/
@Override
- public void updateTarget(final InstructionHandle old_ih, final InstructionHandle new_ih) {
+ public void updateTarget( final InstructionHandle old_ih, final InstructionHandle new_ih ) {
boolean targeted = false;
if (start == old_ih) {
targeted = true;
@@ -174,10 +222,11 @@
* @return true, if ih is target of this variable
*/
@Override
- public boolean containsTarget(final InstructionHandle ih) {
+ public boolean containsTarget( final InstructionHandle ih ) {
return (start == ih) || (end == ih);
}
+
@Override
public int hashCode() {
// If the user changes the name or type, problems with the targeter hashmap will occur.
@@ -185,12 +234,13 @@
return name.hashCode() ^ type.hashCode();
}
+
/**
* We consider to local variables to be equal, if the use the same index and
* are valid in the same range.
*/
@Override
- public boolean equals(final Object o) {
+ public boolean equals( final Object o ) {
if (!(o instanceof LocalVariableGen)) {
return false;
}
@@ -198,11 +248,13 @@
return (l.index == index) && (l.start == start) && (l.end == end);
}
+
@Override
public String toString() {
return "LocalVariableGen(" + name + ", " + type + ", " + start + ", " + end + ")";
}
+
@Override
public Object clone() {
try {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -28,8 +28,8 @@
/**
* Abstract super class for instructions dealing with local variables.
*
- * @version $Id: LocalVariableInstruction.java 1747278 2016-06-07 17:28:43Z
- * britter $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class LocalVariableInstruction extends Instruction implements TypedInstruction,
IndexedInstruction {
@@ -38,14 +38,16 @@
private short c_tag = -1; // compact version, such as ILOAD_0
private short canon_tag = -1; // canonical tag such as ILOAD
+
private boolean wide() {
return n > Const.MAX_BYTE;
}
+
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise. tag and length
- * are defined in readInstruction and initFromFile, respectively.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
+ * tag and length are defined in readInstruction and initFromFile, respectively.
*/
LocalVariableInstruction(final short canon_tag, final short c_tag) {
super();
@@ -53,13 +55,15 @@
this.c_tag = c_tag;
}
+
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Also used by IINC()!
+ * Empty constructor needed for Instruction.readInstruction.
+ * Also used by IINC()!
*/
LocalVariableInstruction() {
}
+
/**
* @param opcode Instruction opcode
* @param c_tag Instruction number for compact version, ALOAD_0, e.g.
@@ -72,13 +76,13 @@
setIndex(n);
}
+
/**
* Dump instruction as byte code to stream out.
- *
* @param out Output stream
*/
@Override
- public void dump(final DataOutputStream out) throws IOException {
+ public void dump( final DataOutputStream out ) throws IOException {
if (wide()) {
out.writeByte(Const.WIDE);
}
@@ -92,25 +96,27 @@
}
}
+
/**
* Long output format:
*
- * <name of opcode> "["<opcode number>"]" "("<length of
- * instruction>")" "<"< local variable index>">"
+ * <name of opcode> "["<opcode number>"]"
+ * "("<length of instruction>")" "<"< local variable index>">"
*
* @param verbose long/short format switch
* @return mnemonic for instruction
*/
@Override
- public String toString(final boolean verbose) {
+ public String toString( final boolean verbose ) {
final short _opcode = super.getOpcode();
if (((_opcode >= Const.ILOAD_0) && (_opcode <= Const.ALOAD_3))
- || ((_opcode >= Const.ISTORE_0) && (_opcode <= Const.ASTORE_3))) {
+ || ((_opcode >= Const.ISTORE_0) && (_opcode <= Const.ASTORE_3))) {
return super.toString(verbose);
}
return super.toString(verbose) + " " + n;
}
+
/**
* Read needed data (e.g. index) from file.
* <pre>
@@ -118,14 +124,14 @@
* </pre>
*/
@Override
- protected void initFromFile(final ByteSequence bytes, final boolean wide) throws IOException {
+ protected void initFromFile( final ByteSequence bytes, final boolean wide ) throws IOException {
if (wide) {
n = bytes.readUnsignedShort();
super.setLength(4);
} else {
final short _opcode = super.getOpcode();
if (((_opcode >= Const.ILOAD) && (_opcode <= Const.ALOAD))
- || ((_opcode >= Const.ISTORE) && (_opcode <= Const.ASTORE))) {
+ || ((_opcode >= Const.ISTORE) && (_opcode <= Const.ASTORE))) {
n = bytes.readUnsignedByte();
super.setLength(2);
} else if (_opcode <= Const.ALOAD_3) { // compact load instruction such as ILOAD_2
@@ -138,6 +144,7 @@
}
}
+
/**
* @return local variable index (n) referred by this instruction.
*/
@@ -146,13 +153,15 @@
return n;
}
+
/**
- * Set the local variable index. also updates opcode and length TODO Why?
- *
+ * Set the local variable index.
+ * also updates opcode and length
+ * TODO Why?
* @see #setIndexOnly(int)
*/
@Override
- public void setIndex(final int n) { // TODO could be package-protected?
+ public void setIndex( final int n ) { // TODO could be package-protected?
if ((n < 0) || (n > Const.MAX_SHORT)) {
throw new ClassGenException("Illegal value: " + n);
}
@@ -171,23 +180,24 @@
}
}
- /**
- * @return canonical tag for instruction, e.g., ALOAD for ALOAD_0
+
+ /** @return canonical tag for instruction, e.g., ALOAD for ALOAD_0
*/
public short getCanonicalTag() {
return canon_tag;
}
+
/**
- * Returns the type associated with the instruction - in case of ALOAD or
- * ASTORE Type.OBJECT is returned. This is just a bit incorrect, because
- * ALOAD and ASTORE may work on every ReferenceType (including Type.NULL)
- * and ASTORE may even work on a ReturnaddressType .
- *
+ * Returns the type associated with the instruction -
+ * in case of ALOAD or ASTORE Type.OBJECT is returned.
+ * This is just a bit incorrect, because ALOAD and ASTORE
+ * may work on every ReferenceType (including Type.NULL) and
+ * ASTORE may even work on a ReturnaddressType .
* @return type associated with the instruction
*/
@Override
- public Type getType(final ConstantPoolGen cp) {
+ public Type getType( final ConstantPoolGen cp ) {
switch (canon_tag) {
case Const.ILOAD:
case Const.ISTORE:
@@ -211,7 +221,6 @@
/**
* Sets the index of the referenced variable (n) only
- *
* @since 6.0
* @see #setIndex(int)
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MONITORENTER.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MONITORENTER.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,8 +26,8 @@
* MONITORENTER - Enter monitor for object
* <PRE>Stack: ..., objectref -> ...</PRE>
*
- * @version $Id: MONITORENTER.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class MONITORENTER extends Instruction implements ExceptionThrower, StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MONITOREXIT.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MONITOREXIT.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,8 +26,8 @@
* MONITOREXIT - Exit monitor for object
* <PRE>Stack: ..., objectref -> ...</PRE>
*
- * @version $Id: MONITOREXIT.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class MONITOREXIT extends Instruction implements ExceptionThrower, StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MULTIANEWARRAY.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MULTIANEWARRAY.java Wed Jun 26 12:12:25 2019 +0530
@@ -32,7 +32,7 @@
* MULTIANEWARRAY - Create new mutidimensional array of references
* <PRE>Stack: ..., count1, [count2, ...] -> ..., arrayref</PRE>
*
- * @version $Id: MULTIANEWARRAY.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class MULTIANEWARRAY extends CPInstruction implements LoadClass, AllocationInstruction,
ExceptionThrower {
@@ -41,8 +41,8 @@
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
MULTIANEWARRAY() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MethodGen.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MethodGen.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -52,13 +52,13 @@
* automatically for the code. Use stripAttributes() if you don't like this.
*
* While generating code it may be necessary to insert NOP operations. You can
- * use the `removeNOPs' method to get rid off them. The resulting method object
- * can be obtained via the `getMethod()' method.
+ * use the `removeNOPs' method to get rid off them.
+ * The resulting method object can be obtained via the `getMethod()' method.
*
- * @version $Id: MethodGen.java 1749603 2016-06-21 20:50:19Z ggregory $
- * @see InstructionList
- * @see Method
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @see InstructionList
+ * @see Method
+ * @LastModified: Jun 2019
*/
public class MethodGen extends FieldGenOrMethodGen {
@@ -69,8 +69,8 @@
private int max_stack;
private InstructionList il;
private boolean strip_attributes;
+ private LocalVariableTypeTable local_variable_type_table = null;
private final List<LocalVariableGen> variable_vec = new ArrayList<>();
- private final List<LocalVariableGen> type_vec = new ArrayList<>();
private final List<LineNumberGen> line_number_vec = new ArrayList<>();
private final List<CodeExceptionGen> exception_vec = new ArrayList<>();
private final List<String> throws_vec = new ArrayList<>();
@@ -83,41 +83,42 @@
private static BCELComparator bcelComparator = new BCELComparator() {
@Override
- public boolean equals(final Object o1, final Object o2) {
+ public boolean equals( final Object o1, final Object o2 ) {
final MethodGen THIS = (MethodGen) o1;
final MethodGen THAT = (MethodGen) o2;
return THIS.getName().equals(THAT.getName())
&& THIS.getSignature().equals(THAT.getSignature());
}
+
@Override
- public int hashCode(final Object o) {
+ public int hashCode( final Object o ) {
final MethodGen THIS = (MethodGen) o;
return THIS.getSignature().hashCode() ^ THIS.getName().hashCode();
}
};
+
/**
- * Declare method. If the method is non-static the constructor automatically
- * declares a local variable `$this' in slot 0. The actual code is contained
- * in the `il' parameter, which may further manipulated by the user. But he
- * must take care not to remove any instruction (handles) that are still
- * referenced from this object.
+ * Declare method. If the method is non-static the constructor
+ * automatically declares a local variable `$this' in slot 0. The
+ * actual code is contained in the `il' parameter, which may further
+ * manipulated by the user. But he must take care not to remove any
+ * instruction (handles) that are still referenced from this object.
*
* For example one may not add a local variable and later remove the
- * instructions it refers to without causing havoc. It is safe however if
- * you remove that local variable, too.
+ * instructions it refers to without causing havoc. It is safe
+ * however if you remove that local variable, too.
*
* @param access_flags access qualifiers
- * @param return_type method type
+ * @param return_type method type
* @param arg_types argument types
- * @param arg_names argument names (if this is null, default names will be
- * provided for them)
+ * @param arg_names argument names (if this is null, default names will be provided
+ * for them)
* @param method_name name of method
- * @param class_name class name containing this method (may be null, if you
- * don't care)
- * @param il instruction list associated with this method, may be null only
- * for abstract or native methods
+ * @param class_name class name containing this method (may be null, if you don't care)
+ * @param il instruction list associated with this method, may be null only for
+ * abstract or native methods
* @param cp constant pool
*/
public MethodGen(final int access_flags, final Type return_type, final Type[] arg_types, String[] arg_names,
@@ -132,14 +133,14 @@
setConstantPool(cp);
final boolean abstract_ = isAbstract() || isNative();
InstructionHandle start = null;
- InstructionHandle end = null;
+ final InstructionHandle end = null;
if (!abstract_) {
start = il.getStart();
- end = il.getEnd();
+ // end == null => live to end of method
/* Add local variables, namely the implicit `this' and the arguments
*/
if (!isStatic() && (class_name != null)) { // Instance method -> `this' is local var 0
- addLocalVariable("this", ObjectType.getInstance(class_name), start, end);
+ addLocalVariable("this", ObjectType.getInstance(class_name), start, end);
}
}
if (arg_types != null) {
@@ -169,6 +170,7 @@
}
}
+
/**
* Instantiate from existing method.
*
@@ -178,10 +180,11 @@
*/
public MethodGen(final Method m, final String class_name, final ConstantPoolGen cp) {
this(m.getAccessFlags(), Type.getReturnType(m.getSignature()), Type.getArgumentTypes(m
- .getSignature()), null /* may be overridden anyway */, m.getName(), class_name,
+ .getSignature()), null /* may be overridden anyway */
+ , m.getName(), class_name,
((m.getAccessFlags() & (Const.ACC_ABSTRACT | Const.ACC_NATIVE)) == 0)
- ? new InstructionList(m.getCode().getCode())
- : null, cp);
+ ? new InstructionList(m.getCode().getCode())
+ : null, cp);
final Attribute[] attributes = m.getAttributes();
for (final Attribute attribute : attributes) {
Attribute a = attribute;
@@ -197,7 +200,7 @@
if (type > 0) {
final String cen = m.getConstantPool().getConstantString(type,
Const.CONSTANT_Class);
- c_type = ObjectType.getInstance(cen);
+ c_type = ObjectType.getInstance(cen);
}
final int end_pc = ce.getEndPC();
final int length = m.getCode().getCode().length;
@@ -224,13 +227,9 @@
}
}
} else if (a instanceof LocalVariableTable) {
- final LocalVariable[] lv = ((LocalVariableTable) a).getLocalVariableTable();
- removeLocalVariables();
- repairHandles(lv, false);
+ updateLocalVariableTable((LocalVariableTable) a);
} else if (a instanceof LocalVariableTypeTable) {
- LocalVariable[] lv = ((LocalVariableTypeTable) a).getLocalVariableTypeTable();
- removeLocalVariableTypes();
- repairHandles(lv, true);
+ this.local_variable_type_table = (LocalVariableTypeTable) a.copy(cp.getConstantPool());
} else {
addCodeAttribute(a);
}
@@ -252,50 +251,28 @@
}
}
- private void repairHandles(final LocalVariable[] lv, boolean isLVT) {
- for (int k = 0; k < lv.length; k++) {
- LocalVariable l = lv[k];
- InstructionHandle start = il.findHandle(l.getStartPC());
- InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength());
- // Repair malformed handles
- if (null == start) {
- start = il.getStart();
- }
- if (null == end) {
- end = il.getEnd();
- }
- if (isLVT) {
- addLocalVariableType(l.getName(), Type.getType(l.getSignature()),
- l.getIndex(), start, end);
- } else {
- addLocalVariable(l.getName(), Type.getType(l.getSignature()),
- l.getIndex(), start, end);
- }
- }
- }
-
/**
* Adds a local variable to this method.
*
* @param name variable name
* @param type variable type
- * @param slot the index of the local variable, if type is long or double,
- * the next available index is slot+2
+ * @param slot the index of the local variable, if type is long or double, the next available
+ * index is slot+2
* @param start from where the variable is valid
* @param end until where the variable is valid
+ * @param orig_index the index of the local variable prior to any modifications
* @return new local variable object
* @see LocalVariable
*/
- public LocalVariableGen addLocalVariable(final String name, final Type type, final int slot,
- final InstructionHandle start, final InstructionHandle end) {
-
+ public LocalVariableGen addLocalVariable( final String name, final Type type, final int slot,
+ final InstructionHandle start, final InstructionHandle end, final int orig_index ) {
final byte t = type.getType();
if (t != Const.T_ADDRESS) {
final int add = type.getSize();
if (slot + add > max_locals) {
max_locals = slot + add;
}
- final LocalVariableGen l = new LocalVariableGen(slot, name, type, start, end);
+ final LocalVariableGen l = new LocalVariableGen(slot, name, type, start, end, orig_index);
int i;
if ((i = variable_vec.indexOf(l)) >= 0) {
variable_vec.set(i, l);
@@ -308,23 +285,42 @@
+ " as type for local variable");
}
+
+ /**
+ * Adds a local variable to this method.
+ *
+ * @param name variable name
+ * @param type variable type
+ * @param slot the index of the local variable, if type is long or double, the next available
+ * index is slot+2
+ * @param start from where the variable is valid
+ * @param end until where the variable is valid
+ * @return new local variable object
+ * @see LocalVariable
+ */
+ public LocalVariableGen addLocalVariable( final String name, final Type type, final int slot,
+ final InstructionHandle start, final InstructionHandle end ) {
+ return addLocalVariable(name, type, slot, start, end, slot);
+ }
+
/**
* Adds a local variable to this method and assigns an index automatically.
*
* @param name variable name
* @param type variable type
- * @param start from where the variable is valid, if this is null, it is
- * valid from the start
- * @param end until where the variable is valid, if this is null, it is
- * valid to the end
+ * @param start from where the variable is valid, if this is null,
+ * it is valid from the start
+ * @param end until where the variable is valid, if this is null,
+ * it is valid to the end
* @return new local variable object
* @see LocalVariable
*/
- public LocalVariableGen addLocalVariable(final String name, final Type type,
- final InstructionHandle start, final InstructionHandle end) {
+ public LocalVariableGen addLocalVariable( final String name, final Type type, final InstructionHandle start,
+ final InstructionHandle end ) {
return addLocalVariable(name, type, max_locals, start, end);
}
+
/**
* Remove a local variable, its slot will not be reused, if you do not use
* addLocalVariable with an explicit index argument.
@@ -333,6 +329,7 @@
variable_vec.remove(l);
}
+
/**
* Remove all local variables.
*/
@@ -340,6 +337,7 @@
variable_vec.clear();
}
+
/*
* If the range of the variable has not been set yet, it will be set to be valid from
* the start to the end of the instruction list.
@@ -347,44 +345,17 @@
* @return array of declared local variables sorted by index
*/
public LocalVariableGen[] getLocalVariables() {
- return getLocalVariableOrTypes(false);
- }
-
- /*
- * If the range of the variable has not been set yet, it will be set to be
- * valid from the start to the end of the instruction list.
- *
- * @return array of declared local variable types sorted by index
- */
- private LocalVariableGen[] getLocalVariableTypes() {
- return getLocalVariableOrTypes(true);
- }
-
- /*
- * If the range of the variable or type has not been set yet, it will be set
- * to be valid from the start to the end of the instruction list.
- *
- * @return array of declared local variables or types sorted by index
- */
- private LocalVariableGen[] getLocalVariableOrTypes(boolean isLVT) {
- int size = (isLVT) ? type_vec.size() : variable_vec.size();
- LocalVariableGen[] lg = new LocalVariableGen[size];
- if (isLVT) {
- type_vec.toArray(lg);
- } else {
- variable_vec.toArray(lg);
- }
-
+ final int size = variable_vec.size();
+ final LocalVariableGen[] lg = new LocalVariableGen[size];
+ variable_vec.toArray(lg);
for (int i = 0; i < size; i++) {
- if (lg[i].getStart() == null) {
+ if ((lg[i].getStart() == null) && (il != null)) {
lg[i].setStart(il.getStart());
}
-
- if (lg[i].getEnd() == null) {
+ if ((lg[i].getEnd() == null) && (il != null)) {
lg[i].setEnd(il.getEnd());
}
}
-
if (size > 1) {
Arrays.sort(lg, new Comparator<LocalVariableGen>() {
@Override
@@ -393,15 +364,14 @@
}
});
}
-
return lg;
}
+
/**
- * @return `LocalVariableTable' attribute of all the local variables of this
- * method.
+ * @return `LocalVariableTable' attribute of all the local variables of this method.
*/
- public LocalVariableTable getLocalVariableTable(final ConstantPoolGen cp) {
+ public LocalVariableTable getLocalVariableTable( final ConstantPoolGen cp ) {
final LocalVariableGen[] lg = getLocalVariables();
final int size = lg.length;
final LocalVariable[] lv = new LocalVariable[size];
@@ -413,68 +383,10 @@
}
/**
- * @return `LocalVariableTypeTable' attribute of all the local variable
- * types of this method.
- */
- public LocalVariableTypeTable getLocalVariableTypeTable(ConstantPoolGen cp) {
- LocalVariableGen[] lg = getLocalVariableTypes();
- int size = lg.length;
- LocalVariable[] lv = new LocalVariable[size];
-
- for (int i = 0; i < size; i++) {
- lv[i] = lg[i].getLocalVariable(cp);
- }
-
- return new LocalVariableTypeTable(cp.addUtf8("LocalVariableTypeTable"),
- 2 + lv.length * 10, lv, cp.getConstantPool());
- }
-
- /**
- * Adds a local variable type to this method.
- *
- * @param name variable name
- * @param type variable type
- * @param slot the index of the local variable, if type is long or double,
- * the next available index is slot+2
- * @param start from where the variable is valid
- * @param end until where the variable is valid
- * @return new local variable object
- * @see LocalVariable
+ * @return `LocalVariableTypeTable' attribute of this method.
*/
- private LocalVariableGen addLocalVariableType(String name, Type type, int slot,
- InstructionHandle start,
- InstructionHandle end) {
- byte t = type.getType();
-
- if (t != Const.T_ADDRESS) {
- int add = type.getSize();
-
- if (slot + add > max_locals) {
- max_locals = slot + add;
- }
-
- LocalVariableGen l = new LocalVariableGen(slot, name, type, start, end);
- int i;
-
- if ((i = type_vec.indexOf(l)) >= 0) // Overwrite if necessary
- {
- type_vec.set(i, l);
- } else {
- type_vec.add(l);
- }
-
- return l;
- } else {
- throw new IllegalArgumentException("Can not use " + type
- + " as type for local variable");
- }
- }
-
- /**
- * Remove all local variable types.
- */
- private void removeLocalVariableTypes() {
- type_vec.clear();
+ public LocalVariableTypeTable getLocalVariableTypeTable() {
+ return local_variable_type_table;
}
/**
@@ -484,19 +396,21 @@
* @return new line number object
* @see LineNumber
*/
- public LineNumberGen addLineNumber(final InstructionHandle ih, final int src_line) {
+ public LineNumberGen addLineNumber( final InstructionHandle ih, final int src_line ) {
final LineNumberGen l = new LineNumberGen(ih, src_line);
line_number_vec.add(l);
return l;
}
+
/**
* Remove a line number.
*/
- public void removeLineNumber(final LineNumberGen l) {
+ public void removeLineNumber( final LineNumberGen l ) {
line_number_vec.remove(l);
}
+
/**
* Remove all line numbers.
*/
@@ -504,6 +418,7 @@
line_number_vec.clear();
}
+
/*
* @return array of line numbers
*/
@@ -513,11 +428,11 @@
return lg;
}
+
/**
- * @return `LineNumberTable' attribute of all the local variables of this
- * method.
+ * @return `LineNumberTable' attribute of all the local variables of this method.
*/
- public LineNumberTable getLineNumberTable(final ConstantPoolGen cp) {
+ public LineNumberTable getLineNumberTable( final ConstantPoolGen cp ) {
final int size = line_number_vec.size();
final LineNumber[] ln = new LineNumber[size];
for (int i = 0; i < size; i++) {
@@ -527,9 +442,10 @@
.getConstantPool());
}
+
/**
- * Add an exception handler, i.e., specify region where a handler is active
- * and an instruction where the actual handling is done.
+ * Add an exception handler, i.e., specify region where a handler is active and an
+ * instruction where the actual handling is done.
*
* @param start_pc Start of region (inclusive)
* @param end_pc End of region (inclusive)
@@ -538,8 +454,8 @@
* exception is handled
* @return new exception handler object
*/
- public CodeExceptionGen addExceptionHandler(final InstructionHandle start_pc,
- final InstructionHandle end_pc, final InstructionHandle handler_pc, final ObjectType catch_type) {
+ public CodeExceptionGen addExceptionHandler( final InstructionHandle start_pc,
+ final InstructionHandle end_pc, final InstructionHandle handler_pc, final ObjectType catch_type ) {
if ((start_pc == null) || (end_pc == null) || (handler_pc == null)) {
throw new ClassGenException("Exception handler target is null instruction");
}
@@ -548,13 +464,15 @@
return c;
}
+
/**
* Remove an exception handler.
*/
- public void removeExceptionHandler(final CodeExceptionGen c) {
+ public void removeExceptionHandler( final CodeExceptionGen c ) {
exception_vec.remove(c);
}
+
/**
* Remove all line numbers.
*/
@@ -562,6 +480,7 @@
exception_vec.clear();
}
+
/*
* @return array of declared exception handlers
*/
@@ -571,6 +490,7 @@
return cg;
}
+
/**
* @return code exceptions for `Code' attribute
*/
@@ -578,28 +498,31 @@
final int size = exception_vec.size();
final CodeException[] c_exc = new CodeException[size];
for (int i = 0; i < size; i++) {
- final CodeExceptionGen c = exception_vec.get(i);
+ final CodeExceptionGen c = exception_vec.get(i);
c_exc[i] = c.getCodeException(super.getConstantPool());
}
return c_exc;
}
+
/**
* Add an exception possibly thrown by this method.
*
* @param class_name (fully qualified) name of exception
*/
- public void addException(final String class_name) {
+ public void addException( final String class_name ) {
throws_vec.add(class_name);
}
+
/**
* Remove an exception.
*/
- public void removeException(final String c) {
+ public void removeException( final String c ) {
throws_vec.remove(c);
}
+
/**
* Remove all exceptions.
*/
@@ -607,6 +530,7 @@
throws_vec.clear();
}
+
/*
* @return array of thrown exceptions
*/
@@ -616,11 +540,11 @@
return e;
}
+
/**
- * @return `Exceptions' attribute of all the exceptions thrown by this
- * method.
+ * @return `Exceptions' attribute of all the exceptions thrown by this method.
*/
- private ExceptionTable getExceptionTable(final ConstantPoolGen cp) {
+ private ExceptionTable getExceptionTable( final ConstantPoolGen cp ) {
final int size = throws_vec.size();
final int[] ex = new int[size];
for (int i = 0; i < size; i++) {
@@ -629,32 +553,45 @@
return new ExceptionTable(cp.addUtf8("Exceptions"), 2 + 2 * size, ex, cp.getConstantPool());
}
+
/**
* Add an attribute to the code. Currently, the JVM knows about the
- * LineNumberTable, LocalVariableTable and StackMap attributes, where the
- * former two will be generated automatically and the latter is used for the
- * MIDP only. Other attributes will be ignored by the JVM but do no harm.
+ * LineNumberTable, LocalVariableTable and StackMap attributes,
+ * where the former two will be generated automatically and the
+ * latter is used for the MIDP only. Other attributes will be
+ * ignored by the JVM but do no harm.
*
* @param a attribute to be added
*/
- public void addCodeAttribute(final Attribute a) {
+ public void addCodeAttribute( final Attribute a ) {
code_attrs_vec.add(a);
}
+
+ /**
+ * Remove the LocalVariableTypeTable
+ */
+ public void removeLocalVariableTypeTable( ) {
+ local_variable_type_table = null;
+ }
+
/**
* Remove a code attribute.
*/
- public void removeCodeAttribute(final Attribute a) {
+ public void removeCodeAttribute( final Attribute a ) {
code_attrs_vec.remove(a);
}
+
/**
* Remove all code attributes.
*/
public void removeCodeAttributes() {
+ local_variable_type_table = null;
code_attrs_vec.clear();
}
+
/**
* @return all attributes of this method.
*/
@@ -668,31 +605,31 @@
* @since 6.0
*/
public void addAnnotationsAsAttribute(final ConstantPoolGen cp) {
- final Attribute[] attrs = AnnotationEntryGen.getAnnotationAttributes(cp, super.getAnnotationEntries());
+ final Attribute[] attrs = AnnotationEntryGen.getAnnotationAttributes(cp, super.getAnnotationEntries());
for (final Attribute attr : attrs) {
addAttribute(attr);
}
- }
+ }
/**
* @since 6.0
*/
- public void addParameterAnnotationsAsAttribute(final ConstantPoolGen cp) {
- if (!hasParameterAnnotations) {
- return;
- }
- final Attribute[] attrs = AnnotationEntryGen.getParameterAnnotationAttributes(cp, param_annotations);
- if (attrs != null) {
- for (final Attribute attr : attrs) {
- addAttribute(attr);
- }
- }
- }
+ public void addParameterAnnotationsAsAttribute(final ConstantPoolGen cp) {
+ if (!hasParameterAnnotations) {
+ return;
+ }
+ final Attribute[] attrs = AnnotationEntryGen.getParameterAnnotationAttributes(cp,param_annotations);
+ if (attrs != null) {
+ for (final Attribute attr : attrs) {
+ addAttribute(attr);
+ }
+ }
+ }
+
/**
- * Get method object. Never forget to call setMaxStack() or
- * setMaxStack(max), respectively, before calling this method (the same
- * applies for max locals).
+ * Get method object. Never forget to call setMaxStack() or setMaxStack(max), respectively,
+ * before calling this method (the same applies for max locals).
*
* @return method object
*/
@@ -709,19 +646,19 @@
}
LineNumberTable lnt = null;
LocalVariableTable lvt = null;
- LocalVariableTypeTable lvtt = null;
-
- /* Create LocalVariableTable, LocalvariableTypeTable, and LineNumberTable
- * attributes (for debuggers, e.g.)
+ /* Create LocalVariableTable and LineNumberTable attributes (for debuggers, e.g.)
*/
if ((variable_vec.size() > 0) && !strip_attributes) {
+ updateLocalVariableTable(getLocalVariableTable(_cp));
addCodeAttribute(lvt = getLocalVariableTable(_cp));
}
-
- if ((type_vec.size() > 0) && !strip_attributes) {
- addCodeAttribute(lvtt = getLocalVariableTypeTable(_cp));
+ if (local_variable_type_table != null) {
+ // LocalVariable length in LocalVariableTypeTable is not updated automatically. It's a difference with LocalVariableTable.
+ if (lvt != null) {
+ adjustLocalVariableTypeTable(lvt);
+ }
+ addCodeAttribute(local_variable_type_table);
}
-
if ((line_number_vec.size() > 0) && !strip_attributes) {
addCodeAttribute(lnt = getLineNumberTable(_cp));
}
@@ -762,8 +699,8 @@
if (lvt != null) {
removeCodeAttribute(lvt);
}
- if (lvtt != null) {
- removeCodeAttribute(lvtt);
+ if (local_variable_type_table != null) {
+ removeCodeAttribute(local_variable_type_table);
}
if (lnt != null) {
removeCodeAttribute(lnt);
@@ -777,6 +714,41 @@
return m;
}
+ private void updateLocalVariableTable(final LocalVariableTable a) {
+ final LocalVariable[] lv = a.getLocalVariableTable();
+ removeLocalVariables();
+ for (final LocalVariable l : lv) {
+ InstructionHandle start = il.findHandle(l.getStartPC());
+ final InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength());
+ // Repair malformed handles
+ if (null == start) {
+ start = il.getStart();
+ }
+ // end == null => live to end of method
+ // Since we are recreating the LocalVaraible, we must
+ // propagate the orig_index to new copy.
+ addLocalVariable(l.getName(), Type.getType(l.getSignature()), l
+ .getIndex(), start, end, l.getOrigIndex());
+ }
+ }
+
+ private void adjustLocalVariableTypeTable(final LocalVariableTable lvt) {
+ final LocalVariable[] lv = lvt.getLocalVariableTable();
+ final LocalVariable[] lvg = local_variable_type_table.getLocalVariableTypeTable();
+
+ for (final LocalVariable element : lvg) {
+ for (final LocalVariable l : lv) {
+ if (element.getName().equals(l.getName()) && element.getIndex() == l.getOrigIndex()) {
+ element.setLength(l.getLength());
+ element.setStartPC(l.getStartPC());
+ element.setIndex(l.getIndex());
+ break;
+ }
+ }
+ }
+ }
+
+
/**
* Remove all NOPs from the instruction list (if possible) and update every
* object referring to them, i.e., branch instructions, local variables and
@@ -804,92 +776,111 @@
}
}
+
/**
* Set maximum number of local variables.
*/
- public void setMaxLocals(final int m) {
+ public void setMaxLocals( final int m ) {
max_locals = m;
}
+
public int getMaxLocals() {
return max_locals;
}
+
/**
* Set maximum stack size for this method.
*/
- public void setMaxStack(final int m) { // TODO could be package-protected?
+ public void setMaxStack( final int m ) { // TODO could be package-protected?
max_stack = m;
}
+
public int getMaxStack() {
return max_stack;
}
- /**
- * @return class that contains this method
+
+ /** @return class that contains this method
*/
public String getClassName() {
return class_name;
}
- public void setClassName(final String class_name) { // TODO could be package-protected?
+
+ public void setClassName( final String class_name ) { // TODO could be package-protected?
this.class_name = class_name;
}
- public void setReturnType(final Type return_type) {
+
+ public void setReturnType( final Type return_type ) {
setType(return_type);
}
+
public Type getReturnType() {
return getType();
}
- public void setArgumentTypes(final Type[] arg_types) {
+
+ public void setArgumentTypes( final Type[] arg_types ) {
this.arg_types = arg_types;
}
+
public Type[] getArgumentTypes() {
return arg_types.clone();
}
- public void setArgumentType(final int i, final Type type) {
+
+ public void setArgumentType( final int i, final Type type ) {
arg_types[i] = type;
}
- public Type getArgumentType(final int i) {
+
+ public Type getArgumentType( final int i ) {
return arg_types[i];
}
- public void setArgumentNames(final String[] arg_names) {
+
+ public void setArgumentNames( final String[] arg_names ) {
this.arg_names = arg_names;
}
+
public String[] getArgumentNames() {
return arg_names.clone();
}
- public void setArgumentName(final int i, final String name) {
+
+ public void setArgumentName( final int i, final String name ) {
arg_names[i] = name;
}
- public String getArgumentName(final int i) {
+
+ public String getArgumentName( final int i ) {
return arg_names[i];
}
+
public InstructionList getInstructionList() {
return il;
}
- public void setInstructionList(final InstructionList il) { // TODO could be package-protected?
+
+ public void setInstructionList( final InstructionList il ) { // TODO could be package-protected?
this.il = il;
}
+
@Override
public String getSignature() {
return Type.getMethodSignature(super.getType(), arg_types);
}
+
/**
* Computes max. stack size by performing control flow analysis.
*/
@@ -901,6 +892,7 @@
}
}
+
/**
* Compute maximum number of local variables.
*/
@@ -929,11 +921,11 @@
}
}
- /**
- * Do not/Do produce attributes code attributesLineNumberTable and
+
+ /** Do not/Do produce attributes code attributesLineNumberTable and
* LocalVariableTable, like javac -O
*/
- public void stripAttributes(final boolean flag) {
+ public void stripAttributes( final boolean flag ) {
strip_attributes = flag;
}
@@ -942,6 +934,7 @@
final InstructionHandle target;
final int stackDepth;
+
BranchTarget(final InstructionHandle target, final int stackDepth) {
this.target = target;
this.stackDepth = stackDepth;
@@ -953,13 +946,15 @@
private final Stack<BranchTarget> branchTargets = new Stack<>();
private final Map<InstructionHandle, BranchTarget> visitedTargets = new HashMap<>();
- public void push(final InstructionHandle target, final int stackDepth) {
+
+ public void push( final InstructionHandle target, final int stackDepth ) {
if (visited(target)) {
return;
}
branchTargets.push(visit(target, stackDepth));
}
+
public BranchTarget pop() {
if (!branchTargets.empty()) {
final BranchTarget bt = branchTargets.pop();
@@ -968,25 +963,26 @@
return null;
}
- private BranchTarget visit(final InstructionHandle target, final int stackDepth) {
+
+ private BranchTarget visit( final InstructionHandle target, final int stackDepth ) {
final BranchTarget bt = new BranchTarget(target, stackDepth);
visitedTargets.put(target, bt);
return bt;
}
- private boolean visited(final InstructionHandle target) {
+
+ private boolean visited( final InstructionHandle target ) {
return visitedTargets.get(target) != null;
}
}
+
/**
- * Computes stack usage of an instruction list by performing control flow
- * analysis.
+ * Computes stack usage of an instruction list by performing control flow analysis.
*
* @return maximum stack depth used by method
*/
- public static int getMaxStack(final ConstantPoolGen cp, final InstructionList il,
- final CodeExceptionGen[] et) {
+ public static int getMaxStack( final ConstantPoolGen cp, final InstructionList il, final CodeExceptionGen[] et ) {
final BranchStack branchTargets = new BranchStack();
/* Initially, populate the branch stack with the exception
* handlers, because these aren't (necessarily) branched to
@@ -1059,29 +1055,29 @@
private List<MethodObserver> observers;
- /**
- * Add observer for this object.
+
+ /** Add observer for this object.
*/
- public void addObserver(final MethodObserver o) {
+ public void addObserver( final MethodObserver o ) {
if (observers == null) {
observers = new ArrayList<>();
}
observers.add(o);
}
- /**
- * Remove observer for this object.
+
+ /** Remove observer for this object.
*/
- public void removeObserver(final MethodObserver o) {
+ public void removeObserver( final MethodObserver o ) {
if (observers != null) {
observers.remove(o);
}
}
- /**
- * Call notify() method on all observers. This method is not called
- * automatically whenever the state has changed, but has to be called by the
- * user after he has finished editing the object.
+
+ /** Call notify() method on all observers. This method is not called
+ * automatically whenever the state has changed, but has to be
+ * called by the user after he has finished editing the object.
*/
public void update() {
if (observers != null) {
@@ -1091,9 +1087,10 @@
}
}
+
/**
- * Return string representation close to declaration format, e.g. public
- * static void main(String[]) throws IOException'
+ * Return string representation close to declaration format,
+ * `public static void main(String[]) throws IOException', e.g.
*
* @return String representation of the method.
*/
@@ -1118,10 +1115,10 @@
return buf.toString();
}
- /**
- * @return deep copy of this method
+
+ /** @return deep copy of this method
*/
- public MethodGen copy(final String class_name, final ConstantPoolGen cp) {
+ public MethodGen copy( final String class_name, final ConstantPoolGen cp ) {
final Method m = ((MethodGen) clone()).getMethod();
final MethodGen mg = new MethodGen(m, class_name, super.getConstantPool());
if (super.getConstantPool() != cp) {
@@ -1135,7 +1132,6 @@
// is more likely to suggest to the caller it is readonly (which a List does not).
/**
* Return a list of AnnotationGen objects representing parameter annotations
- *
* @since 6.0
*/
public List<AnnotationEntryGen> getAnnotationsOnParameter(final int i) {
@@ -1154,7 +1150,8 @@
* deleted. (The annotations will be rebuilt as attributes when someone
* builds a Method object out of this MethodGen object).
*/
- private void ensureExistingParameterAnnotationsUnpacked() {
+ private void ensureExistingParameterAnnotationsUnpacked()
+ {
if (haveUnpackedParameterAnnotations) {
return;
}
@@ -1163,9 +1160,11 @@
ParameterAnnotations paramAnnVisAttr = null;
ParameterAnnotations paramAnnInvisAttr = null;
for (final Attribute attribute : attrs) {
- if (attribute instanceof ParameterAnnotations) {
+ if (attribute instanceof ParameterAnnotations)
+ {
// Initialize param_annotations
- if (!hasParameterAnnotations) {
+ if (!hasParameterAnnotations)
+ {
@SuppressWarnings({"rawtypes", "unchecked"})
final List<AnnotationEntryGen>[] parmList = new List[arg_types.length];
param_annotations = parmList;
@@ -1180,13 +1179,13 @@
} else {
paramAnnInvisAttr = rpa;
}
- for (int j = 0; j < arg_types.length; j++) {
+ final ParameterAnnotationEntry[] parameterAnnotationEntries = rpa.getParameterAnnotationEntries();
+ for (int j = 0; j < parameterAnnotationEntries.length; j++)
+ {
// This returns Annotation[] ...
- final ParameterAnnotationEntry immutableArray = rpa
- .getParameterAnnotationEntries()[j];
+ final ParameterAnnotationEntry immutableArray = rpa.getParameterAnnotationEntries()[j];
// ... which needs transforming into an AnnotationGen[] ...
- final List<AnnotationEntryGen> mutable
- = makeMutableVersion(immutableArray.getAnnotationEntries());
+ final List<AnnotationEntryGen> mutable = makeMutableVersion(immutableArray.getAnnotationEntries());
// ... then add these to any we already know about
param_annotations[j].addAll(mutable);
}
@@ -1201,7 +1200,8 @@
haveUnpackedParameterAnnotations = true;
}
- private List<AnnotationEntryGen> makeMutableVersion(final AnnotationEntry[] mutableArray) {
+ private List<AnnotationEntryGen> makeMutableVersion(final AnnotationEntry[] mutableArray)
+ {
final List<AnnotationEntryGen> result = new ArrayList<>();
for (final AnnotationEntry element : mutableArray) {
result.add(new AnnotationEntryGen(element, getConstantPool(),
@@ -1211,18 +1211,23 @@
}
public void addParameterAnnotation(final int parameterIndex,
- final AnnotationEntryGen annotation) {
+ final AnnotationEntryGen annotation)
+ {
ensureExistingParameterAnnotationsUnpacked();
- if (!hasParameterAnnotations) {
+ if (!hasParameterAnnotations)
+ {
@SuppressWarnings({"rawtypes", "unchecked"})
final List<AnnotationEntryGen>[] parmList = new List[arg_types.length];
param_annotations = parmList;
hasParameterAnnotations = true;
}
final List<AnnotationEntryGen> existingAnnotations = param_annotations[parameterIndex];
- if (existingAnnotations != null) {
+ if (existingAnnotations != null)
+ {
existingAnnotations.add(annotation);
- } else {
+ }
+ else
+ {
final List<AnnotationEntryGen> l = new ArrayList<>();
l.add(annotation);
param_annotations[parameterIndex] = l;
@@ -1236,28 +1241,31 @@
return bcelComparator;
}
+
/**
* @param comparator Comparison strategy object
*/
- public static void setComparator(final BCELComparator comparator) {
+ public static void setComparator( final BCELComparator comparator ) {
bcelComparator = comparator;
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default two
- * MethodGen objects are said to be equal when their names and signatures
- * are equal.
+ * Return value as defined by given BCELComparator strategy.
+ * By default two MethodGen objects are said to be equal when
+ * their names and signatures are equal.
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(final Object obj) {
+ public boolean equals( final Object obj ) {
return bcelComparator.equals(this, obj);
}
+
/**
- * Return value as defined by given BCELComparator strategy. By default
- * return the hashcode of the method's name XOR signature.
+ * Return value as defined by given BCELComparator strategy.
+ * By default return the hashcode of the method's name XOR signature.
*
* @see java.lang.Object#hashCode()
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MethodObserver.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MethodObserver.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Implement this interface if you're interested in changes to a MethodGen object
* and register yourself with addObserver().
*
- * @version $Id: MethodObserver.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface MethodObserver {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/NEW.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/NEW.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,14 +27,14 @@
* NEW - Create new object
* <PRE>Stack: ... -> ..., objectref</PRE>
*
- * @version $Id: NEW.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class NEW extends CPInstruction implements LoadClass, AllocationInstruction,
ExceptionThrower, StackProducer {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
NEW() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/NEWARRAY.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/NEWARRAY.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,18 +20,19 @@
package com.sun.org.apache.bcel.internal.generic;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
import com.sun.org.apache.bcel.internal.ExceptionConst;
import com.sun.org.apache.bcel.internal.util.ByteSequence;
-import java.io.DataOutputStream;
-import java.io.IOException;
/**
* NEWARRAY - Create new array of basic type (int, short, ...)
* <PRE>Stack: ..., count -> ..., arrayref</PRE>
* type must be one of T_INT, T_SHORT, ...
*
- * @version $Id: NEWARRAY.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class NEWARRAY extends Instruction implements AllocationInstruction, ExceptionThrower,
StackProducer {
@@ -40,8 +41,8 @@
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
NEWARRAY() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/NOP.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/NOP.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,7 +24,7 @@
/**
* NOP - Do nothing
*
- * @version $Id: NOP.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class NOP extends Instruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/NamedAndTyped.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/NamedAndTyped.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Denote entity that has both name and type. This is true for local variables,
* methods and fields.
*
- * @version $Id: NamedAndTyped.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface NamedAndTyped {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ObjectType.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ObjectType.java Wed Jun 26 12:12:25 2019 +0530
@@ -28,7 +28,7 @@
/**
* Denotes reference such as java.lang.String.
*
- * @version $Id: ObjectType.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public class ObjectType extends ReferenceType {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/POP.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/POP.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
*
* <PRE>Stack: ..., word -> ...</PRE>
*
- * @version $Id: POP.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class POP extends StackInstruction implements PopInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/POP2.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/POP2.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
*
* <PRE>Stack: ..., word2, word1 -> ...</PRE>
*
- * @version $Id: POP2.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class POP2 extends StackInstruction implements PopInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/PUSH.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/PUSH.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,7 +26,8 @@
* Wrapper class for push operations, which are implemented either as BIPUSH,
* LDC or xCONST_n instructions.
*
- * @version $Id: PUSH.java 1749598 2016-06-21 20:36:33Z ggregory $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public final class PUSH implements CompoundInstruction, VariableLengthInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/PUTFIELD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/PUTFIELD.java Wed Jun 26 12:12:25 2019 +0530
@@ -30,13 +30,13 @@
* OR
* <PRE>Stack: ..., objectref, value.word1, value.word2 -> ...</PRE>
*
- * @version $Id: PUTFIELD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class PUTFIELD extends FieldInstruction implements PopInstruction, ExceptionThrower {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
PUTFIELD() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/PUTSTATIC.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/PUTSTATIC.java Wed Jun 26 12:12:25 2019 +0530
@@ -30,13 +30,13 @@
* OR
* <PRE>Stack: ..., value.word1, value.word2 -> ...</PRE>
*
- * @version $Id: PUTSTATIC.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class PUTSTATIC extends FieldInstruction implements ExceptionThrower, PopInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
PUTSTATIC() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/PopInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/PopInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Denotes an unparameterized instruction to pop a value on top from the stack,
* such as ISTORE, POP, PUTSTATIC.
*
- * @version $Id: PopInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see ISTORE
* @see POP
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/PushInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/PushInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Denotes an unparameterized instruction to produce a value on top of the stack,
* such as ILOAD, LDC, SIPUSH, DUP, ICONST, etc.
*
- * @version $Id: PushInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see ILOAD
* @see ICONST
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/RET.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/RET.java Wed Jun 26 12:12:25 2019 +0530
@@ -31,7 +31,7 @@
*
* <PRE>Stack: ... -> ...</PRE>
*
- * @version $Id: RET.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class RET extends Instruction implements IndexedInstruction, TypedInstruction {
@@ -40,8 +40,8 @@
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
RET() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/RETURN.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/RETURN.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* RETURN - Return from void method
* <PRE>Stack: ... -> <empty></PRE>
*
- * @version $Id: RETURN.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class RETURN extends ReturnInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,7 +27,7 @@
/**
* Super class for object and array types.
*
- * @version $Id: ReferenceType.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public abstract class ReferenceType extends Type {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReturnInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReturnInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,15 +26,15 @@
/**
* Super class for the xRETURN family of instructions.
*
- * @version $Id: ReturnInstruction.java 1747278 2016-06-07 17:28:43Z britter $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class ReturnInstruction extends Instruction implements ExceptionThrower,
TypedInstruction, StackConsumer {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
ReturnInstruction() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReturnaddressType.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReturnaddressType.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,7 +27,7 @@
* Returnaddress, the type JSR or JSR_W instructions push upon the stack.
*
* see vmspec2 3.3.3
- * @version $Id: ReturnaddressType.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public class ReturnaddressType extends Type {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SALOAD.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SALOAD.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* SALOAD - Load short from array
* <PRE>Stack: ..., arrayref, index -> ..., value</PRE>
*
- * @version $Id: SALOAD.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class SALOAD extends ArrayInstruction implements StackProducer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SASTORE.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SASTORE.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* SASTORE - Store into short array
* <PRE>Stack: ..., arrayref, index, value -> ...</PRE>
*
- * @version $Id: SASTORE.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class SASTORE extends ArrayInstruction implements StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SIPUSH.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SIPUSH.java Wed Jun 26 12:12:25 2019 +0530
@@ -30,7 +30,7 @@
*
* <PRE>Stack: ... -> ..., value</PRE>
*
- * @version $Id: SIPUSH.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class SIPUSH extends Instruction implements ConstantPushInstruction {
@@ -38,8 +38,8 @@
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
SIPUSH() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SWAP.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SWAP.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* SWAP - Swa top operand stack word
* <PRE>Stack: ..., word2, word1 -> ..., word1, word2</PRE>
*
- * @version $Id: SWAP.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public class SWAP extends StackInstruction implements StackConsumer, StackProducer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SWITCH.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SWITCH.java Wed Jun 26 12:12:25 2019 +0530
@@ -26,7 +26,7 @@
* TABLESWITCH instruction, depending on whether the match values (int[]) can be
* sorted with no gaps between the numbers.
*
- * @version $Id: SWITCH.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*/
public final class SWITCH implements CompoundInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Select.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Select.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -27,13 +27,13 @@
/**
* Select - Abstract super class for LOOKUPSWITCH and TABLESWITCH instructions.
*
- * <p>
- * We use our super's <code>target</code> property as the default target.
+ * <p>We use our super's <code>target</code> property as the default target.
*
- * @version $Id: Select.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see LOOKUPSWITCH
* @see TABLESWITCH
* @see InstructionList
+ * @LastModified: Jun 2019
*/
public abstract class Select extends BranchInstruction implements VariableLengthInstruction,
StackConsumer /* @since 6.0 */, StackProducer {
@@ -52,9 +52,10 @@
Select() {
}
+
/**
- * (Match, target) pairs for switch. `Match' and `targets' must have the
- * same length of course.
+ * (Match, target) pairs for switch.
+ * `Match' and `targets' must have the same length of course.
*
* @param match array of matching values
* @param targets instruction targets
@@ -71,31 +72,28 @@
notifyTarget(null, target2, this);
}
if ((match_length = match.length) != targets.length) {
- throw new ClassGenException("Match and target array have not the same length: Match length: "
- + match.length + " Target length: " + targets.length);
+ throw new ClassGenException("Match and target array have not the same length: Match length: " +
+ match.length + " Target length: " + targets.length);
}
indices = new int[match_length];
}
+
/**
* Since this is a variable length instruction, it may shift the following
* instructions which then need to update their position.
*
- * Called by InstructionList.setPositions when setting the position for
- * every instruction. In the presence of variable length instructions
- * `setPositions' performs multiple passes over the instruction list to
- * calculate the correct (byte) positions and offsets by calling this
- * function.
+ * Called by InstructionList.setPositions when setting the position for every
+ * instruction. In the presence of variable length instructions `setPositions'
+ * performs multiple passes over the instruction list to calculate the
+ * correct (byte) positions and offsets by calling this function.
*
- * @param offset additional offset caused by preceding (variable length)
- * instructions
- * @param max_offset the maximum offset that may be caused by these
- * instructions
- * @return additional offset caused by possible change of this instruction's
- * length
+ * @param offset additional offset caused by preceding (variable length) instructions
+ * @param max_offset the maximum offset that may be caused by these instructions
+ * @return additional offset caused by possible change of this instruction's length
*/
@Override
- protected int updatePosition(final int offset, final int max_offset) {
+ protected int updatePosition( final int offset, final int max_offset ) {
setPosition(getPosition() + offset); // Additional offset caused by preceding SWITCHs, GOTOs, etc.
final short old_length = (short) super.getLength();
/* Alignment on 4-byte-boundary, + 1, because of tag byte.
@@ -105,13 +103,13 @@
return super.getLength() - old_length;
}
+
/**
* Dump instruction as byte code to stream out.
- *
* @param out Output stream
*/
@Override
- public void dump(final DataOutputStream out) throws IOException {
+ public void dump( final DataOutputStream out ) throws IOException {
out.writeByte(super.getOpcode());
for (int i = 0; i < padding; i++) {
out.writeByte(0);
@@ -120,11 +118,12 @@
out.writeInt(super.getIndex());
}
+
/**
* Read needed data (e.g. index) from file.
*/
@Override
- protected void initFromFile(final ByteSequence bytes, final boolean wide) throws IOException {
+ protected void initFromFile( final ByteSequence bytes, final boolean wide ) throws IOException {
padding = (4 - (bytes.getIndex() % 4)) % 4; // Compute number of pad bytes
for (int i = 0; i < padding; i++) {
bytes.readByte();
@@ -133,11 +132,12 @@
super.setIndex(bytes.readInt());
}
+
/**
* @return mnemonic for instruction
*/
@Override
- public String toString(final boolean verbose) {
+ public String toString( final boolean verbose ) {
final StringBuilder buf = new StringBuilder(super.toString(verbose));
if (verbose) {
for (int i = 0; i < match_length; i++) {
@@ -154,20 +154,22 @@
return buf.toString();
}
+
/**
* Set branch target for `i'th case
*/
- public void setTarget(final int i, final InstructionHandle target) { // TODO could be package-protected?
+ public void setTarget( final int i, final InstructionHandle target ) { // TODO could be package-protected?
notifyTarget(targets[i], target, this);
targets[i] = target;
}
+
/**
* @param old_ih old target
* @param new_ih new target
*/
@Override
- public void updateTarget(final InstructionHandle old_ih, final InstructionHandle new_ih) {
+ public void updateTarget( final InstructionHandle old_ih, final InstructionHandle new_ih ) {
boolean targeted = false;
if (super.getTarget() == old_ih) {
targeted = true;
@@ -184,11 +186,12 @@
}
}
+
/**
* @return true, if ih is target of this instruction
*/
@Override
- public boolean containsTarget(final InstructionHandle ih) {
+ public boolean containsTarget( final InstructionHandle ih ) {
if (super.getTarget() == ih) {
return true;
}
@@ -200,6 +203,7 @@
return false;
}
+
@Override
protected Object clone() throws CloneNotSupportedException {
final Select copy = (Select) super.clone();
@@ -209,6 +213,7 @@
return copy;
}
+
/**
* Inform targets that they're not targeted anymore.
*/
@@ -220,6 +225,7 @@
}
}
+
/**
* @return array of match indices
*/
@@ -227,6 +233,7 @@
return match;
}
+
/**
* @return array of match target offsets
*/
@@ -234,6 +241,7 @@
return indices;
}
+
/**
* @return array of match targets
*/
@@ -249,6 +257,7 @@
return match[index];
}
+
/**
* @return index entry from indices
* @since 6.0
@@ -265,6 +274,7 @@
return targets[index];
}
+
/**
* @return the fixed_length
* @since 6.0
@@ -273,6 +283,7 @@
return fixed_length;
}
+
/**
* @param fixed_length the fixed_length to set
* @since 6.0
@@ -281,6 +292,7 @@
this.fixed_length = fixed_length;
}
+
/**
* @return the match_length
* @since 6.0
@@ -289,6 +301,7 @@
return match_length;
}
+
/**
* @param match_length the match_length to set
* @since 6.0
@@ -344,9 +357,8 @@
return padding;
}
- /**
- * @since 6.0
- */
+
+ /** @since 6.0 */
final int setIndices(final int i, final int value) {
indices[i] = value;
return value; // Allow use in nested calls
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/StackConsumer.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/StackConsumer.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,7 +24,7 @@
/**
* Denote an instruction that may consume a value from the stack.
*
- * @version $Id: StackConsumer.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface StackConsumer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/StackInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/StackInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,13 +24,13 @@
/**
* Super class for stack operations like DUP and POP.
*
- * @version $Id: StackInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public abstract class StackInstruction extends Instruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
StackInstruction() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/StackProducer.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/StackProducer.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Denote an instruction that may produce a value on top of the stack
* (this excludes DUP_X1, e.g.)
*
- * @version $Id: StackProducer.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface StackProducer {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/StoreInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/StoreInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,13 +25,13 @@
* Denotes an unparameterized instruction to store a value into a local variable,
* e.g. ISTORE.
*
- * @version $Id: StoreInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public abstract class StoreInstruction extends LocalVariableInstruction implements PopInstruction {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
* tag and length are defined in readInstruction and initFromFile, respectively.
*/
StoreInstruction(final short canon_tag, final short c_tag) {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/TABLESWITCH.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/TABLESWITCH.java Wed Jun 26 12:12:25 2019 +0530
@@ -29,14 +29,14 @@
/**
* TABLESWITCH - Switch within given range of values, i.e., low..high
*
- * @version $Id: TABLESWITCH.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see SWITCH
*/
public class TABLESWITCH extends Select {
/**
- * Empty constructor needed for the Class.newInstance() statement in
- * Instruction.readInstruction(). Not to be used otherwise.
+ * Empty constructor needed for Instruction.readInstruction.
+ * Not to be used otherwise.
*/
TABLESWITCH() {
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/TargetLostException.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/TargetLostException.java Wed Jun 26 12:12:25 2019 +0530
@@ -47,7 +47,7 @@
* @see InstructionHandle
* @see InstructionList
* @see InstructionTargeter
- * @version $Id: TargetLostException.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public final class TargetLostException extends Exception {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Type.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Type.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -27,10 +27,11 @@
import com.sun.org.apache.bcel.internal.classfile.Utility;
/**
- * Abstract super class for all possible java types, namely basic types such as
- * int, object types like String and array types, e.g. int[]
+ * Abstract super class for all possible java types, namely basic types
+ * such as int, object types like String and array types, e.g. int[]
*
- * @version $Id: Type.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public abstract class Type {
@@ -59,11 +60,13 @@
public static final Type UNKNOWN = new Type(Const.T_UNKNOWN, "<unknown object>") {
};
+
protected Type(final byte t, final String s) {
type = t;
signature = s;
}
+
/**
* @return hashcode of Type
*/
@@ -72,18 +75,20 @@
return type ^ signature.hashCode();
}
+
/**
* @return whether the Types are equal
*/
@Override
public boolean equals(final Object o) {
- if (o instanceof Type) {
- final Type t = (Type) o;
- return (type == t.type) && signature.equals(t.signature);
- }
- return false;
+ if (o instanceof Type) {
+ final Type t = (Type)o;
+ return (type == t.type) && signature.equals(t.signature);
+ }
+ return false;
}
+
/**
* @return signature for given type.
*/
@@ -91,6 +96,7 @@
return signature;
}
+
/**
* @return type as defined in Constants
*/
@@ -99,11 +105,9 @@
}
/**
- * boolean, short and char variable are considered as int in the stack or
- * local variable area. Returns {@link Type#INT} for
- * {@link Type#BOOLEAN}, {@link Type#SHORT} or {@link Type#CHAR}, otherwise
+ * boolean, short and char variable are considered as int in the stack or local variable area.
+ * Returns {@link Type#INT} for {@link Type#BOOLEAN}, {@link Type#SHORT} or {@link Type#CHAR}, otherwise
* returns the given type.
- *
* @since 6.0
*/
public Type normalizeForStackOrLocal() {
@@ -114,8 +118,7 @@
}
/**
- * @return stack size of this type (2 for long and double, 0 for void, 1
- * otherwise)
+ * @return stack size of this type (2 for long and double, 0 for void, 1 otherwise)
*/
public int getSize() {
switch (type) {
@@ -129,6 +132,7 @@
}
}
+
/**
* @return Type string, e.g. `int[]'
*/
@@ -138,6 +142,7 @@
.signatureToString(signature, false);
}
+
/**
* Convert type to Java method signature, e.g. int[] f(java.lang.String x)
* becomes (Ljava/lang/String;)[I
@@ -146,7 +151,7 @@
* @param arg_types what are the argument types
* @return method signature for given type(s).
*/
- public static String getMethodSignature(final Type return_type, final Type[] arg_types) {
+ public static String getMethodSignature( final Type return_type, final Type[] arg_types ) {
final StringBuilder buf = new StringBuilder("(");
if (arg_types != null) {
for (final Type arg_type : arg_types) {
@@ -166,22 +171,24 @@
}
};//int consumed_chars=0; // Remember position in string, see getArgumentTypes
- private static int unwrap(final ThreadLocal<Integer> tl) {
+
+ private static int unwrap( final ThreadLocal<Integer> tl ) {
return tl.get().intValue();
}
- private static void wrap(final ThreadLocal<Integer> tl, final int value) {
+
+ private static void wrap( final ThreadLocal<Integer> tl, final int value ) {
tl.set(Integer.valueOf(value));
}
+
/**
* Convert signature to a Type object.
- *
* @param signature signature string such as Ljava/lang/String;
* @return type object
*/
// @since 6.0 no longer final
- public static Type getType(final String signature) throws StringIndexOutOfBoundsException {
+ public static Type getType( final String signature ) throws StringIndexOutOfBoundsException {
final byte type = Utility.typeOfSignature(signature);
if (type <= Const.T_VOID) {
//corrected concurrent private static field acess
@@ -208,13 +215,14 @@
}
}
+
/**
* Convert return value of a method (signature) to a Type object.
*
* @param signature signature string such as (Ljava/lang/String;)V
* @return return type
*/
- public static Type getReturnType(final String signature) {
+ public static Type getReturnType( final String signature ) {
try {
// Read return type after `)'
final int index = signature.lastIndexOf(')') + 1;
@@ -224,13 +232,13 @@
}
}
+
/**
* Convert arguments of a method (signature) to an array of Type objects.
- *
* @param signature signature string such as (Ljava/lang/String;)V
* @return array of argument types
*/
- public static Type[] getArgumentTypes(final String signature) {
+ public static Type[] getArgumentTypes( final String signature ) {
final List<Type> vec = new ArrayList<>();
int index;
Type[] types;
@@ -252,13 +260,12 @@
return types;
}
- /**
- * Convert runtime java.lang.Class to BCEL Type object.
- *
+
+ /** Convert runtime java.lang.Class to BCEL Type object.
* @param cl Java class
* @return corresponding Type object
*/
- public static Type getType(final java.lang.Class<?> cl) {
+ public static Type getType( final java.lang.Class<?> cl ) {
if (cl == null) {
throw new IllegalArgumentException("Class must not be null");
}
@@ -296,13 +303,13 @@
}
}
+
/**
* Convert runtime java.lang.Class[] to BCEL Type objects.
- *
* @param classes an array of runtime class objects
* @return array of corresponding Type objects
*/
- public static Type[] getTypes(final java.lang.Class<?>[] classes) {
+ public static Type[] getTypes( final java.lang.Class<?>[] classes ) {
final Type[] ret = new Type[classes.length];
for (int i = 0; i < ret.length; i++) {
ret[i] = getType(classes[i]);
@@ -310,7 +317,8 @@
return ret;
}
- public static String getSignature(final java.lang.reflect.Method meth) {
+
+ public static String getSignature( final java.lang.reflect.Method meth ) {
final StringBuilder sb = new StringBuilder("(");
final Class<?>[] params = meth.getParameterTypes(); // avoid clone
for (final Class<?> param : params) {
@@ -333,7 +341,7 @@
return consumed << 2 | size;
}
- static int getArgumentTypesSize(final String signature) {
+ static int getArgumentTypesSize( final String signature ) {
int res = 0;
int index;
try { // Read all declarations between for `(' and `)'
@@ -352,7 +360,7 @@
return res;
}
- static int getTypeSize(final String signature) throws StringIndexOutOfBoundsException {
+ static int getTypeSize( final String signature ) throws StringIndexOutOfBoundsException {
final byte type = Utility.typeOfSignature(signature);
if (type <= Const.T_VOID) {
return encode(BasicType.getType(type).getSize(), 1);
@@ -373,6 +381,7 @@
}
}
+
static int getReturnTypeSize(final String signature) {
final int index = signature.lastIndexOf(')') + 1;
return Type.size(getTypeSize(signature.substring(index)));
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/TypedInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/TypedInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Get the type associated with an instruction, int for ILOAD, or the type
* of the field of a PUTFIELD instruction, e.g..
*
- * @version $Id: TypedInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface TypedInstruction {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/UnconditionalBranch.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/UnconditionalBranch.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,7 +24,7 @@
/**
* Denotes an instruction to perform an unconditional branch, i.e., GOTO, JSR.
*
- * @version $Id: UnconditionalBranch.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see GOTO
* @see JSR
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/VariableLengthInstruction.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/VariableLengthInstruction.java Wed Jun 26 12:12:25 2019 +0530
@@ -25,7 +25,7 @@
* Denotes an instruction to be a variable length instruction, such as
* GOTO, JSR, LOOKUPSWITCH and TABLESWITCH.
*
- * @version $Id: VariableLengthInstruction.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see GOTO
* @see JSR
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Visitor.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Visitor.java Wed Jun 26 12:12:25 2019 +0530
@@ -27,7 +27,7 @@
* instructions with the properly typed methods just by calling the accept()
* method.
*
- * @version $Id: Visitor.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public interface Visitor {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/AttributeHTML.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/AttributeHTML.java Wed Jun 26 12:12:25 2019 +0530
@@ -45,7 +45,7 @@
/**
* Convert found attributes into HTML file.
*
- * @version $Id: AttributeHTML.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*
*/
final class AttributeHTML {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELComparator.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELComparator.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,7 +24,7 @@
/**
* Used for BCEL comparison strategy
*
- * @version $Id: BCELComparator.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @since 5.2
*/
public interface BCELComparator {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -64,8 +64,8 @@
* A helper class for BCELifier.
*
* @see BCELifier
- * @version $Id: BCELFactory.java 1749603 2016-06-21 20:50:19Z ggregory $
- * @LastModified: Oct 2017
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
class BCELFactory extends EmptyVisitor {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELifier.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELifier.java Wed Jun 26 12:12:25 2019 +0530
@@ -46,7 +46,7 @@
* are done with BCEL. It does not cover all features of BCEL,
* but tries to mimic hand-written code as close as possible.
*
- * @version $Id: BCELifier.java 1750228 2016-06-25 21:47:44Z ggregory $
+ * @version $Id$
*/
public class BCELifier extends com.sun.org.apache.bcel.internal.classfile.EmptyVisitor {
@@ -284,7 +284,7 @@
/** Default main method
*/
- public static void _main( final String[] argv ) throws Exception {
+ public static void main( final String[] argv ) throws Exception {
if (argv.length != 1) {
System.out.println("Usage: BCELifier classname");
System.out.println("\tThe class must exist on the classpath");
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ByteSequence.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ByteSequence.java Wed Jun 26 12:12:25 2019 +0530
@@ -29,7 +29,7 @@
* via the `readByte()' method. This is used to implement a wrapper for the
* Java byte code stream to gain some more readability.
*
- * @version $Id: ByteSequence.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
*/
public final class ByteSequence extends DataInputStream {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/Class2HTML.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/Class2HTML.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -37,24 +37,24 @@
/**
* Read class file(s) and convert them into HTML files.
*
- * Given a JavaClass object "class" that is in package "package" five files will
- * be created in the specified directory.
+ * Given a JavaClass object "class" that is in package "package" five files
+ * will be created in the specified directory.
*
* <OL>
- * <LI> "package"."class".html as the main file which defines the frames for the
- * following subfiles.
- * <LI> "package"."class"_attributes.html contains all (known) attributes found
- * in the file
- * <LI> "package"."class"_cp.html contains the constant pool
- * <LI> "package"."class"_code.html contains the byte code
- * <LI> "package"."class"_methods.html contains references to all methods and
- * fields of the class
+ * <LI> "package"."class".html as the main file which defines the frames for
+ * the following subfiles.
+ * <LI> "package"."class"_attributes.html contains all (known) attributes found in the file
+ * <LI> "package"."class"_cp.html contains the constant pool
+ * <LI> "package"."class"_code.html contains the byte code
+ * <LI> "package"."class"_methods.html contains references to all methods and fields of the class
* </OL>
*
- * All subfiles reference each other appropriately, e.g. clicking on a method in
- * the Method's frame will jump to the appropriate method in the Code frame.
+ * All subfiles reference each other appropriately, e.g. clicking on a
+ * method in the Method's frame will jump to the appropriate method in
+ * the Code frame.
*
- * @version $Id: Class2HTML.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class Class2HTML {
@@ -111,7 +111,8 @@
attribute_html.close();
}
- public static void _main(final String[] argv) throws IOException {
+
+ public static void main( final String[] argv ) throws IOException {
final String[] file_name = new String[argv.length];
int files = 0;
ClassParser parser = null;
@@ -129,7 +130,6 @@
dir = dir + sep;
}
final File store = new File(dir);
-
if (!store.isDirectory()) {
final boolean created = store.mkdirs(); // Create target directory if necessary
if (!created) {
@@ -176,7 +176,8 @@
+ "</A>";
}
- static String referenceType(final String type) {
+
+ static String referenceType( final String type ) {
String short_type = Utility.compactClassName(type);
short_type = Utility.compactClassName(short_type, class_package + ".", true);
final int index = type.indexOf('['); // Type is an array?
@@ -191,7 +192,8 @@
return "<A HREF=\"" + base_type + ".html\" TARGET=_top>" + short_type + "</A>";
}
- static String toHTML(final String str) {
+
+ static String toHTML( final String str ) {
final StringBuilder buf = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
char ch;
@@ -215,7 +217,8 @@
return buf.toString();
}
- private void writeMainHTML(final AttributeHTML attribute_html) throws IOException {
+
+ private void writeMainHTML( final AttributeHTML attribute_html ) throws IOException {
try (PrintWriter file = new PrintWriter(new FileOutputStream(dir + class_name + ".html"))) {
file.println("<HTML>\n" + "<HEAD><TITLE>Documentation for " + class_name + "</TITLE>" + "</HEAD>\n"
+ "<FRAMESET BORDER=1 cols=\"30%,*\">\n" + "<FRAMESET BORDER=1 rows=\"80%,*\">\n"
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassQueue.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassQueue.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -24,26 +24,32 @@
import com.sun.org.apache.bcel.internal.classfile.JavaClass;
/**
- * Utility class implementing a (typesafe) queue of JavaClass objects.
+ * Utility class implementing a (typesafe) queue of JavaClass
+ * objects.
*
- * @version $Id: ClassQueue.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class ClassQueue {
private final LinkedList<JavaClass> vec = new LinkedList<>();
- public void enqueue(final JavaClass clazz) {
+
+ public void enqueue( final JavaClass clazz ) {
vec.addLast(clazz);
}
+
public JavaClass dequeue() {
return vec.removeFirst();
}
+
public boolean empty() {
return vec.isEmpty();
}
+
@Override
public String toString() {
return vec.toString();
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassSet.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassSet.java Wed Jun 26 12:12:25 2019 +0530
@@ -32,7 +32,7 @@
* Since JavaClass has no equals() method, the name of the class is
* used for comparison.
*
- * @version $Id: ClassSet.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see ClassStack
*/
public class ClassSet {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassStack.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassStack.java Wed Jun 26 12:12:25 2019 +0530
@@ -22,12 +22,13 @@
package com.sun.org.apache.bcel.internal.util;
import java.util.Stack;
+
import com.sun.org.apache.bcel.internal.classfile.JavaClass;
/**
* Utility class implementing a (typesafe) stack of JavaClass objects.
*
- * @version $Id: ClassStack.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
* @see Stack
*/
public class ClassStack {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/CodeHTML.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/CodeHTML.java Wed Jun 26 12:12:25 2019 +0530
@@ -44,7 +44,7 @@
/**
* Convert code into HTML file.
*
- * @version $Id: CodeHTML.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*
*/
final class CodeHTML {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ConstantHTML.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ConstantHTML.java Wed Jun 26 12:12:25 2019 +0530
@@ -40,7 +40,7 @@
/**
* Convert constant pool into HTML file.
*
- * @version $Id: ConstantHTML.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*
*/
final class ConstantHTML {
@@ -54,8 +54,8 @@
private final Method[] methods;
- ConstantHTML(final String dir, final String class_name, final String class_package,
- final Method[] methods, final ConstantPool constant_pool) throws IOException {
+ ConstantHTML(final String dir, final String class_name, final String class_package, final Method[] methods,
+ final ConstantPool constant_pool) throws IOException {
this.class_name = class_name;
this.class_package = class_package;
this.constant_pool = constant_pool;
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/InstructionFinder.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/InstructionFinder.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -62,10 +62,10 @@
*
* </pre>
*
- * @version $Id: InstructionFinder.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
* @see com.sun.org.apache.bcel.internal.generic.Instruction
* @see InstructionList
- * @LastModified: Oct 2017
+ * @LastModified: Jun 2019
*/
public class InstructionFinder {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/MethodHTML.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/MethodHTML.java Wed Jun 26 12:12:25 2019 +0530
@@ -37,7 +37,7 @@
/**
* Convert methods and fields into HTML file.
*
- * @version $Id: MethodHTML.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @version $Id$
*
*/
final class MethodHTML {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ModularRuntimeImage.java Wed Jun 26 12:12:25 2019 +0530
@@ -0,0 +1,158 @@
+/*
+ * reserved comment block
+ * DO NOT REMOVE OR ALTER!
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.org.apache.bcel.internal.util;
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.DirectoryStream;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Wraps a Java 9 JEP 220 modular runtime image. Requires the JRT NIO file system.
+ *
+ * @since 6.3
+ */
+public class ModularRuntimeImage implements Closeable {
+
+ static final String MODULES_PATH = File.separator + "modules";
+ static final String PACKAGES_PATH = File.separator + "packages";
+
+ private final URLClassLoader classLoader;
+ private final FileSystem fileSystem;
+
+ /**
+ * Constructs a default instance.
+ *
+ * @throws IOException
+ * an I/O error occurs accessing the file system
+ */
+ public ModularRuntimeImage() throws IOException {
+ this(null, FileSystems.getFileSystem(URI.create("jrt:/")));
+ }
+
+ /**
+ * Constructs an instance using the JRT file system implementation from a specific Java Home.
+ *
+ * @param javaHome
+ * Path to a Java 9 or greater home.
+ *
+ * @throws IOException
+ * an I/O error occurs accessing the file system
+ */
+ public ModularRuntimeImage(final String javaHome) throws IOException {
+ final Map<String, ?> emptyMap = Collections.emptyMap();
+ final Path jrePath = Paths.get(javaHome);
+ final Path jrtFsPath = jrePath.resolve("lib").resolve("jrt-fs.jar");
+ this.classLoader = new URLClassLoader(new URL[] {jrtFsPath.toUri().toURL() });
+ this.fileSystem = FileSystems.newFileSystem(URI.create("jrt:/"), emptyMap, classLoader);
+ }
+
+ private ModularRuntimeImage(final URLClassLoader cl, final FileSystem fs) {
+ this.classLoader = cl;
+ this.fileSystem = fs;
+ }
+
+ @Override
+ public void close() throws IOException {
+ if (classLoader != null) {
+ if (classLoader != null) {
+ classLoader.close();
+ }
+ if (fileSystem != null) {
+ fileSystem.close();
+ }
+ }
+ }
+
+ /**
+ * Lists all entries in the given directory.
+ *
+ * @param dirPath
+ * directory path.
+ * @return a list of dir entries if an I/O error occurs
+ * @throws IOException
+ * an I/O error occurs accessing the file system
+ */
+ public List<Path> list(final Path dirPath) throws IOException {
+ final List<Path> list = new ArrayList<>();
+ try (DirectoryStream<Path> ds = Files.newDirectoryStream(dirPath)) {
+ final Iterator<Path> iterator = ds.iterator();
+ while (iterator.hasNext()) {
+ list.add(iterator.next());
+ }
+ }
+ return list;
+ }
+
+ /**
+ * Lists all entries in the given directory.
+ *
+ * @param dirName
+ * directory path.
+ * @return a list of dir entries if an I/O error occurs
+ * @throws IOException
+ * an I/O error occurs accessing the file system
+ */
+ public List<Path> list(final String dirName) throws IOException {
+ return list(fileSystem.getPath(dirName));
+ }
+
+ /**
+ * Lists all modules.
+ *
+ * @return a list of modules
+ * @throws IOException
+ * an I/O error occurs accessing the file system
+ */
+ public List<Path> modules() throws IOException {
+ return list(MODULES_PATH);
+ }
+
+ /**
+ * Lists all packages.
+ *
+ * @return a list of modules
+ * @throws IOException
+ * an I/O error occurs accessing the file system
+ */
+ public List<Path> packages() throws IOException {
+ return list(PACKAGES_PATH);
+ }
+
+ public FileSystem getFileSystem() {
+ return fileSystem;
+ }
+
+}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/Repository.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/Repository.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,44 +22,50 @@
import com.sun.org.apache.bcel.internal.classfile.JavaClass;
/**
- * Abstract definition of a class repository. Instances may be used to load
- * classes from different sources and may be used in the
+ * Abstract definition of a class repository. Instances may be used
+ * to load classes from different sources and may be used in the
* Repository.setRepository method.
*
* @see com.sun.org.apache.bcel.internal.Repository
- * @version $Id: Repository.java 1747278 2016-06-07 17:28:43Z britter $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public interface Repository {
/**
- * Store the provided class under "clazz.getClassName()"
+ * Stores the provided class under "clazz.getClassName()"
*/
- void storeClass(JavaClass clazz);
+ void storeClass( JavaClass clazz );
+
/**
- * Remove class from repository
+ * Removes class from repository
*/
- void removeClass(JavaClass clazz);
+ void removeClass( JavaClass clazz );
+
/**
- * Find the class with the name provided, if the class isn't there, return
- * NULL.
+ * Finds the class with the name provided, if the class
+ * isn't there, return NULL.
*/
- JavaClass findClass(String className);
+ JavaClass findClass( String className );
+
/**
- * Find the class with the name provided, if the class isn't there, make an
- * attempt to load it.
+ * Finds the class with the name provided, if the class
+ * isn't there, make an attempt to load it.
*/
- JavaClass loadClass(String className) throws java.lang.ClassNotFoundException;
+ JavaClass loadClass( String className ) throws java.lang.ClassNotFoundException;
+
/**
- * Find the JavaClass instance for the given run-time class object
+ * Finds the JavaClass instance for the given run-time class object
*/
- JavaClass loadClass(Class<?> clazz) throws java.lang.ClassNotFoundException;
+ JavaClass loadClass( Class<?> clazz ) throws java.lang.ClassNotFoundException;
+
/**
- * Clear all entries from cache.
+ * Clears all entries from cache.
*/
void clear();
}
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/SyntheticRepository.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/SyntheticRepository.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -39,8 +39,8 @@
*
* @see com.sun.org.apache.bcel.internal.Repository
*
- * @version $Id: SyntheticRepository.java 1748124 2016-06-13 08:02:16Z ggregory
- * $
+ * @version $Id$
+ * @LastModified: Jun 2019
*/
public class SyntheticRepository implements Repository {
@@ -79,7 +79,7 @@
final SoftReference<JavaClass> ref = loadedClasses.get(className);
if (ref == null) {
return null;
- }
+}
return ref.get();
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
package com.sun.tools.javac.util;
import java.util.HashSet;
+import java.util.Objects;
import java.util.Set;
import javax.tools.JavaFileObject;
@@ -147,7 +148,7 @@
deferredDiagnosticArg = currentSource;
} else if ((deferredDiagnosticKind == DeferredDiagnosticKind.IN_FILE
|| deferredDiagnosticKind == DeferredDiagnosticKind.ADDITIONAL_IN_FILE)
- && !equal(deferredDiagnosticSource, currentSource)) {
+ && !Objects.equals(deferredDiagnosticSource, currentSource)) {
// additional errors in more than one source file
deferredDiagnosticKind = DeferredDiagnosticKind.ADDITIONAL_IN_FILES;
deferredDiagnosticArg = null;
@@ -159,7 +160,7 @@
deferredDiagnosticSource = currentSource;
deferredDiagnosticArg = currentSource;
} else if (deferredDiagnosticKind == DeferredDiagnosticKind.IN_FILE &&
- !equal(deferredDiagnosticSource, currentSource)) {
+ !Objects.equals(deferredDiagnosticSource, currentSource)) {
// warnings in multiple source files
deferredDiagnosticKind = DeferredDiagnosticKind.IN_FILES;
deferredDiagnosticArg = null;
@@ -183,13 +184,6 @@
}
/**
- * Check two objects, each possibly null, are either both null or are equal.
- */
- private static boolean equal(Object o1, Object o2) {
- return ((o1 == null || o2 == null) ? (o1 == o2) : o1.equals(o2));
- }
-
- /**
* The log to which to report warnings.
*/
private Log log;
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Wed Jun 26 12:12:25 2019 +0530
@@ -211,20 +211,13 @@
native HotSpotResolvedJavaType lookupClass(Class<?> javaClass);
/**
- * Resolves the entry at index {@code cpi} in {@code constantPool} to an object.
- *
- * The behavior of this method is undefined if {@code cpi} does not denote one of the following
- * entry types: {@code JVM_CONSTANT_MethodHandle}, {@code JVM_CONSTANT_MethodHandleInError},
- * {@code JVM_CONSTANT_MethodType} and {@code JVM_CONSTANT_MethodTypeInError}.
- */
- native HotSpotObjectConstantImpl resolveConstantInPool(HotSpotConstantPool constantPool, int cpi);
-
- /**
* Resolves the entry at index {@code cpi} in {@code constantPool} to an object, looking in the
* constant pool cache first.
*
- * The behavior of this method is undefined if {@code cpi} does not denote a
- * {@code JVM_CONSTANT_String} entry.
+ * The behavior of this method is undefined if {@code cpi} does not denote one of the following
+ * entry types: {@code JVM_CONSTANT_String}, {@code JVM_CONSTANT_MethodHandle},
+ * {@code JVM_CONSTANT_MethodHandleInError}, {@code JVM_CONSTANT_MethodType} and
+ * {@code JVM_CONSTANT_MethodTypeInError}.
*/
native HotSpotObjectConstantImpl resolvePossiblyCachedConstantInPool(HotSpotConstantPool constantPool, int cpi);
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java Tue Jun 25 16:21:42 2019 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java Wed Jun 26 12:12:25 2019 +0530
@@ -545,7 +545,7 @@
case "MethodHandleInError":
case "MethodType":
case "MethodTypeInError":
- return compilerToVM().resolveConstantInPool(this, cpi);
+ return compilerToVM().resolvePossiblyCachedConstantInPool(this, cpi);
default:
throw new JVMCIError("Unknown constant pool tag %s", tag);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/c1/CCEMessageTest.java Wed Jun 26 12:12:25 2019 +0530
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8225644
+ * @summary C1 dumps incorrect class name in CCE message
+ * @run main/othervm compiler.c1.CCEMessageTest
+ * @run main/othervm -Xcomp -XX:TieredStopAtLevel=1 compiler.c1.CCEMessageTest
+ */
+
+package compiler.c1;
+
+public class CCEMessageTest {
+ public static void main(String... args) {
+ String[] s = null;
+ try {
+ s = (String[])new Object[1];
+ } catch (ClassCastException cce) {
+ if (!cce.getMessage().contains("[Ljava.lang.String;"))
+ throw new AssertionError("Incorrect CCE message", cce);
+ }
+ if (s != null)
+ throw new AssertionError("Unexpected error");
+ }
+}
--- a/test/hotspot/jtreg/compiler/jvmci/common/patches/jdk.internal.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java Tue Jun 25 16:21:42 2019 +0530
+++ b/test/hotspot/jtreg/compiler/jvmci/common/patches/jdk.internal.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java Wed Jun 26 12:12:25 2019 +0530
@@ -101,11 +101,6 @@
}
}
- public static Object resolveConstantInPool(ConstantPool constantPool, int cpi) {
- DirectHotSpotObjectConstantImpl obj = (DirectHotSpotObjectConstantImpl) CTVM.resolveConstantInPool((HotSpotConstantPool) constantPool, cpi);
- return obj.object;
- }
-
public static Object resolvePossiblyCachedConstantInPool(ConstantPool constantPool, int cpi) {
DirectHotSpotObjectConstantImpl obj = (DirectHotSpotObjectConstantImpl) CTVM.resolvePossiblyCachedConstantInPool((HotSpotConstantPool) constantPool, cpi);
return obj.object;
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java Tue Jun 25 16:21:42 2019 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8136421
- * @requires vm.jvmci
- * @library /test/lib /
- * @library ../common/patches
- * @modules java.base/jdk.internal.access
- * java.base/jdk.internal.reflect
- * java.base/jdk.internal.org.objectweb.asm
- * jdk.internal.vm.ci/jdk.vm.ci.hotspot
- * jdk.internal.vm.ci/jdk.vm.ci.runtime
- * jdk.internal.vm.ci/jdk.vm.ci.meta
- *
- * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:.
- * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- * -XX:-UseJVMCICompiler
- * compiler.jvmci.compilerToVM.ResolveConstantInPoolTest
- */
-
-package compiler.jvmci.compilerToVM;
-
-import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
-import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
-import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
-import jdk.test.lib.Asserts;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.meta.ConstantPool;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodType;
-import java.util.HashMap;
-import java.util.Map;
-
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE;
-import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE;
-
-/**
- * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveConstantInPool} method
- */
-public class ResolveConstantInPoolTest {
-
- private static final String NOT_NULL_MSG
- = "Object returned by resolveConstantInPool method should not be null";
-
- public static void main(String[] args) throws Exception {
- Map<ConstantTypes, Validator> typeTests = new HashMap<>();
- typeTests.put(CONSTANT_METHODHANDLE, ResolveConstantInPoolTest::validateMethodHandle);
- typeTests.put(CONSTANT_METHODTYPE, ResolveConstantInPoolTest::validateMethodType);
- ConstantPoolTestCase testCase = new ConstantPoolTestCase(typeTests);
- testCase.test();
- // The next "Class.forName" and repeating "testCase.test()"
- // are here for the following reason.
- // The first test run is without dummy class initialization,
- // which means no constant pool cache exists.
- // The second run is with initialized class (with constant pool cache available).
- // Some CompilerToVM methods require different input
- // depending on whether CP cache exists or not.
- for (DummyClasses dummy : DummyClasses.values()) {
- Class.forName(dummy.klass.getName());
- }
- testCase.test();
- }
-
- private static void validateMethodHandle(ConstantPool constantPoolCTVM,
- ConstantTypes cpType,
- DummyClasses dummyClass,
- int index) {
- Object constantInPool = CompilerToVMHelper.resolveConstantInPool(constantPoolCTVM, index);
- String msg = String.format("%s for index %d", NOT_NULL_MSG, index);
- Asserts.assertNotNull(constantInPool, msg);
- if (!(constantInPool instanceof MethodHandle)) {
- msg = String.format("Wrong constant pool entry accessed by index"
- + " %d: %s, but should be subclass of %s",
- index,
- constantInPool.getClass(),
- MethodHandle.class.getName());
- throw new AssertionError(msg);
- }
- }
-
- private static void validateMethodType(ConstantPool constantPoolCTVM,
- ConstantTypes cpType,
- DummyClasses dummyClass,
- int index) {
- Object constantInPool = CompilerToVMHelper.resolveConstantInPool(constantPoolCTVM, index);
- String msg = String.format("%s for index %d", NOT_NULL_MSG, index);
- Asserts.assertNotNull(constantInPool, msg);
- Class mtToVerify = constantInPool.getClass();
- Class mtToRefer = MethodType.class;
- msg = String.format("Wrong method type class accessed by"
- + " constant pool index %d",
- index);
- Asserts.assertEQ(mtToRefer, mtToVerify, msg);
- }
-}
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java Tue Jun 25 16:21:42 2019 +0530
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java Wed Jun 26 12:12:25 2019 +0530
@@ -24,6 +24,7 @@
/*
* @test
* @bug 8138708
+ * @bug 8136421
* @requires vm.jvmci
* @library /test/lib /
* @library ../common/patches
@@ -54,9 +55,13 @@
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.meta.ConstantPool;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodType;
import java.util.HashMap;
import java.util.Map;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE;
+import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE;
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_STRING;
/**
@@ -67,10 +72,17 @@
public static void main(String[] args) throws Exception {
Map<ConstantTypes, Validator> typeTests = new HashMap<>();
typeTests.put(CONSTANT_STRING, ResolvePossiblyCachedConstantInPoolTest::validateString);
+ typeTests.put(CONSTANT_METHODHANDLE, ResolvePossiblyCachedConstantInPoolTest::validateMethodHandle);
+ typeTests.put(CONSTANT_METHODTYPE, ResolvePossiblyCachedConstantInPoolTest::validateMethodType);
ConstantPoolTestCase testCase = new ConstantPoolTestCase(typeTests);
- // The next "Class.forName" is here for the following reason.
- // When class is initialized, constant pool cache is available.
- // This method works only with cached constant pool.
+ testCase.test();
+ // The next "Class.forName" and repeating "testCase.test()"
+ // are here for the following reason.
+ // The first test run is without dummy class initialization,
+ // which means no constant pool cache exists.
+ // The second run is with initialized class (with constant pool cache available).
+ // Some CompilerToVM methods require different input
+ // depending on whether CP cache exists or not.
for (DummyClasses dummy : DummyClasses.values()) {
Class.forName(dummy.klass.getName());
}
@@ -101,4 +113,40 @@
String msg = String.format("Wrong string accessed by %sconstant pool index %d", cached, index);
Asserts.assertEQ(stringToRefer, stringToVerify, msg);
}
+
+ private static final String NOT_NULL_MSG
+ = "Object returned by resolvePossiblyCachedConstantInPool method should not be null";
+
+
+ private static void validateMethodHandle(ConstantPool constantPoolCTVM,
+ ConstantTypes cpType,
+ DummyClasses dummyClass,
+ int index) {
+ Object constantInPool = CompilerToVMHelper.resolvePossiblyCachedConstantInPool(constantPoolCTVM, index);
+ String msg = String.format("%s for index %d", NOT_NULL_MSG, index);
+ Asserts.assertNotNull(constantInPool, msg);
+ if (!(constantInPool instanceof MethodHandle)) {
+ msg = String.format("Wrong constant pool entry accessed by index"
+ + " %d: %s, but should be subclass of %s",
+ index,
+ constantInPool.getClass(),
+ MethodHandle.class.getName());
+ throw new AssertionError(msg);
+ }
+ }
+
+ private static void validateMethodType(ConstantPool constantPoolCTVM,
+ ConstantTypes cpType,
+ DummyClasses dummyClass,
+ int index) {
+ Object constantInPool = CompilerToVMHelper.resolvePossiblyCachedConstantInPool(constantPoolCTVM, index);
+ String msg = String.format("%s for index %d", NOT_NULL_MSG, index);
+ Asserts.assertNotNull(constantInPool, msg);
+ Class mtToVerify = constantInPool.getClass();
+ Class mtToRefer = MethodType.class;
+ msg = String.format("Wrong method type class accessed by"
+ + " constant pool index %d",
+ index);
+ Asserts.assertEQ(mtToRefer, mtToVerify, msg);
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/Unsafe/InternalErrorTest.java Wed Jun 26 12:12:25 2019 +0530
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8191278
+ * @requires os.family != "windows"
+ * @summary Check that SIGBUS errors caused by memory accesses in Unsafe_CopyMemory()
+ * and UnsafeCopySwapMemory() get converted to java.lang.InternalError exceptions.
+ * @modules java.base/jdk.internal.misc
+ *
+ * @library /test/lib
+ * @build sun.hotspot.WhiteBox
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @run main/othervm -XX:CompileCommand=exclude,*InternalErrorTest.main -XX:CompileCommand=inline,*.get -XX:CompileCommand=inline,*Unsafe.* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI InternalErrorTest
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.file.Files;
+import jdk.internal.misc.Unsafe;
+import sun.hotspot.WhiteBox;
+
+// Test that illegal memory access errors in Unsafe_CopyMemory0() and
+// UnsafeCopySwapMemory() that cause SIGBUS errors result in
+// java.lang.InternalError exceptions, not JVM crashes.
+public class InternalErrorTest {
+
+ private static final Unsafe unsafe = Unsafe.getUnsafe();
+ private static final int pageSize = WhiteBox.getWhiteBox().getVMPageSize();
+ private static final String expectedErrorMsg = "fault occurred in a recent unsafe memory access";
+ private static final String failureMsg1 = "InternalError not thrown";
+ private static final String failureMsg2 = "Wrong InternalError: ";
+
+ public static void main(String[] args) throws Throwable {
+ Unsafe unsafe = Unsafe.getUnsafe();
+
+ String currentDir = System.getProperty("test.classes");
+ File file = new File(currentDir, "tmpFile.txt");
+
+ StringBuilder s = new StringBuilder();
+ for (int i = 1; i < pageSize + 1000; i++) {
+ s.append("1");
+ }
+ Files.write(file.toPath(), s.toString().getBytes());
+ FileChannel fileChannel = new RandomAccessFile(file, "r").getChannel();
+ MappedByteBuffer buffer =
+ fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, fileChannel.size());
+
+ // Get address of mapped memory.
+ long mapAddr = 0;
+ try {
+ Field af = java.nio.Buffer.class.getDeclaredField("address");
+ af.setAccessible(true);
+ mapAddr = af.getLong(buffer);
+ } catch (Exception f) {
+ throw f;
+ }
+ long allocMem = unsafe.allocateMemory(4000);
+
+ for (int i = 0; i < 3; i++) {
+ test(buffer, unsafe, mapAddr, allocMem, i);
+ }
+
+ Files.write(file.toPath(), "2".getBytes());
+ buffer.position(buffer.position() + pageSize);
+ for (int i = 0; i < 3; i++) {
+ try {
+ test(buffer, unsafe, mapAddr, allocMem, i);
+ WhiteBox.getWhiteBox().forceSafepoint();
+ throw new RuntimeException(failureMsg1);
+ } catch (InternalError e) {
+ if (!e.getMessage().contains(expectedErrorMsg)) {
+ throw new RuntimeException(failureMsg2 + e.getMessage());
+ }
+ }
+ }
+
+ Method m = InternalErrorTest.class.getMethod("test", MappedByteBuffer.class, Unsafe.class, long.class, long.class, int.class);
+ WhiteBox.getWhiteBox().enqueueMethodForCompilation(m, 3);
+
+ for (int i = 0; i < 3; i++) {
+ try {
+ test(buffer, unsafe, mapAddr, allocMem, i);
+ WhiteBox.getWhiteBox().forceSafepoint();
+ throw new RuntimeException(failureMsg1);
+ } catch (InternalError e) {
+ if (!e.getMessage().contains(expectedErrorMsg)) {
+ throw new RuntimeException(failureMsg2 + e.getMessage());
+ }
+ }
+ }
+
+ WhiteBox.getWhiteBox().enqueueMethodForCompilation(m, 4);
+
+ for (int i = 0; i < 3; i++) {
+ try {
+ test(buffer, unsafe, mapAddr, allocMem, i);
+ WhiteBox.getWhiteBox().forceSafepoint();
+ throw new RuntimeException(failureMsg1);
+ } catch (InternalError e) {
+ if (!e.getMessage().contains(expectedErrorMsg)) {
+ throw new RuntimeException(failureMsg2 + e.getMessage());
+ }
+ }
+ }
+
+ System.out.println("Success");
+ }
+
+ public static void test(MappedByteBuffer buffer, Unsafe unsafe, long mapAddr, long allocMem, int type) {
+ switch (type) {
+ case 0:
+ // testing Unsafe.copyMemory, trying to access a word from next page after truncation.
+ buffer.get(new byte[8]);
+ break;
+ case 1:
+ // testing Unsafe.copySwapMemory, trying to access next page after truncation.
+ unsafe.copySwapMemory(null, mapAddr + pageSize, new byte[4000], 16, 2000, 2);
+ break;
+ case 2:
+ // testing Unsafe.copySwapMemory, trying to access next page after truncation.
+ unsafe.copySwapMemory(null, mapAddr + pageSize, null, allocMem, 2000, 2);
+ break;
+ }
+ }
+
+}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001.java Tue Jun 25 16:21:42 2019 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,86 +28,7 @@
import nsk.share.*;
import nsk.share.jvmti.*;
-// THIS TEST IS LINE NUMBER SENSITIVE
-
-public class tc02t001 extends DebugeeClass {
-
- // run test from command line
- public static void main(String argv[]) {
- argv = nsk.share.jvmti.JVMTITest.commonInit(argv);
-
- // JCK-compatible exit
- System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE);
- }
-
- // run test from JCK-compatible environment
- public static int run(String argv[], PrintStream out) {
- return new tc02t001().runIt(argv, out);
- }
-
- /* =================================================================== */
-
- // scaffold objects
- ArgumentHandler argHandler = null;
- Log log = null;
- int status = Consts.TEST_PASSED;
- static long timeout = 0;
-
- // tested thread
- tc02t001Thread thread = null;
-
- // run debuggee
- public int runIt(String argv[], PrintStream out) {
- argHandler = new ArgumentHandler(argv);
- log = new Log(out, argHandler);
- timeout = argHandler.getWaitTime() * 60 * 1000;
- log.display("Timeout = " + timeout + " msc.");
-
- thread = new tc02t001Thread("Debuggee Thread");
- synchronized (thread.M) {
- thread.start();
- thread.startingBarrier.waitFor();
- status = checkStatus(status);
-
- thread.waitingBarrier1.unlock();
- try {
- Thread.sleep(1000); // Wait for contended "synchronized (M)"
- thread.M.wait(timeout);
- } catch (InterruptedException e) {
- throw new Failure(e);
- }
-
- thread.waitingBarrier2.unlock();
- try {
- Thread.sleep(1000); // Wait for contended "synchronized (M)"
- thread.M.wait(timeout);
- } catch (InterruptedException e) {
- throw new Failure(e);
- }
-
- thread.waitingBarrier3.unlock();
- try {
- Thread.sleep(1000); // Wait for contended "synchronized (M)"
- thread.M.wait(timeout);
- } catch (InterruptedException e) {
- throw new Failure(e);
- }
- }
-
- try {
- thread.join(timeout);
- } catch (InterruptedException e) {
- throw new Failure(e);
- }
-
- log.display("Debugee finished");
- status = checkStatus(status);
-
- return status;
- }
-}
-
-/* =================================================================== */
+// THIS CLASS IS LINE NUMBER SENSITIVE
class tc02t001Thread extends Thread {
public Wicket startingBarrier = new Wicket();
@@ -139,3 +60,97 @@
}
}
}
+
+/* =================================================================== */
+
+public class tc02t001 extends DebugeeClass {
+
+ // run test from command line
+ public static void main(String argv[]) {
+ argv = nsk.share.jvmti.JVMTITest.commonInit(argv);
+
+ // JCK-compatible exit
+ System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE);
+ }
+
+ // run test from JCK-compatible environment
+ public static int run(String argv[], PrintStream out) {
+ return new tc02t001().runIt(argv, out);
+ }
+
+ /* =================================================================== */
+
+ // scaffold objects
+ ArgumentHandler argHandler = null;
+ Log log = null;
+ int status = Consts.TEST_PASSED;
+ static long timeout = 0;
+
+ private static volatile int lastEnterEventsCount;
+ private static native int enterEventsCount();
+
+ // tested thread
+ tc02t001Thread thread = null;
+
+ static void log (String msg) { System.out.println(msg); }
+
+ private void waitForContendedEnterEvent() {
+ try {
+ for (int j = 0; j < (timeout / 20); j++) {
+ Thread.sleep(20);
+ if (enterEventsCount() > lastEnterEventsCount) {
+ log("Got expected MonitorContendedEnter event\n");
+ break;
+ }
+ }
+ if (enterEventsCount() == lastEnterEventsCount) {
+ String msg = "Timeout in waiting for a MonitorContendedEnter event";
+ throw new RuntimeException(msg);
+ }
+ thread.M.wait(timeout);
+ } catch (InterruptedException e) {
+ throw new Failure(e);
+ }
+ }
+
+ // run debuggee
+ public int runIt(String argv[], PrintStream out) {
+ argHandler = new ArgumentHandler(argv);
+ log = new Log(out, argHandler);
+ timeout = argHandler.getWaitTime() * 60 * 1000;
+ log.display("Timeout = " + timeout + " msc.");
+
+ thread = new tc02t001Thread("Debuggee Thread");
+ synchronized (thread.M) {
+ thread.start();
+ thread.startingBarrier.waitFor();
+ status = checkStatus(status);
+
+ lastEnterEventsCount = enterEventsCount();
+ thread.waitingBarrier1.unlock();
+ log("Waiting for MonitorEnterEvent #1");
+ waitForContendedEnterEvent();
+
+ lastEnterEventsCount = enterEventsCount();
+ thread.waitingBarrier2.unlock();
+ log("Waiting for MonitorEnterEvent #2");
+ waitForContendedEnterEvent();
+
+ lastEnterEventsCount = enterEventsCount();
+ thread.waitingBarrier3.unlock();
+ log("Waiting for MonitorEnterEvent #3");
+ waitForContendedEnterEvent();
+ }
+
+ try {
+ thread.join(timeout);
+ } catch (InterruptedException e) {
+ throw new Failure(e);
+ }
+
+ log.display("Debugee finished");
+ status = checkStatus(status);
+
+ return status;
+ }
+}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp Tue Jun 25 16:21:42 2019 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
static jthread thread = NULL;
static jobject object_M = NULL;
/* line numbers of "synchronized (M)" clauses in java part of the test */
-static jint lines[] = { 127, 132, 137 };
+static jint lines[] = { 48, 53, 58 };
static volatile int enterEventsCount = 0;
static volatile int enteredEventsCount = 0;
@@ -370,6 +370,11 @@
return JNI_OK;
}
+JNIEXPORT jint JNICALL
+Java_nsk_jvmti_scenarios_contention_TC02_tc02t001_enterEventsCount(JNIEnv* jni, jclass klass) {
+ return enterEventsCount;
+}
+
/* ========================================================================== */
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001.java Tue Jun 25 16:21:42 2019 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001.java Wed Jun 26 12:12:25 2019 +0530
@@ -86,23 +86,6 @@
", expected: " + THREADS_LIMIT*tc04t001Thread.INCREMENT_LIMIT);
status = Consts.TEST_FAILED;
}
-
-/* DEBUG -- to check if the threads taking turns in right order
- boolean race = false;
- for (int i = 1; i < 2*tc04t001Thread.INCREMENT_LIMIT; i++) {
- if (tc04t001Thread.passOrder[i] == tc04t001Thread.passOrder[i-1]) {
- race = true;
- System.out.println("Race condition in the test:");
- System.out.println("passOrder[" + (i-1) + "]:"
- + tc04t001Thread.passOrder[i-1]);
- System.out.println("passOrder[" + (i) + "]:"
- + tc04t001Thread.passOrder[i]);
- }
- }
- if (race)
- System.out.println("There was a race condition in the test.");
-*/
-
return status;
}
}
@@ -117,11 +100,6 @@
static volatile int value = 0;
static Flicker flicker = new Flicker();
-/* DEBUG -- to check if the threads taking turns in right order
- static volatile int iter = 0;
- static volatile int passOrder[] =
- new int[INCREMENT_LIMIT*tc04t001.THREADS_LIMIT];
-*/
private int id;
private static volatile int lastEnterEventsCount;
@@ -135,7 +113,6 @@
public synchronized void run() {
for (int i = 0; i < INCREMENT_LIMIT; i++) {
flicker.waitFor(id);
- lastEnterEventsCount = enterEventsCount();
increment(id);
try {
wait(1);
@@ -145,11 +122,9 @@
}
static synchronized void increment(int i) {
-/* DEBUG -- to check if the threads taking turns in right order
- passOrder[iter++] = i;
-*/
flicker.unlock(i);
int temp = value;
+ boolean done = false;
// Wait in a loop for a MonitorContendedEnter event.
// Timeout is: 20ms * DELAY.
@@ -158,17 +133,22 @@
sleep(20);
} catch (InterruptedException e) {}
+ done = (tc04t001.threadsDoneSignal.getCount() == 1);
+ if (done) {
+ break; // This thread is the only remaining thread, no more contention
+ }
if (enterEventsCount() > lastEnterEventsCount) {
+ System.out.println("Thread-" + i + ": increment event: " + enterEventsCount());
break; // Got an expected MonitorContendedEnter event
}
}
- System.out.println("Thread-" + i + ": increment event: " + enterEventsCount());
- if (enterEventsCount() == lastEnterEventsCount) {
+ if (!done && enterEventsCount() == lastEnterEventsCount) {
String msg = "Timeout in waiting for a MonitorContendedEnter event";
throw new RuntimeException(msg);
}
value = temp + 1;
+ lastEnterEventsCount = enterEventsCount();
}
}
--- a/test/jdk/ProblemList.txt Tue Jun 25 16:21:42 2019 +0530
+++ b/test/jdk/ProblemList.txt Wed Jun 26 12:12:25 2019 +0530
@@ -875,7 +875,3 @@
############################################################################
-# jdk/internal/docker
-
-jdk/internal/platform/docker/TestDockerMemoryMetrics.java 8224506 generic-all
-jdk/internal/platform/docker/TestSystemMetrics.java 8224502 generic-all
--- a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java Tue Jun 25 16:21:42 2019 +0530
+++ b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,7 +63,7 @@
testOomKillFlag("100m", false);
testOomKillFlag("100m", true);
- testMemoryFailCount("20m");
+ testMemoryFailCount("64m");
testMemorySoftLimit("500m","200m");
--- a/test/jdk/jdk/internal/platform/docker/TestSystemMetrics.java Tue Jun 25 16:21:42 2019 +0530
+++ b/test/jdk/jdk/internal/platform/docker/TestSystemMetrics.java Wed Jun 26 12:12:25 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,7 @@
DockerRunOptions opts =
new DockerRunOptions(imageName, "/jdk/bin/java", "jdk.test.lib.containers.cgroup.MetricsTester");
opts.addDockerOpts("--volume", Utils.TEST_CLASSES + ":/test-classes/");
+ opts.addDockerOpts("--memory=256m");
opts.addJavaOpts("-cp", "/test-classes/");
opts.addJavaOpts("--add-exports", "java.base/jdk.internal.platform=ALL-UNNAMED");
DockerTestUtils.dockerRunJava(opts).shouldHaveExitValue(0).shouldContain("TEST PASSED!!!");
--- a/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java Tue Jun 25 16:21:42 2019 +0530
+++ b/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java Wed Jun 26 12:12:25 2019 +0530
@@ -560,7 +560,7 @@
long memoryMaxUsage = metrics.getMemoryMaxUsage();
long memoryUsage = metrics.getMemoryUsage();
- long[] ll = new long[64*1024*1024]; // 64M
+ byte[] bb = new byte[64*1024*1024]; // 64M
long newMemoryMaxUsage = metrics.getMemoryMaxUsage();
long newMemoryUsage = metrics.getMemoryUsage();