mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2026-01-05 16:11:39 +01:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d59ac88185 | ||
|
|
8dfb5d6c11 | ||
|
|
3024ff9871 | ||
|
|
df1513ec7b | ||
|
|
1d7a8c53e4 | ||
|
|
8ab71d2062 | ||
|
|
0ebaebfd0f | ||
|
|
2e9f4de4c4 | ||
|
|
77bc73233e | ||
|
|
86308a0448 | ||
|
|
98d588586e | ||
|
|
d67616f4bb | ||
|
|
317d2780cc | ||
|
|
cb0e461cfe | ||
|
|
caec684a71 | ||
|
|
8c072582dd | ||
|
|
2d49098c01 | ||
|
|
abcfb62560 | ||
|
|
f1727a1398 | ||
|
|
6e0e0a28fc | ||
|
|
1041a919be | ||
|
|
e546f01a4a | ||
|
|
78755530ba | ||
|
|
eaa3df194a |
2
.hgtags
2
.hgtags
@@ -654,7 +654,5 @@ a32f58c6b8be81877411767de7ba9c4cf087c1b5 jdk-15+31
|
||||
c3a4a7ea7c304cabdacdc31741eb94c51351668d jdk-16+7
|
||||
b0817631d2f4395508cb10e81c3858a94d9ae4de jdk-15+34
|
||||
0a73d6f3aab48ff6d7e61e47f0bc2d87a054f217 jdk-16+8
|
||||
fd60c3146a024037cdd9be34c645bb793995a7cc jdk-15+35
|
||||
c075a286cc7df767cce28e8057d6ec5051786490 jdk-16+9
|
||||
b01985b4f88f554f97901e53e1ba314681dd9c19 jdk-16+10
|
||||
5c18d696c7ce724ca36df13933aa53f50e12b9e0 jdk-16+11
|
||||
|
||||
@@ -218,12 +218,10 @@ AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
|
||||
# We also need -iframework<path>/System/Library/Frameworks
|
||||
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
|
||||
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
|
||||
if test -d "[$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks" ; then
|
||||
# These always need to be set on macOS 10.X, or we can't find the frameworks embedded in JavaVM.framework
|
||||
# set this here so it doesn't have to be peppered throughout the forest
|
||||
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
|
||||
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
|
||||
fi
|
||||
# These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
|
||||
# set this here so it doesn't have to be peppered throughout the forest
|
||||
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
|
||||
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
|
||||
fi
|
||||
|
||||
AC_SUBST($1SYSROOT_CFLAGS)
|
||||
|
||||
@@ -902,14 +902,9 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
|
||||
# FIXME: we should list the discovered compilers as an exclude pattern!
|
||||
# If we do that, we can do this detection before POST_DETECTION, and still
|
||||
# find the build compilers in the tools dir, if needed.
|
||||
if test "x$OPENJDK_BUILD_OS" = xmacosx; then
|
||||
UTIL_REQUIRE_PROGS(BUILD_CC, [clang cl cc gcc])
|
||||
UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++])
|
||||
else
|
||||
UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc])
|
||||
UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++])
|
||||
fi
|
||||
UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc])
|
||||
UTIL_FIXUP_EXECUTABLE(BUILD_CC)
|
||||
UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++])
|
||||
UTIL_FIXUP_EXECUTABLE(BUILD_CXX)
|
||||
UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm)
|
||||
UTIL_FIXUP_EXECUTABLE(BUILD_NM)
|
||||
|
||||
@@ -346,7 +346,7 @@ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
|
||||
sub(/\/\*.*\*\//, ""); \
|
||||
gsub(/^ +\*.*/, ""); \
|
||||
gsub(/ /, ""); \
|
||||
gsub(/\r/, ""); \
|
||||
gsub(/\r/, ""); \
|
||||
printf(" %s", $$0) } \
|
||||
END { printf("\n") }' $m && \
|
||||
$(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) :=" && \
|
||||
@@ -360,7 +360,7 @@ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
|
||||
sub(/\/\*.*\*\//, ""); \
|
||||
gsub(/^ +\*.*/, ""); \
|
||||
gsub(/ /, ""); \
|
||||
gsub(/\r/, ""); \
|
||||
gsub(/\r/, ""); \
|
||||
printf(" %s", $$0) } \
|
||||
END { printf("\n") }' $m \
|
||||
) >> $@ $(NEWLINE))
|
||||
|
||||
@@ -53,7 +53,7 @@ class NativeCall;
|
||||
class NativeInstruction {
|
||||
friend class Relocation;
|
||||
friend bool is_NativeCallTrampolineStub_at(address);
|
||||
public:
|
||||
public:
|
||||
enum {
|
||||
instruction_size = 4
|
||||
};
|
||||
@@ -62,16 +62,12 @@ public:
|
||||
return uint_at(0);
|
||||
}
|
||||
|
||||
bool is_blr() const {
|
||||
// blr(register) or br(register)
|
||||
return (encoding() & 0xff9ffc1f) == 0xd61f0000;
|
||||
}
|
||||
bool is_adr_aligned() const {
|
||||
// adr Xn, <label>, where label is aligned to 4 bytes (address of instruction).
|
||||
return (encoding() & 0xff000000) == 0x10000000;
|
||||
}
|
||||
bool is_blr() const { return (encoding() & 0xff9ffc1f) == 0xd61f0000; } // blr(register) or br(register)
|
||||
bool is_adr_aligned() const { return (encoding() & 0xff000000) == 0x10000000; } // adr Xn, <label>, where label is aligned to 4 bytes (address of instruction).
|
||||
|
||||
inline bool is_nop();
|
||||
inline bool is_illegal();
|
||||
inline bool is_return();
|
||||
bool is_jump();
|
||||
bool is_general_jump();
|
||||
inline bool is_jump_or_nop();
|
||||
@@ -82,25 +78,29 @@ public:
|
||||
bool is_sigill_zombie_not_entrant();
|
||||
bool is_stop();
|
||||
|
||||
protected:
|
||||
address addr_at(int offset) const { return address(this) + offset; }
|
||||
protected:
|
||||
address addr_at(int offset) const { return address(this) + offset; }
|
||||
|
||||
s_char sbyte_at(int offset) const { return *(s_char*)addr_at(offset); }
|
||||
u_char ubyte_at(int offset) const { return *(u_char*)addr_at(offset); }
|
||||
jint int_at(int offset) const { return *(jint*)addr_at(offset); }
|
||||
juint uint_at(int offset) const { return *(juint*)addr_at(offset); }
|
||||
address ptr_at(int offset) const { return *(address*)addr_at(offset); }
|
||||
oop oop_at(int offset) const { return *(oop*)addr_at(offset); }
|
||||
s_char sbyte_at(int offset) const { return *(s_char*) addr_at(offset); }
|
||||
u_char ubyte_at(int offset) const { return *(u_char*) addr_at(offset); }
|
||||
|
||||
void set_char_at(int offset, char c) { *addr_at(offset) = (u_char)c; }
|
||||
void set_int_at(int offset, jint i) { *(jint*)addr_at(offset) = i; }
|
||||
void set_uint_at(int offset, jint i) { *(juint*)addr_at(offset) = i; }
|
||||
void set_ptr_at(int offset, address ptr) { *(address*)addr_at(offset) = ptr; }
|
||||
void set_oop_at(int offset, oop o) { *(oop*)addr_at(offset) = o; }
|
||||
jint int_at(int offset) const { return *(jint*) addr_at(offset); }
|
||||
juint uint_at(int offset) const { return *(juint*) addr_at(offset); }
|
||||
|
||||
address ptr_at(int offset) const { return *(address*) addr_at(offset); }
|
||||
|
||||
oop oop_at (int offset) const { return *(oop*) addr_at(offset); }
|
||||
|
||||
|
||||
void set_char_at(int offset, char c) { *addr_at(offset) = (u_char)c; }
|
||||
void set_int_at(int offset, jint i) { *(jint*)addr_at(offset) = i; }
|
||||
void set_uint_at(int offset, jint i) { *(juint*)addr_at(offset) = i; }
|
||||
void set_ptr_at (int offset, address ptr) { *(address*) addr_at(offset) = ptr; }
|
||||
void set_oop_at (int offset, oop o) { *(oop*) addr_at(offset) = o; }
|
||||
|
||||
void wrote(int offset);
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
inline friend NativeInstruction* nativeInstruction_at(address address);
|
||||
|
||||
@@ -146,7 +146,7 @@ inline NativeInstruction* nativeInstruction_at(address address) {
|
||||
}
|
||||
|
||||
// The natural type of an AArch64 instruction is uint32_t
|
||||
inline NativeInstruction* nativeInstruction_at(uint32_t* address) {
|
||||
inline NativeInstruction* nativeInstruction_at(uint32_t *address) {
|
||||
return (NativeInstruction*)address;
|
||||
}
|
||||
|
||||
@@ -171,15 +171,17 @@ public:
|
||||
address plt_c2i_stub() const;
|
||||
void set_stub_to_clean();
|
||||
|
||||
void reset_to_plt_resolve_call();
|
||||
void set_destination_mt_safe(address dest);
|
||||
void reset_to_plt_resolve_call();
|
||||
void set_destination_mt_safe(address dest);
|
||||
|
||||
void verify() const;
|
||||
};
|
||||
|
||||
inline NativePltCall* nativePltCall_at(address address) {
|
||||
NativePltCall* call = (NativePltCall*)address;
|
||||
DEBUG_ONLY(call->verify());
|
||||
NativePltCall* call = (NativePltCall*) address;
|
||||
#ifdef ASSERT
|
||||
call->verify();
|
||||
#endif
|
||||
return call;
|
||||
}
|
||||
|
||||
@@ -194,7 +196,7 @@ inline NativeCall* nativeCall_at(address address);
|
||||
// DSO calls, etc.).
|
||||
|
||||
class NativeCall: public NativeInstruction {
|
||||
public:
|
||||
public:
|
||||
enum Aarch64_specific_constants {
|
||||
instruction_size = 4,
|
||||
instruction_offset = 0,
|
||||
@@ -202,14 +204,14 @@ public:
|
||||
return_address_offset = 4
|
||||
};
|
||||
|
||||
address instruction_address() const { return addr_at(instruction_offset); }
|
||||
address next_instruction_address() const { return addr_at(return_address_offset); }
|
||||
int displacement() const { return (int_at(displacement_offset) << 6) >> 4; }
|
||||
address displacement_address() const { return addr_at(displacement_offset); }
|
||||
address return_address() const { return addr_at(return_address_offset); }
|
||||
address instruction_address() const { return addr_at(instruction_offset); }
|
||||
address next_instruction_address() const { return addr_at(return_address_offset); }
|
||||
int displacement() const { return (int_at(displacement_offset) << 6) >> 4; }
|
||||
address displacement_address() const { return addr_at(displacement_offset); }
|
||||
address return_address() const { return addr_at(return_address_offset); }
|
||||
address destination() const;
|
||||
|
||||
void set_destination(address dest) {
|
||||
void set_destination(address dest) {
|
||||
int offset = dest - instruction_address();
|
||||
unsigned int insn = 0b100101 << 26;
|
||||
assert((offset & 3) == 0, "should be");
|
||||
@@ -219,8 +221,9 @@ public:
|
||||
set_int_at(displacement_offset, insn);
|
||||
}
|
||||
|
||||
void verify_alignment() { ; }
|
||||
void verify();
|
||||
void verify_alignment() { ; }
|
||||
void verify();
|
||||
void print();
|
||||
|
||||
// Creation
|
||||
inline friend NativeCall* nativeCall_at(address address);
|
||||
@@ -266,29 +269,32 @@ public:
|
||||
|
||||
inline NativeCall* nativeCall_at(address address) {
|
||||
NativeCall* call = (NativeCall*)(address - NativeCall::instruction_offset);
|
||||
DEBUG_ONLY(call->verify());
|
||||
#ifdef ASSERT
|
||||
call->verify();
|
||||
#endif
|
||||
return call;
|
||||
}
|
||||
|
||||
inline NativeCall* nativeCall_before(address return_address) {
|
||||
NativeCall* call = (NativeCall*)(return_address - NativeCall::return_address_offset);
|
||||
DEBUG_ONLY(call->verify());
|
||||
#ifdef ASSERT
|
||||
call->verify();
|
||||
#endif
|
||||
return call;
|
||||
}
|
||||
|
||||
// An interface for accessing/manipulating native mov reg, imm instructions.
|
||||
// (used to manipulate inlined 64-bit data calls, etc.)
|
||||
class NativeMovConstReg: public NativeInstruction {
|
||||
public:
|
||||
public:
|
||||
enum Aarch64_specific_constants {
|
||||
instruction_size = 3 * 4, // movz, movk, movk. See movptr().
|
||||
instruction_offset = 0,
|
||||
displacement_offset = 0,
|
||||
};
|
||||
|
||||
address instruction_address() const { return addr_at(instruction_offset); }
|
||||
|
||||
address next_instruction_address() const {
|
||||
address instruction_address() const { return addr_at(instruction_offset); }
|
||||
address next_instruction_address() const {
|
||||
if (nativeInstruction_at(instruction_address())->is_movz())
|
||||
// Assume movz, movk, movk
|
||||
return addr_at(instruction_size);
|
||||
@@ -301,7 +307,7 @@ public:
|
||||
}
|
||||
|
||||
intptr_t data() const;
|
||||
void set_data(intptr_t x);
|
||||
void set_data(intptr_t x);
|
||||
|
||||
void flush() {
|
||||
if (! maybe_cpool_ref(instruction_address())) {
|
||||
@@ -309,8 +315,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void verify();
|
||||
void print();
|
||||
void verify();
|
||||
void print();
|
||||
|
||||
// Creation
|
||||
inline friend NativeMovConstReg* nativeMovConstReg_at(address address);
|
||||
@@ -319,23 +325,29 @@ public:
|
||||
|
||||
inline NativeMovConstReg* nativeMovConstReg_at(address address) {
|
||||
NativeMovConstReg* test = (NativeMovConstReg*)(address - NativeMovConstReg::instruction_offset);
|
||||
DEBUG_ONLY(test->verify());
|
||||
#ifdef ASSERT
|
||||
test->verify();
|
||||
#endif
|
||||
return test;
|
||||
}
|
||||
|
||||
inline NativeMovConstReg* nativeMovConstReg_before(address address) {
|
||||
NativeMovConstReg* test = (NativeMovConstReg*)(address - NativeMovConstReg::instruction_size - NativeMovConstReg::instruction_offset);
|
||||
DEBUG_ONLY(test->verify());
|
||||
#ifdef ASSERT
|
||||
test->verify();
|
||||
#endif
|
||||
return test;
|
||||
}
|
||||
|
||||
class NativeMovConstRegPatching: public NativeMovConstReg {
|
||||
private:
|
||||
friend NativeMovConstRegPatching* nativeMovConstRegPatching_at(address address) {
|
||||
private:
|
||||
friend NativeMovConstRegPatching* nativeMovConstRegPatching_at(address address) {
|
||||
NativeMovConstRegPatching* test = (NativeMovConstRegPatching*)(address - instruction_offset);
|
||||
DEBUG_ONLY(test->verify());
|
||||
#ifdef ASSERT
|
||||
test->verify();
|
||||
#endif
|
||||
return test;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// An interface for accessing/manipulating native moves of the form:
|
||||
@@ -362,7 +374,7 @@ class NativeMovRegMem: public NativeInstruction {
|
||||
next_instruction_offset = 4
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
// helper
|
||||
int instruction_start() const { return instruction_offset; }
|
||||
|
||||
@@ -370,32 +382,30 @@ public:
|
||||
|
||||
int num_bytes_to_end_of_patch() const { return instruction_offset + instruction_size; }
|
||||
|
||||
int offset() const;
|
||||
int offset() const;
|
||||
|
||||
void set_offset(int x);
|
||||
void set_offset(int x);
|
||||
|
||||
void add_offset_in_bytes(int add_offset) {
|
||||
set_offset(offset() + add_offset);
|
||||
}
|
||||
void add_offset_in_bytes(int add_offset) { set_offset ( ( offset() + add_offset ) ); }
|
||||
|
||||
void verify();
|
||||
void print ();
|
||||
|
||||
private:
|
||||
inline friend NativeMovRegMem* nativeMovRegMem_at(address address);
|
||||
private:
|
||||
inline friend NativeMovRegMem* nativeMovRegMem_at (address address);
|
||||
};
|
||||
|
||||
inline NativeMovRegMem* nativeMovRegMem_at(address address) {
|
||||
inline NativeMovRegMem* nativeMovRegMem_at (address address) {
|
||||
NativeMovRegMem* test = (NativeMovRegMem*)(address - NativeMovRegMem::instruction_offset);
|
||||
DEBUG_ONLY(test->verify());
|
||||
#ifdef ASSERT
|
||||
test->verify();
|
||||
#endif
|
||||
return test;
|
||||
}
|
||||
|
||||
class NativeMovRegMemPatching: public NativeMovRegMem {
|
||||
private:
|
||||
friend NativeMovRegMemPatching* nativeMovRegMemPatching_at(address address) {
|
||||
Unimplemented();
|
||||
return 0;
|
||||
}
|
||||
private:
|
||||
friend NativeMovRegMemPatching* nativeMovRegMemPatching_at (address address) {Unimplemented(); return 0; }
|
||||
};
|
||||
|
||||
// An interface for accessing/manipulating native leal instruction of form:
|
||||
@@ -409,8 +419,10 @@ class NativeLoadAddress: public NativeInstruction {
|
||||
next_instruction_offset = 4
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
void verify();
|
||||
void print ();
|
||||
|
||||
};
|
||||
|
||||
// adrp x16, #page
|
||||
@@ -429,7 +441,7 @@ public:
|
||||
address next_instruction_address() const { return return_address(); }
|
||||
intptr_t data() const;
|
||||
void set_data(intptr_t data) {
|
||||
intptr_t* addr = (intptr_t*)got_address();
|
||||
intptr_t *addr = (intptr_t *) got_address();
|
||||
*addr = data;
|
||||
}
|
||||
|
||||
@@ -439,13 +451,15 @@ private:
|
||||
};
|
||||
|
||||
inline NativeLoadGot* nativeLoadGot_at(address addr) {
|
||||
NativeLoadGot* load = (NativeLoadGot*)addr;
|
||||
DEBUG_ONLY(load->verify());
|
||||
NativeLoadGot* load = (NativeLoadGot*) addr;
|
||||
#ifdef ASSERT
|
||||
load->verify();
|
||||
#endif
|
||||
return load;
|
||||
}
|
||||
|
||||
class NativeJump: public NativeInstruction {
|
||||
public:
|
||||
public:
|
||||
enum AArch64_specific_constants {
|
||||
instruction_size = 4,
|
||||
instruction_offset = 0,
|
||||
@@ -453,8 +467,8 @@ public:
|
||||
next_instruction_offset = 4
|
||||
};
|
||||
|
||||
address instruction_address() const { return addr_at(instruction_offset); }
|
||||
address next_instruction_address() const { return addr_at(instruction_size); }
|
||||
address instruction_address() const { return addr_at(instruction_offset); }
|
||||
address next_instruction_address() const { return addr_at(instruction_size); }
|
||||
address jump_destination() const;
|
||||
void set_jump_destination(address dest);
|
||||
|
||||
@@ -472,7 +486,9 @@ public:
|
||||
|
||||
inline NativeJump* nativeJump_at(address address) {
|
||||
NativeJump* jump = (NativeJump*)(address - NativeJump::instruction_offset);
|
||||
DEBUG_ONLY(jump->verify());
|
||||
#ifdef ASSERT
|
||||
jump->verify();
|
||||
#endif
|
||||
return jump;
|
||||
}
|
||||
|
||||
@@ -495,7 +511,7 @@ public:
|
||||
|
||||
inline NativeGeneralJump* nativeGeneralJump_at(address address) {
|
||||
NativeGeneralJump* jump = (NativeGeneralJump*)(address);
|
||||
DEBUG_ONLY(jump->verify());
|
||||
debug_only(jump->verify();)
|
||||
return jump;
|
||||
}
|
||||
|
||||
@@ -513,47 +529,46 @@ public:
|
||||
address next_instruction_address() const { return addr_at(instruction_size); }
|
||||
bool is_GotJump() const;
|
||||
|
||||
void set_jump_destination(address dest) {
|
||||
address* got = (address*)got_address();
|
||||
void set_jump_destination(address dest) {
|
||||
address* got = (address *)got_address();
|
||||
*got = dest;
|
||||
}
|
||||
};
|
||||
|
||||
inline NativeGotJump* nativeGotJump_at(address addr) {
|
||||
NativeGotJump* jump = (NativeGotJump*)(addr);
|
||||
DEBUG_ONLY(jump->verify());
|
||||
return jump;
|
||||
}
|
||||
|
||||
class NativePopReg : public NativeInstruction {
|
||||
public:
|
||||
public:
|
||||
// Insert a pop instruction
|
||||
static void insert(address code_pos, Register reg);
|
||||
};
|
||||
|
||||
|
||||
class NativeIllegalInstruction: public NativeInstruction {
|
||||
public:
|
||||
public:
|
||||
// Insert illegal opcode as specific address
|
||||
static void insert(address code_pos);
|
||||
};
|
||||
|
||||
// return instruction that does not pop values of the stack
|
||||
class NativeReturn: public NativeInstruction {
|
||||
public:
|
||||
public:
|
||||
};
|
||||
|
||||
// return instruction that does pop values of the stack
|
||||
class NativeReturnX: public NativeInstruction {
|
||||
public:
|
||||
public:
|
||||
};
|
||||
|
||||
// Simple test vs memory
|
||||
class NativeTstRegMem: public NativeInstruction {
|
||||
public:
|
||||
public:
|
||||
};
|
||||
|
||||
inline bool NativeInstruction::is_nop() {
|
||||
inline bool NativeInstruction::is_nop() {
|
||||
uint32_t insn = *(uint32_t*)addr_at(0);
|
||||
return insn == 0xd503201f;
|
||||
}
|
||||
@@ -583,7 +598,7 @@ inline bool NativeInstruction::is_jump_or_nop() {
|
||||
|
||||
// Call trampoline stubs.
|
||||
class NativeCallTrampolineStub : public NativeInstruction {
|
||||
public:
|
||||
public:
|
||||
|
||||
enum AArch64_specific_constants {
|
||||
instruction_size = 4 * 4,
|
||||
@@ -592,7 +607,7 @@ public:
|
||||
next_instruction_offset = 4 * 4
|
||||
};
|
||||
|
||||
address destination(nmethod* nm = NULL) const;
|
||||
address destination(nmethod *nm = NULL) const;
|
||||
void set_destination(address new_destination);
|
||||
ptrdiff_t destination_offset() const;
|
||||
};
|
||||
@@ -602,7 +617,7 @@ inline bool is_NativeCallTrampolineStub_at(address addr) {
|
||||
// ldr xscratch1, L
|
||||
// br xscratch1
|
||||
// L:
|
||||
uint32_t* i = (uint32_t*)addr;
|
||||
uint32_t *i = (uint32_t *)addr;
|
||||
return i[0] == 0x58000048 && i[1] == 0xd61f0100;
|
||||
}
|
||||
|
||||
@@ -617,7 +632,7 @@ public:
|
||||
void set_kind(int order_kind) { Instruction_aarch64::patch(addr_at(0), 11, 8, order_kind); }
|
||||
};
|
||||
|
||||
inline NativeMembar* NativeMembar_at(address addr) {
|
||||
inline NativeMembar *NativeMembar_at(address addr) {
|
||||
assert(nativeInstruction_at(addr)->is_Membar(), "no membar found");
|
||||
return (NativeMembar*)addr;
|
||||
}
|
||||
@@ -671,9 +686,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
inline NativeLdSt* NativeLdSt_at(address addr) {
|
||||
inline NativeLdSt *NativeLdSt_at(address addr) {
|
||||
assert(nativeInstruction_at(addr)->is_Imm_LdSt(), "no immediate load/store found");
|
||||
return (NativeLdSt*)addr;
|
||||
}
|
||||
|
||||
#endif // CPU_AARCH64_NATIVEINST_AARCH64_HPP
|
||||
|
||||
@@ -110,9 +110,6 @@
|
||||
# include <inttypes.h>
|
||||
# include <sys/ioctl.h>
|
||||
# include <linux/elf-em.h>
|
||||
#ifdef __GLIBC__
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
@@ -921,17 +918,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
|
||||
assert(is_aligned(stack_size, os::vm_page_size()), "stack_size not aligned");
|
||||
|
||||
int status = pthread_attr_setstacksize(&attr, stack_size);
|
||||
if (status != 0) {
|
||||
// pthread_attr_setstacksize() function can fail
|
||||
// if the stack size exceeds a system-imposed limit.
|
||||
assert_status(status == EINVAL, status, "pthread_attr_setstacksize");
|
||||
log_warning(os, thread)("The %sthread stack size specified is invalid: " SIZE_FORMAT "k",
|
||||
(thr_type == compiler_thread) ? "compiler " : ((thr_type == java_thread) ? "" : "VM "),
|
||||
stack_size / K);
|
||||
thread->set_osthread(NULL);
|
||||
delete osthread;
|
||||
return false;
|
||||
}
|
||||
assert_status(status == 0, status, "pthread_attr_setstacksize");
|
||||
|
||||
ThreadState state;
|
||||
|
||||
@@ -2169,10 +2156,7 @@ void os::print_os_info(outputStream* st) {
|
||||
os::Posix::print_load_average(st);
|
||||
st->cr();
|
||||
|
||||
os::Linux::print_system_memory_info(st);
|
||||
st->cr();
|
||||
|
||||
os::Linux::print_process_memory_info(st);
|
||||
os::Linux::print_full_memory_info(st);
|
||||
st->cr();
|
||||
|
||||
os::Linux::print_proc_sys_info(st);
|
||||
@@ -2330,7 +2314,7 @@ void os::Linux::print_proc_sys_info(outputStream* st) {
|
||||
"/proc/sys/kernel/pid_max", st);
|
||||
}
|
||||
|
||||
void os::Linux::print_system_memory_info(outputStream* st) {
|
||||
void os::Linux::print_full_memory_info(outputStream* st) {
|
||||
_print_ascii_file_h("/proc/meminfo", "/proc/meminfo", st, false);
|
||||
st->cr();
|
||||
|
||||
@@ -2342,63 +2326,6 @@ void os::Linux::print_system_memory_info(outputStream* st) {
|
||||
"/sys/kernel/mm/transparent_hugepage/defrag", st);
|
||||
}
|
||||
|
||||
void os::Linux::print_process_memory_info(outputStream* st) {
|
||||
|
||||
st->print_cr("Process Memory:");
|
||||
|
||||
// Print virtual and resident set size; peak values; swap; and for
|
||||
// rss its components if the kernel is recent enough.
|
||||
ssize_t vmsize = -1, vmpeak = -1, vmswap = -1,
|
||||
vmrss = -1, vmhwm = -1, rssanon = -1, rssfile = -1, rssshmem = -1;
|
||||
const int num_values = 8;
|
||||
int num_found = 0;
|
||||
FILE* f = ::fopen("/proc/self/status", "r");
|
||||
char buf[256];
|
||||
while (::fgets(buf, sizeof(buf), f) != NULL && num_found < num_values) {
|
||||
if ( (vmsize == -1 && sscanf(buf, "VmSize: " SSIZE_FORMAT " kB", &vmsize) == 1) ||
|
||||
(vmpeak == -1 && sscanf(buf, "VmPeak: " SSIZE_FORMAT " kB", &vmpeak) == 1) ||
|
||||
(vmswap == -1 && sscanf(buf, "VmSwap: " SSIZE_FORMAT " kB", &vmswap) == 1) ||
|
||||
(vmhwm == -1 && sscanf(buf, "VmHWM: " SSIZE_FORMAT " kB", &vmhwm) == 1) ||
|
||||
(vmrss == -1 && sscanf(buf, "VmRSS: " SSIZE_FORMAT " kB", &vmrss) == 1) ||
|
||||
(rssanon == -1 && sscanf(buf, "RssAnon: " SSIZE_FORMAT " kB", &rssanon) == 1) ||
|
||||
(rssfile == -1 && sscanf(buf, "RssFile: " SSIZE_FORMAT " kB", &rssfile) == 1) ||
|
||||
(rssshmem == -1 && sscanf(buf, "RssShmem: " SSIZE_FORMAT " kB", &rssshmem) == 1)
|
||||
)
|
||||
{
|
||||
num_found ++;
|
||||
}
|
||||
}
|
||||
st->print_cr("Virtual Size: " SSIZE_FORMAT "K (peak: " SSIZE_FORMAT "K)", vmsize, vmpeak);
|
||||
st->print("Resident Set Size: " SSIZE_FORMAT "K (peak: " SSIZE_FORMAT "K)", vmrss, vmhwm);
|
||||
if (rssanon != -1) { // requires kernel >= 4.5
|
||||
st->print(" (anon: " SSIZE_FORMAT "K, file: " SSIZE_FORMAT "K, shmem: " SSIZE_FORMAT "K)",
|
||||
rssanon, rssfile, rssshmem);
|
||||
}
|
||||
st->cr();
|
||||
if (vmswap != -1) { // requires kernel >= 2.6.34
|
||||
st->print_cr("Swapped out: " SSIZE_FORMAT "K", vmswap);
|
||||
}
|
||||
|
||||
// Print glibc outstanding allocations.
|
||||
// (note: there is no implementation of mallinfo for muslc)
|
||||
#ifdef __GLIBC__
|
||||
struct mallinfo mi = ::mallinfo();
|
||||
|
||||
// mallinfo is an old API. Member names mean next to nothing and, beyond that, are int.
|
||||
// So values may have wrapped around. Still useful enough to see how much glibc thinks
|
||||
// we allocated.
|
||||
const size_t total_allocated = (size_t)(unsigned)mi.uordblks;
|
||||
st->print("C-Heap outstanding allocations: " SIZE_FORMAT "K", total_allocated / K);
|
||||
// Since mallinfo members are int, glibc values may have wrapped. Warn about this.
|
||||
if ((vmrss * K) > UINT_MAX && (vmrss * K) > (total_allocated + UINT_MAX)) {
|
||||
st->print(" (may have wrapped)");
|
||||
}
|
||||
st->cr();
|
||||
|
||||
#endif // __GLIBC__
|
||||
|
||||
}
|
||||
|
||||
bool os::Linux::print_ld_preload_file(outputStream* st) {
|
||||
return _print_ascii_file("/etc/ld.so.preload", st, "/etc/ld.so.preload:");
|
||||
}
|
||||
@@ -3726,10 +3653,6 @@ bool os::pd_release_memory(char* addr, size_t size) {
|
||||
return anon_munmap(addr, size);
|
||||
}
|
||||
|
||||
#ifdef CAN_SHOW_REGISTERS_ON_ASSERT
|
||||
extern char* g_assert_poison; // assertion poison page address
|
||||
#endif
|
||||
|
||||
static bool linux_mprotect(char* addr, size_t size, int prot) {
|
||||
// Linux wants the mprotect address argument to be page aligned.
|
||||
char* bottom = (char*)align_down((intptr_t)addr, os::Linux::page_size());
|
||||
@@ -3742,11 +3665,6 @@ static bool linux_mprotect(char* addr, size_t size, int prot) {
|
||||
assert(addr == bottom, "sanity check");
|
||||
|
||||
size = align_up(pointer_delta(addr, bottom, 1) + size, os::Linux::page_size());
|
||||
// Don't log anything if we're executing in the poison page signal handling
|
||||
// context. It can lead to reentrant use of other parts of the VM code.
|
||||
#ifdef CAN_SHOW_REGISTERS_ON_ASSERT
|
||||
if (addr != g_assert_poison)
|
||||
#endif
|
||||
Events::log(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(bottom), p2i(bottom+size), prot);
|
||||
return ::mprotect(bottom, size, prot) == 0;
|
||||
}
|
||||
|
||||
@@ -101,8 +101,7 @@ class Linux {
|
||||
static bool release_memory_special_shm(char* base, size_t bytes);
|
||||
static bool release_memory_special_huge_tlbfs(char* base, size_t bytes);
|
||||
|
||||
static void print_process_memory_info(outputStream* st);
|
||||
static void print_system_memory_info(outputStream* st);
|
||||
static void print_full_memory_info(outputStream* st);
|
||||
static bool print_container_info(outputStream* st);
|
||||
static void print_steal_info(outputStream* st);
|
||||
static void print_distro_info(outputStream* st);
|
||||
|
||||
@@ -4542,18 +4542,6 @@ bool Interval::has_hole_between(int hole_from, int hole_to) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if there is an intersection with any of the split children of 'interval'
|
||||
bool Interval::intersects_any_children_of(Interval* interval) const {
|
||||
if (interval->_split_children != NULL) {
|
||||
for (int i = 0; i < interval->_split_children->length(); i++) {
|
||||
if (intersects(interval->_split_children->at(i))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#ifndef PRODUCT
|
||||
void Interval::print(outputStream* out) const {
|
||||
@@ -5734,13 +5722,6 @@ void LinearScanWalker::combine_spilled_intervals(Interval* cur) {
|
||||
return;
|
||||
}
|
||||
assert(register_hint->canonical_spill_slot() != -1, "must be set when part of interval was spilled");
|
||||
assert(!cur->intersects(register_hint), "cur should not intersect register_hint");
|
||||
|
||||
if (cur->intersects_any_children_of(register_hint)) {
|
||||
// Bail out if cur intersects any split children of register_hint, which have the same spill slot as their parent. An overlap of two intervals with
|
||||
// the same spill slot could result in a situation where both intervals are spilled at the same time to the same stack location which is not correct.
|
||||
return;
|
||||
}
|
||||
|
||||
// modify intervals such that cur gets the same stack slot as register_hint
|
||||
// delete use positions to prevent the intervals to get a register at beginning
|
||||
|
||||
@@ -613,7 +613,6 @@ class Interval : public CompilationResourceObj {
|
||||
bool covers(int op_id, LIR_OpVisitState::OprMode mode) const;
|
||||
bool has_hole_between(int from, int to);
|
||||
bool intersects(Interval* i) const { return _first->intersects(i->_first); }
|
||||
bool intersects_any_children_of(Interval* i) const;
|
||||
int intersects_at(Interval* i) const { return _first->intersects_at(i->_first); }
|
||||
|
||||
// range iteration
|
||||
|
||||
@@ -37,7 +37,7 @@ class OopStorageSet : public AllStatic {
|
||||
|
||||
public:
|
||||
// Must be updated when new OopStorages are introduced
|
||||
static const uint strong_count = 4 JVMTI_ONLY(+ 1);
|
||||
static const uint strong_count = 3;
|
||||
static const uint weak_count = 4 JFR_ONLY(+ 1);
|
||||
static const uint all_count = strong_count + weak_count;
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@ inline oop ShenandoahBarrierSet::load_reference_barrier_mutator(oop obj, T* load
|
||||
}
|
||||
|
||||
inline void ShenandoahBarrierSet::enqueue(oop obj) {
|
||||
assert(obj != NULL, "checked by caller");
|
||||
assert(_satb_mark_queue_set.is_active(), "only get here when SATB active");
|
||||
|
||||
// Filter marked objects before hitting the SATB queues. The same predicate would
|
||||
@@ -117,7 +116,6 @@ inline void ShenandoahBarrierSet::storeval_barrier(oop obj) {
|
||||
|
||||
inline void ShenandoahBarrierSet::keep_alive_if_weak(DecoratorSet decorators, oop value) {
|
||||
assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
|
||||
assert(value != NULL, "checked by caller");
|
||||
const bool on_strong_oop_ref = (decorators & ON_STRONG_OOP_REF) != 0;
|
||||
const bool peek = (decorators & AS_NO_KEEPALIVE) != 0;
|
||||
if (!peek && !on_strong_oop_ref) {
|
||||
@@ -127,7 +125,6 @@ inline void ShenandoahBarrierSet::keep_alive_if_weak(DecoratorSet decorators, oo
|
||||
|
||||
template <DecoratorSet decorators>
|
||||
inline void ShenandoahBarrierSet::keep_alive_if_weak(oop value) {
|
||||
assert(value != NULL, "checked by caller");
|
||||
assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
|
||||
if (!HasDecorator<decorators, ON_STRONG_OOP_REF>::value &&
|
||||
!HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {
|
||||
|
||||
@@ -256,8 +256,7 @@ class ShenandoahFinalMarkingTask : public AbstractGangTask {
|
||||
private:
|
||||
ShenandoahConcurrentMark* _cm;
|
||||
TaskTerminator* _terminator;
|
||||
bool _dedup_string;
|
||||
ShenandoahSharedFlag _claimed_syncroots;
|
||||
bool _dedup_string;
|
||||
|
||||
public:
|
||||
ShenandoahFinalMarkingTask(ShenandoahConcurrentMark* cm, TaskTerminator* terminator, bool dedup_string) :
|
||||
@@ -295,9 +294,6 @@ public:
|
||||
ShenandoahStoreValEnqueueBarrier ? &resolve_mark_cl : NULL,
|
||||
do_nmethods ? &blobsCl : NULL);
|
||||
Threads::threads_do(&tc);
|
||||
if (ShenandoahStoreValEnqueueBarrier && _claimed_syncroots.try_set()) {
|
||||
ObjectSynchronizer::oops_do(&resolve_mark_cl);
|
||||
}
|
||||
} else {
|
||||
ShenandoahMarkRefsClosure mark_cl(q, rp);
|
||||
MarkingCodeBlobClosure blobsCl(&mark_cl, !CodeBlobToOopClosure::FixRelocations);
|
||||
@@ -305,9 +301,6 @@ public:
|
||||
ShenandoahStoreValEnqueueBarrier ? &mark_cl : NULL,
|
||||
do_nmethods ? &blobsCl : NULL);
|
||||
Threads::threads_do(&tc);
|
||||
if (ShenandoahStoreValEnqueueBarrier && _claimed_syncroots.try_set()) {
|
||||
ObjectSynchronizer::oops_do(&mark_cl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ ShenandoahControlThread::ShenandoahControlThread() :
|
||||
_allocs_seen(0) {
|
||||
|
||||
reset_gc_id();
|
||||
create_and_start();
|
||||
create_and_start(ShenandoahCriticalControlThreadPriority ? CriticalPriority : NearMaxPriority);
|
||||
_periodic_task.enroll();
|
||||
_periodic_satb_flush_task.enroll();
|
||||
if (ShenandoahPacing) {
|
||||
|
||||
@@ -82,6 +82,20 @@
|
||||
#include "services/mallocTracker.hpp"
|
||||
#include "utilities/powerOfTwo.hpp"
|
||||
|
||||
#ifdef ASSERT
|
||||
template <class T>
|
||||
void ShenandoahAssertToSpaceClosure::do_oop_work(T* p) {
|
||||
T o = RawAccess<>::oop_load(p);
|
||||
if (! CompressedOops::is_null(o)) {
|
||||
oop obj = CompressedOops::decode_not_null(o);
|
||||
shenandoah_assert_not_forwarded(p, obj);
|
||||
}
|
||||
}
|
||||
|
||||
void ShenandoahAssertToSpaceClosure::do_oop(narrowOop* p) { do_oop_work(p); }
|
||||
void ShenandoahAssertToSpaceClosure::do_oop(oop* p) { do_oop_work(p); }
|
||||
#endif
|
||||
|
||||
class ShenandoahPretouchHeapTask : public AbstractGangTask {
|
||||
private:
|
||||
ShenandoahRegionIterator _regions;
|
||||
@@ -1325,7 +1339,7 @@ void ShenandoahHeap::object_iterate(ObjectClosure* cl) {
|
||||
|
||||
// Keep alive an object that was loaded with AS_NO_KEEPALIVE.
|
||||
void ShenandoahHeap::keep_alive(oop obj) {
|
||||
if (is_concurrent_mark_in_progress() && (obj != NULL)) {
|
||||
if (is_concurrent_mark_in_progress()) {
|
||||
ShenandoahBarrierSet::barrier_set()->enqueue(obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +105,17 @@ public:
|
||||
virtual bool is_thread_safe() { return false; }
|
||||
};
|
||||
|
||||
#ifdef ASSERT
|
||||
class ShenandoahAssertToSpaceClosure : public OopClosure {
|
||||
private:
|
||||
template <class T>
|
||||
void do_oop_work(T* p);
|
||||
public:
|
||||
void do_oop(narrowOop* p);
|
||||
void do_oop(oop* p);
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef ShenandoahLock ShenandoahHeapLock;
|
||||
typedef ShenandoahLocker ShenandoahHeapLocker;
|
||||
|
||||
|
||||
@@ -191,6 +191,9 @@
|
||||
"adjustment. Lower values make adjustments faster, at the " \
|
||||
"expense of higher perf overhead. Time is in milliseconds.") \
|
||||
\
|
||||
experimental(bool, ShenandoahCriticalControlThreadPriority, false, \
|
||||
"Run control thread runs at critical scheduling priority.") \
|
||||
\
|
||||
diagnostic(bool, ShenandoahVerify, false, \
|
||||
"Enable internal verification. This would catch many GC bugs, " \
|
||||
"but it would also stall the collector during the verification, " \
|
||||
|
||||
@@ -136,23 +136,17 @@ oop HeapShared::archive_heap_object(oop obj, Thread* THREAD) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Pre-compute object identity hash at CDS dump time.
|
||||
obj->identity_hash();
|
||||
|
||||
oop archived_oop = (oop)G1CollectedHeap::heap()->archive_mem_allocate(len);
|
||||
if (archived_oop != NULL) {
|
||||
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(obj), cast_from_oop<HeapWord*>(archived_oop), len);
|
||||
MetaspaceShared::relocate_klass_ptr(archived_oop);
|
||||
// Reinitialize markword to remove age/marking/locking/etc.
|
||||
//
|
||||
// We need to retain the identity_hash, because it may have been used by some hashtables
|
||||
// in the shared heap. This also has the side effect of pre-initializing the
|
||||
// identity_hash for all shared objects, so they are less likely to be written
|
||||
// into during run time, increasing the potential of memory sharing.
|
||||
int hash_original = obj->identity_hash();
|
||||
archived_oop->set_mark_raw(markWord::prototype().copy_set_hash(hash_original));
|
||||
assert(archived_oop->mark().is_unlocked(), "sanity");
|
||||
|
||||
DEBUG_ONLY(int hash_archived = archived_oop->identity_hash());
|
||||
assert(hash_original == hash_archived, "Different hash codes: original %x, archived %x", hash_original, hash_archived);
|
||||
|
||||
// Clear age -- it might have been set if a GC happened during -Xshare:dump
|
||||
markWord mark = archived_oop->mark_raw();
|
||||
mark = mark.set_age(0);
|
||||
archived_oop->set_mark_raw(mark);
|
||||
ArchivedObjectCache* cache = archived_object_cache();
|
||||
cache->put(obj, archived_oop);
|
||||
log_debug(cds, heap)("Archived heap object " PTR_FORMAT " ==> " PTR_FORMAT,
|
||||
|
||||
@@ -33,15 +33,18 @@
|
||||
#include "classfile/vmSymbols.hpp"
|
||||
#include "code/codeBehaviours.hpp"
|
||||
#include "code/codeCache.hpp"
|
||||
#include "code/dependencies.hpp"
|
||||
#include "gc/shared/collectedHeap.inline.hpp"
|
||||
#include "gc/shared/gcArguments.hpp"
|
||||
#include "gc/shared/gcConfig.hpp"
|
||||
#include "gc/shared/gcLogPrecious.hpp"
|
||||
#include "gc/shared/gcTraceTime.inline.hpp"
|
||||
#include "gc/shared/oopStorageSet.hpp"
|
||||
#include "interpreter/interpreter.hpp"
|
||||
#include "logging/log.hpp"
|
||||
#include "logging/logStream.hpp"
|
||||
#include "memory/heapShared.hpp"
|
||||
#include "memory/filemap.hpp"
|
||||
#include "memory/metadataFactory.hpp"
|
||||
#include "memory/metaspaceClosure.hpp"
|
||||
#include "memory/metaspaceCounters.hpp"
|
||||
@@ -50,8 +53,11 @@
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "memory/universe.hpp"
|
||||
#include "oops/compressedOops.hpp"
|
||||
#include "oops/constantPool.hpp"
|
||||
#include "oops/instanceClassLoaderKlass.hpp"
|
||||
#include "oops/instanceKlass.hpp"
|
||||
#include "oops/instanceMirrorKlass.hpp"
|
||||
#include "oops/instanceRefKlass.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/oopHandle.inline.hpp"
|
||||
@@ -59,17 +65,25 @@
|
||||
#include "prims/resolvedMethodTable.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/atomic.hpp"
|
||||
#include "runtime/deoptimization.hpp"
|
||||
#include "runtime/flags/jvmFlagConstraintList.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
#include "runtime/init.hpp"
|
||||
#include "runtime/java.hpp"
|
||||
#include "runtime/javaCalls.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
#include "runtime/synchronizer.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
#include "runtime/timerTrace.hpp"
|
||||
#include "runtime/vmOperations.hpp"
|
||||
#include "services/memoryService.hpp"
|
||||
#include "utilities/align.hpp"
|
||||
#include "utilities/autoRestore.hpp"
|
||||
#include "utilities/copy.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
#include "utilities/events.hpp"
|
||||
#include "utilities/formatBuffer.hpp"
|
||||
#include "utilities/hashtable.inline.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
#include "utilities/preserveException.hpp"
|
||||
|
||||
@@ -42,12 +42,13 @@
|
||||
InlineTree::InlineTree(Compile* c,
|
||||
const InlineTree *caller_tree, ciMethod* callee,
|
||||
JVMState* caller_jvms, int caller_bci,
|
||||
int max_inline_level) :
|
||||
float site_invoke_ratio, int max_inline_level) :
|
||||
C(c),
|
||||
_caller_jvms(caller_jvms),
|
||||
_method(callee),
|
||||
_caller_tree((InlineTree*) caller_tree),
|
||||
_count_inline_bcs(method()->code_size_for_inlining()),
|
||||
_site_invoke_ratio(site_invoke_ratio),
|
||||
_max_inline_level(max_inline_level),
|
||||
_subtrees(c->comp_arena(), 2, 0, NULL),
|
||||
_msg(NULL)
|
||||
@@ -645,8 +646,21 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//------------------------------compute_callee_frequency-----------------------
|
||||
float InlineTree::compute_callee_frequency( int caller_bci ) const {
|
||||
int count = method()->interpreter_call_site_count(caller_bci);
|
||||
int invcnt = method()->interpreter_invocation_count();
|
||||
float freq = (float)count/(float)invcnt;
|
||||
// Call-site count / interpreter invocation count, scaled recursively.
|
||||
// Always between 0.0 and 1.0. Represents the percentage of the method's
|
||||
// total execution time used at this call site.
|
||||
|
||||
return freq;
|
||||
}
|
||||
|
||||
//------------------------------build_inline_tree_for_callee-------------------
|
||||
InlineTree *InlineTree::build_inline_tree_for_callee( ciMethod* callee_method, JVMState* caller_jvms, int caller_bci) {
|
||||
float recur_frequency = _site_invoke_ratio * compute_callee_frequency(caller_bci);
|
||||
// Attempt inlining.
|
||||
InlineTree* old_ilt = callee_at(caller_bci, callee_method);
|
||||
if (old_ilt != NULL) {
|
||||
@@ -671,7 +685,7 @@ InlineTree *InlineTree::build_inline_tree_for_callee( ciMethod* callee_method, J
|
||||
}
|
||||
}
|
||||
// Allocate in the comp_arena to make sure the InlineTree is live when dumping a replay compilation file
|
||||
InlineTree* ilt = new (C->comp_arena()) InlineTree(C, this, callee_method, caller_jvms, caller_bci, _max_inline_level + max_inline_level_adjust);
|
||||
InlineTree* ilt = new (C->comp_arena()) InlineTree(C, this, callee_method, caller_jvms, caller_bci, recur_frequency, _max_inline_level + max_inline_level_adjust);
|
||||
_subtrees.append(ilt);
|
||||
|
||||
NOT_PRODUCT( _count_inlines += 1; )
|
||||
@@ -697,7 +711,7 @@ InlineTree *InlineTree::build_inline_tree_root() {
|
||||
Compile* C = Compile::current();
|
||||
|
||||
// Root of inline tree
|
||||
InlineTree* ilt = new InlineTree(C, NULL, C->method(), NULL, -1, MaxInlineLevel);
|
||||
InlineTree* ilt = new InlineTree(C, NULL, C->method(), NULL, -1, 1.0F, MaxInlineLevel);
|
||||
|
||||
return ilt;
|
||||
}
|
||||
|
||||
@@ -1890,7 +1890,7 @@ void PhaseChaitin::add_reference(const Node *node, const Node *old_node) {
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void PhaseChaitin::dump(const Node* n) const {
|
||||
void PhaseChaitin::dump(const Node *n) const {
|
||||
uint r = (n->_idx < _lrg_map.size()) ? _lrg_map.find_const(n) : 0;
|
||||
tty->print("L%d",r);
|
||||
if (r && n->Opcode() != Op_Phi) {
|
||||
@@ -1968,7 +1968,7 @@ void PhaseChaitin::dump(const Node* n) const {
|
||||
tty->print("\n");
|
||||
}
|
||||
|
||||
void PhaseChaitin::dump(const Block* b) const {
|
||||
void PhaseChaitin::dump(const Block *b) const {
|
||||
b->dump_head(&_cfg);
|
||||
|
||||
// For all instructions
|
||||
@@ -2064,7 +2064,7 @@ void PhaseChaitin::dump_simplified() const {
|
||||
tty->cr();
|
||||
}
|
||||
|
||||
static char *print_reg(OptoReg::Name reg, const PhaseChaitin* pc, char* buf) {
|
||||
static char *print_reg( OptoReg::Name reg, const PhaseChaitin *pc, char *buf ) {
|
||||
if ((int)reg < 0)
|
||||
sprintf(buf, "<OptoReg::%d>", (int)reg);
|
||||
else if (OptoReg::is_reg(reg))
|
||||
@@ -2077,7 +2077,7 @@ static char *print_reg(OptoReg::Name reg, const PhaseChaitin* pc, char* buf) {
|
||||
|
||||
// Dump a register name into a buffer. Be intelligent if we get called
|
||||
// before allocation is complete.
|
||||
char *PhaseChaitin::dump_register(const Node* n, char* buf) const {
|
||||
char *PhaseChaitin::dump_register( const Node *n, char *buf ) const {
|
||||
if( _node_regs ) {
|
||||
// Post allocation, use direct mappings, no LRG info available
|
||||
print_reg( get_reg_first(n), this, buf );
|
||||
@@ -2226,7 +2226,7 @@ void PhaseChaitin::dump_frame() const {
|
||||
tty->print_cr("#");
|
||||
}
|
||||
|
||||
void PhaseChaitin::dump_bb(uint pre_order) const {
|
||||
void PhaseChaitin::dump_bb( uint pre_order ) const {
|
||||
tty->print_cr("---dump of B%d---",pre_order);
|
||||
for (uint i = 0; i < _cfg.number_of_blocks(); i++) {
|
||||
Block* block = _cfg.get_block(i);
|
||||
@@ -2236,7 +2236,7 @@ void PhaseChaitin::dump_bb(uint pre_order) const {
|
||||
}
|
||||
}
|
||||
|
||||
void PhaseChaitin::dump_lrg(uint lidx, bool defs_only) const {
|
||||
void PhaseChaitin::dump_lrg( uint lidx, bool defs_only ) const {
|
||||
tty->print_cr("---dump of L%d---",lidx);
|
||||
|
||||
if (_ifg) {
|
||||
@@ -2294,102 +2294,6 @@ void PhaseChaitin::dump_lrg(uint lidx, bool defs_only) const {
|
||||
}
|
||||
#endif // not PRODUCT
|
||||
|
||||
#ifdef ASSERT
|
||||
// Verify that base pointers and derived pointers are still sane.
|
||||
void PhaseChaitin::verify_base_ptrs(ResourceArea* a) const {
|
||||
Unique_Node_List worklist(a);
|
||||
for (uint i = 0; i < _cfg.number_of_blocks(); i++) {
|
||||
Block* block = _cfg.get_block(i);
|
||||
for (uint j = block->end_idx() + 1; j > 1; j--) {
|
||||
Node* n = block->get_node(j-1);
|
||||
if (n->is_Phi()) {
|
||||
break;
|
||||
}
|
||||
// Found a safepoint?
|
||||
if (n->is_MachSafePoint()) {
|
||||
MachSafePointNode* sfpt = n->as_MachSafePoint();
|
||||
JVMState* jvms = sfpt->jvms();
|
||||
if (jvms != NULL) {
|
||||
// Now scan for a live derived pointer
|
||||
if (jvms->oopoff() < sfpt->req()) {
|
||||
// Check each derived/base pair
|
||||
for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx++) {
|
||||
Node* check = sfpt->in(idx);
|
||||
bool is_derived = ((idx - jvms->oopoff()) & 1) == 0;
|
||||
// search upwards through spills and spill phis for AddP
|
||||
worklist.clear();
|
||||
worklist.push(check);
|
||||
uint k = 0;
|
||||
while (k < worklist.size()) {
|
||||
check = worklist.at(k);
|
||||
assert(check, "Bad base or derived pointer");
|
||||
// See PhaseChaitin::find_base_for_derived() for all cases.
|
||||
int isc = check->is_Copy();
|
||||
if (isc) {
|
||||
worklist.push(check->in(isc));
|
||||
} else if (check->is_Phi()) {
|
||||
for (uint m = 1; m < check->req(); m++) {
|
||||
worklist.push(check->in(m));
|
||||
}
|
||||
} else if (check->is_Con()) {
|
||||
if (is_derived) {
|
||||
// Derived is NULL+offset
|
||||
assert(!is_derived || check->bottom_type()->is_ptr()->ptr() == TypePtr::Null, "Bad derived pointer");
|
||||
} else {
|
||||
assert(check->bottom_type()->is_ptr()->_offset == 0, "Bad base pointer");
|
||||
// Base either ConP(NULL) or loadConP
|
||||
if (check->is_Mach()) {
|
||||
assert(check->as_Mach()->ideal_Opcode() == Op_ConP, "Bad base pointer");
|
||||
} else {
|
||||
assert(check->Opcode() == Op_ConP &&
|
||||
check->bottom_type()->is_ptr()->ptr() == TypePtr::Null, "Bad base pointer");
|
||||
}
|
||||
}
|
||||
} else if (check->bottom_type()->is_ptr()->_offset == 0) {
|
||||
if (check->is_Proj() || (check->is_Mach() &&
|
||||
(check->as_Mach()->ideal_Opcode() == Op_CreateEx ||
|
||||
check->as_Mach()->ideal_Opcode() == Op_ThreadLocal ||
|
||||
check->as_Mach()->ideal_Opcode() == Op_CMoveP ||
|
||||
check->as_Mach()->ideal_Opcode() == Op_CheckCastPP ||
|
||||
#ifdef _LP64
|
||||
(UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_CastPP) ||
|
||||
(UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_DecodeN) ||
|
||||
(UseCompressedClassPointers && check->as_Mach()->ideal_Opcode() == Op_DecodeNKlass) ||
|
||||
#endif // _LP64
|
||||
check->as_Mach()->ideal_Opcode() == Op_LoadP ||
|
||||
check->as_Mach()->ideal_Opcode() == Op_LoadKlass))) {
|
||||
// Valid nodes
|
||||
} else {
|
||||
check->dump();
|
||||
assert(false, "Bad base or derived pointer");
|
||||
}
|
||||
} else {
|
||||
assert(is_derived, "Bad base pointer");
|
||||
assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP, "Bad derived pointer");
|
||||
}
|
||||
k++;
|
||||
assert(k < 100000, "Derived pointer checking in infinite loop");
|
||||
} // End while
|
||||
}
|
||||
} // End of check for derived pointers
|
||||
} // End of Kcheck for debug info
|
||||
} // End of if found a safepoint
|
||||
} // End of forall instructions in block
|
||||
} // End of forall blocks
|
||||
}
|
||||
|
||||
// Verify that graphs and base pointers are still sane.
|
||||
void PhaseChaitin::verify(ResourceArea* a, bool verify_ifg) const {
|
||||
if (VerifyRegisterAllocator) {
|
||||
_cfg.verify();
|
||||
verify_base_ptrs(a);
|
||||
if (verify_ifg) {
|
||||
_ifg->verify(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // ASSERT
|
||||
|
||||
int PhaseChaitin::_final_loads = 0;
|
||||
int PhaseChaitin::_final_stores = 0;
|
||||
int PhaseChaitin::_final_memoves= 0;
|
||||
|
||||
@@ -751,34 +751,34 @@ private:
|
||||
static int _used_cisc_instructions, _unused_cisc_instructions;
|
||||
static int _allocator_attempts, _allocator_successes;
|
||||
|
||||
#ifdef ASSERT
|
||||
// Verify that base pointers and derived pointers are still sane
|
||||
void verify_base_ptrs(ResourceArea* a) const;
|
||||
void verify(ResourceArea* a, bool verify_ifg = false) const;
|
||||
#endif // ASSERT
|
||||
|
||||
#ifndef PRODUCT
|
||||
static uint _high_pressure, _low_pressure;
|
||||
|
||||
void dump() const;
|
||||
void dump(const Node* n) const;
|
||||
void dump(const Block* b) const;
|
||||
void dump( const Node *n ) const;
|
||||
void dump( const Block * b ) const;
|
||||
void dump_degree_lists() const;
|
||||
void dump_simplified() const;
|
||||
void dump_lrg(uint lidx, bool defs_only) const;
|
||||
void dump_lrg(uint lidx) const {
|
||||
void dump_lrg( uint lidx, bool defs_only) const;
|
||||
void dump_lrg( uint lidx) const {
|
||||
// dump defs and uses by default
|
||||
dump_lrg(lidx, false);
|
||||
}
|
||||
void dump_bb(uint pre_order) const;
|
||||
void dump_bb( uint pre_order ) const;
|
||||
|
||||
// Verify that base pointers and derived pointers are still sane
|
||||
void verify_base_ptrs( ResourceArea *a ) const;
|
||||
|
||||
void verify( ResourceArea *a, bool verify_ifg = false ) const;
|
||||
|
||||
void dump_for_spill_split_recycle() const;
|
||||
|
||||
public:
|
||||
void dump_frame() const;
|
||||
char *dump_register(const Node* n, char* buf) const;
|
||||
char *dump_register( const Node *n, char *buf ) const;
|
||||
private:
|
||||
static void print_chaitin_statistics();
|
||||
#endif // not PRODUCT
|
||||
#endif
|
||||
friend class PhaseCoalesce;
|
||||
friend class PhaseAggressiveCoalesce;
|
||||
friend class PhaseConservativeCoalesce;
|
||||
|
||||
@@ -301,4 +301,100 @@ void PhaseLive::dump(const Block *b) const {
|
||||
tty->print("\n");
|
||||
}
|
||||
|
||||
// Verify that base pointers and derived pointers are still sane.
|
||||
void PhaseChaitin::verify_base_ptrs(ResourceArea *a) const {
|
||||
#ifdef ASSERT
|
||||
Unique_Node_List worklist(a);
|
||||
for (uint i = 0; i < _cfg.number_of_blocks(); i++) {
|
||||
Block* block = _cfg.get_block(i);
|
||||
for (uint j = block->end_idx() + 1; j > 1; j--) {
|
||||
Node* n = block->get_node(j-1);
|
||||
if (n->is_Phi()) {
|
||||
break;
|
||||
}
|
||||
// Found a safepoint?
|
||||
if (n->is_MachSafePoint()) {
|
||||
MachSafePointNode *sfpt = n->as_MachSafePoint();
|
||||
JVMState* jvms = sfpt->jvms();
|
||||
if (jvms != NULL) {
|
||||
// Now scan for a live derived pointer
|
||||
if (jvms->oopoff() < sfpt->req()) {
|
||||
// Check each derived/base pair
|
||||
for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx++) {
|
||||
Node *check = sfpt->in(idx);
|
||||
bool is_derived = ((idx - jvms->oopoff()) & 1) == 0;
|
||||
// search upwards through spills and spill phis for AddP
|
||||
worklist.clear();
|
||||
worklist.push(check);
|
||||
uint k = 0;
|
||||
while (k < worklist.size()) {
|
||||
check = worklist.at(k);
|
||||
assert(check,"Bad base or derived pointer");
|
||||
// See PhaseChaitin::find_base_for_derived() for all cases.
|
||||
int isc = check->is_Copy();
|
||||
if (isc) {
|
||||
worklist.push(check->in(isc));
|
||||
} else if (check->is_Phi()) {
|
||||
for (uint m = 1; m < check->req(); m++)
|
||||
worklist.push(check->in(m));
|
||||
} else if (check->is_Con()) {
|
||||
if (is_derived) {
|
||||
// Derived is NULL+offset
|
||||
assert(!is_derived || check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad derived pointer");
|
||||
} else {
|
||||
assert(check->bottom_type()->is_ptr()->_offset == 0,"Bad base pointer");
|
||||
// Base either ConP(NULL) or loadConP
|
||||
if (check->is_Mach()) {
|
||||
assert(check->as_Mach()->ideal_Opcode() == Op_ConP,"Bad base pointer");
|
||||
} else {
|
||||
assert(check->Opcode() == Op_ConP &&
|
||||
check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad base pointer");
|
||||
}
|
||||
}
|
||||
} else if (check->bottom_type()->is_ptr()->_offset == 0) {
|
||||
if (check->is_Proj() || (check->is_Mach() &&
|
||||
(check->as_Mach()->ideal_Opcode() == Op_CreateEx ||
|
||||
check->as_Mach()->ideal_Opcode() == Op_ThreadLocal ||
|
||||
check->as_Mach()->ideal_Opcode() == Op_CMoveP ||
|
||||
check->as_Mach()->ideal_Opcode() == Op_CheckCastPP ||
|
||||
#ifdef _LP64
|
||||
(UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_CastPP) ||
|
||||
(UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_DecodeN) ||
|
||||
(UseCompressedClassPointers && check->as_Mach()->ideal_Opcode() == Op_DecodeNKlass) ||
|
||||
#endif
|
||||
check->as_Mach()->ideal_Opcode() == Op_LoadP ||
|
||||
check->as_Mach()->ideal_Opcode() == Op_LoadKlass))) {
|
||||
// Valid nodes
|
||||
} else {
|
||||
check->dump();
|
||||
assert(false,"Bad base or derived pointer");
|
||||
}
|
||||
} else {
|
||||
assert(is_derived,"Bad base pointer");
|
||||
assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer");
|
||||
}
|
||||
k++;
|
||||
assert(k < 100000,"Derived pointer checking in infinite loop");
|
||||
} // End while
|
||||
}
|
||||
} // End of check for derived pointers
|
||||
} // End of Kcheck for debug info
|
||||
} // End of if found a safepoint
|
||||
} // End of forall instructions in block
|
||||
} // End of forall blocks
|
||||
#endif
|
||||
}
|
||||
|
||||
// Verify that graphs and base pointers are still sane.
|
||||
void PhaseChaitin::verify(ResourceArea *a, bool verify_ifg) const {
|
||||
#ifdef ASSERT
|
||||
if (VerifyRegisterAllocator) {
|
||||
_cfg.verify();
|
||||
verify_base_ptrs(a);
|
||||
if(verify_ifg)
|
||||
_ifg->verify(this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -245,45 +245,21 @@ void IdealLoopTree::compute_profile_trip_cnt(PhaseIdealLoop *phase) {
|
||||
head->set_profile_trip_cnt(trip_cnt);
|
||||
}
|
||||
|
||||
//---------------------find_invariant-----------------------------
|
||||
// Return nonzero index of invariant operand for an associative
|
||||
// binary operation of (nonconstant) invariant and variant values.
|
||||
// Helper for reassociate_invariants.
|
||||
int IdealLoopTree::find_invariant(Node* n, PhaseIdealLoop *phase) {
|
||||
bool in1_invar = this->is_invariant(n->in(1));
|
||||
bool in2_invar = this->is_invariant(n->in(2));
|
||||
if (in1_invar && !in2_invar) return 1;
|
||||
if (!in1_invar && in2_invar) return 2;
|
||||
//---------------------is_invariant_addition-----------------------------
|
||||
// Return nonzero index of invariant operand for an Add or Sub
|
||||
// of (nonconstant) invariant and variant values. Helper for reassociate_invariants.
|
||||
int IdealLoopTree::is_invariant_addition(Node* n, PhaseIdealLoop *phase) {
|
||||
int op = n->Opcode();
|
||||
if (op == Op_AddI || op == Op_SubI) {
|
||||
bool in1_invar = this->is_invariant(n->in(1));
|
||||
bool in2_invar = this->is_invariant(n->in(2));
|
||||
if (in1_invar && !in2_invar) return 1;
|
||||
if (!in1_invar && in2_invar) return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------is_associative-----------------------------
|
||||
// Return TRUE if "n" is an associative binary node. If "base" is
|
||||
// not NULL, "n" must be re-associative with it.
|
||||
bool IdealLoopTree::is_associative(Node* n, Node* base) {
|
||||
int op = n->Opcode();
|
||||
if (base != NULL) {
|
||||
assert(is_associative(base), "Base node should be associative");
|
||||
int base_op = base->Opcode();
|
||||
if (base_op == Op_AddI || base_op == Op_SubI) {
|
||||
return op == Op_AddI || op == Op_SubI;
|
||||
}
|
||||
if (base_op == Op_AddL || base_op == Op_SubL) {
|
||||
return op == Op_AddL || op == Op_SubL;
|
||||
}
|
||||
return op == base_op;
|
||||
} else {
|
||||
// Integer "add/sub/mul/and/or/xor" operations are associative.
|
||||
return op == Op_AddI || op == Op_AddL
|
||||
|| op == Op_SubI || op == Op_SubL
|
||||
|| op == Op_MulI || op == Op_MulL
|
||||
|| op == Op_AndI || op == Op_AndL
|
||||
|| op == Op_OrI || op == Op_OrL
|
||||
|| op == Op_XorI || op == Op_XorL;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------reassociate_add_sub------------------------
|
||||
//---------------------reassociate_add_sub-----------------------------
|
||||
// Reassociate invariant add and subtract expressions:
|
||||
//
|
||||
// inv1 + (x + inv2) => ( inv1 + inv2) + x
|
||||
@@ -299,12 +275,22 @@ bool IdealLoopTree::is_associative(Node* n, Node* base) {
|
||||
// (inv2 - x) - inv1 => (-inv1 + inv2) - x
|
||||
// inv1 - (x + inv2) => ( inv1 - inv2) - x
|
||||
//
|
||||
Node* IdealLoopTree::reassociate_add_sub(Node* n1, int inv1_idx, int inv2_idx, PhaseIdealLoop *phase) {
|
||||
assert(n1->is_Add() || n1->is_Sub(), "Target node should be add or subtract");
|
||||
Node* n2 = n1->in(3 - inv1_idx);
|
||||
Node* IdealLoopTree::reassociate_add_sub(Node* n1, PhaseIdealLoop *phase) {
|
||||
if ((!n1->is_Add() && !n1->is_Sub()) || n1->outcnt() == 0) return NULL;
|
||||
if (is_invariant(n1)) return NULL;
|
||||
int inv1_idx = is_invariant_addition(n1, phase);
|
||||
if (!inv1_idx) return NULL;
|
||||
// Don't mess with add of constant (igvn moves them to expression tree root.)
|
||||
if (n1->is_Add() && n1->in(2)->is_Con()) return NULL;
|
||||
Node* inv1 = n1->in(inv1_idx);
|
||||
Node* inv2 = n2->in(inv2_idx);
|
||||
Node* n2 = n1->in(3 - inv1_idx);
|
||||
int inv2_idx = is_invariant_addition(n2, phase);
|
||||
if (!inv2_idx) return NULL;
|
||||
|
||||
if (!phase->may_require_nodes(10, 10)) return NULL;
|
||||
|
||||
Node* x = n2->in(3 - inv2_idx);
|
||||
Node* inv2 = n2->in(inv2_idx);
|
||||
|
||||
bool neg_x = n2->is_Sub() && inv2_idx == 1;
|
||||
bool neg_inv2 = n2->is_Sub() && inv2_idx == 2;
|
||||
@@ -313,111 +299,36 @@ Node* IdealLoopTree::reassociate_add_sub(Node* n1, int inv1_idx, int inv2_idx, P
|
||||
neg_x = !neg_x;
|
||||
neg_inv2 = !neg_inv2;
|
||||
}
|
||||
|
||||
bool is_int = n1->bottom_type()->isa_int() != NULL;
|
||||
Node* inv1_c = phase->get_ctrl(inv1);
|
||||
Node* inv2_c = phase->get_ctrl(inv2);
|
||||
Node* n_inv1;
|
||||
if (neg_inv1) {
|
||||
Node* zero;
|
||||
if (is_int) {
|
||||
zero = phase->_igvn.intcon(0);
|
||||
n_inv1 = new SubINode(zero, inv1);
|
||||
} else {
|
||||
zero = phase->_igvn.longcon(0L);
|
||||
n_inv1 = new SubLNode(zero, inv1);
|
||||
}
|
||||
Node *zero = phase->_igvn.intcon(0);
|
||||
phase->set_ctrl(zero, phase->C->root());
|
||||
n_inv1 = new SubINode(zero, inv1);
|
||||
phase->register_new_node(n_inv1, inv1_c);
|
||||
} else {
|
||||
n_inv1 = inv1;
|
||||
}
|
||||
|
||||
Node* inv;
|
||||
if (is_int) {
|
||||
if (neg_inv2) {
|
||||
inv = new SubINode(n_inv1, inv2);
|
||||
} else {
|
||||
inv = new AddINode(n_inv1, inv2);
|
||||
}
|
||||
phase->register_new_node(inv, phase->get_early_ctrl(inv));
|
||||
if (neg_x) {
|
||||
return new SubINode(inv, x);
|
||||
} else {
|
||||
return new AddINode(x, inv);
|
||||
}
|
||||
if (neg_inv2) {
|
||||
inv = new SubINode(n_inv1, inv2);
|
||||
} else {
|
||||
if (neg_inv2) {
|
||||
inv = new SubLNode(n_inv1, inv2);
|
||||
} else {
|
||||
inv = new AddLNode(n_inv1, inv2);
|
||||
}
|
||||
phase->register_new_node(inv, phase->get_early_ctrl(inv));
|
||||
if (neg_x) {
|
||||
return new SubLNode(inv, x);
|
||||
} else {
|
||||
return new AddLNode(x, inv);
|
||||
}
|
||||
inv = new AddINode(n_inv1, inv2);
|
||||
}
|
||||
}
|
||||
phase->register_new_node(inv, phase->get_early_ctrl(inv));
|
||||
|
||||
//---------------------reassociate-----------------------------
|
||||
// Reassociate invariant binary expressions with add/sub/mul/
|
||||
// and/or/xor operators.
|
||||
// For add/sub expressions: see "reassociate_add_sub"
|
||||
//
|
||||
// For mul/and/or/xor expressions:
|
||||
//
|
||||
// inv1 op (x op inv2) => (inv1 op inv2) op x
|
||||
//
|
||||
Node* IdealLoopTree::reassociate(Node* n1, PhaseIdealLoop *phase) {
|
||||
if (!is_associative(n1) || n1->outcnt() == 0) return NULL;
|
||||
if (is_invariant(n1)) return NULL;
|
||||
// Don't mess with add of constant (igvn moves them to expression tree root.)
|
||||
if (n1->is_Add() && n1->in(2)->is_Con()) return NULL;
|
||||
|
||||
int inv1_idx = find_invariant(n1, phase);
|
||||
if (!inv1_idx) return NULL;
|
||||
Node* n2 = n1->in(3 - inv1_idx);
|
||||
if (!is_associative(n2, n1)) return NULL;
|
||||
int inv2_idx = find_invariant(n2, phase);
|
||||
if (!inv2_idx) return NULL;
|
||||
|
||||
if (!phase->may_require_nodes(10, 10)) return NULL;
|
||||
|
||||
Node* result = NULL;
|
||||
switch (n1->Opcode()) {
|
||||
case Op_AddI:
|
||||
case Op_AddL:
|
||||
case Op_SubI:
|
||||
case Op_SubL:
|
||||
result = reassociate_add_sub(n1, inv1_idx, inv2_idx, phase);
|
||||
break;
|
||||
case Op_MulI:
|
||||
case Op_MulL:
|
||||
case Op_AndI:
|
||||
case Op_AndL:
|
||||
case Op_OrI:
|
||||
case Op_OrL:
|
||||
case Op_XorI:
|
||||
case Op_XorL: {
|
||||
Node* inv1 = n1->in(inv1_idx);
|
||||
Node* inv2 = n2->in(inv2_idx);
|
||||
Node* x = n2->in(3 - inv2_idx);
|
||||
Node* inv = n2->clone_with_data_edge(inv1, inv2);
|
||||
phase->register_new_node(inv, phase->get_early_ctrl(inv));
|
||||
result = n1->clone_with_data_edge(x, inv);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
Node* addx;
|
||||
if (neg_x) {
|
||||
addx = new SubINode(inv, x);
|
||||
} else {
|
||||
addx = new AddINode(x, inv);
|
||||
}
|
||||
|
||||
assert(result != NULL, "");
|
||||
phase->register_new_node(result, phase->get_ctrl(n1));
|
||||
phase->_igvn.replace_node(n1, result);
|
||||
phase->register_new_node(addx, phase->get_ctrl(x));
|
||||
phase->_igvn.replace_node(n1, addx);
|
||||
assert(phase->get_loop(phase->get_ctrl(n1)) == this, "");
|
||||
_body.yank(n1);
|
||||
return result;
|
||||
return addx;
|
||||
}
|
||||
|
||||
//---------------------reassociate_invariants-----------------------------
|
||||
@@ -426,7 +337,7 @@ void IdealLoopTree::reassociate_invariants(PhaseIdealLoop *phase) {
|
||||
for (int i = _body.size() - 1; i >= 0; i--) {
|
||||
Node *n = _body.at(i);
|
||||
for (int j = 0; j < 5; j++) {
|
||||
Node* nn = reassociate(n, phase);
|
||||
Node* nn = reassociate_add_sub(n, phase);
|
||||
if (nn == NULL) break;
|
||||
n = nn; // again
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@@ -636,15 +636,11 @@ public:
|
||||
|
||||
// Reassociate invariant expressions.
|
||||
void reassociate_invariants(PhaseIdealLoop *phase);
|
||||
// Reassociate invariant binary expressions.
|
||||
Node* reassociate(Node* n1, PhaseIdealLoop *phase);
|
||||
// Reassociate invariant add and subtract expressions.
|
||||
Node* reassociate_add_sub(Node* n1, int inv1_idx, int inv2_idx, PhaseIdealLoop *phase);
|
||||
Node* reassociate_add_sub(Node* n1, PhaseIdealLoop *phase);
|
||||
// Return nonzero index of invariant operand if invariant and variant
|
||||
// are combined with an associative binary. Helper for reassociate_invariants.
|
||||
int find_invariant(Node* n, PhaseIdealLoop *phase);
|
||||
// Return TRUE if "n" is associative.
|
||||
bool is_associative(Node* n, Node* base=NULL);
|
||||
// are combined with an Add or Sub. Helper for reassociate_invariants.
|
||||
int is_invariant_addition(Node* n, PhaseIdealLoop *phase);
|
||||
|
||||
// Return true if n is invariant
|
||||
bool is_invariant(Node* n) const;
|
||||
|
||||
@@ -48,7 +48,12 @@ class InlineTree : public ResourceObj {
|
||||
ciMethod* _method; // method being called by the caller_jvms
|
||||
InlineTree* _caller_tree;
|
||||
uint _count_inline_bcs; // Accumulated count of inlined bytecodes
|
||||
// Call-site count / interpreter invocation count, scaled recursively.
|
||||
// Always between 0.0 and 1.0. Represents the percentage of the method's
|
||||
// total execution time used at this call site.
|
||||
const float _site_invoke_ratio;
|
||||
const int _max_inline_level; // the maximum inline level for this sub-tree (may be adjusted)
|
||||
float compute_callee_frequency( int caller_bci ) const;
|
||||
|
||||
GrowableArray<InlineTree*> _subtrees;
|
||||
|
||||
@@ -62,6 +67,7 @@ protected:
|
||||
ciMethod* callee_method,
|
||||
JVMState* caller_jvms,
|
||||
int caller_bci,
|
||||
float site_invoke_ratio,
|
||||
int max_inline_level);
|
||||
InlineTree *build_inline_tree_for_callee(ciMethod* callee_method,
|
||||
JVMState* caller_jvms,
|
||||
@@ -119,6 +125,7 @@ public:
|
||||
ciMethod *method() const { return _method; }
|
||||
int caller_bci() const { return _caller_jvms ? _caller_jvms->bci() : InvocationEntryBci; }
|
||||
uint count_inline_bcs() const { return _count_inline_bcs; }
|
||||
float site_invoke_ratio() const { return _site_invoke_ratio; };
|
||||
|
||||
#ifndef PRODUCT
|
||||
private:
|
||||
|
||||
@@ -499,10 +499,6 @@ void SuperWord::SLP_extract() {
|
||||
|
||||
find_adjacent_refs();
|
||||
|
||||
if (align_to_ref() == NULL) {
|
||||
return; // Did not find memory reference to align vectors
|
||||
}
|
||||
|
||||
extend_packlist();
|
||||
|
||||
if (_do_vector_loop) {
|
||||
@@ -579,9 +575,6 @@ void SuperWord::find_adjacent_refs() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (TraceSuperWord) {
|
||||
tty->print_cr("\nfind_adjacent_refs found %d memops", memops.size());
|
||||
}
|
||||
|
||||
Node_List align_to_refs;
|
||||
int max_idx;
|
||||
@@ -2644,10 +2637,8 @@ void SuperWord::output() {
|
||||
}
|
||||
}
|
||||
|
||||
if (vlen > max_vlen) {
|
||||
if (vlen_in_bytes >= max_vlen_in_bytes && vlen > max_vlen) {
|
||||
max_vlen = vlen;
|
||||
}
|
||||
if (vlen_in_bytes > max_vlen_in_bytes) {
|
||||
max_vlen_in_bytes = vlen_in_bytes;
|
||||
}
|
||||
#ifdef ASSERT
|
||||
@@ -3236,15 +3227,15 @@ void SuperWord::compute_vector_element_type() {
|
||||
//------------------------------memory_alignment---------------------------
|
||||
// Alignment within a vector memory reference
|
||||
int SuperWord::memory_alignment(MemNode* s, int iv_adjust) {
|
||||
#ifndef PRODUCT
|
||||
if ((TraceSuperWord && Verbose) || is_trace_alignment()) {
|
||||
tty->print("SuperWord::memory_alignment within a vector memory reference for %d: ", s->_idx); s->dump();
|
||||
}
|
||||
#endif
|
||||
#ifndef PRODUCT
|
||||
if(TraceSuperWord && Verbose) {
|
||||
tty->print("SuperWord::memory_alignment within a vector memory reference for %d: ", s->_idx); s->dump();
|
||||
}
|
||||
#endif
|
||||
NOT_PRODUCT(SWPointer::Tracer::Depth ddd(0);)
|
||||
SWPointer p(s, this, NULL, false);
|
||||
if (!p.valid()) {
|
||||
NOT_PRODUCT(if(is_trace_alignment()) tty->print_cr("SWPointer::memory_alignment: SWPointer p invalid, return bottom_align");)
|
||||
NOT_PRODUCT(if(is_trace_alignment()) tty->print("SWPointer::memory_alignment: SWPointer p invalid, return bottom_align");)
|
||||
return bottom_align;
|
||||
}
|
||||
int vw = get_vw_bytes_special(s);
|
||||
@@ -3256,11 +3247,9 @@ int SuperWord::memory_alignment(MemNode* s, int iv_adjust) {
|
||||
offset += iv_adjust*p.memory_size();
|
||||
int off_rem = offset % vw;
|
||||
int off_mod = off_rem >= 0 ? off_rem : off_rem + vw;
|
||||
#ifndef PRODUCT
|
||||
if ((TraceSuperWord && Verbose) || is_trace_alignment()) {
|
||||
if (TraceSuperWord && Verbose) {
|
||||
tty->print_cr("SWPointer::memory_alignment: off_rem = %d, off_mod = %d", off_rem, off_mod);
|
||||
}
|
||||
#endif
|
||||
return off_mod;
|
||||
}
|
||||
|
||||
@@ -3775,7 +3764,6 @@ bool SWPointer::invariant(Node* n) {
|
||||
NOT_PRODUCT(_tracer.invariant_1(n, n_c);)
|
||||
return !lpt()->is_member(phase()->get_loop(n_c));
|
||||
}
|
||||
|
||||
//------------------------scaled_iv_plus_offset--------------------
|
||||
// Match: k*iv + offset
|
||||
// where: k is a constant that maybe zero, and
|
||||
@@ -3796,20 +3784,20 @@ bool SWPointer::scaled_iv_plus_offset(Node* n) {
|
||||
|
||||
int opc = n->Opcode();
|
||||
if (opc == Op_AddI) {
|
||||
if (offset_plus_k(n->in(2)) && scaled_iv_plus_offset(n->in(1))) {
|
||||
if (scaled_iv(n->in(1)) && offset_plus_k(n->in(2))) {
|
||||
NOT_PRODUCT(_tracer.scaled_iv_plus_offset_4(n);)
|
||||
return true;
|
||||
}
|
||||
if (offset_plus_k(n->in(1)) && scaled_iv_plus_offset(n->in(2))) {
|
||||
if (scaled_iv(n->in(2)) && offset_plus_k(n->in(1))) {
|
||||
NOT_PRODUCT(_tracer.scaled_iv_plus_offset_5(n);)
|
||||
return true;
|
||||
}
|
||||
} else if (opc == Op_SubI) {
|
||||
if (offset_plus_k(n->in(2), true) && scaled_iv_plus_offset(n->in(1))) {
|
||||
if (scaled_iv(n->in(1)) && offset_plus_k(n->in(2), true)) {
|
||||
NOT_PRODUCT(_tracer.scaled_iv_plus_offset_6(n);)
|
||||
return true;
|
||||
}
|
||||
if (offset_plus_k(n->in(1)) && scaled_iv_plus_offset(n->in(2))) {
|
||||
if (scaled_iv(n->in(2)) && offset_plus_k(n->in(1))) {
|
||||
_scale *= -1;
|
||||
NOT_PRODUCT(_tracer.scaled_iv_plus_offset_7(n);)
|
||||
return true;
|
||||
@@ -3881,7 +3869,6 @@ bool SWPointer::scaled_iv(Node* n) {
|
||||
int mult = 1 << n->in(2)->get_int();
|
||||
_scale = tmp._scale * mult;
|
||||
_offset += tmp._offset * mult;
|
||||
_invar = tmp._invar;
|
||||
NOT_PRODUCT(_tracer.scaled_iv_9(n, _scale, _offset, mult);)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "code/nmethod.hpp"
|
||||
#include "code/pcDesc.hpp"
|
||||
#include "code/scopeDesc.hpp"
|
||||
#include "gc/shared/oopStorageSet.hpp"
|
||||
#include "interpreter/interpreter.hpp"
|
||||
#include "jvmtifiles/jvmtiEnv.hpp"
|
||||
#include "logging/log.hpp"
|
||||
@@ -679,18 +678,6 @@ void JvmtiExport::post_vm_start() {
|
||||
}
|
||||
}
|
||||
|
||||
static OopStorage* _jvmti_oop_storage = NULL;
|
||||
|
||||
OopStorage* JvmtiExport::jvmti_oop_storage() {
|
||||
assert(_jvmti_oop_storage != NULL, "not yet initialized");
|
||||
return _jvmti_oop_storage;
|
||||
}
|
||||
|
||||
void JvmtiExport::initialize_oop_storage() {
|
||||
// OopStorage needs to be created early in startup and unconditionally
|
||||
// because of OopStorageSet static array indices.
|
||||
_jvmti_oop_storage = OopStorageSet::create_strong("JVMTI OopStorage");
|
||||
}
|
||||
|
||||
void JvmtiExport::post_vm_initialized() {
|
||||
EVT_TRIG_TRACE(JVMTI_EVENT_VM_INIT, ("Trg VM init event triggered" ));
|
||||
@@ -2841,7 +2828,7 @@ void JvmtiObjectAllocEventCollector::generate_call_for_allocated() {
|
||||
oop obj = _allocated->at(i).resolve();
|
||||
_post_callback(JavaThread::current(), obj);
|
||||
// Release OopHandle
|
||||
_allocated->at(i).release(JvmtiExport::jvmti_oop_storage());
|
||||
_allocated->at(i).release(Universe::vm_global());
|
||||
|
||||
}
|
||||
delete _allocated, _allocated = NULL;
|
||||
@@ -2853,7 +2840,7 @@ void JvmtiObjectAllocEventCollector::record_allocation(oop obj) {
|
||||
if (_allocated == NULL) {
|
||||
_allocated = new (ResourceObj::C_HEAP, mtServiceability) GrowableArray<OopHandle>(1, mtServiceability);
|
||||
}
|
||||
_allocated->push(OopHandle(JvmtiExport::jvmti_oop_storage(), obj));
|
||||
_allocated->push(OopHandle(Universe::vm_global(), obj));
|
||||
}
|
||||
|
||||
// Disable collection of VMObjectAlloc events
|
||||
|
||||
@@ -47,8 +47,6 @@ class JvmtiManageCapabilities;
|
||||
class JvmtiEnv;
|
||||
class JvmtiThreadState;
|
||||
|
||||
class OopStorage;
|
||||
|
||||
#define JVMTI_SUPPORT_FLAG(key) \
|
||||
private: \
|
||||
static bool _##key; \
|
||||
@@ -164,9 +162,6 @@ class JvmtiExport : public AllStatic {
|
||||
static void post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end) NOT_JVMTI_RETURN;
|
||||
|
||||
static void post_class_unload_internal(const char *name) NOT_JVMTI_RETURN;
|
||||
|
||||
static void initialize_oop_storage() NOT_JVMTI_RETURN;
|
||||
static OopStorage* jvmti_oop_storage();
|
||||
private:
|
||||
|
||||
// GenerateEvents support to allow posting of CompiledMethodLoad and
|
||||
|
||||
@@ -200,19 +200,19 @@ JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location)
|
||||
assert(_method != NULL, "No method for breakpoint.");
|
||||
assert(_bci >= 0, "Negative bci for breakpoint.");
|
||||
oop class_holder_oop = _method->method_holder()->klass_holder();
|
||||
_class_holder = OopHandle(JvmtiExport::jvmti_oop_storage(), class_holder_oop);
|
||||
_class_holder = OopHandle(Universe::vm_global(), class_holder_oop);
|
||||
}
|
||||
|
||||
JvmtiBreakpoint::~JvmtiBreakpoint() {
|
||||
if (_class_holder.peek() != NULL) {
|
||||
_class_holder.release(JvmtiExport::jvmti_oop_storage());
|
||||
_class_holder.release(Universe::vm_global());
|
||||
}
|
||||
}
|
||||
|
||||
void JvmtiBreakpoint::copy(JvmtiBreakpoint& bp) {
|
||||
_method = bp._method;
|
||||
_bci = bp._bci;
|
||||
_class_holder = OopHandle(JvmtiExport::jvmti_oop_storage(), bp._class_holder.resolve());
|
||||
_class_holder = OopHandle(Universe::vm_global(), bp._class_holder.resolve());
|
||||
}
|
||||
|
||||
bool JvmtiBreakpoint::equals(JvmtiBreakpoint& bp) {
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "logging/log.hpp"
|
||||
#include "logging/logTag.hpp"
|
||||
#include "memory/universe.hpp"
|
||||
#include "prims/jvmtiExport.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
#include "runtime/atomic.hpp"
|
||||
#include "runtime/flags/jvmFlag.hpp"
|
||||
@@ -107,7 +106,6 @@ void vm_init_globals() {
|
||||
|
||||
jint init_globals() {
|
||||
management_init();
|
||||
JvmtiExport::initialize_oop_storage();
|
||||
bytecodes_init();
|
||||
classLoader_init1();
|
||||
compilationPolicy_init();
|
||||
|
||||
@@ -88,6 +88,18 @@ static size_t cur_malloc_words = 0; // current size for MallocMaxTestWords
|
||||
|
||||
DEBUG_ONLY(bool os::_mutex_init_done = false;)
|
||||
|
||||
static time_t get_timezone(const struct tm* time_struct) {
|
||||
#if defined(_ALLBSD_SOURCE)
|
||||
return time_struct->tm_gmtoff;
|
||||
#elif defined(_WINDOWS)
|
||||
long zone;
|
||||
_get_timezone(&zone);
|
||||
return static_cast<time_t>(zone);
|
||||
#else
|
||||
return timezone;
|
||||
#endif
|
||||
}
|
||||
|
||||
int os::snprintf(char* buf, size_t len, const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
@@ -140,32 +152,21 @@ char* os::iso8601_time(char* buffer, size_t buffer_length, bool utc) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
const time_t zone = get_timezone(&time_struct);
|
||||
|
||||
// If daylight savings time is in effect,
|
||||
// we are 1 hour East of our time zone
|
||||
const time_t seconds_per_minute = 60;
|
||||
const time_t minutes_per_hour = 60;
|
||||
const time_t seconds_per_hour = seconds_per_minute * minutes_per_hour;
|
||||
time_t UTC_to_local = zone;
|
||||
if (time_struct.tm_isdst > 0) {
|
||||
UTC_to_local = UTC_to_local - seconds_per_hour;
|
||||
}
|
||||
|
||||
// No offset when dealing with UTC
|
||||
time_t UTC_to_local = 0;
|
||||
if (!utc) {
|
||||
#if defined(_ALLBSD_SOURCE) || defined(_GNU_SOURCE)
|
||||
UTC_to_local = -(time_struct.tm_gmtoff);
|
||||
#elif defined(_WINDOWS)
|
||||
long zone;
|
||||
_get_timezone(&zone);
|
||||
UTC_to_local = static_cast<time_t>(zone);
|
||||
#else
|
||||
UTC_to_local = timezone;
|
||||
#endif
|
||||
|
||||
// tm_gmtoff already includes adjustment for daylight saving
|
||||
#if !defined(_ALLBSD_SOURCE) && !defined(_GNU_SOURCE)
|
||||
// If daylight savings time is in effect,
|
||||
// we are 1 hour East of our time zone
|
||||
if (time_struct.tm_isdst > 0) {
|
||||
UTC_to_local = UTC_to_local - seconds_per_hour;
|
||||
}
|
||||
#endif
|
||||
if (utc) {
|
||||
UTC_to_local = 0;
|
||||
}
|
||||
|
||||
// Compute the time zone offset.
|
||||
|
||||
@@ -69,17 +69,10 @@ class OopHandleList : public CHeapObj<mtInternal> {
|
||||
static OopHandleList* _oop_handle_list = NULL;
|
||||
|
||||
static void release_oop_handles() {
|
||||
OopHandleList* list;
|
||||
{
|
||||
MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
list = _oop_handle_list;
|
||||
_oop_handle_list = NULL;
|
||||
}
|
||||
assert(!SafepointSynchronize::is_at_safepoint(), "cannot be called at a safepoint");
|
||||
|
||||
while (list != NULL) {
|
||||
OopHandleList* l = list;
|
||||
list = l->next();
|
||||
assert_lock_strong(Service_lock);
|
||||
while (_oop_handle_list != NULL) {
|
||||
OopHandleList* l = _oop_handle_list;
|
||||
_oop_handle_list = l->next();
|
||||
delete l;
|
||||
}
|
||||
}
|
||||
@@ -144,7 +137,6 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
|
||||
bool oopstorage_work = false;
|
||||
bool deflate_idle_monitors = false;
|
||||
JvmtiDeferredEvent jvmti_event;
|
||||
bool oop_handles_to_release = false;
|
||||
{
|
||||
// Need state transition ThreadBlockInVM so that this thread
|
||||
// will be handled by safepoint correctly when this thread is
|
||||
@@ -171,7 +163,7 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
|
||||
(thread_id_table_work = ThreadIdTable::has_work()) |
|
||||
(protection_domain_table_work = SystemDictionary::pd_cache_table()->has_work()) |
|
||||
(oopstorage_work = OopStorage::has_cleanup_work_and_reset()) |
|
||||
(oop_handles_to_release = (_oop_handle_list != NULL)) |
|
||||
(_oop_handle_list != NULL) |
|
||||
(deflate_idle_monitors = ObjectSynchronizer::is_async_deflation_needed())
|
||||
) == 0) {
|
||||
// Wait until notified that there is some work to do.
|
||||
@@ -185,6 +177,11 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
|
||||
jvmti_event = _jvmti_service_queue.dequeue();
|
||||
_jvmti_event = &jvmti_event;
|
||||
}
|
||||
|
||||
// Release thread OopHandles in lock
|
||||
if (_oop_handle_list != NULL) {
|
||||
release_oop_handles();
|
||||
}
|
||||
}
|
||||
|
||||
if (stringtable_work) {
|
||||
@@ -233,10 +230,6 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
|
||||
if (deflate_idle_monitors) {
|
||||
ObjectSynchronizer::deflate_idle_monitors_using_JT();
|
||||
}
|
||||
|
||||
if (oop_handles_to_release) {
|
||||
release_oop_handles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ const char* NMTUtil::_memory_type_names[] = {
|
||||
|
||||
const char* NMTUtil::scale_name(size_t scale) {
|
||||
switch(scale) {
|
||||
case 1: return "";
|
||||
case K: return "KB";
|
||||
case M: return "MB";
|
||||
case G: return "GB";
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "gc/shared/oopStorageSet.hpp"
|
||||
#include "memory/allocation.hpp"
|
||||
#include "memory/heapInspection.hpp"
|
||||
#include "memory/oopFactory.hpp"
|
||||
@@ -68,9 +67,6 @@ ThreadDumpResult* ThreadService::_threaddump_list = NULL;
|
||||
|
||||
static const int INITIAL_ARRAY_SIZE = 10;
|
||||
|
||||
// OopStorage for thread stack sampling
|
||||
static OopStorage* _thread_service_storage = NULL;
|
||||
|
||||
void ThreadService::init() {
|
||||
EXCEPTION_MARK;
|
||||
|
||||
@@ -99,9 +95,6 @@ void ThreadService::init() {
|
||||
}
|
||||
|
||||
_thread_allocated_memory_enabled = true; // Always on, so enable it
|
||||
|
||||
// Initialize OopStorage for thread stack sampling walking
|
||||
_thread_service_storage = OopStorageSet::create_strong("ThreadService OopStorage");
|
||||
}
|
||||
|
||||
void ThreadService::reset_peak_thread_count() {
|
||||
@@ -570,7 +563,7 @@ ThreadsList* ThreadDumpResult::t_list() {
|
||||
StackFrameInfo::StackFrameInfo(javaVFrame* jvf, bool with_lock_info) {
|
||||
_method = jvf->method();
|
||||
_bci = jvf->bci();
|
||||
_class_holder = OopHandle(_thread_service_storage, _method->method_holder()->klass_holder());
|
||||
_class_holder = OopHandle(Universe::vm_global(), _method->method_holder()->klass_holder());
|
||||
_locked_monitors = NULL;
|
||||
if (with_lock_info) {
|
||||
Thread* current_thread = Thread::current();
|
||||
@@ -583,7 +576,7 @@ StackFrameInfo::StackFrameInfo(javaVFrame* jvf, bool with_lock_info) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
MonitorInfo* monitor = list->at(i);
|
||||
assert(monitor->owner() != NULL, "This monitor must have an owning object");
|
||||
_locked_monitors->append(OopHandle(_thread_service_storage, monitor->owner()));
|
||||
_locked_monitors->append(OopHandle(Universe::vm_global(), monitor->owner()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -592,11 +585,11 @@ StackFrameInfo::StackFrameInfo(javaVFrame* jvf, bool with_lock_info) {
|
||||
StackFrameInfo::~StackFrameInfo() {
|
||||
if (_locked_monitors != NULL) {
|
||||
for (int i = 0; i < _locked_monitors->length(); i++) {
|
||||
_locked_monitors->at(i).release(_thread_service_storage);
|
||||
_locked_monitors->at(i).release(Universe::vm_global());
|
||||
}
|
||||
delete _locked_monitors;
|
||||
}
|
||||
_class_holder.release(_thread_service_storage);
|
||||
_class_holder.release(Universe::vm_global());
|
||||
}
|
||||
|
||||
void StackFrameInfo::metadata_do(void f(Metadata*)) {
|
||||
@@ -647,7 +640,7 @@ ThreadStackTrace::ThreadStackTrace(JavaThread* t, bool with_locked_monitors) {
|
||||
}
|
||||
|
||||
void ThreadStackTrace::add_jni_locked_monitor(oop object) {
|
||||
_jni_locked_monitors->append(OopHandle(_thread_service_storage, object));
|
||||
_jni_locked_monitors->append(OopHandle(Universe::vm_global(), object));
|
||||
}
|
||||
|
||||
ThreadStackTrace::~ThreadStackTrace() {
|
||||
@@ -657,7 +650,7 @@ ThreadStackTrace::~ThreadStackTrace() {
|
||||
delete _frames;
|
||||
if (_jni_locked_monitors != NULL) {
|
||||
for (int i = 0; i < _jni_locked_monitors->length(); i++) {
|
||||
_jni_locked_monitors->at(i).release(_thread_service_storage);
|
||||
_jni_locked_monitors->at(i).release(Universe::vm_global());
|
||||
}
|
||||
delete _jni_locked_monitors;
|
||||
}
|
||||
@@ -841,13 +834,13 @@ ThreadConcurrentLocks::ThreadConcurrentLocks(JavaThread* thread) {
|
||||
|
||||
ThreadConcurrentLocks::~ThreadConcurrentLocks() {
|
||||
for (int i = 0; i < _owned_locks->length(); i++) {
|
||||
_owned_locks->at(i).release(_thread_service_storage);
|
||||
_owned_locks->at(i).release(Universe::vm_global());
|
||||
}
|
||||
delete _owned_locks;
|
||||
}
|
||||
|
||||
void ThreadConcurrentLocks::add_lock(instanceOop o) {
|
||||
_owned_locks->append(OopHandle(_thread_service_storage, o));
|
||||
_owned_locks->append(OopHandle(Universe::vm_global(), o));
|
||||
}
|
||||
|
||||
ThreadStatistics::ThreadStatistics() {
|
||||
@@ -864,7 +857,7 @@ oop ThreadSnapshot::threadObj() const { return _threadObj.resolve(); }
|
||||
void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) {
|
||||
_thread = thread;
|
||||
oop threadObj = thread->threadObj();
|
||||
_threadObj = OopHandle(_thread_service_storage, threadObj);
|
||||
_threadObj = OopHandle(Universe::vm_global(), threadObj);
|
||||
|
||||
ThreadStatistics* stat = thread->get_thread_stat();
|
||||
_contended_enter_ticks = stat->contended_enter_ticks();
|
||||
@@ -917,10 +910,10 @@ void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) {
|
||||
}
|
||||
|
||||
if (blocker_object != NULL) {
|
||||
_blocker_object = OopHandle(_thread_service_storage, blocker_object);
|
||||
_blocker_object = OopHandle(Universe::vm_global(), blocker_object);
|
||||
}
|
||||
if (blocker_object_owner != NULL) {
|
||||
_blocker_object_owner = OopHandle(_thread_service_storage, blocker_object_owner);
|
||||
_blocker_object_owner = OopHandle(Universe::vm_global(), blocker_object_owner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -928,9 +921,9 @@ oop ThreadSnapshot::blocker_object() const { return _blocker_object.re
|
||||
oop ThreadSnapshot::blocker_object_owner() const { return _blocker_object_owner.resolve(); }
|
||||
|
||||
ThreadSnapshot::~ThreadSnapshot() {
|
||||
_blocker_object.release(_thread_service_storage);
|
||||
_blocker_object_owner.release(_thread_service_storage);
|
||||
_threadObj.release(_thread_service_storage);
|
||||
_blocker_object.release(Universe::vm_global());
|
||||
_blocker_object_owner.release(Universe::vm_global());
|
||||
_threadObj.release(Universe::vm_global());
|
||||
|
||||
delete _stack_trace;
|
||||
delete _concurrent_locks;
|
||||
|
||||
@@ -627,6 +627,32 @@ void BitMap::clear_large() {
|
||||
clear_large_range_of_words(0, size_in_words());
|
||||
}
|
||||
|
||||
// Note that if the closure itself modifies the bitmap
|
||||
// then modifications in and to the left of the _bit_ being
|
||||
// currently sampled will not be seen. Note also that the
|
||||
// interval [leftOffset, rightOffset) is right open.
|
||||
bool BitMap::iterate(BitMapClosure* blk, idx_t leftOffset, idx_t rightOffset) {
|
||||
verify_range(leftOffset, rightOffset);
|
||||
|
||||
idx_t startIndex = to_words_align_down(leftOffset);
|
||||
idx_t endIndex = to_words_align_up(rightOffset);
|
||||
for (idx_t index = startIndex, offset = leftOffset;
|
||||
offset < rightOffset && index < endIndex;
|
||||
offset = (++index) << LogBitsPerWord) {
|
||||
idx_t rest = map(index) >> (offset & (BitsPerWord - 1));
|
||||
for (; offset < rightOffset && rest != 0; offset++) {
|
||||
if (rest & 1) {
|
||||
if (!blk->do_bit(offset)) return false;
|
||||
// resample at each closure application
|
||||
// (see, for instance, CMS bug 4525989)
|
||||
rest = map(index) >> (offset & (BitsPerWord -1));
|
||||
}
|
||||
rest = rest >> 1;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
BitMap::idx_t BitMap::count_one_bits_in_range_of_words(idx_t beg_full_word, idx_t end_full_word) const {
|
||||
idx_t sum = 0;
|
||||
for (idx_t i = beg_full_word; i < end_full_word; i++) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, 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
|
||||
@@ -284,16 +284,14 @@ class BitMap {
|
||||
void clear_large();
|
||||
inline void clear();
|
||||
|
||||
// Iteration support. Applies the closure to the index for each set bit,
|
||||
// starting from the least index in the range to the greatest, in order.
|
||||
// The iteration terminates if the closure returns false. Returns true if
|
||||
// the iteration completed, false if terminated early because the closure
|
||||
// returned false. If the closure modifies the bitmap, modifications to
|
||||
// bits at indices greater than the current index will affect which further
|
||||
// indices the closure will be applied to.
|
||||
// precondition: beg and end form a valid range.
|
||||
bool iterate(BitMapClosure* cl, idx_t beg, idx_t end);
|
||||
bool iterate(BitMapClosure* cl);
|
||||
// Iteration support. Returns "true" if the iteration completed, false
|
||||
// if the iteration terminated early (because the closure "blk" returned
|
||||
// false).
|
||||
bool iterate(BitMapClosure* blk, idx_t leftIndex, idx_t rightIndex);
|
||||
bool iterate(BitMapClosure* blk) {
|
||||
// call the version that takes an interval
|
||||
return iterate(blk, 0, size());
|
||||
}
|
||||
|
||||
// Looking for 1's and 0's at indices equal to or greater than "l_index",
|
||||
// stopping if none has been found before "r_index", and returning
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2020, 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
|
||||
@@ -242,21 +242,6 @@ BitMap::get_next_one_offset_aligned_right(idx_t l_offset, idx_t r_offset) const
|
||||
return get_next_bit_impl<find_ones_flip, true>(l_offset, r_offset);
|
||||
}
|
||||
|
||||
inline bool BitMap::iterate(BitMapClosure* cl, idx_t beg, idx_t end) {
|
||||
for (idx_t index = beg; true; ++index) {
|
||||
index = get_next_one_offset(index, end);
|
||||
if (index >= end) {
|
||||
return true;
|
||||
} else if (!cl->do_bit(index)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline bool BitMap::iterate(BitMapClosure* cl) {
|
||||
return iterate(cl, 0, size());
|
||||
}
|
||||
|
||||
// Returns a bit mask for a range of bits [beg, end) within a single word. Each
|
||||
// bit in the mask is 0 if the bit is in the range, 1 if not in the range. The
|
||||
// returned mask can be used directly to clear the range, or inverted to set the
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
*
|
||||
* 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
* 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
|
||||
|
||||
@@ -1790,42 +1790,6 @@ public class TreeMap<K,V>
|
||||
return m.put(key, value);
|
||||
}
|
||||
|
||||
public V putIfAbsent(K key, V value) {
|
||||
if (!inRange(key))
|
||||
throw new IllegalArgumentException("key out of range");
|
||||
return m.putIfAbsent(key, value);
|
||||
}
|
||||
|
||||
public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
|
||||
if (!inRange(key))
|
||||
throw new IllegalArgumentException("key out of range");
|
||||
return m.merge(key, value, remappingFunction);
|
||||
}
|
||||
|
||||
public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
|
||||
if (!inRange(key)) {
|
||||
// Do not throw if mapping function returns null
|
||||
// to preserve compatibility with default computeIfAbsent implementation
|
||||
if (mappingFunction.apply(key) == null) return null;
|
||||
throw new IllegalArgumentException("key out of range");
|
||||
}
|
||||
return m.computeIfAbsent(key, mappingFunction);
|
||||
}
|
||||
|
||||
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
|
||||
if (!inRange(key)) {
|
||||
// Do not throw if remapping function returns null
|
||||
// to preserve compatibility with default computeIfAbsent implementation
|
||||
if (remappingFunction.apply(key, null) == null) return null;
|
||||
throw new IllegalArgumentException("key out of range");
|
||||
}
|
||||
return m.compute(key, remappingFunction);
|
||||
}
|
||||
|
||||
public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
|
||||
return !inRange(key) ? null : m.computeIfPresent(key, remappingFunction);
|
||||
}
|
||||
|
||||
public final V get(Object key) {
|
||||
return !inRange(key) ? null : m.get(key);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2013, 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
|
||||
@@ -33,204 +33,67 @@ package java.util.zip;
|
||||
* @since 1.1
|
||||
*/
|
||||
interface ZipConstants {
|
||||
|
||||
/**
|
||||
* Local file (LOC) header signature.
|
||||
/*
|
||||
* Header signatures
|
||||
*/
|
||||
static long LOCSIG = 0x04034b50L; // "PK\003\004"
|
||||
|
||||
/**
|
||||
* Extra local (EXT) header signature.
|
||||
*/
|
||||
static long EXTSIG = 0x08074b50L; // "PK\007\008"
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header signature.
|
||||
*/
|
||||
static long CENSIG = 0x02014b50L; // "PK\001\002"
|
||||
|
||||
/**
|
||||
* End of central directory (END) header signature.
|
||||
*/
|
||||
static long ENDSIG = 0x06054b50L; // "PK\005\006"
|
||||
|
||||
/**
|
||||
* Local file (LOC) header size in bytes (including signature).
|
||||
/*
|
||||
* Header sizes in bytes (including signatures)
|
||||
*/
|
||||
static final int LOCHDR = 30;
|
||||
static final int LOCHDR = 30; // LOC header size
|
||||
static final int EXTHDR = 16; // EXT header size
|
||||
static final int CENHDR = 46; // CEN header size
|
||||
static final int ENDHDR = 22; // END header size
|
||||
|
||||
/**
|
||||
* Extra local (EXT) header size in bytes (including signature).
|
||||
/*
|
||||
* Local file (LOC) header field offsets
|
||||
*/
|
||||
static final int EXTHDR = 16;
|
||||
static final int LOCVER = 4; // version needed to extract
|
||||
static final int LOCFLG = 6; // general purpose bit flag
|
||||
static final int LOCHOW = 8; // compression method
|
||||
static final int LOCTIM = 10; // modification time
|
||||
static final int LOCCRC = 14; // uncompressed file crc-32 value
|
||||
static final int LOCSIZ = 18; // compressed size
|
||||
static final int LOCLEN = 22; // uncompressed size
|
||||
static final int LOCNAM = 26; // filename length
|
||||
static final int LOCEXT = 28; // extra field length
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header size in bytes (including signature).
|
||||
/*
|
||||
* Extra local (EXT) header field offsets
|
||||
*/
|
||||
static final int CENHDR = 46;
|
||||
static final int EXTCRC = 4; // uncompressed file crc-32 value
|
||||
static final int EXTSIZ = 8; // compressed size
|
||||
static final int EXTLEN = 12; // uncompressed size
|
||||
|
||||
/**
|
||||
* End of central directory (END) header size in bytes (including signature).
|
||||
/*
|
||||
* Central directory (CEN) header field offsets
|
||||
*/
|
||||
static final int ENDHDR = 22;
|
||||
static final int CENVEM = 4; // version made by
|
||||
static final int CENVER = 6; // version needed to extract
|
||||
static final int CENFLG = 8; // encrypt, decrypt flags
|
||||
static final int CENHOW = 10; // compression method
|
||||
static final int CENTIM = 12; // modification time
|
||||
static final int CENCRC = 16; // uncompressed file crc-32 value
|
||||
static final int CENSIZ = 20; // compressed size
|
||||
static final int CENLEN = 24; // uncompressed size
|
||||
static final int CENNAM = 28; // filename length
|
||||
static final int CENEXT = 30; // extra field length
|
||||
static final int CENCOM = 32; // comment length
|
||||
static final int CENDSK = 34; // disk number start
|
||||
static final int CENATT = 36; // internal file attributes
|
||||
static final int CENATX = 38; // external file attributes
|
||||
static final int CENOFF = 42; // LOC header offset
|
||||
|
||||
/**
|
||||
* Local file (LOC) header version needed to extract field offset.
|
||||
/*
|
||||
* End of central directory (END) header field offsets
|
||||
*/
|
||||
static final int LOCVER = 4;
|
||||
|
||||
/**
|
||||
* Local file (LOC) header general purpose bit flag field offset.
|
||||
*/
|
||||
static final int LOCFLG = 6;
|
||||
|
||||
/**
|
||||
* Local file (LOC) header compression method field offset.
|
||||
*/
|
||||
static final int LOCHOW = 8;
|
||||
|
||||
/**
|
||||
* Local file (LOC) header modification time field offset.
|
||||
*/
|
||||
static final int LOCTIM = 10;
|
||||
|
||||
/**
|
||||
* Local file (LOC) header uncompressed file crc-32 value field offset.
|
||||
*/
|
||||
static final int LOCCRC = 14;
|
||||
|
||||
/**
|
||||
* Local file (LOC) header compressed size field offset.
|
||||
*/
|
||||
static final int LOCSIZ = 18;
|
||||
|
||||
/**
|
||||
* Local file (LOC) header uncompressed size field offset.
|
||||
*/
|
||||
static final int LOCLEN = 22;
|
||||
|
||||
/**
|
||||
* Local file (LOC) header filename length field offset.
|
||||
*/
|
||||
static final int LOCNAM = 26;
|
||||
|
||||
/**
|
||||
* Local file (LOC) header extra field length field offset.
|
||||
*/
|
||||
static final int LOCEXT = 28;
|
||||
|
||||
/**
|
||||
* Extra local (EXT) header uncompressed file crc-32 value field offset.
|
||||
*/
|
||||
static final int EXTCRC = 4;
|
||||
|
||||
/**
|
||||
* Extra local (EXT) header compressed size field offset.
|
||||
*/
|
||||
static final int EXTSIZ = 8;
|
||||
|
||||
/**
|
||||
* Extra local (EXT) header uncompressed size field offset.
|
||||
*/
|
||||
static final int EXTLEN = 12;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header version made by field offset.
|
||||
*/
|
||||
static final int CENVEM = 4;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header version needed to extract field offset.
|
||||
*/
|
||||
static final int CENVER = 6;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header encrypt, decrypt flags field offset.
|
||||
*/
|
||||
static final int CENFLG = 8;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header compression method field offset.
|
||||
*/
|
||||
static final int CENHOW = 10;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header modification time field offset.
|
||||
*/
|
||||
static final int CENTIM = 12;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header uncompressed file crc-32 value field offset.
|
||||
*/
|
||||
static final int CENCRC = 16;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header compressed size field offset.
|
||||
*/
|
||||
static final int CENSIZ = 20;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header uncompressed size field offset.
|
||||
*/
|
||||
static final int CENLEN = 24;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header filename length field offset.
|
||||
*/
|
||||
static final int CENNAM = 28;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header extra field length field offset.
|
||||
*/
|
||||
static final int CENEXT = 30;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header comment length field offset.
|
||||
*/
|
||||
static final int CENCOM = 32;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header disk number start field offset.
|
||||
*/
|
||||
static final int CENDSK = 34;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header internal file attributes field offset.
|
||||
*/
|
||||
static final int CENATT = 36;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header external file attributes field offset.
|
||||
*/
|
||||
static final int CENATX = 38;
|
||||
|
||||
/**
|
||||
* Central directory (CEN) header LOC header offset field offset.
|
||||
*/
|
||||
static final int CENOFF = 42;
|
||||
|
||||
/**
|
||||
* End of central directory (END) header number of entries on this disk field offset.
|
||||
*/
|
||||
static final int ENDSUB = 8;
|
||||
|
||||
/**
|
||||
* End of central directory (END) header total number of entries field offset.
|
||||
*/
|
||||
static final int ENDTOT = 10;
|
||||
|
||||
/**
|
||||
* End of central directory (END) header central directory size in bytes field offset.
|
||||
*/
|
||||
static final int ENDSIZ = 12;
|
||||
|
||||
/**
|
||||
* End of central directory (END) header offset for the first CEN header field offset.
|
||||
*/
|
||||
static final int ENDOFF = 16;
|
||||
|
||||
/**
|
||||
* End of central directory (END) header zip file comment length field offset.
|
||||
*/
|
||||
static final int ENDCOM = 20;
|
||||
static final int ENDSUB = 8; // number of entries on this disk
|
||||
static final int ENDTOT = 10; // total number of entries
|
||||
static final int ENDSIZ = 12; // central directory size in bytes
|
||||
static final int ENDOFF = 16; // offset of first CEN header
|
||||
static final int ENDCOM = 20; // zip file comment length
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@@ -324,7 +324,8 @@ class SocketChannelImpl
|
||||
/**
|
||||
* Marks the beginning of a read operation that might block.
|
||||
*
|
||||
* @throws ClosedChannelException if blocking and the channel is closed
|
||||
* @throws ClosedChannelException if the channel is closed
|
||||
* @throws NotYetConnectedException if the channel is not yet connected
|
||||
*/
|
||||
private void beginRead(boolean blocking) throws ClosedChannelException {
|
||||
if (blocking) {
|
||||
@@ -332,10 +333,12 @@ class SocketChannelImpl
|
||||
begin();
|
||||
|
||||
synchronized (stateLock) {
|
||||
ensureOpen();
|
||||
ensureOpenAndConnected();
|
||||
// record thread so it can be signalled if needed
|
||||
readerThread = NativeThread.current();
|
||||
}
|
||||
} else {
|
||||
ensureOpenAndConnected();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,7 +373,6 @@ class SocketChannelImpl
|
||||
|
||||
readLock.lock();
|
||||
try {
|
||||
ensureOpenAndConnected();
|
||||
boolean blocking = isBlocking();
|
||||
int n = 0;
|
||||
try {
|
||||
@@ -413,7 +415,6 @@ class SocketChannelImpl
|
||||
|
||||
readLock.lock();
|
||||
try {
|
||||
ensureOpenAndConnected();
|
||||
boolean blocking = isBlocking();
|
||||
long n = 0;
|
||||
try {
|
||||
@@ -451,7 +452,8 @@ class SocketChannelImpl
|
||||
/**
|
||||
* Marks the beginning of a write operation that might block.
|
||||
*
|
||||
* @throws ClosedChannelException if blocking and the channel is closed
|
||||
* @throws ClosedChannelException if the channel is closed or output shutdown
|
||||
* @throws NotYetConnectedException if the channel is not yet connected
|
||||
*/
|
||||
private void beginWrite(boolean blocking) throws ClosedChannelException {
|
||||
if (blocking) {
|
||||
@@ -459,12 +461,14 @@ class SocketChannelImpl
|
||||
begin();
|
||||
|
||||
synchronized (stateLock) {
|
||||
ensureOpen();
|
||||
ensureOpenAndConnected();
|
||||
if (isOutputClosed)
|
||||
throw new ClosedChannelException();
|
||||
// record thread so it can be signalled if needed
|
||||
writerThread = NativeThread.current();
|
||||
}
|
||||
} else {
|
||||
ensureOpenAndConnected();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,9 +496,9 @@ class SocketChannelImpl
|
||||
@Override
|
||||
public int write(ByteBuffer buf) throws IOException {
|
||||
Objects.requireNonNull(buf);
|
||||
|
||||
writeLock.lock();
|
||||
try {
|
||||
ensureOpenAndConnected();
|
||||
boolean blocking = isBlocking();
|
||||
int n = 0;
|
||||
try {
|
||||
@@ -525,7 +529,6 @@ class SocketChannelImpl
|
||||
|
||||
writeLock.lock();
|
||||
try {
|
||||
ensureOpenAndConnected();
|
||||
boolean blocking = isBlocking();
|
||||
long n = 0;
|
||||
try {
|
||||
@@ -554,7 +557,6 @@ class SocketChannelImpl
|
||||
int sendOutOfBandData(byte b) throws IOException {
|
||||
writeLock.lock();
|
||||
try {
|
||||
ensureOpenAndConnected();
|
||||
boolean blocking = isBlocking();
|
||||
int n = 0;
|
||||
try {
|
||||
@@ -1175,8 +1177,6 @@ class SocketChannelImpl
|
||||
|
||||
readLock.lock();
|
||||
try {
|
||||
ensureOpenAndConnected();
|
||||
|
||||
// check that channel is configured blocking
|
||||
if (!isBlocking())
|
||||
throw new IllegalBlockingModeException();
|
||||
@@ -1254,8 +1254,6 @@ class SocketChannelImpl
|
||||
|
||||
writeLock.lock();
|
||||
try {
|
||||
ensureOpenAndConnected();
|
||||
|
||||
// check that channel is configured blocking
|
||||
if (!isBlocking())
|
||||
throw new IllegalBlockingModeException();
|
||||
@@ -1263,8 +1261,8 @@ class SocketChannelImpl
|
||||
// loop until all bytes have been written
|
||||
int pos = off;
|
||||
int end = off + len;
|
||||
beginWrite(true);
|
||||
try {
|
||||
beginWrite(true);
|
||||
while (pos < end && isOpen()) {
|
||||
int size = end - pos;
|
||||
int n = tryWrite(b, pos, size);
|
||||
|
||||
@@ -770,57 +770,6 @@ NET_EnableFastTcpLoopback(int fd) {
|
||||
return result == SOCKET_ERROR ? WSAGetLastError() : 0;
|
||||
}
|
||||
|
||||
int
|
||||
IsWindows10RS3OrGreater() {
|
||||
OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
|
||||
DWORDLONG const cond_mask = VerSetConditionMask(
|
||||
VerSetConditionMask(
|
||||
VerSetConditionMask(
|
||||
0, VER_MAJORVERSION, VER_GREATER_EQUAL),
|
||||
VER_MINORVERSION, VER_GREATER_EQUAL),
|
||||
VER_BUILDNUMBER, VER_GREATER_EQUAL);
|
||||
|
||||
osvi.dwMajorVersion = HIBYTE(_WIN32_WINNT_WIN10);
|
||||
osvi.dwMinorVersion = LOBYTE(_WIN32_WINNT_WIN10);
|
||||
osvi.dwBuildNumber = 16299; // RS3 (Redstone 3)
|
||||
|
||||
return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER, cond_mask) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortens the default Windows socket
|
||||
* connect timeout. Recommended for usage
|
||||
* on the loopback adapter only.
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
NET_EnableFastTcpLoopbackConnect(int fd) {
|
||||
TCP_INITIAL_RTO_PARAMETERS rto = {
|
||||
TCP_INITIAL_RTO_UNSPECIFIED_RTT, // Use the default or overriden by the Administrator
|
||||
1 // Minimum possible value before Windows 10 RS3
|
||||
};
|
||||
|
||||
/**
|
||||
* In Windows 10 RS3+ we can use the no retransmissions flag to
|
||||
* completely remove the timeout delay, which is fixed to 500ms
|
||||
* if Windows receives RST when the destination port is not open.
|
||||
*/
|
||||
if (IsWindows10RS3OrGreater()) {
|
||||
rto.MaxSynRetransmissions = TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS;
|
||||
}
|
||||
|
||||
DWORD result_byte_count = -1;
|
||||
int result = WSAIoctl(fd, // descriptor identifying a socket
|
||||
SIO_TCP_INITIAL_RTO, // dwIoControlCode
|
||||
&rto, // pointer to TCP_INITIAL_RTO_PARAMETERS structure
|
||||
sizeof(rto), // size, in bytes, of the input buffer
|
||||
NULL, // pointer to output buffer
|
||||
0, // size of output buffer
|
||||
&result_byte_count, // number of bytes returned
|
||||
NULL, // OVERLAPPED structure
|
||||
NULL); // completion routine
|
||||
return (result == SOCKET_ERROR) ? WSAGetLastError() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* See net_util.h for documentation
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <WS2tcpip.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <icmpapi.h>
|
||||
#include <mstcpip.h>
|
||||
|
||||
/* used to disable connection reset messages on Windows XP */
|
||||
#ifndef SIO_UDP_CONNRESET
|
||||
@@ -87,29 +86,10 @@ struct ipv6bind {
|
||||
|
||||
#define GET_PORT(X) ((X)->sa.sa_family == AF_INET ? (X)->sa4.sin_port : (X)->sa6.sin6_port)
|
||||
|
||||
/**
|
||||
* With dual socket implementation the
|
||||
* IPv4 addresseses might be mapped as IPv6.
|
||||
* The IPv4 loopback adapter address will
|
||||
* be mapped as the following IPv6 ::ffff:127.0.0.1.
|
||||
* For example, this is done by NET_InetAddressToSockaddr.
|
||||
*/
|
||||
#define IN6_IS_ADDR_V4MAPPED_LOOPBACK(x) ( \
|
||||
(((x)->s6_words[0] == 0) && \
|
||||
((x)->s6_words[1] == 0) && \
|
||||
((x)->s6_words[2] == 0) && \
|
||||
((x)->s6_words[3] == 0) && \
|
||||
((x)->s6_words[4] == 0) && \
|
||||
((x)->s6_words[5] == 0xFFFF) && \
|
||||
((x)->s6_words[6] == 0x007F) && \
|
||||
((x)->s6_words[7] == 0x0100)) \
|
||||
)
|
||||
|
||||
#define IS_LOOPBACK_ADDRESS(x) ( \
|
||||
((x)->sa.sa_family == AF_INET) ? \
|
||||
(ntohl((x)->sa4.sin_addr.s_addr) == INADDR_LOOPBACK) : \
|
||||
((IN6_IS_ADDR_LOOPBACK(&(x)->sa6.sin6_addr)) || \
|
||||
(IN6_IS_ADDR_V4MAPPED_LOOPBACK(&(x)->sa6.sin6_addr))) \
|
||||
(IN6ADDR_ISLOOPBACK(x)) \
|
||||
)
|
||||
|
||||
JNIEXPORT int JNICALL NET_SocketClose(int fd);
|
||||
@@ -139,8 +119,6 @@ JNIEXPORT int JNICALL NET_BindV6(struct ipv6bind *b, jboolean exclBind);
|
||||
JNIEXPORT int JNICALL NET_WinBind(int s, SOCKETADDRESS *sa, int len,
|
||||
jboolean exclBind);
|
||||
|
||||
JNIEXPORT jint JNICALL NET_EnableFastTcpLoopbackConnect(int fd);
|
||||
|
||||
/* XP versions of the native routines */
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0_XP
|
||||
|
||||
@@ -226,25 +226,13 @@ Java_sun_nio_ch_Net_connect0(JNIEnv *env, jclass clazz, jboolean preferIPv6, job
|
||||
{
|
||||
SOCKETADDRESS sa;
|
||||
int rv;
|
||||
int so_rv;
|
||||
int sa_len = 0;
|
||||
SOCKET s = (SOCKET)fdval(env, fdo);
|
||||
int type = 0, optlen = sizeof(type);
|
||||
|
||||
if (NET_InetAddressToSockaddr(env, iao, port, &sa, &sa_len, preferIPv6) != 0) {
|
||||
return IOS_THROWN;
|
||||
}
|
||||
|
||||
so_rv = getsockopt(s, SOL_SOCKET, SO_TYPE, (char*)&type, &optlen);
|
||||
|
||||
/**
|
||||
* Windows has a very long socket connect timeout of 2 seconds.
|
||||
* If it's the loopback adapter we can shorten the wait interval.
|
||||
*/
|
||||
if (so_rv == 0 && type == SOCK_STREAM && IS_LOOPBACK_ADDRESS(&sa)) {
|
||||
NET_EnableFastTcpLoopbackConnect((jint)s);
|
||||
}
|
||||
|
||||
rv = connect(s, &sa.sa, sa_len);
|
||||
if (rv != 0) {
|
||||
int err = WSAGetLastError();
|
||||
@@ -255,7 +243,9 @@ Java_sun_nio_ch_Net_connect0(JNIEnv *env, jclass clazz, jboolean preferIPv6, job
|
||||
return IOS_THROWN;
|
||||
} else {
|
||||
/* Enable WSAECONNRESET errors when a UDP socket is connected */
|
||||
if (so_rv == 0 && type == SOCK_DGRAM) {
|
||||
int type = 0, optlen = sizeof(type);
|
||||
rv = getsockopt(s, SOL_SOCKET, SO_TYPE, (char*)&type, &optlen);
|
||||
if (rv == 0 && type == SOCK_DGRAM) {
|
||||
setConnectionReset(s, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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,8 +26,6 @@
|
||||
package java.net.http;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.channels.Selector;
|
||||
import java.net.Authenticator;
|
||||
import java.net.CookieHandler;
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -155,8 +153,6 @@ public abstract class HttpClient {
|
||||
* built instances.
|
||||
*
|
||||
* @return a new HttpClient
|
||||
* @throws UncheckedIOException if necessary underlying IO resources required to
|
||||
* {@linkplain Builder#build() build a new HttpClient} cannot be allocated.
|
||||
*/
|
||||
public static HttpClient newHttpClient() {
|
||||
return newBuilder().build();
|
||||
@@ -356,11 +352,6 @@ public abstract class HttpClient {
|
||||
* builder.
|
||||
*
|
||||
* @return a new {@code HttpClient}
|
||||
*
|
||||
* @throws UncheckedIOException may be thrown if underlying IO resources required
|
||||
* by the implementation cannot be allocated. For instance,
|
||||
* if the implementation requires a {@link Selector}, and opening
|
||||
* one fails due to {@linkplain Selector#open() lack of necessary resources}.
|
||||
*/
|
||||
public HttpClient build();
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ final class HttpClientImpl extends HttpClient implements Trackable {
|
||||
selmgr = new SelectorManager(this);
|
||||
} catch (IOException e) {
|
||||
// unlikely
|
||||
throw new UncheckedIOException(e);
|
||||
throw new InternalError(e);
|
||||
}
|
||||
selmgr.setDaemon(true);
|
||||
filters = new FilterFactory();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2018, 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
|
||||
@@ -190,7 +190,7 @@ import jdk.xml.internal.SecuritySupport;
|
||||
* @author Sunitha Reddy
|
||||
* @see javax.xml.datatype.Duration
|
||||
* @since 1.5
|
||||
* @LastModified: Aug 2020
|
||||
* @LastModified: June 2018
|
||||
*/
|
||||
|
||||
public class XMLGregorianCalendarImpl
|
||||
@@ -1682,6 +1682,49 @@ public class XMLGregorianCalendarImpl
|
||||
return Pfield.compareTo(Qfield);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Indicates whether parameter <code>obj</code> is "equal to" this one.</p>
|
||||
*
|
||||
* @param obj to compare.
|
||||
*
|
||||
* @return <code>true</code> when <code>compare(this,(XMLGregorianCalendar)obj) == EQUAL.</code>.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
if (obj == null || !(obj instanceof XMLGregorianCalendar)) {
|
||||
return false;
|
||||
}
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
return compare((XMLGregorianCalendar) obj) == DatatypeConstants.EQUAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns a hash code consistent with the definition of the equals method.</p>
|
||||
*
|
||||
* @return hash code of this object.
|
||||
*/
|
||||
public int hashCode() {
|
||||
|
||||
// Following two dates compare to EQUALS since in different timezones.
|
||||
// 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00
|
||||
//
|
||||
// Must ensure both instances generate same hashcode by normalizing
|
||||
// this to UTC timezone.
|
||||
int timezone = getTimezone();
|
||||
if (timezone == DatatypeConstants.FIELD_UNDEFINED) {
|
||||
timezone = 0;
|
||||
}
|
||||
XMLGregorianCalendar gc = this;
|
||||
if (timezone != 0) {
|
||||
gc = this.normalizeToTimezone(getTimezone());
|
||||
}
|
||||
return gc.getYear() + gc.getMonth() + gc.getDay() +
|
||||
gc.getHour() + gc.getMinute() + gc.getSecond();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Constructs a new XMLGregorianCalendar object by
|
||||
* parsing its lexical string representation as defined in
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2017, 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,7 +28,6 @@ package javax.xml.datatype;
|
||||
import javax.xml.namespace.QName;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Arrays;
|
||||
import java.util.TimeZone;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
@@ -689,12 +688,10 @@ public abstract class XMLGregorianCalendar
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
if (obj == null || !(obj instanceof XMLGregorianCalendar)) {
|
||||
return false;
|
||||
}
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
return compare((XMLGregorianCalendar) obj) == DatatypeConstants.EQUAL;
|
||||
}
|
||||
|
||||
@@ -719,10 +716,12 @@ public abstract class XMLGregorianCalendar
|
||||
if (timezone != 0) {
|
||||
gc = this.normalize();
|
||||
}
|
||||
|
||||
int[] elements = {gc.getYear(), gc.getMonth(), gc.getDay(), gc.getHour(),
|
||||
gc.getMinute(), gc.getSecond(), gc.getMillisecond()};
|
||||
return Arrays.hashCode(elements);
|
||||
return gc.getYear()
|
||||
+ gc.getMonth()
|
||||
+ gc.getDay()
|
||||
+ gc.getHour()
|
||||
+ gc.getMinute()
|
||||
+ gc.getSecond();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -280,9 +280,7 @@ final class P11AEADCipher extends CipherSpi {
|
||||
SecureRandom sr)
|
||||
throws InvalidKeyException, InvalidAlgorithmParameterException {
|
||||
reset(true);
|
||||
if (fixedKeySize != -1 &&
|
||||
((key instanceof P11Key) ? ((P11Key) key).length() >> 3 :
|
||||
key.getEncoded().length) != fixedKeySize) {
|
||||
if (fixedKeySize != -1 && key.getEncoded().length != fixedKeySize) {
|
||||
throw new InvalidKeyException("Key size is invalid");
|
||||
}
|
||||
P11Key newKey = P11SecretKeyFactory.convertKey(token, key, ALGO);
|
||||
|
||||
@@ -345,9 +345,7 @@ final class P11Cipher extends CipherSpi {
|
||||
SecureRandom random)
|
||||
throws InvalidKeyException, InvalidAlgorithmParameterException {
|
||||
reset(true);
|
||||
if (fixedKeySize != -1 &&
|
||||
((key instanceof P11Key) ? ((P11Key) key).length() >> 3 :
|
||||
key.getEncoded().length) != fixedKeySize) {
|
||||
if (fixedKeySize != -1 && key.getEncoded().length != fixedKeySize) {
|
||||
throw new InvalidKeyException("Key size is invalid");
|
||||
}
|
||||
switch (opmode) {
|
||||
|
||||
@@ -30,42 +30,26 @@ import java.io.InputStream;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.PathMatcher;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.xpath.XPath;
|
||||
import javax.xml.xpath.XPathConstants;
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
|
||||
import static jdk.incubator.jpackage.internal.OverridableResource.createResource;
|
||||
import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
|
||||
import static jdk.incubator.jpackage.internal.StandardBundlerParam.CONFIG_ROOT;
|
||||
import static jdk.incubator.jpackage.internal.StandardBundlerParam.DESCRIPTION;
|
||||
import static jdk.incubator.jpackage.internal.StandardBundlerParam.LICENSE_FILE;
|
||||
import static jdk.incubator.jpackage.internal.StandardBundlerParam.RESOURCE_DIR;
|
||||
import static jdk.incubator.jpackage.internal.StandardBundlerParam.TEMP_ROOT;
|
||||
import static jdk.incubator.jpackage.internal.StandardBundlerParam.VENDOR;
|
||||
import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* WinMsiBundler
|
||||
@@ -432,7 +416,7 @@ public class WinMsiBundler extends AbstractBundler {
|
||||
}
|
||||
}
|
||||
|
||||
// Copy standard l10n files.
|
||||
// Copy l10n files.
|
||||
for (String loc : Arrays.asList("en", "ja", "zh_CN")) {
|
||||
String fname = "MsiInstallerStrings_" + loc + ".wxl";
|
||||
try (InputStream is = OverridableResource.readDefault(fname)) {
|
||||
@@ -486,23 +470,9 @@ public class WinMsiBundler extends AbstractBundler {
|
||||
wixPipeline.addLightOptions("-ext", "WixUIExtension");
|
||||
}
|
||||
|
||||
final Path primaryWxlFile = CONFIG_ROOT.fetchFrom(params).resolve(
|
||||
I18N.getString("resource.wxl-file-name")).toAbsolutePath();
|
||||
|
||||
wixPipeline.addLightOptions("-loc", primaryWxlFile.toString());
|
||||
|
||||
List<String> cultures = new ArrayList<>();
|
||||
for (var wxl : getCustomWxlFiles(params)) {
|
||||
wixPipeline.addLightOptions("-loc", wxl.toAbsolutePath().toString());
|
||||
cultures.add(getCultureFromWxlFile(wxl));
|
||||
}
|
||||
cultures.add(getCultureFromWxlFile(primaryWxlFile));
|
||||
|
||||
// Build ordered list of unique cultures.
|
||||
Set<String> uniqueCultures = new LinkedHashSet<>();
|
||||
uniqueCultures.addAll(cultures);
|
||||
wixPipeline.addLightOptions(uniqueCultures.stream().collect(
|
||||
Collectors.joining(";", "-cultures:", "")));
|
||||
wixPipeline.addLightOptions("-loc",
|
||||
CONFIG_ROOT.fetchFrom(params).resolve(I18N.getString(
|
||||
"resource.wxl-file-name")).toAbsolutePath().toString());
|
||||
|
||||
// Only needed if we using CA dll, so Wix can find it
|
||||
if (enableInstalldirUI) {
|
||||
@@ -515,52 +485,6 @@ public class WinMsiBundler extends AbstractBundler {
|
||||
return msiOut;
|
||||
}
|
||||
|
||||
private static List<Path> getCustomWxlFiles(Map<String, ? super Object> params)
|
||||
throws IOException {
|
||||
Path resourceDir = RESOURCE_DIR.fetchFrom(params);
|
||||
if (resourceDir == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
final String glob = "glob:**/*.wxl";
|
||||
final PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher(
|
||||
glob);
|
||||
|
||||
try (var walk = Files.walk(resourceDir, 1)) {
|
||||
return walk
|
||||
.filter(Files::isReadable)
|
||||
.filter(pathMatcher::matches)
|
||||
.sorted((a, b) -> a.getFileName().toString().compareToIgnoreCase(b.getFileName().toString()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
private static String getCultureFromWxlFile(Path wxlPath) throws IOException {
|
||||
try {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(false);
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
|
||||
Document doc = builder.parse(wxlPath.toFile());
|
||||
|
||||
XPath xPath = XPathFactory.newInstance().newXPath();
|
||||
NodeList nodes = (NodeList) xPath.evaluate(
|
||||
"//WixLocalization/@Culture", doc,
|
||||
XPathConstants.NODESET);
|
||||
if (nodes.getLength() != 1) {
|
||||
throw new IOException(MessageFormat.format(I18N.getString(
|
||||
"error.extract-culture-from-wix-l10n-file"),
|
||||
wxlPath.toAbsolutePath()));
|
||||
}
|
||||
|
||||
return nodes.item(0).getNodeValue();
|
||||
} catch (XPathExpressionException | ParserConfigurationException
|
||||
| SAXException ex) {
|
||||
throw new IOException(MessageFormat.format(I18N.getString(
|
||||
"error.read-wix-l10n-file"), wxlPath.toAbsolutePath()), ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ensureByMutationFileIsRTF(Path f) {
|
||||
if (f == null || !Files.isRegularFile(f)) return;
|
||||
|
||||
|
||||
@@ -48,8 +48,6 @@ error.msi-product-version-minor-out-of-range=Minor version must be in the range
|
||||
error.version-swap=Failed to update version information for {0}
|
||||
error.invalid-envvar=Invalid value of {0} environment variable
|
||||
error.lock-resource=Failed to lock: {0}
|
||||
error.read-wix-l10n-file=Failed to parse {0} file
|
||||
error.extract-culture-from-wix-l10n-file=Failed to read value of culture from {0} file
|
||||
|
||||
message.icon-not-ico=The specified icon "{0}" is not an ICO file and will not be used. The default icon will be used in it's place.
|
||||
message.potential.windows.defender.issue=Warning: Windows Defender may prevent jpackage from functioning. If there is an issue, it can be addressed by either disabling realtime monitoring, or adding an exclusion for the directory "{0}".
|
||||
|
||||
@@ -48,8 +48,6 @@ error.msi-product-version-minor-out-of-range=\u30DE\u30A4\u30CA\u30FC\u30FB\u30D
|
||||
error.version-swap={0}\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u306E\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F
|
||||
error.invalid-envvar={0}\u74B0\u5883\u5909\u6570\u306E\u5024\u304C\u7121\u52B9\u3067\u3059
|
||||
error.lock-resource=\u30ED\u30C3\u30AF\u306B\u5931\u6557\u3057\u307E\u3057\u305F: {0}
|
||||
error.read-wix-l10n-file=Failed to parse {0} file
|
||||
error.extract-culture-from-wix-l10n-file=Failed to read value of culture from {0} file
|
||||
|
||||
message.icon-not-ico=\u6307\u5B9A\u3057\u305F\u30A2\u30A4\u30B3\u30F3"{0}"\u306FICO\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u306A\u304F\u3001\u4F7F\u7528\u3055\u308C\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30A4\u30B3\u30F3\u304C\u305D\u306E\u4F4D\u7F6E\u306B\u4F7F\u7528\u3055\u308C\u307E\u3059\u3002
|
||||
message.potential.windows.defender.issue=\u8B66\u544A: Windows Defender\u304C\u539F\u56E0\u3067jpackage\u304C\u6A5F\u80FD\u3057\u306A\u3044\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002\u554F\u984C\u304C\u767A\u751F\u3057\u305F\u5834\u5408\u306F\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30FB\u30E2\u30CB\u30BF\u30EA\u30F3\u30B0\u3092\u7121\u52B9\u306B\u3059\u308B\u304B\u3001\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA"{0}"\u306E\u9664\u5916\u3092\u8FFD\u52A0\u3059\u308B\u3053\u3068\u306B\u3088\u308A\u3001\u554F\u984C\u306B\u5BFE\u51E6\u3067\u304D\u307E\u3059\u3002
|
||||
|
||||
@@ -48,8 +48,6 @@ error.msi-product-version-minor-out-of-range=\u6B21\u7248\u672C\u5FC5\u987B\u4F4
|
||||
error.version-swap=\u65E0\u6CD5\u66F4\u65B0 {0} \u7684\u7248\u672C\u4FE1\u606F
|
||||
error.invalid-envvar={0} \u73AF\u5883\u53D8\u91CF\u7684\u503C\u65E0\u6548
|
||||
error.lock-resource=\u65E0\u6CD5\u9501\u5B9A\uFF1A{0}
|
||||
error.read-wix-l10n-file=Failed to parse {0} file
|
||||
error.extract-culture-from-wix-l10n-file=Failed to read value of culture from {0} file
|
||||
|
||||
message.icon-not-ico=\u6307\u5B9A\u7684\u56FE\u6807 "{0}" \u4E0D\u662F ICO \u6587\u4EF6, \u4E0D\u4F1A\u4F7F\u7528\u3002\u5C06\u4F7F\u7528\u9ED8\u8BA4\u56FE\u6807\u4EE3\u66FF\u3002
|
||||
message.potential.windows.defender.issue=\u8B66\u544A\uFF1AWindows Defender \u53EF\u80FD\u4F1A\u963B\u6B62 jpackage \u6B63\u5E38\u5DE5\u4F5C\u3002\u5982\u679C\u5B58\u5728\u95EE\u9898\uFF0C\u53EF\u4EE5\u901A\u8FC7\u7981\u7528\u5B9E\u65F6\u76D1\u89C6\u6216\u8005\u4E3A\u76EE\u5F55 "{0}" \u6DFB\u52A0\u6392\u9664\u9879\u6765\u89E3\u51B3\u3002
|
||||
|
||||
@@ -384,7 +384,6 @@ public class Extern {
|
||||
DocPath elempath;
|
||||
String moduleName = null;
|
||||
DocPath basePath = DocPath.create(path);
|
||||
boolean issueWarning = true;
|
||||
while ((elemname = in.readLine()) != null) {
|
||||
if (elemname.length() > 0) {
|
||||
elempath = basePath;
|
||||
@@ -399,11 +398,10 @@ public class Extern {
|
||||
} else {
|
||||
elempath = elempath.resolve(pkgPath);
|
||||
}
|
||||
String actualModuleName = checkLinkCompatibility(elemname, moduleName, path, issueWarning);
|
||||
String actualModuleName = checkLinkCompatibility(elemname, moduleName, path);
|
||||
Item item = new Item(elemname, elempath, relative);
|
||||
packageItems.computeIfAbsent(actualModuleName, k -> new TreeMap<>())
|
||||
.putIfAbsent(elemname, item); // first-one-wins semantics
|
||||
issueWarning = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -418,15 +416,14 @@ public class Extern {
|
||||
* @param packageName the package name
|
||||
* @param moduleName the module name or null
|
||||
* @param path the documentation path
|
||||
* @param issueWarning whether to print a warning in case of modularity mismatch
|
||||
* @return the module name to use according to actual modularity of the package
|
||||
*/
|
||||
private String checkLinkCompatibility(String packageName, String moduleName, String path, boolean issueWarning) {
|
||||
private String checkLinkCompatibility(String packageName, String moduleName, String path) {
|
||||
PackageElement pe = utils.elementUtils.getPackageElement(packageName);
|
||||
if (pe != null) {
|
||||
ModuleElement me = (ModuleElement)pe.getEnclosingElement();
|
||||
if (me == null || me.isUnnamed()) {
|
||||
if (moduleName != null && issueWarning) {
|
||||
if (moduleName != null) {
|
||||
configuration.getReporter().print(Kind.WARNING,
|
||||
resources.getText("doclet.linkMismatch_PackagedLinkedtoModule", path));
|
||||
}
|
||||
@@ -434,7 +431,7 @@ public class Extern {
|
||||
return DocletConstants.DEFAULT_ELEMENT_NAME;
|
||||
} else if (moduleName == null) {
|
||||
// suppress the warning message in the case of automatic modules
|
||||
if (!isAutomaticModule(me) && issueWarning) {
|
||||
if (!isAutomaticModule(me)) {
|
||||
configuration.getReporter().print(Kind.WARNING,
|
||||
resources.getText("doclet.linkMismatch_ModuleLinkedtoPackage", path));
|
||||
}
|
||||
|
||||
@@ -1,29 +1,3 @@
|
||||
###########################################################################
|
||||
#
|
||||
# Copyright (c) 2016, 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. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
###########################################################################
|
||||
# This file is auto-generated by ListJDKInternals tool on 2016-07-12T16:13:20.303865
|
||||
apple.applescript
|
||||
apple.laf
|
||||
|
||||
@@ -1,29 +1,3 @@
|
||||
###########################################################################
|
||||
#
|
||||
# Copyright (c) 2014, 2016, 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. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
###########################################################################
|
||||
# No translation needed
|
||||
com.sun.crypto.provider.SunJCE=Use java.security.Security.getProvider(provider-name) @since 1.3
|
||||
com.sun.org.apache.xml.internal.security=Use java.xml.crypto @since 1.6
|
||||
|
||||
@@ -326,7 +326,6 @@ hotspot_appcds_dynamic = \
|
||||
-runtime/cds/appcds/javaldr/ArrayTest.java \
|
||||
-runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java \
|
||||
-runtime/cds/appcds/javaldr/HumongousDuringDump.java \
|
||||
-runtime/cds/appcds/javaldr/LockDuringDump.java \
|
||||
-runtime/cds/appcds/sharedStrings \
|
||||
-runtime/cds/appcds/ArchiveRelocationTest.java \
|
||||
-runtime/cds/appcds/DumpClassList.java \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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,7 +26,7 @@
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @compile IllegalClass.jasm
|
||||
* @run driver/timeout=360 compiler.aot.cli.jaotc.IgnoreErrorsTest
|
||||
* @run driver compiler.aot.cli.jaotc.IgnoreErrorsTest
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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 8249603
|
||||
* @summary The C1 register allocator uses a register hint interval i as spill location for an interval j which
|
||||
* overlaps with one of i's split children which has the same spill location which lets verification fail.
|
||||
*
|
||||
* @run main/othervm -Xcomp -XX:CompileCommand=compileonly,compiler.regalloc.TestC1OverlappingRegisterHint::*
|
||||
* compiler.regalloc.TestC1OverlappingRegisterHint
|
||||
*/
|
||||
package compiler.regalloc;
|
||||
|
||||
public class TestC1OverlappingRegisterHint {
|
||||
|
||||
public static int iFldStatic = 10;
|
||||
public int iFld = 11;
|
||||
|
||||
public int test() {
|
||||
int a = 1;
|
||||
int b = 2;
|
||||
int c = 3;
|
||||
int v = 4;
|
||||
int w = 5;
|
||||
int x = 6;
|
||||
int y = 7;
|
||||
int z = 8;
|
||||
int iArr[] = new int[400];
|
||||
|
||||
double d = 1.5;
|
||||
|
||||
int k = 0;
|
||||
for (a = 9; a < 283; a += 2) {
|
||||
for (int i = 8; i < 183; i++) {
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 12; i < 283; i++) {
|
||||
iFldStatic += i;
|
||||
for (int j = 1; 93 > j; j += 2) {
|
||||
x += (j - z);
|
||||
c -= iFld;
|
||||
k = 3;
|
||||
while ((k -= 2) > 0) {
|
||||
}
|
||||
switch ((i % 8) + 52) {
|
||||
case 52:
|
||||
iArr[8] = 5;
|
||||
for (int i20 = 1; i20 < 3; ++i20) {
|
||||
x *= (int)d;
|
||||
w += 5;
|
||||
}
|
||||
break;
|
||||
case 53:
|
||||
case 55:
|
||||
v *= iFldStatic;
|
||||
break;
|
||||
case 56:
|
||||
case 57:
|
||||
try {
|
||||
iArr[5] = a;
|
||||
v = (a / b);
|
||||
} catch (ArithmeticException a_e) {}
|
||||
break;
|
||||
default:
|
||||
iFldStatic += iFldStatic;
|
||||
}
|
||||
}
|
||||
}
|
||||
return y + k;
|
||||
}
|
||||
|
||||
public static void main(String[] strArr) {
|
||||
TestC1OverlappingRegisterHint _instance = new TestC1OverlappingRegisterHint();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
_instance.test();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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 8249749
|
||||
* @summary Test vectorization for complex address expressions
|
||||
* @requires vm.compMode != "Xint"
|
||||
* @run main compiler.vectorization.TestComplexAddrExpr test1
|
||||
* @run main compiler.vectorization.TestComplexAddrExpr test2
|
||||
* @run main compiler.vectorization.TestComplexAddrExpr test3
|
||||
* @run main compiler.vectorization.TestComplexAddrExpr test4
|
||||
* @run main compiler.vectorization.TestComplexAddrExpr test5
|
||||
* @run main compiler.vectorization.TestComplexAddrExpr test6
|
||||
*/
|
||||
|
||||
package compiler.vectorization;
|
||||
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class TestComplexAddrExpr {
|
||||
|
||||
static final int n = 1024;
|
||||
|
||||
static void test1(int[] data) {
|
||||
IntStream.range(0, n).forEach(j -> {
|
||||
for (int i = 0; i < n; i++) {
|
||||
data[j * n + i]++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void test2(int[] data) {
|
||||
IntStream.range(0, n).forEach(j -> {
|
||||
for (int i = n - 1; i >= 0; i--) {
|
||||
data[j * n + i]--;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void test3(int[] data) {
|
||||
IntStream.range(0, n).forEach(j -> {
|
||||
for (int i = 1 - n; i < 1; i++) {
|
||||
data[j * n - i]++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void test4(int[] data) {
|
||||
IntStream.range(0, n).forEach(j -> {
|
||||
for (int i = 0; i >= 1 - n; i--) {
|
||||
data[j * n - i]--;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void test5(int[] data) {
|
||||
IntStream.range(0, n).forEach(j -> {
|
||||
for (int i = 0; i < n/2; i++) {
|
||||
data[j * n + (i << 1)]++;
|
||||
}
|
||||
for (int i = 0; i < n/2; i++) {
|
||||
data[j * n + i * 2 + 1]++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void test6(int[] data) {
|
||||
IntStream.range(0, n).forEach(j -> {
|
||||
for (int i = (n - 1)/2; i >= 0; i--) {
|
||||
data[j * n + (i << 1)]--;
|
||||
}
|
||||
for (int i = (n - 1)/2; i >= 0; i--) {
|
||||
data[j * n + i * 2 + 1]--;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void verify(int[] data, int k) {
|
||||
for (int i = 0; i < n * n; i++) {
|
||||
if (data[i] != k) {
|
||||
throw new RuntimeException(" Invalid result: data[" + i + "]: " + data[i] + " != " + k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// int n = 1024;
|
||||
int[] data = new int[n * n];
|
||||
|
||||
if (args.length == 0) {
|
||||
throw new RuntimeException(" Missing test name: test1, test2, test3, test4, test5, test6");
|
||||
}
|
||||
|
||||
if (args[0].equals("test1")) {
|
||||
System.out.println(" Run test1 ...");
|
||||
for (int k = 0; k < n; k++) {
|
||||
test1(data);
|
||||
}
|
||||
verify(data, n);
|
||||
System.out.println(" Finished test1.");
|
||||
}
|
||||
|
||||
if (args[0].equals("test2")) {
|
||||
System.out.println(" Run test2 ...");
|
||||
for (int k = 0; k < n; k++) {
|
||||
test2(data);
|
||||
}
|
||||
verify(data, -n);
|
||||
System.out.println(" Finished test2.");
|
||||
}
|
||||
|
||||
if (args[0].equals("test3")) {
|
||||
System.out.println(" Run test3 ...");
|
||||
for (int k = 0; k < n; k++) {
|
||||
test3(data);
|
||||
}
|
||||
verify(data, n);
|
||||
System.out.println(" Finished test3.");
|
||||
}
|
||||
|
||||
if (args[0].equals("test4")) {
|
||||
System.out.println(" Run test4 ...");
|
||||
for (int k = 0; k < n; k++) {
|
||||
test4(data);
|
||||
}
|
||||
verify(data, -n);
|
||||
System.out.println(" Finished test4.");
|
||||
}
|
||||
|
||||
if (args[0].equals("test5")) {
|
||||
System.out.println(" Run test5 ...");
|
||||
for (int k = 0; k < n; k++) {
|
||||
test5(data);
|
||||
}
|
||||
verify(data, n);
|
||||
System.out.println(" Finished test5.");
|
||||
}
|
||||
|
||||
if (args[0].equals("test6")) {
|
||||
System.out.println(" Run test6 ...");
|
||||
for (int k = 0; k < n; k++) {
|
||||
test6(data);
|
||||
}
|
||||
verify(data, -n);
|
||||
System.out.println(" Finished test6.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, Red Hat, Inc. 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 8193518 8249608
|
||||
* @summary C2: Vector registers are sometimes corrupted at safepoint
|
||||
* @run main/othervm -XX:-BackgroundCompilation -XX:+UseCountedLoopSafepoints -XX:LoopStripMiningIter=1000 TestVectorsNotSavedAtSafepoint test1
|
||||
* @run main/othervm -XX:-BackgroundCompilation TestVectorsNotSavedAtSafepoint test2
|
||||
*/
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class TestVectorsNotSavedAtSafepoint {
|
||||
|
||||
static void test1(byte[] barray1, byte[] barray2, byte[] barray3, long[] larray, long v) {
|
||||
// Uses wide vectors, v in vector registers is live at the
|
||||
// safepoint of the outer strip mined loop
|
||||
for (int i = 0; i < larray.length; i++) {
|
||||
larray[i] = v;
|
||||
}
|
||||
// Runs for few iterations so limited unrolling and short
|
||||
// vectors
|
||||
for (int i = 0; i < barray3.length; i++) {
|
||||
barray3[i] = (byte)(barray1[i] + barray2[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public static void test2(int[] iArr, long[] lArr) {
|
||||
// Loop with wide and non-wide vectors
|
||||
for (int i = 0; i < lArr.length; i++) {
|
||||
iArr[i] = 1;
|
||||
lArr[i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static class GarbageProducerThread extends Thread {
|
||||
public void run() {
|
||||
for(;;) {
|
||||
Object[] arrays = new Object[1024];
|
||||
for (int i = 0; i < arrays.length; i++) {
|
||||
arrays[i] = new int[1024];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Thread garbage_producer = new GarbageProducerThread();
|
||||
garbage_producer.setDaemon(true);
|
||||
garbage_producer.start();
|
||||
|
||||
if (args[0].equals("test1")) {
|
||||
byte[] barray = new byte[10];
|
||||
long[] larray1 = new long[1000];
|
||||
long[] larray2 = new long[100_000_000];
|
||||
for (int i = 0; i < 20_000; i++) {
|
||||
test1(barray, barray, barray, larray1, -1);
|
||||
}
|
||||
for (int i = 0; i < 100; i++) {
|
||||
test1(barray, barray, barray, larray2, -1);
|
||||
if (larray2[larray2.length-1] != -1) {
|
||||
System.out.println("Iter " + i + " Failed with " + Long.toHexString(larray2[larray2.length-1]));
|
||||
throw new RuntimeException("Test1 failed");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int iArr[] = new int[100];
|
||||
long lArr[] = new long[100];
|
||||
for (int i = 0; i < 600_000; ++i) {
|
||||
test2(iArr, lArr);
|
||||
for (int j = 0; j < lArr.length; ++j) {
|
||||
if (iArr[j] != 1 || lArr[j] != 1) {
|
||||
throw new RuntimeException("Test2 failed at iteration " + i + ": iArr[" + j + "] = " + iArr[j] + ", lArr[" + j + "] = " + lArr[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, Red Hat, Inc. 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
|
||||
@@ -22,12 +22,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
public class LockDuringDumpApp {
|
||||
static String LITERAL = "@@LockDuringDump@@LITERAL"; // must be the same as in LockDuringDumpAgent
|
||||
/*
|
||||
* @test TestCriticalControlThreadPriority
|
||||
* @summary Check that ShenandoahCriticalControlThreadPriority works
|
||||
* @bug 8217343
|
||||
* @requires vm.gc.Shenandoah
|
||||
*
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:-ShenandoahCriticalControlThreadPriority -Xmx1g TestCriticalControlThreadPriority
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+ShenandoahCriticalControlThreadPriority -Xmx1g TestCriticalControlThreadPriority
|
||||
*/
|
||||
|
||||
public static void main(String args[]) {
|
||||
synchronized (LITERAL) { // See comments in LockDuringDumpAgent.java
|
||||
System.out.println("I am able to lock the literal string \"" + LITERAL + "\"");
|
||||
}
|
||||
public class TestCriticalControlThreadPriority {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// checking the initialization before entering main()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,14 +42,6 @@ public class JcmdScale {
|
||||
// Grab my own PID
|
||||
String pid = Long.toString(ProcessTools.getProcessId());
|
||||
|
||||
pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "scale=1"});
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain(", committed=");
|
||||
|
||||
pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "scale=b"});
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain(", committed=");
|
||||
|
||||
pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "scale=KB"});
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("KB, committed=");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@@ -36,7 +36,6 @@ import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class AppendClasspath {
|
||||
@@ -55,11 +54,11 @@ public class AppendClasspath {
|
||||
.assertNormalExit();
|
||||
|
||||
// PASS: 2) runtime has an non-existing jar in the -cp
|
||||
String outDir = CDSTestUtils.getOutputDir();
|
||||
String classDir = System.getProperty("test.classes");
|
||||
String newFile = "non-exist.jar";
|
||||
String nonExistPath = outDir + File.separator + newFile;
|
||||
String nonExistPath = classDir + File.separator + newFile;
|
||||
String classPath = appJar + File.pathSeparator + nonExistPath;
|
||||
File nonExistJar = new File(outDir, newFile);
|
||||
File nonExistJar = new File(classDir, newFile);
|
||||
if (nonExistJar.exists()) {
|
||||
nonExistJar.delete();
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ public class BootClassPathMismatch {
|
||||
}
|
||||
|
||||
private static void copyHelloToNewDir() throws Exception {
|
||||
String classDir = CDSTestUtils.getOutputDir();
|
||||
String classDir = System.getProperty("test.classes");
|
||||
String dstDir = classDir + File.separator + "newdir";
|
||||
try {
|
||||
Files.createDirectory(Paths.get(dstDir));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@@ -30,7 +30,6 @@
|
||||
* @run driver/timeout=240 ClassPathAttr
|
||||
*/
|
||||
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
@@ -102,7 +101,7 @@ public class ClassPathAttr {
|
||||
buildCpAttr("cpattr6", "cpattr6.mf", "CpAttr6", "CpAttr6");
|
||||
|
||||
String cp = TestCommon.getTestJar("cpattr6.jar");
|
||||
String nonExistPath = CDSTestUtils.getOutputDir() + File.separator + "cpattrX.jar";
|
||||
String nonExistPath = System.getProperty("test.classes") + File.separator + "cpattrX.jar";
|
||||
(new File(nonExistPath)).delete();
|
||||
|
||||
TestCommon.testDump(cp, TestCommon.list("CpAttr6"),
|
||||
@@ -130,7 +129,7 @@ public class ClassPathAttr {
|
||||
}
|
||||
|
||||
private static void buildCpAttr(String jarName, String manifest, String enclosingClassName, String ...testClassNames) throws Exception {
|
||||
String jarClassesDir = CDSTestUtils.getOutputDir() + File.separator + jarName + "_classes";
|
||||
String jarClassesDir = System.getProperty("test.classes") + File.separator + jarName + "_classes";
|
||||
try { Files.createDirectory(Paths.get(jarClassesDir)); } catch (FileAlreadyExistsException e) { }
|
||||
|
||||
JarBuilder.compile(jarClassesDir, System.getProperty("test.src") + File.separator +
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
*/
|
||||
|
||||
import jdk.test.lib.JDKToolFinder;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
@@ -49,7 +48,7 @@ public class JarBuilder {
|
||||
.orElseThrow(() -> new RuntimeException("ToolProvider for jar not found"));
|
||||
|
||||
public static String getJarFilePath(String jarName) {
|
||||
return CDSTestUtils.getOutputDir() + File.separator + jarName + ".jar";
|
||||
return classDir + File.separator + jarName + ".jar";
|
||||
}
|
||||
|
||||
// jar all files under dir, with manifest file man, with an optional versionArgs
|
||||
@@ -60,7 +59,7 @@ public class JarBuilder {
|
||||
// -C <path to the base classes> .\
|
||||
// --release 9 -C <path to the versioned classes> .
|
||||
// the last line begins with "--release" corresponds to the optional versionArgs.
|
||||
public static String build(String jarName, File dir, String man, String ...versionArgs)
|
||||
public static void build(String jarName, File dir, String man, String ...versionArgs)
|
||||
throws Exception {
|
||||
ArrayList<String> args = new ArrayList<String>();
|
||||
if (man != null) {
|
||||
@@ -68,8 +67,7 @@ public class JarBuilder {
|
||||
} else {
|
||||
args.add("cf");
|
||||
}
|
||||
String jarFile = getJarFilePath(jarName);
|
||||
args.add(jarFile);
|
||||
args.add(classDir + File.separator + jarName + ".jar");
|
||||
if (man != null) {
|
||||
args.add(man);
|
||||
}
|
||||
@@ -80,7 +78,6 @@ public class JarBuilder {
|
||||
args.add(verArg);
|
||||
}
|
||||
createJar(args);
|
||||
return jarFile;
|
||||
}
|
||||
|
||||
public static String build(String jarName, String ...classNames)
|
||||
@@ -262,6 +259,8 @@ public class JarBuilder {
|
||||
public static void signJar() throws Exception {
|
||||
String keyTool = JDKToolFinder.getJDKTool("keytool");
|
||||
String jarSigner = JDKToolFinder.getJDKTool("jarsigner");
|
||||
String classDir = System.getProperty("test.classes");
|
||||
String FS = File.separator;
|
||||
|
||||
executeProcess(keyTool,
|
||||
"-genkey", "-keystore", "./keystore", "-alias", "mykey",
|
||||
@@ -271,8 +270,8 @@ public class JarBuilder {
|
||||
|
||||
executeProcess(jarSigner,
|
||||
"-keystore", "./keystore", "-storepass", "abc123", "-keypass",
|
||||
"abc123", "-signedjar", getJarFilePath("signed_hello"),
|
||||
getJarFilePath("hello"), "mykey")
|
||||
"abc123", "-signedjar", classDir + FS + "signed_hello.jar",
|
||||
classDir + FS + "hello.jar", "mykey")
|
||||
.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@@ -51,14 +51,14 @@ public class LongClassListPath {
|
||||
|
||||
// Create a directory with long path and copy the classlist file to
|
||||
// the directory.
|
||||
Path classDir = Paths.get(CDSTestUtils.getOutputDir());
|
||||
Path classDir = Paths.get(System.getProperty("test.classes"));
|
||||
Path destDir = classDir;
|
||||
int subDirLen = MAX_PATH - classDir.toString().length() - 2;
|
||||
if (subDirLen > 0) {
|
||||
char[] chars = new char[subDirLen];
|
||||
Arrays.fill(chars, 'x');
|
||||
String subPath = new String(chars);
|
||||
destDir = Paths.get(CDSTestUtils.getOutputDir(), subPath);
|
||||
destDir = Paths.get(System.getProperty("test.classes"), subPath);
|
||||
}
|
||||
File longDir = destDir.toFile();
|
||||
longDir.mkdir();
|
||||
|
||||
@@ -41,7 +41,6 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class MoveJDKTest {
|
||||
@@ -179,12 +178,12 @@ public class MoveJDKTest {
|
||||
}
|
||||
|
||||
private static String copyFakeModulesFromHelloJar() throws Exception {
|
||||
String outDir = CDSTestUtils.getOutputDir();
|
||||
String classDir = System.getProperty("test.classes");
|
||||
String newFile = "hello.modules";
|
||||
String path = outDir + File.separator + newFile;
|
||||
String path = classDir + File.separator + newFile;
|
||||
|
||||
Files.copy(Paths.get(outDir, "hello.jar"),
|
||||
Paths.get(outDir, newFile),
|
||||
Files.copy(Paths.get(classDir, "hello.jar"),
|
||||
Paths.get(classDir, newFile),
|
||||
StandardCopyOption.REPLACE_EXISTING);
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
@@ -34,7 +34,6 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.io.IOException;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class MultiReleaseJars {
|
||||
@@ -91,7 +90,7 @@ public class MultiReleaseJars {
|
||||
* META-INF/versions/<major-version>/version/Version.class
|
||||
*/
|
||||
static void createClassFilesAndJar() throws Exception {
|
||||
String tempDir = CDSTestUtils.getOutputDir();
|
||||
String tempDir = System.getProperty("test.classes");
|
||||
File baseDir = new File(tempDir + File.separator + "base");
|
||||
File vDir = new File(tempDir + File.separator + MAJOR_VERSION_STRING);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@@ -36,7 +36,6 @@ import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class NonExistClasspath {
|
||||
@@ -47,9 +46,9 @@ public class NonExistClasspath {
|
||||
}
|
||||
|
||||
static void doTest(String appJar, boolean bootcp) throws Exception {
|
||||
String outDir = CDSTestUtils.getOutputDir();
|
||||
String classDir = System.getProperty("test.classes");
|
||||
String newFile = "non-exist.jar";
|
||||
String nonExistPath = outDir + File.separator + newFile;
|
||||
String nonExistPath = classDir + File.separator + newFile;
|
||||
final String errorMessage1 = "Unable to use shared archive";
|
||||
final String errorMessage2 = "shared class paths mismatch";
|
||||
final String errorMessage3 = (bootcp ? "BOOT" : "APP") + " classpath mismatch";
|
||||
@@ -91,8 +90,8 @@ public class NonExistClasspath {
|
||||
.assertNormalExit();
|
||||
|
||||
// Now make nonExistPath exist. CDS will fail to load.
|
||||
Files.copy(Paths.get(outDir, "hello.jar"),
|
||||
Paths.get(outDir, newFile),
|
||||
Files.copy(Paths.get(classDir, "hello.jar"),
|
||||
Paths.get(classDir, newFile),
|
||||
StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
TestCommon.run(make_args(bootcp,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@@ -45,8 +45,10 @@ public class OldClassTest implements Opcodes {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
File jarSrcFile = new File(JarBuilder.getOrCreateHelloJar());
|
||||
String jar = JarBuilder.getJarFilePath("OldClassTest_old");
|
||||
File jarFile = new File(jar);
|
||||
|
||||
File dir = new File(System.getProperty("test.classes", "."));
|
||||
File jarFile = new File(dir, "OldClassTest_old.jar");
|
||||
String jar = jarFile.getPath();
|
||||
|
||||
if (!jarFile.exists() || jarFile.lastModified() < jarSrcFile.lastModified()) {
|
||||
createTestJarFile(jarSrcFile, jarFile);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@@ -321,11 +321,12 @@ public class TestCommon extends CDSTestUtils {
|
||||
firstJar = firstJar.substring(0, n);
|
||||
}
|
||||
String classDir = System.getProperty("test.classes");
|
||||
String expected = getOutputDir() + File.separator;
|
||||
String expected1 = classDir + File.separator;
|
||||
String expected2 = System.getProperty("user.dir") + File.separator;
|
||||
|
||||
if (!firstJar.startsWith(expected)) {
|
||||
if (!firstJar.startsWith(expected1) && !firstJar.startsWith(expected2)) {
|
||||
throw new RuntimeException("FIXME: jar file not at a supported location ('"
|
||||
+ expected + "'): " + firstJar);
|
||||
+ expected1 + "', or '" + expected2 + "'): " + firstJar);
|
||||
}
|
||||
|
||||
String replaceJar = firstJar + ".tmp";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@@ -62,13 +62,15 @@ public class VerifierTest implements Opcodes {
|
||||
String jarName_hi = "hi" + "_" + subCaseId;
|
||||
|
||||
|
||||
File jarSrcFile = new File(JarBuilder.build(jarName_verifier_test_tmp, "VerifierTest0", "VerifierTestA",
|
||||
JarBuilder.build(jarName_verifier_test_tmp, "VerifierTest0", "VerifierTestA",
|
||||
"VerifierTestB", "VerifierTestC", "VerifierTestD", "VerifierTestE",
|
||||
"UnverifiableBase", "UnverifiableIntf", "UnverifiableIntfSub"));
|
||||
"UnverifiableBase", "UnverifiableIntf", "UnverifiableIntfSub");
|
||||
JarBuilder.build(jarName_greet, "Greet");
|
||||
JarBuilder.build(jarName_hi, "Hi", "Hi$MyClass");
|
||||
|
||||
File jarFile = new File(JarBuilder.getJarFilePath(jarName_verifier_test));
|
||||
File dir = new File(System.getProperty("test.classes", "."));
|
||||
File jarSrcFile = new File(dir, jarName_verifier_test_tmp + ".jar");
|
||||
File jarFile = new File(dir, jarName_verifier_test + ".jar");
|
||||
String jar = jarFile.getPath();
|
||||
|
||||
if (!jarFile.exists() || jarFile.lastModified() < jarSrcFile.lastModified()) {
|
||||
|
||||
@@ -36,8 +36,11 @@
|
||||
*/
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import jtreg.SkippedException;
|
||||
|
||||
import sun.hotspot.gc.GC;
|
||||
|
||||
@Test
|
||||
@@ -55,7 +58,8 @@ public class CDSStreamTestDriver extends DynamicArchiveTestBase {
|
||||
|
||||
static void doTest() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("streamapp", new File(classDir), null);
|
||||
JarBuilder.build("streamapp", new File(classDir), null);
|
||||
String appJar = classDir + File.separator + "streamapp.jar";
|
||||
|
||||
String[] classPaths = javaClassPath.split(File.pathSeparator);
|
||||
String testngJar = null;
|
||||
|
||||
@@ -47,7 +47,8 @@ public class DoubleSumAverageTest extends DynamicArchiveTestBase {
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("stream", new File(classDir), null);
|
||||
JarBuilder.build("stream", new File(classDir), null);
|
||||
String appJar = classDir + File.separator + "stream.jar";
|
||||
|
||||
dumpAndRun(topArchiveName, "-Xlog:cds,cds+dynamic=debug,class+load=trace",
|
||||
"-cp", appJar, mainClass);
|
||||
|
||||
@@ -36,11 +36,11 @@
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class HelloDynamicCustom extends DynamicArchiveTestBase {
|
||||
private static final String ARCHIVE_NAME = CDSTestUtils.getOutputFileName("top.jsa");
|
||||
private static final String ARCHIVE_NAME =
|
||||
System.getProperty("test.classes") + File.separator + "HelloDynamicCustom-top.jsa";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
runTest(HelloDynamicCustom::testDefaultBase);
|
||||
|
||||
@@ -39,10 +39,10 @@
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
|
||||
public class HelloDynamicCustomUnload extends DynamicArchiveTestBase {
|
||||
private static final String ARCHIVE_NAME = CDSTestUtils.getOutputFileName("top.jsa");
|
||||
private static final String ARCHIVE_NAME =
|
||||
System.getProperty("test.classes") + File.separator + "HelloDynamicCustomUnload.jsa";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
runTest(HelloDynamicCustomUnload::testDefaultBase);
|
||||
|
||||
@@ -37,12 +37,12 @@
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class LambdaForClassInBaseArchive extends DynamicArchiveTestBase {
|
||||
static final String classList = CDSTestUtils.getOutputFileName("classlist");
|
||||
static final String classList = System.getProperty("test.classes") +
|
||||
File.separator + "LambdaForClassInBaseArchive.list";
|
||||
static final String appClass = "SimpleApp";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
@@ -45,14 +45,14 @@
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class NoClassToArchive extends DynamicArchiveTestBase {
|
||||
static final String warningMessage =
|
||||
"There is no class to be included in the dynamic archive";
|
||||
static final String classList = CDSTestUtils.getOutputFileName("classlist");
|
||||
static final String classList = System.getProperty("test.classes") +
|
||||
File.separator + "NoClassToArchive.list";
|
||||
static final String appClass = "StrConcatApp";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
@@ -30,29 +30,7 @@ for i in "${testnames[@]}"
|
||||
do
|
||||
fname="$i$name_suffix"
|
||||
cat << EOF > $fname
|
||||
/*
|
||||
* Copyright (c) 2020, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// this file is auto-generated by $0. Do not edit manually.
|
||||
|
||||
/*
|
||||
@@ -100,7 +78,8 @@ public class $i extends DynamicArchiveTestBase {
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
JarBuilder.build("MH", new File(classDir), null);
|
||||
String appJar = classDir + File.separator + "MH.jar";
|
||||
|
||||
String[] classPaths = javaClassPath.split(File.pathSeparator);
|
||||
String junitJar = null;
|
||||
|
||||
@@ -68,7 +68,8 @@ public class MethodHandlesAsCollectorTest extends DynamicArchiveTestBase {
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
JarBuilder.build("MH", new File(classDir), null);
|
||||
String appJar = classDir + File.separator + "MH.jar";
|
||||
|
||||
String[] classPaths = javaClassPath.split(File.pathSeparator);
|
||||
String junitJar = null;
|
||||
|
||||
@@ -68,7 +68,8 @@ public class MethodHandlesCastFailureTest extends DynamicArchiveTestBase {
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
JarBuilder.build("MH", new File(classDir), null);
|
||||
String appJar = classDir + File.separator + "MH.jar";
|
||||
|
||||
String[] classPaths = javaClassPath.split(File.pathSeparator);
|
||||
String junitJar = null;
|
||||
|
||||
@@ -68,7 +68,8 @@ public class MethodHandlesGeneralTest extends DynamicArchiveTestBase {
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
JarBuilder.build("MH", new File(classDir), null);
|
||||
String appJar = classDir + File.separator + "MH.jar";
|
||||
|
||||
String[] classPaths = javaClassPath.split(File.pathSeparator);
|
||||
String junitJar = null;
|
||||
|
||||
@@ -68,7 +68,8 @@ public class MethodHandlesInvokersTest extends DynamicArchiveTestBase {
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
JarBuilder.build("MH", new File(classDir), null);
|
||||
String appJar = classDir + File.separator + "MH.jar";
|
||||
|
||||
String[] classPaths = javaClassPath.split(File.pathSeparator);
|
||||
String junitJar = null;
|
||||
|
||||
@@ -68,7 +68,8 @@ public class MethodHandlesPermuteArgumentsTest extends DynamicArchiveTestBase {
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
JarBuilder.build("MH", new File(classDir), null);
|
||||
String appJar = classDir + File.separator + "MH.jar";
|
||||
|
||||
String[] classPaths = javaClassPath.split(File.pathSeparator);
|
||||
String junitJar = null;
|
||||
|
||||
@@ -68,7 +68,8 @@ public class MethodHandlesSpreadArgumentsTest extends DynamicArchiveTestBase {
|
||||
|
||||
static void testImpl() throws Exception {
|
||||
String topArchiveName = getNewArchiveName();
|
||||
String appJar = JarBuilder.build("MH", new File(classDir), null);
|
||||
JarBuilder.build("MH", new File(classDir), null);
|
||||
String appJar = classDir + File.separator + "MH.jar";
|
||||
|
||||
String[] classPaths = javaClassPath.split(File.pathSeparator);
|
||||
String junitJar = null;
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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 8249276
|
||||
* @summary When dumping the CDS archive, try to lock some objects. These objects should be archived
|
||||
* without the locking bits in the markWord.
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @requires vm.cds
|
||||
* @requires vm.flavor != "minimal"
|
||||
* @modules java.instrument
|
||||
* @run driver LockDuringDump
|
||||
*/
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class LockDuringDump {
|
||||
public static String appClasses[] = {
|
||||
LockDuringDumpApp.class.getName(),
|
||||
};
|
||||
public static String agentClasses[] = {
|
||||
LockDuringDumpAgent.class.getName(),
|
||||
};
|
||||
|
||||
private static final String MANIFEST =
|
||||
"Manifest-Version: 1.0\nPremain-Class: LockDuringDumpAgent\n";
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
String agentJar =
|
||||
ClassFileInstaller.writeJar("LockDuringDumpAgent.jar",
|
||||
ClassFileInstaller.Manifest.fromString(MANIFEST),
|
||||
agentClasses);
|
||||
|
||||
String appJar =
|
||||
ClassFileInstaller.writeJar("LockDuringDumpApp.jar", appClasses);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
// i = 0 -- dump without agent
|
||||
// i = 1 -- dump with agent = disable BiasedLocking
|
||||
// i = 2 -- dump with agent = enable BiasedLocking
|
||||
|
||||
String agentArg = (i == 0) ? "-showversion" : "-javaagent:" + agentJar;
|
||||
String agentArg2 = (i == 0) ? "-showversion" : "-XX:+AllowArchivingWithJavaAgent";
|
||||
String biasedLock = (i != 2) ? "-showversion" : "-XX:+UseBiasedLocking";
|
||||
|
||||
OutputAnalyzer out =
|
||||
TestCommon.testDump(appJar, TestCommon.list(LockDuringDumpApp.class.getName()),
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
agentArg, agentArg2, biasedLock);
|
||||
if (i != 0) {
|
||||
out.shouldContain("Let's hold the lock on the literal string");
|
||||
}
|
||||
|
||||
TestCommon.run(
|
||||
"-cp", appJar,
|
||||
"-XX:+UnlockDiagnosticVMOptions", agentArg2, biasedLock,
|
||||
LockDuringDumpApp.class.getName())
|
||||
.assertNormalExit("I am able to lock the literal string");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
import java.lang.instrument.Instrumentation;
|
||||
|
||||
public class LockDuringDumpAgent implements Runnable {
|
||||
static boolean threadStarted = false;
|
||||
static Object lock = new Object();
|
||||
|
||||
// The following literal string will be stored into the VM's interned string table when this
|
||||
// class (or the LockDuringDumpApp class) is loaded during -Xshare:dump. As a result it will be
|
||||
// stored in the CDS archived heap (all strings in the dump-time interned string table are archived).
|
||||
//
|
||||
// We try to make sure this string is locked while the archived heap is dumped. CDS should
|
||||
// clear the lock states in this string's object header. See JDK-8249276.
|
||||
//
|
||||
// At run time, when LockDuringDumpApp loads this literal string (from the shared string table)
|
||||
// it should be able to lock it without problems.
|
||||
static String LITERAL = "@@LockDuringDump@@LITERAL"; // must be the same as in LockDuringDumpAgent
|
||||
|
||||
public static void premain(String agentArg, Instrumentation instrumentation) {
|
||||
System.out.println("inside LockDuringDumpAgent: " + LockDuringDumpAgent.class.getClassLoader());
|
||||
|
||||
Thread t = new Thread(new LockDuringDumpAgent());
|
||||
t.setDaemon(true);
|
||||
t.start();
|
||||
|
||||
waitForThreadStart();
|
||||
}
|
||||
|
||||
static void waitForThreadStart() {
|
||||
try {
|
||||
synchronized (lock) {
|
||||
while (!threadStarted) {
|
||||
lock.wait();
|
||||
}
|
||||
System.out.println("Thread has started");
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
System.err.println("Unexpected: " + t);
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
synchronized (LITERAL) {
|
||||
System.out.println("Let's hold the lock on the literal string \"" + LITERAL + "\" + forever .....");
|
||||
synchronized (lock) {
|
||||
threadStarted = true;
|
||||
lock.notifyAll();
|
||||
}
|
||||
//if (false) {
|
||||
while (true) {
|
||||
Thread.sleep(1);
|
||||
}
|
||||
//}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
System.err.println("Unexpected: " + t);
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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.
|
||||
*/
|
||||
|
||||
package datatype;
|
||||
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
import org.testng.annotations.Test;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.DataProvider;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246816
|
||||
* @run testng datatype.HashCodeTest
|
||||
* @summary Test hashCode generation.
|
||||
*/
|
||||
public class HashCodeTest {
|
||||
/*
|
||||
DataProvider: for testHashCode
|
||||
Data: datetime1, datetime2, flag indicating if their hashCodes are equal
|
||||
*/
|
||||
@DataProvider(name = "testHashCode")
|
||||
public Object[][] getData() {
|
||||
|
||||
return new Object[][]{
|
||||
// the reported case: identical hash codes before the patch
|
||||
{"2020-04-24T12:53:00+02:00", "2020-06-04T06:58:17.727Z", false},
|
||||
// a case mentioned in the dev note of hashCode() implementation
|
||||
{"2000-01-15T12:00:00-05:00", "2000-01-15T13:00:00-04:00", true},
|
||||
/**
|
||||
* Comparing with a datetime that needs to be normalized.
|
||||
* Before the patch, XMLGregorianCalendarImpl called the normalizeToTimezone
|
||||
* method that will set UNDEFINED fractional second to zero.
|
||||
*/
|
||||
{"2000-01-01T03:19:04Z", "1999-12-31T23:49:04-03:30", true},
|
||||
// another case mentioned in the javadoc of XMLGregorianCalendar::normalize()
|
||||
{"2000-03-04T23:00:00+03:00", "2000-03-04T20:00:00Z", true},
|
||||
};
|
||||
}
|
||||
|
||||
@Test(dataProvider = "testHashCode")
|
||||
public final void testHashCode(String dt1, String dt2, boolean equal) throws Exception {
|
||||
DatatypeFactory dataTypeFactory = DatatypeFactory.newInstance();
|
||||
XMLGregorianCalendar cal1 = dataTypeFactory.newXMLGregorianCalendar(dt1);
|
||||
XMLGregorianCalendar cal2 = dataTypeFactory.newXMLGregorianCalendar(dt2);
|
||||
|
||||
// identical hash codes before the patch
|
||||
int hashCode1 = cal1.hashCode();
|
||||
int hashCode2 = cal2.hashCode();
|
||||
|
||||
if (equal) {
|
||||
Assert.assertTrue(cal1.equals(cal2));
|
||||
Assert.assertEquals(hashCode1, hashCode2);
|
||||
} else {
|
||||
Assert.assertFalse(cal1.equals(cal2));
|
||||
Assert.assertNotEquals(hashCode1, hashCode2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -590,6 +590,7 @@ javax/management/monitor/DerivedGaugeMonitorTest.java 8042211 generic-al
|
||||
# jdk_io
|
||||
|
||||
java/io/pathNames/GeneralWin32.java 8180264 windows-all
|
||||
java/io/File/GetXSpace.java 8249703 macosx-all
|
||||
|
||||
############################################################################
|
||||
|
||||
|
||||
@@ -111,13 +111,6 @@ class ProviderTest implements Callable<Boolean> {
|
||||
env.put(Context.PROVIDER_URL, url);
|
||||
}
|
||||
|
||||
// Set JNDI LDAP connect timeout property. It helps to prevent
|
||||
// initial bind operation from blocking in case of a local process
|
||||
// listening on the port specified in the URL. With the property set,
|
||||
// the bind operation will fail with timeout exception, and then it
|
||||
// could be retried with another port number.
|
||||
env.put("com.sun.jndi.ldap.connect.timeout", "1000");
|
||||
|
||||
try {
|
||||
ctx = new InitialDirContext(env);
|
||||
SearchControls scl = new SearchControls();
|
||||
@@ -126,13 +119,8 @@ class ProviderTest implements Callable<Boolean> {
|
||||
"ou=People,o=Test", "(objectClass=*)", scl);
|
||||
throw new RuntimeException("Search should not complete");
|
||||
} catch (NamingException e) {
|
||||
e.printStackTrace();
|
||||
passed = e.toString().contains(expected);
|
||||
System.err.println((passed ? "Expected" : "Unexpected") +
|
||||
" NamingException observed: " + e.toString());
|
||||
// Print stack trace only for unexpected exceptions
|
||||
if (!passed) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
shutItDown(ctx);
|
||||
}
|
||||
@@ -255,8 +243,7 @@ public class LdapDnsProviderTest {
|
||||
// Construct text expected to be present in Exception message
|
||||
String expected = "localhost:" + port;
|
||||
|
||||
System.err.printf("Iteration %d: Testing: url='%s', expected content='%s'%n",
|
||||
attempt, url, expected);
|
||||
System.err.printf("Iteration %d: Testing: %s, %s%n", attempt, url, expected);
|
||||
|
||||
FutureTask<Boolean> future = new FutureTask<>(
|
||||
new ProviderTest(url, expected));
|
||||
@@ -291,7 +278,7 @@ public class LdapDnsProviderTest {
|
||||
new ProviderTest(url, expected));
|
||||
new Thread(future).start();
|
||||
|
||||
System.err.printf("Testing: url='%s', expected content='%s'%n", url, expected);
|
||||
System.err.println("Testing: " + url + ", " + expected);
|
||||
while (!future.isDone()) {
|
||||
try {
|
||||
if (!future.get()) {
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.ServiceUnavailableException;
|
||||
import javax.naming.directory.InitialDirContext;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -68,16 +67,8 @@ public class NamingExceptionMessageTest {
|
||||
ldapServer.awaitStartup();
|
||||
var env = ldapServer.getInitialLdapCtxEnvironment(0);
|
||||
var namingException = Assert.expectThrows(NamingException.class, () -> new InitialDirContext(env));
|
||||
if (namingException instanceof ServiceUnavailableException) {
|
||||
// If naming exception is ServiceUnavailableException it could mean
|
||||
// that the connection was closed on test server-side before LDAP client starts
|
||||
// read-out of the reply message. For such cases test run is considered as successful.
|
||||
System.out.println("Got ServiceUnavailableException: Test PASSED");
|
||||
} else {
|
||||
// If exception is not ServiceUnavailableException - check the exception message
|
||||
System.out.println("Got NamingException:" + namingException);
|
||||
Assert.assertEquals(namingException.getMessage(), EXPECTED_CLOSURE_MESSAGE);
|
||||
}
|
||||
System.out.println("Got naming exception:" + namingException);
|
||||
Assert.assertEquals(namingException.getMessage(), EXPECTED_CLOSURE_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,12 +140,6 @@ public class NamingExceptionMessageTest {
|
||||
switch (msg.getOperation()) {
|
||||
case BIND_REQUEST:
|
||||
if (closeConnections) {
|
||||
// Give some time for LDAP client to start-up
|
||||
try {
|
||||
TimeUnit.MILLISECONDS.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
// Close the socket
|
||||
closeSilently(socket);
|
||||
} else {
|
||||
try {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
/**
|
||||
* @test
|
||||
* @bug 4057701 6286712 6364377
|
||||
* @requires (os.family == "linux" | os.family == "mac" | os.family == "windows")
|
||||
* @run build GetXSpace
|
||||
* @run shell GetXSpace.sh
|
||||
* @summary Basic functionality of File.get-X-Space methods.
|
||||
@@ -36,8 +35,6 @@ import java.io.File;
|
||||
import java.io.FilePermission;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.FileStore;
|
||||
import java.security.Permission;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -50,12 +47,9 @@ public class GetXSpace {
|
||||
private static SecurityManager [] sma = { null, new Allow(), new DenyFSA(),
|
||||
new DenyRead() };
|
||||
|
||||
private static final String OS_NAME = System.getProperty("os.name");
|
||||
private static final boolean IS_MAC = OS_NAME.startsWith("Mac");
|
||||
private static final boolean IS_WIN = OS_NAME.startsWith("Windows");
|
||||
|
||||
private static final String osName = System.getProperty("os.name");
|
||||
// FileSystem Total Used Available Use% MountedOn
|
||||
private static final Pattern DF_PATTERN = Pattern.compile("([^\\s]+)\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s+\\d+%\\s+([^\\s].*)\n");
|
||||
private static final Pattern dfPattern = Pattern.compile("([^\\s]+)\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s+\\d+%\\s+([^\\s].*)\n");
|
||||
|
||||
private static int fail = 0;
|
||||
private static int pass = 0;
|
||||
@@ -135,7 +129,7 @@ public class GetXSpace {
|
||||
}
|
||||
out.println(sb);
|
||||
|
||||
Matcher m = DF_PATTERN.matcher(sb);
|
||||
Matcher m = dfPattern.matcher(sb);
|
||||
int j = 0;
|
||||
while (j < sb.length()) {
|
||||
if (m.find(j)) {
|
||||
@@ -144,7 +138,7 @@ public class GetXSpace {
|
||||
String name = f;
|
||||
if (name == null) {
|
||||
// cygwin's df lists windows path as FileSystem (1st group)
|
||||
name = IS_WIN ? m.group(1) : m.group(4);
|
||||
name = osName.startsWith("Windows") ? m.group(1) : m.group(4);
|
||||
}
|
||||
al.add(new Space(m.group(2), m.group(3), name));;
|
||||
}
|
||||
@@ -207,31 +201,13 @@ public class GetXSpace {
|
||||
|
||||
// if the file system can dynamically change size, this check will fail
|
||||
if (ts != s.total()) {
|
||||
long blockSize = 1;
|
||||
long numBlocks = 0;
|
||||
try {
|
||||
FileStore fileStore = Files.getFileStore(f.toPath());
|
||||
blockSize = fileStore.getBlockSize();
|
||||
numBlocks = fileStore.getTotalSpace()/blockSize;
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
// On macOS, the number of 1024 byte blocks might be incorrectly
|
||||
// calculated by 'df' using integer division by 2 of the number of
|
||||
// 512 byte blocks, resulting in a size smaller than the actual
|
||||
// value when the number of blocks is odd.
|
||||
if (!IS_MAC || blockSize != 512 || numBlocks % 2 == 0
|
||||
|| ts - s.total() != 512) {
|
||||
fail(s.name(), s.total(), "!=", ts);
|
||||
}
|
||||
fail(s.name(), s.total(), "!=", ts);
|
||||
} else {
|
||||
pass();
|
||||
}
|
||||
|
||||
// unix df returns statvfs.f_bavail
|
||||
long tsp = (!IS_WIN ? us : fs);
|
||||
long tsp = (!osName.startsWith("Windows") ? us : fs);
|
||||
if (!s.woomFree(tsp)) {
|
||||
fail(s.name(), s.free(), "??", tsp);
|
||||
} else {
|
||||
|
||||
@@ -48,21 +48,17 @@ import java.util.logging.LogRecord;
|
||||
|
||||
public class HttpURLConWithProxy {
|
||||
|
||||
private static Logger logger =
|
||||
Logger.getLogger("sun.net.www.protocol.http.HttpURLConnection");
|
||||
|
||||
public static void main(String... arg) throws Exception {
|
||||
// Remove the default nonProxyHosts to use localhost for testing
|
||||
System.setProperty("http.nonProxyHosts", "");
|
||||
|
||||
System.setProperty("http.proxyHost", "1.1.1.1");
|
||||
System.setProperty("http.proxyPort", "1111");
|
||||
|
||||
// Use the logger to help verify the Proxy was used
|
||||
logger.setLevel(Level.ALL);
|
||||
String HTTPLOG = "sun.net.www.protocol.http.HttpURLConnection";
|
||||
Logger.getLogger(HTTPLOG).setLevel(Level.ALL);
|
||||
Handler h = new ProxyHandler();
|
||||
h.setLevel(Level.ALL);
|
||||
logger.addHandler(h);
|
||||
Logger.getLogger(HTTPLOG).addHandler(h);
|
||||
|
||||
ServerSocket ss;
|
||||
URL url;
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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.
|
||||
*/
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
import java.io.IOException;
|
||||
import java.net.ProtocolFamily;
|
||||
import java.net.http.HttpClient;
|
||||
import java.nio.channels.DatagramChannel;
|
||||
import java.nio.channels.Pipe;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.nio.channels.Channel;
|
||||
import java.nio.channels.spi.AbstractSelector;
|
||||
import java.nio.channels.spi.SelectorProvider;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8248006
|
||||
* @summary The test checks if UncheckedIOException is thrown
|
||||
* @build HttpClientExceptionTest
|
||||
* @run testng/othervm -Djava.nio.channels.spi.SelectorProvider=HttpClientExceptionTest$CustomSelectorProvider
|
||||
* HttpClientExceptionTest
|
||||
*/
|
||||
|
||||
public class HttpClientExceptionTest {
|
||||
|
||||
static final int ITERATIONS = 10;
|
||||
|
||||
@Test
|
||||
public void testHttpClientException() {
|
||||
for(int i = 0; i < ITERATIONS; i++) {
|
||||
Assert.assertThrows(HttpClient.newBuilder()::build);
|
||||
Assert.assertThrows(HttpClient::newHttpClient);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CustomSelectorProvider extends SelectorProvider {
|
||||
|
||||
@Override
|
||||
public DatagramChannel openDatagramChannel() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatagramChannel openDatagramChannel(ProtocolFamily family) throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pipe openPipe() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerSocketChannel openServerSocketChannel() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SocketChannel openSocketChannel() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Channel inheritedChannel() throws IOException {
|
||||
return super.inheritedChannel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SocketChannel openSocketChannel(ProtocolFamily family) throws IOException {
|
||||
return super.openSocketChannel(family);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerSocketChannel openServerSocketChannel(ProtocolFamily family) throws IOException {
|
||||
return super.openServerSocketChannel(family);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractSelector openSelector() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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.
|
||||
*/
|
||||
|
||||
import org.testng.annotations.AfterTest;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246707
|
||||
* @library /test/lib
|
||||
* @summary Reading or Writing to a closed SocketChannel should throw a ClosedChannelException
|
||||
* @run testng/othervm ReadWriteAfterClose
|
||||
*/
|
||||
|
||||
public class ReadWriteAfterClose {
|
||||
|
||||
private ServerSocketChannel listener;
|
||||
private SocketAddress saddr;
|
||||
private static final int bufCapacity = 4;
|
||||
private static final int bufArraySize = 4;
|
||||
private static final Class<ClosedChannelException> CCE = ClosedChannelException.class;
|
||||
|
||||
@BeforeTest
|
||||
public void setUp() throws IOException {
|
||||
listener = ServerSocketChannel.open();
|
||||
listener.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
|
||||
saddr = listener.getLocalAddress();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteAfterClose1() throws IOException {
|
||||
SocketChannel sc = SocketChannel.open(saddr);
|
||||
sc.close();
|
||||
ByteBuffer bufWrite = ByteBuffer.allocate(bufCapacity);
|
||||
Throwable ex = expectThrows(CCE, () -> sc.write(bufWrite));
|
||||
assertEquals(ex.getClass(), CCE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteAfterClose2() throws IOException {
|
||||
SocketChannel sc = SocketChannel.open(saddr);
|
||||
sc.close();
|
||||
ByteBuffer[] bufArrayWrite = allocateBufArray();
|
||||
Throwable ex = expectThrows(CCE, () -> sc.write(bufArrayWrite));
|
||||
assertEquals(ex.getClass(), CCE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteAfterClose3() throws IOException {
|
||||
SocketChannel sc = SocketChannel.open(saddr);
|
||||
sc.close();
|
||||
ByteBuffer[] bufArrayWrite = allocateBufArray();
|
||||
Throwable ex = expectThrows(CCE, () -> sc.write(bufArrayWrite, 0, bufArraySize));
|
||||
assertEquals(ex.getClass(), CCE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadAfterClose1() throws IOException {
|
||||
SocketChannel sc = SocketChannel.open(saddr);
|
||||
sc.close();
|
||||
ByteBuffer dst = ByteBuffer.allocate(bufCapacity);
|
||||
Throwable ex = expectThrows(CCE, () -> sc.read(dst));
|
||||
assertEquals(ex.getClass(), CCE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadAfterClose2() throws IOException {
|
||||
SocketChannel sc = SocketChannel.open(saddr);
|
||||
sc.close();
|
||||
ByteBuffer[] dstArray = allocateBufArray();
|
||||
Throwable ex = expectThrows(CCE, () -> sc.read(dstArray));
|
||||
assertEquals(ex.getClass(), CCE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadAfterClose3() throws IOException {
|
||||
SocketChannel sc = SocketChannel.open(saddr);
|
||||
sc.close();
|
||||
ByteBuffer[] dstArray = allocateBufArray();
|
||||
Throwable ex = expectThrows(CCE, () -> sc.read(dstArray, 0, bufArraySize));
|
||||
assertEquals(ex.getClass(), CCE);
|
||||
}
|
||||
|
||||
public ByteBuffer[] allocateBufArray() {
|
||||
ByteBuffer[] bufArr = new ByteBuffer[bufArraySize];
|
||||
for (int i = 0; i < bufArraySize; i++)
|
||||
bufArr[i] = ByteBuffer.allocate(bufCapacity);
|
||||
return bufArr;
|
||||
}
|
||||
|
||||
@AfterTest
|
||||
public void tearDown() throws IOException {
|
||||
listener.close();
|
||||
}
|
||||
}
|
||||
@@ -523,8 +523,7 @@ public class InPlaceOpsCollisions extends MapWithCollisionsProviders {
|
||||
new Object[]{"HashMap", (Supplier<Map<?, ?>>) HashMap::new},
|
||||
new Object[]{"LinkedHashMap", (Supplier<Map<?, ?>>) LinkedHashMap::new},
|
||||
new Object[]{"TreeMap", (Supplier<Map<?, ?>>) TreeMap::new},
|
||||
new Object[]{"TreeMap(cmp)", (Supplier<Map<?, ?>>) () -> new TreeMap<>(Comparator.reverseOrder())},
|
||||
new Object[]{"TreeMap.descendingMap", (Supplier<Map<?, ?>>) () -> new TreeMap<>().descendingMap()}
|
||||
new Object[]{"TreeMap(cmp)", (Supplier<Map<?, ?>>) () -> new TreeMap<>(Comparator.reverseOrder())}
|
||||
).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,8 +193,6 @@ public class MapWithCollisionsProviders {
|
||||
new IdentityHashMap<>(), keys, val));
|
||||
cases.add(createCase("TreeMap with " + desc,
|
||||
new TreeMap<>(), keys, val));
|
||||
cases.add(createCase("Descending TreeMap with " + desc,
|
||||
new TreeMap<>().descendingMap(), keys, val));
|
||||
cases.add(createCase("WeakHashMap with " + desc,
|
||||
new WeakHashMap<>(), keys, val));
|
||||
cases.add(createCase("ConcurrentHashMap with " + desc,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user