This commit is contained in:
Phil Race 2020-01-14 15:23:01 -08:00
commit 4aab785db1
292 changed files with 2982 additions and 2712 deletions

View File

@ -608,4 +608,5 @@ f33197adda9ad82fdef46ac0f7dc0126204f35b2 jdk-15+2
d05fcdf25717d85e80a3a39a6b719458b22be5fe jdk-15+3
d54ce919da90dab361995bb4d87be9851f00537a jdk-14+30
bb0a7975b31ded63d594ee8dbfc4d4ead587f79b jdk-15+4
decd3d2953b640f1043ee76953ff89238bff92e8 jdk-14+31
b97c1773ccafae4a8c16cc6aedb10b2a4f9a07ed jdk-15+5

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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
@ -302,15 +302,21 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
if test "x$withval" = xexternal || test "x$withval" = xzipped; then
AC_MSG_ERROR([AIX only supports the parameters 'none' and 'internal' for --with-native-debug-symbols])
fi
else
if test "x$OPENJDK_TARGET_OS" = xwindows; then
if test "x$withval" = xinternal; then
AC_MSG_ERROR([Windows does not support the parameter 'internal' for --with-native-debug-symbols])
fi
fi
fi
],
[
if test "x$OPENJDK_TARGET_OS" = xaix; then
# AIX doesn't support 'external' so use 'internal' as default
with_native_debug_symbols="internal"
if test "x$STATIC_BUILD" = xtrue; then
with_native_debug_symbols="none"
else
if test "x$STATIC_BUILD" = xtrue; then
with_native_debug_symbols="none"
if test "x$OPENJDK_TARGET_OS" = xaix; then
# AIX doesn't support 'external' so use 'internal' as default
with_native_debug_symbols="internal"
else
with_native_debug_symbols="external"
fi
@ -319,20 +325,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
NATIVE_DEBUG_SYMBOLS=$with_native_debug_symbols
AC_MSG_RESULT([$NATIVE_DEBUG_SYMBOLS])
if test "x$NATIVE_DEBUG_SYMBOLS" = xzipped; then
if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
if test "x$OBJCOPY" = x; then
# enabling of enable-debug-symbols and can't find objcopy
# this is an error
AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
fi
fi
COMPILE_WITH_DEBUG_SYMBOLS=true
COPY_DEBUG_SYMBOLS=true
ZIP_EXTERNAL_DEBUG_SYMBOLS=true
elif test "x$NATIVE_DEBUG_SYMBOLS" = xnone; then
if test "x$NATIVE_DEBUG_SYMBOLS" = xnone; then
COMPILE_WITH_DEBUG_SYMBOLS=false
COPY_DEBUG_SYMBOLS=false
ZIP_EXTERNAL_DEBUG_SYMBOLS=false
@ -353,6 +346,19 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
COMPILE_WITH_DEBUG_SYMBOLS=true
COPY_DEBUG_SYMBOLS=true
ZIP_EXTERNAL_DEBUG_SYMBOLS=false
elif test "x$NATIVE_DEBUG_SYMBOLS" = xzipped; then
if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
if test "x$OBJCOPY" = x; then
# enabling of enable-debug-symbols and can't find objcopy
# this is an error
AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
fi
fi
COMPILE_WITH_DEBUG_SYMBOLS=true
COPY_DEBUG_SYMBOLS=true
ZIP_EXTERNAL_DEBUG_SYMBOLS=true
else
AC_MSG_ERROR([Allowed native debug symbols are: none, internal, external, zipped])
fi

View File

@ -209,8 +209,8 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}"
eval VS_TOOLSET_SUPPORTED="\${VS_TOOLSET_SUPPORTED_${VS_VERSION}}"
VS_ENV_CMD=""
VS_ENV_CMD=""
# When using --with-tools-dir, assume it points to the correct and default
# version of Visual Studio or that --with-toolchain-version was also set.

View File

@ -1066,7 +1066,7 @@ var getJibProfilesDependencies = function (input, common) {
// build_number: "b07",
// file: "bundles/jcov-3_0.zip",
organization: common.organization,
revision: "3.0-58-support+1.0",
revision: "3.0-59-support+1.0",
ext: "zip",
environment_name: "JCOV_HOME",
},

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016, 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
@ -45,12 +45,14 @@ ifeq ($(call isTargetOs, windows), true)
FLATTEN := true, \
)) \
$(eval TARGETS += $$(COPY_GTEST_MSVCR_$v)) \
$(eval $(call SetupCopyFiles, COPY_GTEST_PDB_$v, \
SRC := $(HOTSPOT_OUTPUTDIR)/variant-$v/libjvm/gtest, \
DEST := $(TEST_IMAGE_DIR)/hotspot/gtest/$v, \
FILES := jvm.pdb gtestLauncher.pdb, \
)) \
$(eval TARGETS += $$(COPY_GTEST_PDB_$v)) \
$(if $(call equals, $(COPY_DEBUG_SYMBOLS), true), \
$(eval $(call SetupCopyFiles, COPY_GTEST_PDB_$v, \
SRC := $(HOTSPOT_OUTPUTDIR)/variant-$v/libjvm/gtest, \
DEST := $(TEST_IMAGE_DIR)/hotspot/gtest/$v, \
FILES := jvm.pdb gtestLauncher.pdb, \
)) \
$(eval TARGETS += $$(COPY_GTEST_PDB_$v)) \
) \
)
endif

View File

@ -35,8 +35,6 @@
#include "ci/ciArrayKlass.hpp"
#include "ci/ciInstance.hpp"
#include "code/compiledIC.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTableBarrierSet.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "nativeInst_aarch64.hpp"
#include "oops/objArrayKlass.hpp"

View File

@ -31,8 +31,6 @@
#include "c1/c1_ValueStack.hpp"
#include "ci/ciArrayKlass.hpp"
#include "ci/ciInstance.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTableBarrierSet.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "memory/universe.hpp"
#include "nativeInst_arm.hpp"

View File

@ -33,8 +33,6 @@
#include "ci/ciArrayKlass.hpp"
#include "ci/ciInstance.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTableBarrierSet.hpp"
#include "memory/universe.hpp"
#include "nativeInst_ppc.hpp"
#include "oops/compressedOops.hpp"

View File

@ -294,7 +294,7 @@ void PatchingStub::align_patch_site(MacroAssembler* masm) {
void PatchingStub::emit_code(LIR_Assembler* ce) {
// Copy original code here.
assert(NativeGeneralJump::instruction_size <= _bytes_to_copy && _bytes_to_copy <= 0xFF,
"not enough room for call");
"not enough room for call, need %d", _bytes_to_copy);
NearLabel call_patch;
@ -331,7 +331,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
}
#endif
} else {
// Make a copy the code which is going to be patched.
// Make a copy of the code which is going to be patched.
for (int i = 0; i < _bytes_to_copy; i++) {
address ptr = (address)(_pc_start + i);
int a_byte = (*ptr) & 0xFF;

View File

@ -33,8 +33,6 @@
#include "ci/ciArrayKlass.hpp"
#include "ci/ciInstance.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTableBarrierSet.hpp"
#include "memory/universe.hpp"
#include "nativeInst_s390.hpp"
#include "oops/objArrayKlass.hpp"
@ -897,7 +895,7 @@ void LIR_Assembler::mem2reg(LIR_Opr src_opr, LIR_Opr dest, BasicType type, LIR_P
bool needs_patching = (patch_code != lir_patch_none);
if (addr->base()->type() == T_OBJECT) {
__ verify_oop(src);
__ verify_oop(src, FILE_AND_LINE);
}
PatchingStub* patch = NULL;
@ -972,7 +970,7 @@ void LIR_Assembler::mem2reg(LIR_Opr src_opr, LIR_Opr dest, BasicType type, LIR_P
} else {
__ z_lg(dest->as_register(), disp_value, disp_reg, src);
}
__ verify_oop(dest->as_register());
__ verify_oop(dest->as_register(), FILE_AND_LINE);
break;
}
case T_FLOAT:
@ -1006,7 +1004,7 @@ void LIR_Assembler::stack2reg(LIR_Opr src, LIR_Opr dest, BasicType type) {
if (dest->is_single_cpu()) {
if (is_reference_type(type)) {
__ mem2reg_opt(dest->as_register(), frame_map()->address_for_slot(src->single_stack_ix()), true);
__ verify_oop(dest->as_register());
__ verify_oop(dest->as_register(), FILE_AND_LINE);
} else if (type == T_METADATA || type == T_ADDRESS) {
__ mem2reg_opt(dest->as_register(), frame_map()->address_for_slot(src->single_stack_ix()), true);
} else {
@ -1033,7 +1031,7 @@ void LIR_Assembler::reg2stack(LIR_Opr src, LIR_Opr dest, BasicType type, bool po
if (src->is_single_cpu()) {
const Address dst = frame_map()->address_for_slot(dest->single_stack_ix());
if (is_reference_type(type)) {
__ verify_oop(src->as_register());
__ verify_oop(src->as_register(), FILE_AND_LINE);
__ reg2mem_opt(src->as_register(), dst, true);
} else if (type == T_METADATA || type == T_ADDRESS) {
__ reg2mem_opt(src->as_register(), dst, true);
@ -1079,7 +1077,7 @@ void LIR_Assembler::reg2reg(LIR_Opr from_reg, LIR_Opr to_reg) {
ShouldNotReachHere();
}
if (is_reference_type(to_reg->type())) {
__ verify_oop(to_reg->as_register());
__ verify_oop(to_reg->as_register(), FILE_AND_LINE);
}
}
@ -1095,7 +1093,7 @@ void LIR_Assembler::reg2mem(LIR_Opr from, LIR_Opr dest_opr, BasicType type,
bool needs_patching = (patch_code != lir_patch_none);
if (addr->base()->is_oop_register()) {
__ verify_oop(dest);
__ verify_oop(dest, FILE_AND_LINE);
}
PatchingStub* patch = NULL;
@ -1130,7 +1128,7 @@ void LIR_Assembler::reg2mem(LIR_Opr from, LIR_Opr dest_opr, BasicType type,
assert(disp_reg != Z_R0 || Immediate::is_simm20(disp_value), "should have set this up");
if (is_reference_type(type)) {
__ verify_oop(from->as_register());
__ verify_oop(from->as_register(), FILE_AND_LINE);
}
bool short_disp = Immediate::is_uimm12(disp_value);
@ -2412,7 +2410,7 @@ void LIR_Assembler::emit_alloc_obj(LIR_OpAllocObj* op) {
op->klass()->as_register(),
*op->stub()->entry());
__ bind(*op->stub()->continuation());
__ verify_oop(op->obj()->as_register());
__ verify_oop(op->obj()->as_register(), FILE_AND_LINE);
}
void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) {
@ -2548,7 +2546,7 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, L
}
assert(obj != k_RInfo, "must be different");
__ verify_oop(obj);
__ verify_oop(obj, FILE_AND_LINE);
// Get object class.
// Not a safepoint as obj null check happens earlier.
@ -3009,7 +3007,7 @@ void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
assert(do_null || do_update, "why are we here?");
assert(!TypeEntries::was_null_seen(current_klass) || do_update, "why are we here?");
__ verify_oop(obj);
__ verify_oop(obj, FILE_AND_LINE);
if (do_null || tmp1 != obj DEBUG_ONLY(|| true)) {
__ z_ltgr(tmp1, obj);

View File

@ -40,7 +40,7 @@
void C1_MacroAssembler::inline_cache_check(Register receiver, Register iCache) {
Label ic_miss, ic_hit;
verify_oop(receiver);
verify_oop(receiver, FILE_AND_LINE);
int klass_offset = oopDesc::klass_offset_in_bytes();
if (!ImplicitNullChecks || MacroAssembler::needs_explicit_null_check(klass_offset)) {
@ -83,7 +83,7 @@ void C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hd
assert_different_registers(hdr, obj, disp_hdr);
NearLabel done;
verify_oop(obj);
verify_oop(obj, FILE_AND_LINE);
// Load object header.
z_lg(hdr, Address(obj, hdr_offset));
@ -158,7 +158,7 @@ void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_
// Load object.
z_lg(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
}
verify_oop(obj);
verify_oop(obj, FILE_AND_LINE);
// Test if object header is pointing to the displaced header, and if so, restore
// the displaced header in the object. If the object header is not pointing to
// the displaced header, get the object header instead.
@ -278,7 +278,7 @@ void C1_MacroAssembler::initialize_object(
// call(RuntimeAddress(Runtime1::entry_for (Runtime1::dtrace_object_alloc_id)));
// }
verify_oop(obj);
verify_oop(obj, FILE_AND_LINE);
}
void C1_MacroAssembler::allocate_array(
@ -336,16 +336,15 @@ void C1_MacroAssembler::allocate_array(
// call(RuntimeAddress(Runtime1::entry_for (Runtime1::dtrace_object_alloc_id)));
// }
verify_oop(obj);
verify_oop(obj, FILE_AND_LINE);
}
#ifndef PRODUCT
void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
Unimplemented();
// if (!VerifyOops) return;
// verify_oop_addr(Address(SP, stack_offset + STACK_BIAS));
if (!VerifyOops) return;
verify_oop_addr(Address(Z_SP, stack_offset), FILE_AND_LINE);
}
void C1_MacroAssembler::verify_not_null_oop(Register r) {
@ -354,7 +353,7 @@ void C1_MacroAssembler::verify_not_null_oop(Register r) {
compareU64_and_branch(r, (intptr_t)0, bcondNotEqual, not_null);
stop("non-null oop required");
bind(not_null);
verify_oop(r);
verify_oop(r, FILE_AND_LINE);
}
void C1_MacroAssembler::invalidate_registers(Register preserve1,

View File

@ -339,7 +339,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
oop_maps->add_gc_map(call_offset, map);
restore_live_registers_except_r2(sasm);
__ verify_oop(obj);
__ verify_oop(obj, FILE_AND_LINE);
__ z_br(Z_R14);
}
break;
@ -405,7 +405,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
oop_maps->add_gc_map(call_offset, map);
restore_live_registers_except_r2(sasm);
__ verify_oop(obj);
__ verify_oop(obj, FILE_AND_LINE);
__ z_br(Z_R14);
}
break;
@ -423,7 +423,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
restore_live_registers_except_r2(sasm);
// Z_R2,: new multi array
__ verify_oop(Z_R2);
__ verify_oop(Z_R2, FILE_AND_LINE);
__ z_br(Z_R14);
}
break;

View File

@ -400,11 +400,11 @@ void G1BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value
__ z_tmll(tmp1, JNIHandles::weak_tag_mask); // Test for jweak tag.
__ z_braz(Lnot_weak);
__ verify_oop(value);
__ verify_oop(value, FILE_AND_LINE);
DecoratorSet decorators = IN_NATIVE | ON_PHANTOM_OOP_REF;
g1_write_barrier_pre(masm, decorators, (const Address*)NULL, value, noreg, tmp1, tmp2, true);
__ bind(Lnot_weak);
__ verify_oop(value);
__ verify_oop(value, FILE_AND_LINE);
__ bind(Ldone);
}

View File

@ -108,7 +108,7 @@ void BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value,
__ z_nill(value, ~JNIHandles::weak_tag_mask);
__ z_lg(value, 0, value); // Resolve (untagged) jobject.
__ verify_oop(value);
__ verify_oop(value, FILE_AND_LINE);
__ bind(Ldone);
}

View File

@ -1664,7 +1664,7 @@ void InterpreterMacroAssembler::profile_obj_type(Register obj, Address mdo_addr,
compareU64_and_branch(obj, (intptr_t)0, Assembler::bcondEqual, null_seen);
}
verify_oop(obj);
MacroAssembler::verify_oop(obj, FILE_AND_LINE);
load_klass(klass, obj);
// Klass seen before, nothing to do (regardless of unknown bit).
@ -2073,7 +2073,7 @@ void InterpreterMacroAssembler::access_local_int(Register index, Register dst) {
}
void InterpreterMacroAssembler::verify_oop(Register reg, TosState state) {
if (state == atos) { MacroAssembler::verify_oop(reg); }
if (state == atos) { MacroAssembler::verify_oop(reg, FILE_AND_LINE); }
}
// Inline assembly for:

View File

@ -3587,7 +3587,7 @@ void MacroAssembler::get_vm_result(Register oop_result) {
z_lg(oop_result, Address(Z_thread, JavaThread::vm_result_offset()));
clear_mem(Address(Z_thread, JavaThread::vm_result_offset()), sizeof(void*));
verify_oop(oop_result);
verify_oop(oop_result, FILE_AND_LINE);
}
void MacroAssembler::get_vm_result_2(Register result) {
@ -6813,26 +6813,94 @@ void MacroAssembler::verify_thread() {
}
}
// Save and restore functions: Exclude Z_R0.
void MacroAssembler::save_volatile_regs(Register dst, int offset, bool include_fp, bool include_flags) {
z_stmg(Z_R1, Z_R5, offset, dst); offset += 5 * BytesPerWord;
if (include_fp) {
z_std(Z_F0, Address(dst, offset)); offset += BytesPerWord;
z_std(Z_F1, Address(dst, offset)); offset += BytesPerWord;
z_std(Z_F2, Address(dst, offset)); offset += BytesPerWord;
z_std(Z_F3, Address(dst, offset)); offset += BytesPerWord;
z_std(Z_F4, Address(dst, offset)); offset += BytesPerWord;
z_std(Z_F5, Address(dst, offset)); offset += BytesPerWord;
z_std(Z_F6, Address(dst, offset)); offset += BytesPerWord;
z_std(Z_F7, Address(dst, offset)); offset += BytesPerWord;
}
if (include_flags) {
Label done;
z_mvi(Address(dst, offset), 2); // encoding: equal
z_bre(done);
z_mvi(Address(dst, offset), 4); // encoding: higher
z_brh(done);
z_mvi(Address(dst, offset), 1); // encoding: lower
bind(done);
}
}
void MacroAssembler::restore_volatile_regs(Register src, int offset, bool include_fp, bool include_flags) {
z_lmg(Z_R1, Z_R5, offset, src); offset += 5 * BytesPerWord;
if (include_fp) {
z_ld(Z_F0, Address(src, offset)); offset += BytesPerWord;
z_ld(Z_F1, Address(src, offset)); offset += BytesPerWord;
z_ld(Z_F2, Address(src, offset)); offset += BytesPerWord;
z_ld(Z_F3, Address(src, offset)); offset += BytesPerWord;
z_ld(Z_F4, Address(src, offset)); offset += BytesPerWord;
z_ld(Z_F5, Address(src, offset)); offset += BytesPerWord;
z_ld(Z_F6, Address(src, offset)); offset += BytesPerWord;
z_ld(Z_F7, Address(src, offset)); offset += BytesPerWord;
}
if (include_flags) {
z_cli(Address(src, offset), 2); // see encoding above
}
}
// Plausibility check for oops.
void MacroAssembler::verify_oop(Register oop, const char* msg) {
if (!VerifyOops) return;
BLOCK_COMMENT("verify_oop {");
Register tmp = Z_R0;
unsigned int nbytes_save = 5*BytesPerWord;
address entry = StubRoutines::verify_oop_subroutine_entry_address();
unsigned int nbytes_save = (5 + 8 + 1) * BytesPerWord;
address entry_addr = StubRoutines::verify_oop_subroutine_entry_address();
save_return_pc();
push_frame_abi160(nbytes_save);
z_stmg(Z_R1, Z_R5, frame::z_abi_160_size, Z_SP);
z_lgr(Z_ARG2, oop);
load_const(Z_ARG1, (address) msg);
load_const(Z_R1, entry);
// Push frame, but preserve flags
z_lgr(Z_R0, Z_SP);
z_lay(Z_SP, -((int64_t)nbytes_save + frame::z_abi_160_size), Z_SP);
z_stg(Z_R0, _z_abi(callers_sp), Z_SP);
save_volatile_regs(Z_SP, frame::z_abi_160_size, true, true);
lgr_if_needed(Z_ARG2, oop);
load_const_optimized(Z_ARG1, (address)msg);
load_const_optimized(Z_R1, entry_addr);
z_lg(Z_R1, 0, Z_R1);
call_c(Z_R1);
z_lmg(Z_R1, Z_R5, frame::z_abi_160_size, Z_SP);
restore_volatile_regs(Z_SP, frame::z_abi_160_size, true, true);
pop_frame();
restore_return_pc();
BLOCK_COMMENT("} verify_oop ");
}
void MacroAssembler::verify_oop_addr(Address addr, const char* msg) {
if (!VerifyOops) return;
BLOCK_COMMENT("verify_oop {");
unsigned int nbytes_save = (5 + 8) * BytesPerWord;
address entry_addr = StubRoutines::verify_oop_subroutine_entry_address();
save_return_pc();
unsigned int frame_size = push_frame_abi160(nbytes_save); // kills Z_R0
save_volatile_regs(Z_SP, frame::z_abi_160_size, true, false);
z_lg(Z_ARG2, addr.plus_disp(frame_size));
load_const_optimized(Z_ARG1, (address)msg);
load_const_optimized(Z_R1, entry_addr);
z_lg(Z_R1, 0, Z_R1);
call_c(Z_R1);
restore_volatile_regs(Z_SP, frame::z_abi_160_size, true, false);
pop_frame();
restore_return_pc();

View File

@ -973,8 +973,15 @@ class MacroAssembler: public Assembler {
// Verify Z_thread contents.
void verify_thread();
// Save and restore functions: Exclude Z_R0.
void save_volatile_regs( Register dst, int offset, bool include_fp, bool include_flags);
void restore_volatile_regs(Register src, int offset, bool include_fp, bool include_flags);
// Only if +VerifyOops.
// Kills Z_R0.
void verify_oop(Register reg, const char* s = "broken oop");
// Kills Z_R0, condition code.
void verify_oop_addr(Address addr, const char* msg = "contains broken oop");
// TODO: verify_method and klass metadata (compare against vptr?).
void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}

View File

@ -85,7 +85,7 @@ void MethodHandles::verify_klass(MacroAssembler* _masm,
BLOCK_COMMENT("verify_klass {");
__ verify_oop(obj_reg);
__ verify_oop(obj_reg, FILE_AND_LINE);
__ compareU64_and_branch(obj_reg, (intptr_t)0L, Assembler::bcondEqual, L_bad);
__ load_klass(temp_reg, obj_reg);
// klass_addr is a klass in allstatic SystemDictionaryHandles. Can't get GCed.
@ -194,22 +194,22 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
BLOCK_COMMENT("jump_to_lambda_form {");
// Load the invoker, as MH -> MH.form -> LF.vmentry
__ verify_oop(recv);
__ verify_oop(recv, FILE_AND_LINE);
__ load_heap_oop(method_temp,
Address(recv,
NONZERO(java_lang_invoke_MethodHandle::form_offset_in_bytes())),
noreg, noreg, IS_NOT_NULL);
__ verify_oop(method_temp);
__ verify_oop(method_temp, FILE_AND_LINE);
__ load_heap_oop(method_temp,
Address(method_temp,
NONZERO(java_lang_invoke_LambdaForm::vmentry_offset_in_bytes())),
noreg, noreg, IS_NOT_NULL);
__ verify_oop(method_temp);
__ verify_oop(method_temp, FILE_AND_LINE);
__ load_heap_oop(method_temp,
Address(method_temp,
NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes())),
noreg, noreg, IS_NOT_NULL);
__ verify_oop(method_temp);
__ verify_oop(method_temp, FILE_AND_LINE);
__ z_lg(method_temp,
Address(method_temp,
NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes())));
@ -385,7 +385,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
Register temp1_recv_klass = temp1;
if (iid != vmIntrinsics::_linkToStatic) {
__ verify_oop(receiver_reg);
__ verify_oop(receiver_reg, FILE_AND_LINE);
if (iid == vmIntrinsics::_linkToSpecial) {
// Don't actually load the klass; just null-check the receiver.
__ null_check(receiver_reg);

View File

@ -892,9 +892,9 @@ static void verify_oop_args(MacroAssembler *masm,
if (r->is_stack()) {
__ z_lg(Z_R0_scratch,
Address(Z_SP, r->reg2stack() * VMRegImpl::stack_slot_size + wordSize));
__ verify_oop(Z_R0_scratch);
__ verify_oop(Z_R0_scratch, FILE_AND_LINE);
} else {
__ verify_oop(r->as_Register());
__ verify_oop(r->as_Register(), FILE_AND_LINE);
}
}
}
@ -2686,7 +2686,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
__ z_ltgr(Z_ARG1, Z_ARG1);
__ z_bre(ic_miss);
}
__ verify_oop(Z_ARG1);
__ verify_oop(Z_ARG1, FILE_AND_LINE);
// Check ic: object class <-> cached class
// Compress cached class for comparison. That's more efficient.
@ -2955,7 +2955,7 @@ void SharedRuntime::generate_deopt_blob() {
#ifdef ASSERT
// verify that there is really an exception oop in JavaThread
__ z_lg(Z_ARG1, Address(Z_thread, JavaThread::exception_oop_offset()));
__ verify_oop(Z_ARG1);
__ MacroAssembler::verify_oop(Z_ARG1, FILE_AND_LINE);
// verify that there is no pending exception
__ asm_assert_mem8_is_zero(in_bytes(Thread::pending_exception_offset()), Z_thread,

View File

@ -667,6 +667,17 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
#if !defined(PRODUCT)
// Wrapper which calls oopDesc::is_oop_or_null()
// Only called by MacroAssembler::verify_oop
static void verify_oop_helper(const char* message, oopDesc* o) {
if (!oopDesc::is_oop_or_null(o)) {
fatal("%s. oop: " PTR_FORMAT, message, p2i(o));
}
++ StubRoutines::_verify_oop_count;
}
#endif
// Return address of code to be called from code generated by
// MacroAssembler::verify_oop.
//
@ -679,6 +690,11 @@ class StubGenerator: public StubCodeGenerator {
// StubCodeMark mark(this, "StubRoutines", "verify_oop_stub");
address start = 0;
#if !defined(PRODUCT)
start = CAST_FROM_FN_PTR(address, verify_oop_helper);
#endif
return start;
}

View File

@ -31,8 +31,6 @@
#include "c1/c1_ValueStack.hpp"
#include "ci/ciArrayKlass.hpp"
#include "ci/ciInstance.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTableBarrierSet.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "memory/universe.hpp"
#include "nativeInst_sparc.hpp"

View File

@ -32,8 +32,6 @@
#include "c1/c1_ValueStack.hpp"
#include "ci/ciArrayKlass.hpp"
#include "ci/ciInstance.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTableBarrierSet.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "nativeInst_x86.hpp"
#include "oops/objArrayKlass.hpp"

View File

@ -30,6 +30,8 @@
#include "code/nativeInst.hpp"
#include "code/vtableStubs.hpp"
#include "gc/shared/gcLocker.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
#include "interpreter/interpreter.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -2225,7 +2225,7 @@ void LIRGenerator::do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegi
int lng = x->length();
for (int i = 0; i < lng; i++) {
SwitchRange* one_range = x->at(i);
C1SwitchRange* one_range = x->at(i);
int low_key = one_range->low_key();
int high_key = one_range->high_key();
BlockBegin* dest = one_range->sux();
@ -2257,7 +2257,7 @@ SwitchRangeArray* LIRGenerator::create_lookup_ranges(TableSwitch* x) {
BlockBegin* sux = x->sux_at(0);
int key = x->lo_key();
BlockBegin* default_sux = x->default_sux();
SwitchRange* range = new SwitchRange(key, sux);
C1SwitchRange* range = new C1SwitchRange(key, sux);
for (int i = 0; i < len; i++, key++) {
BlockBegin* new_sux = x->sux_at(i);
if (sux == new_sux) {
@ -2268,7 +2268,7 @@ SwitchRangeArray* LIRGenerator::create_lookup_ranges(TableSwitch* x) {
if (sux != default_sux) {
res->append(range);
}
range = new SwitchRange(key, new_sux);
range = new C1SwitchRange(key, new_sux);
}
sux = new_sux;
}
@ -2286,7 +2286,7 @@ SwitchRangeArray* LIRGenerator::create_lookup_ranges(LookupSwitch* x) {
BlockBegin* default_sux = x->default_sux();
int key = x->key_at(0);
BlockBegin* sux = x->sux_at(0);
SwitchRange* range = new SwitchRange(key, sux);
C1SwitchRange* range = new C1SwitchRange(key, sux);
for (int i = 1; i < len; i++) {
int new_key = x->key_at(i);
BlockBegin* new_sux = x->sux_at(i);
@ -2298,7 +2298,7 @@ SwitchRangeArray* LIRGenerator::create_lookup_ranges(LookupSwitch* x) {
if (range->sux() != default_sux) {
res->append(range);
}
range = new SwitchRange(new_key, new_sux);
range = new C1SwitchRange(new_key, new_sux);
}
key = new_key;
sux = new_sux;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -42,18 +42,17 @@ class BarrierSetC1;
class LIRGenerator;
class LIREmitter;
class Invoke;
class SwitchRange;
class LIRItem;
typedef GrowableArray<LIRItem*> LIRItemList;
class SwitchRange: public CompilationResourceObj {
class C1SwitchRange: public CompilationResourceObj {
private:
int _low_key;
int _high_key;
BlockBegin* _sux;
public:
SwitchRange(int start_key, BlockBegin* sux): _low_key(start_key), _high_key(start_key), _sux(sux) {}
C1SwitchRange(int start_key, BlockBegin* sux): _low_key(start_key), _high_key(start_key), _sux(sux) {}
void set_high_key(int key) { _high_key = key; }
int high_key() const { return _high_key; }
@ -61,8 +60,8 @@ class SwitchRange: public CompilationResourceObj {
BlockBegin* sux() const { return _sux; }
};
typedef GrowableArray<SwitchRange*> SwitchRangeArray;
typedef GrowableArray<SwitchRange*> SwitchRangeList;
typedef GrowableArray<C1SwitchRange*> SwitchRangeArray;
typedef GrowableArray<C1SwitchRange*> SwitchRangeList;
class ResolveNode;

View File

@ -51,7 +51,15 @@ void DebugInfoWriteStream::write_metadata(Metadata* h) {
}
oop DebugInfoReadStream::read_oop() {
oop o = code()->oop_at(read_int());
nmethod* nm = const_cast<CompiledMethod*>(code())->as_nmethod_or_null();
oop o;
if (nm != NULL) {
// Despite these oops being found inside nmethods that are on-stack,
// they are not kept alive by all GCs (e.g. G1 and Shenandoah).
o = nm->oop_at_phantom(read_int());
} else {
o = code()->oop_at(read_int());
}
assert(oopDesc::is_oop_or_null(o), "oop only");
return o;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -412,8 +412,7 @@ size_t G1PLABAllocator::undo_waste() const {
}
bool G1ArchiveAllocator::_archive_check_enabled = false;
G1ArchiveRegionMap G1ArchiveAllocator::_closed_archive_region_map;
G1ArchiveRegionMap G1ArchiveAllocator::_open_archive_region_map;
G1ArchiveRegionMap G1ArchiveAllocator::_archive_region_map;
G1ArchiveAllocator* G1ArchiveAllocator::create_allocator(G1CollectedHeap* g1h, bool open) {
// Create the archive allocator, and also enable archive object checking

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -203,12 +203,17 @@ public:
void undo_allocation(G1HeapRegionAttr dest, HeapWord* obj, size_t word_sz, uint node_index);
};
// G1ArchiveRegionMap is a boolean array used to mark G1 regions as
// G1ArchiveRegionMap is an array used to mark G1 regions as
// archive regions. This allows a quick check for whether an object
// should not be marked because it is in an archive region.
class G1ArchiveRegionMap : public G1BiasedMappedArray<bool> {
class G1ArchiveRegionMap : public G1BiasedMappedArray<uint8_t> {
public:
static const uint8_t NoArchive = 0;
static const uint8_t OpenArchive = 1;
static const uint8_t ClosedArchive = 2;
protected:
bool default_value() const { return false; }
uint8_t default_value() const { return NoArchive; }
};
// G1ArchiveAllocator is used to allocate memory in archive
@ -290,7 +295,7 @@ public:
// Mark regions containing the specified address range as archive/non-archive.
static inline void set_range_archive(MemRegion range, bool open);
static inline void clear_range_archive(MemRegion range, bool open);
static inline void clear_range_archive(MemRegion range);
// Check if the object is in closed archive
static inline bool is_closed_archive_object(oop object);
@ -301,8 +306,7 @@ public:
private:
static bool _archive_check_enabled;
static G1ArchiveRegionMap _closed_archive_region_map;
static G1ArchiveRegionMap _open_archive_region_map;
static G1ArchiveRegionMap _archive_region_map;
// Check if an object is in a closed archive region using the _closed_archive_region_map.
static inline bool in_closed_archive_range(oop object);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -131,12 +131,9 @@ inline void G1ArchiveAllocator::enable_archive_object_check() {
_archive_check_enabled = true;
size_t length = G1CollectedHeap::heap()->max_reserved_capacity();
_closed_archive_region_map.initialize(G1CollectedHeap::heap()->base(),
G1CollectedHeap::heap()->base() + length,
HeapRegion::GrainBytes);
_open_archive_region_map.initialize(G1CollectedHeap::heap()->base(),
G1CollectedHeap::heap()->base() + length,
HeapRegion::GrainBytes);
_archive_region_map.initialize(G1CollectedHeap::heap()->base(),
G1CollectedHeap::heap()->base() + length,
HeapRegion::GrainBytes);
}
// Set the regions containing the specified address range as archive.
@ -146,36 +143,26 @@ inline void G1ArchiveAllocator::set_range_archive(MemRegion range, bool open) {
open ? "open" : "closed",
p2i(range.start()),
p2i(range.last()));
if (open) {
_open_archive_region_map.set_by_address(range, true);
} else {
_closed_archive_region_map.set_by_address(range, true);
}
uint8_t const value = open ? G1ArchiveRegionMap::OpenArchive : G1ArchiveRegionMap::ClosedArchive;
_archive_region_map.set_by_address(range, value);
}
// Clear the archive regions map containing the specified address range.
inline void G1ArchiveAllocator::clear_range_archive(MemRegion range, bool open) {
inline void G1ArchiveAllocator::clear_range_archive(MemRegion range) {
assert(_archive_check_enabled, "archive range check not enabled");
log_info(gc, cds)("Clear %s archive regions in map: [" PTR_FORMAT ", " PTR_FORMAT "]",
open ? "open" : "closed",
log_info(gc, cds)("Clear archive regions in map: [" PTR_FORMAT ", " PTR_FORMAT "]",
p2i(range.start()),
p2i(range.last()));
if (open) {
_open_archive_region_map.set_by_address(range, false);
} else {
_closed_archive_region_map.set_by_address(range, false);
}
_archive_region_map.set_by_address(range, G1ArchiveRegionMap::NoArchive);
}
// Check if an object is in a closed archive region using the _archive_region_map.
inline bool G1ArchiveAllocator::in_closed_archive_range(oop object) {
// This is the out-of-line part of is_closed_archive_object test, done separately
// to avoid additional performance impact when the check is not enabled.
return _closed_archive_region_map.get_by_address((HeapWord*)object);
return _archive_region_map.get_by_address((HeapWord*)object) == G1ArchiveRegionMap::ClosedArchive;
}
inline bool G1ArchiveAllocator::in_open_archive_range(oop object) {
return _open_archive_region_map.get_by_address((HeapWord*)object);
return _archive_region_map.get_by_address((HeapWord*)object) == G1ArchiveRegionMap::OpenArchive;
}
// Check if archive object checking is enabled, to avoid calling in_open/closed_archive_range
@ -193,8 +180,8 @@ inline bool G1ArchiveAllocator::is_open_archive_object(oop object) {
}
inline bool G1ArchiveAllocator::is_archived_object(oop object) {
return (archive_check_enabled() && (in_closed_archive_range(object) ||
in_open_archive_range(object)));
return archive_check_enabled() &&
(_archive_region_map.get_by_address((HeapWord*)object) != G1ArchiveRegionMap::NoArchive);
}
#endif // SHARE_GC_G1_G1ALLOCATOR_INLINE_HPP

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -766,7 +766,7 @@ inline HeapWord* G1CollectedHeap::attempt_allocation(size_t min_word_size,
return result;
}
void G1CollectedHeap::dealloc_archive_regions(MemRegion* ranges, size_t count, bool is_open) {
void G1CollectedHeap::dealloc_archive_regions(MemRegion* ranges, size_t count) {
assert(!is_init_completed(), "Expect to be called at JVM init time");
assert(ranges != NULL, "MemRegion array NULL");
assert(count != 0, "No MemRegions provided");
@ -828,7 +828,7 @@ void G1CollectedHeap::dealloc_archive_regions(MemRegion* ranges, size_t count, b
}
// Notify mark-sweep that this is no longer an archive range.
G1ArchiveAllocator::clear_range_archive(ranges[i], is_open);
G1ArchiveAllocator::clear_range_archive(ranges[i]);
}
if (uncommitted_regions != 0) {
@ -2151,6 +2151,13 @@ bool G1CollectedHeap::try_collect_concurrently(GCCause::Cause cause,
return op.gc_succeeded();
}
// If VMOp skipped initiating concurrent marking cycle because
// we're terminating, then we're done.
if (op.terminating()) {
LOG_COLLECT_CONCURRENTLY(cause, "skipped: terminating");
return false;
}
// Lock to get consistent set of values.
uint old_marking_started_after;
uint old_marking_completed_after;

View File

@ -723,7 +723,7 @@ public:
// which had been allocated by alloc_archive_regions. This should be called
// rather than fill_archive_regions at JVM init time if the archive file
// mapping failed, with the same non-overlapping and sorted MemRegion array.
void dealloc_archive_regions(MemRegion* range, size_t count, bool is_open);
void dealloc_archive_regions(MemRegion* range, size_t count);
oop materialize_archived_object(oop obj);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -47,6 +47,7 @@ VM_G1TryInitiateConcMark::VM_G1TryInitiateConcMark(uint gc_count_before,
_target_pause_time_ms(target_pause_time_ms),
_transient_failure(false),
_cycle_already_in_progress(false),
_terminating(false),
_gc_succeeded(false)
{}
@ -66,7 +67,17 @@ void VM_G1TryInitiateConcMark::doit() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
GCCauseSetter x(g1h, _gc_cause);
if (!g1h->policy()->force_initial_mark_if_outside_cycle(_gc_cause)) {
// Record for handling by caller.
_terminating = g1h->_cm_thread->should_terminate();
if (_terminating && GCCause::is_user_requested_gc(_gc_cause)) {
// When terminating, the request to initiate a concurrent cycle will be
// ignored by do_collection_pause_at_safepoint; instead it will just do
// a young-only or mixed GC (depending on phase). For a user request
// there's no point in even doing that much, so done. For some non-user
// requests the alternative GC might still be needed.
} else if (!g1h->policy()->force_initial_mark_if_outside_cycle(_gc_cause)) {
// Failure to force the next GC pause to be an initial mark indicates
// there is already a concurrent marking cycle in progress. Set flag
// to notify the caller and return immediately.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -52,6 +52,7 @@ class VM_G1TryInitiateConcMark : public VM_GC_Operation {
double _target_pause_time_ms;
bool _transient_failure;
bool _cycle_already_in_progress;
bool _terminating;
bool _gc_succeeded;
public:
@ -63,6 +64,7 @@ public:
virtual void doit();
bool transient_failure() const { return _transient_failure; }
bool cycle_already_in_progress() const { return _cycle_already_in_progress; }
bool terminating() const { return _terminating; }
bool gc_succeeded() const { return _gc_succeeded; }
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
@ -100,7 +100,7 @@ void GCTracer::report_object_count_after_gc(BoolObjectClosure* is_alive_cl) {
KlassInfoTable cit(false);
if (!cit.allocation_failed()) {
HeapInspection hi(false, false, false, NULL);
HeapInspection hi;
hi.populate_table(&cit, is_alive_cl);
ObjectCountEventSenderClosure event_sender(cit.size_of_instances_in_words(), Ticks::now());
cit.iterate(&event_sender);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -151,8 +151,7 @@ void VM_GC_HeapInspection::doit() {
log_warning(gc)("GC locker is held; pre-dump GC was skipped");
}
}
HeapInspection inspect(_csv_format, _print_help, _print_class_stats,
_columns);
HeapInspection inspect;
inspect.heap_inspection(_out);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -125,32 +125,17 @@ class VM_GC_HeapInspection: public VM_GC_Operation {
private:
outputStream* _out;
bool _full_gc;
bool _csv_format; // "comma separated values" format for spreadsheet.
bool _print_help;
bool _print_class_stats;
const char* _columns;
public:
VM_GC_HeapInspection(outputStream* out, bool request_full_gc) :
VM_GC_Operation(0 /* total collections, dummy, ignored */,
GCCause::_heap_inspection /* GC Cause */,
0 /* total full collections, dummy, ignored */,
request_full_gc) {
_out = out;
_full_gc = request_full_gc;
_csv_format = false;
_print_help = false;
_print_class_stats = false;
_columns = NULL;
}
request_full_gc), _out(out), _full_gc(request_full_gc) {}
~VM_GC_HeapInspection() {}
virtual VMOp_Type type() const { return VMOp_GC_HeapInspection; }
virtual bool skip_operation() const;
virtual void doit();
void set_csv_format(bool value) {_csv_format = value;}
void set_print_help(bool value) {_print_help = value;}
void set_print_class_stats(bool value) {_print_class_stats = value;}
void set_columns(const char* value) {_columns = value;}
protected:
bool collect();
};

View File

@ -223,7 +223,9 @@ public:
ShenandoahReentrantLocker locker(nm_data->lock());
// Heal oops and disarm
ShenandoahNMethod::heal_nmethod(nm);
if (_heap->is_evacuation_in_progress()) {
ShenandoahNMethod::heal_nmethod(nm);
}
ShenandoahNMethod::disarm_nmethod(nm);
// Clear compiled ICs and exception caches

View File

@ -1715,7 +1715,6 @@ void ShenandoahEvacUpdateCleanupOopStorageRootsClosure::do_oop(oop* p) {
if (obj == old) {
_dead_counter ++;
}
assert(*p == NULL, "Must be");
} else if (_evac_in_progress && _heap->in_collection_set(obj)) {
oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
if (resolved == obj) {
@ -2805,7 +2804,7 @@ void ShenandoahHeap::entry_init_traversal() {
ShenandoahGCPhase total_phase(ShenandoahPhaseTimings::total_pause);
ShenandoahGCPhase phase(ShenandoahPhaseTimings::init_traversal_gc);
static const char* msg = "Pause Init Traversal";
static const char* msg = init_traversal_event_message();
GCTraceTime(Info, gc) time(msg, gc_timer());
EventMark em("%s", msg);
@ -2820,7 +2819,7 @@ void ShenandoahHeap::entry_final_traversal() {
ShenandoahGCPhase total_phase(ShenandoahPhaseTimings::total_pause);
ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_traversal_gc);
static const char* msg = "Pause Final Traversal";
static const char* msg = final_traversal_event_message();
GCTraceTime(Info, gc) time(msg, gc_timer());
EventMark em("%s", msg);
@ -2972,7 +2971,7 @@ void ShenandoahHeap::entry_preclean() {
}
void ShenandoahHeap::entry_traversal() {
static const char* msg = "Concurrent traversal";
static const char* msg = conc_traversal_event_message();
GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true);
EventMark em("%s", msg);
@ -3141,6 +3140,51 @@ const char* ShenandoahHeap::conc_mark_event_message() const {
}
}
const char* ShenandoahHeap::init_traversal_event_message() const {
bool proc_refs = process_references();
bool unload_cls = unload_classes();
if (proc_refs && unload_cls) {
return "Pause Init Traversal (process weakrefs) (unload classes)";
} else if (proc_refs) {
return "Pause Init Traversal (process weakrefs)";
} else if (unload_cls) {
return "Pause Init Traversal (unload classes)";
} else {
return "Pause Init Traversal";
}
}
const char* ShenandoahHeap::final_traversal_event_message() const {
bool proc_refs = process_references();
bool unload_cls = unload_classes();
if (proc_refs && unload_cls) {
return "Pause Final Traversal (process weakrefs) (unload classes)";
} else if (proc_refs) {
return "Pause Final Traversal (process weakrefs)";
} else if (unload_cls) {
return "Pause Final Traversal (unload classes)";
} else {
return "Pause Final Traversal";
}
}
const char* ShenandoahHeap::conc_traversal_event_message() const {
bool proc_refs = process_references();
bool unload_cls = unload_classes();
if (proc_refs && unload_cls) {
return "Concurrent Traversal (process weakrefs) (unload classes)";
} else if (proc_refs) {
return "Concurrent Traversal (process weakrefs)";
} else if (unload_cls) {
return "Concurrent Traversal (unload classes)";
} else {
return "Concurrent Traversal";
}
}
const char* ShenandoahHeap::degen_event_message(ShenandoahDegenPoint point) const {
switch (point) {
case _degenerated_unset:

View File

@ -438,6 +438,9 @@ private:
const char* init_mark_event_message() const;
const char* final_mark_event_message() const;
const char* conc_mark_event_message() const;
const char* init_traversal_event_message() const;
const char* final_traversal_event_message() const;
const char* conc_traversal_event_message() const;
const char* degen_event_message(ShenandoahDegenPoint point) const;
// ---------- GC subsystems

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Red Hat, Inc. All rights reserved.
* Copyright (c) 2015, 2020, Red Hat, Inc. All rights reserved.
*
* 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
@ -226,6 +226,7 @@ private:
ShenandoahThreadRoots _thread_roots;
ShenandoahCodeCacheRoots<ITR> _code_roots;
ShenandoahVMRoots<false /*concurrent*/ > _vm_roots;
ShenandoahStringDedupRoots _dedup_roots;
ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
_cld_roots;
public:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Red Hat, Inc. All rights reserved.
* Copyright (c) 2019, 2020, Red Hat, Inc. All rights reserved.
*
* 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
@ -250,6 +250,9 @@ void ShenandoahRootScanner<ITR>::roots_do(uint worker_id, OopClosure* oops, CLDC
if (code != NULL && !ShenandoahConcurrentScanCodeRoots) {
_code_roots.code_blobs_do(code, worker_id);
}
AlwaysTrueClosure always_true;
_dedup_roots.oops_do(&always_true, oops, worker_id);
}
template <typename ITR>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
* Copyright (c) 2018, 2020, Red Hat, Inc. All rights reserved.
*
* 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
@ -193,9 +193,6 @@ public:
} else {
_rp->roots_do(worker_id, &roots_cl, &cld_cl, &code_cl);
}
AlwaysTrueClosure is_alive;
_dedup_roots.oops_do(&is_alive, &roots_cl, worker_id);
}
}
};

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2012, 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
@ -1023,36 +1023,6 @@
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Event name="FlushStorage" category="Flight Recorder" label="Flush Storage" thread="false" experimental="true">
<Field type="ulong" name="flushId" label="Flush Identifier" relation="FlushId" />
<Field type="ulong" name="elements" label="Elements Written" />
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Event name="FlushStacktrace" category="Flight Recorder" label="Flush Stacktrace" thread="false" experimental="true">
<Field type="ulong" name="flushId" label="Flush Identifier" relation="FlushId" />
<Field type="ulong" name="elements" label="Elements Written" />
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Event name="FlushStringPool" category="Flight Recorder" label="Flush String Pool" thread="false" experimental="true">
<Field type="ulong" name="flushId" label="Flush Identifier" relation="FlushId" />
<Field type="ulong" name="elements" label="Elements Written" />
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Event name="FlushMetadata" category="Flight Recorder" label="Flush Metadata" thread="false" experimental="true">
<Field type="ulong" name="flushId" label="Flush Identifier" relation="FlushId" />
<Field type="ulong" name="elements" label="Elements Written" />
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Event name="FlushTypeSet" category="Flight Recorder" label="Flush Type Set" thread="false" experimental="true">
<Field type="ulong" name="flushId" label="Flush Identifier" relation="FlushId" />
<Field type="ulong" name="elements" label="Elements Written" />
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Type name="DeoptimizationReason" label="Deoptimization Reason">
<Field type="string" name="reason" label="Reason" />
</Type>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 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
@ -58,13 +58,12 @@
// incremented on each flushpoint
static u8 flushpoint_id = 0;
template <typename E, typename Instance, size_t(Instance::*func)()>
template <typename Instance, size_t(Instance::*func)()>
class Content {
private:
Instance& _instance;
u4 _elements;
public:
typedef E EventType;
Content(Instance& instance) : _instance(instance), _elements(0) {}
bool process() {
_elements = (u4)(_instance.*func)();
@ -82,7 +81,6 @@ class WriteContent : public StackObj {
Content& _content;
const int64_t _start_offset;
public:
typedef typename Content::EventType EventType;
WriteContent(JfrChunkWriter& cw, Content& content) :
_start_time(JfrTicks::now()),
@ -128,14 +126,6 @@ class WriteContent : public StackObj {
return (u4)(end_offset() - start_offset());
}
static bool is_event_enabled() {
return EventType::is_enabled();
}
static u8 event_id() {
return EventType::eventId;
}
void write_elements(int64_t offset) {
_cw.write_padded_at_offset<u4>(elements(), offset);
}
@ -198,23 +188,16 @@ static u4 invoke(Functor& f) {
return f.elements();
}
template <typename Functor>
static void write_flush_event(Functor& f) {
if (Functor::is_event_enabled()) {
typename Functor::EventType e(UNTIMED);
e.set_starttime(f.start_time());
e.set_endtime(f.end_time());
e.set_flushId(flushpoint_id);
e.set_elements(f.elements());
e.set_size(f.size());
e.commit();
}
}
template <typename Functor>
static u4 invoke_with_flush_event(Functor& f) {
const u4 elements = invoke(f);
write_flush_event(f);
EventFlush e(UNTIMED);
e.set_starttime(f.start_time());
e.set_endtime(f.end_time());
e.set_flushId(flushpoint_id);
e.set_elements(f.elements());
e.set_size(f.size());
e.commit();
return elements;
}
@ -226,7 +209,6 @@ class StackTraceRepository : public StackObj {
bool _clear;
public:
typedef EventFlushStacktrace EventType;
StackTraceRepository(JfrStackTraceRepository& repo, JfrChunkWriter& cw, bool clear) :
_repo(repo), _cw(cw), _elements(0), _clear(clear) {}
bool process() {
@ -242,7 +224,7 @@ typedef WriteCheckpointEvent<StackTraceRepository> WriteStackTrace;
static u4 flush_stacktrace(JfrStackTraceRepository& stack_trace_repo, JfrChunkWriter& chunkwriter) {
StackTraceRepository str(stack_trace_repo, chunkwriter, false);
WriteStackTrace wst(chunkwriter, str, TYPE_STACKTRACE);
return invoke_with_flush_event(wst);
return invoke(wst);
}
static u4 write_stacktrace(JfrStackTraceRepository& stack_trace_repo, JfrChunkWriter& chunkwriter, bool clear) {
@ -251,14 +233,14 @@ static u4 write_stacktrace(JfrStackTraceRepository& stack_trace_repo, JfrChunkWr
return invoke(wst);
}
typedef Content<EventFlushStorage, JfrStorage, &JfrStorage::write> Storage;
typedef Content<JfrStorage, &JfrStorage::write> Storage;
typedef WriteContent<Storage> WriteStorage;
static size_t flush_storage(JfrStorage& storage, JfrChunkWriter& chunkwriter) {
assert(chunkwriter.is_valid(), "invariant");
Storage fsf(storage);
WriteStorage fs(chunkwriter, fsf);
return invoke_with_flush_event(fs);
return invoke(fs);
}
static size_t write_storage(JfrStorage& storage, JfrChunkWriter& chunkwriter) {
@ -268,15 +250,15 @@ static size_t write_storage(JfrStorage& storage, JfrChunkWriter& chunkwriter) {
return invoke(fs);
}
typedef Content<EventFlushStringPool, JfrStringPool, &JfrStringPool::write> StringPool;
typedef Content<EventFlushStringPool, JfrStringPool, &JfrStringPool::write_at_safepoint> StringPoolSafepoint;
typedef Content<JfrStringPool, &JfrStringPool::write> StringPool;
typedef Content<JfrStringPool, &JfrStringPool::write_at_safepoint> StringPoolSafepoint;
typedef WriteCheckpointEvent<StringPool> WriteStringPool;
typedef WriteCheckpointEvent<StringPoolSafepoint> WriteStringPoolSafepoint;
static u4 flush_stringpool(JfrStringPool& string_pool, JfrChunkWriter& chunkwriter) {
StringPool sp(string_pool);
WriteStringPool wsp(chunkwriter, sp, TYPE_STRING);
return invoke_with_flush_event(wsp);
return invoke(wsp);
}
static u4 write_stringpool(JfrStringPool& string_pool, JfrChunkWriter& chunkwriter) {
@ -291,20 +273,19 @@ static u4 write_stringpool_safepoint(JfrStringPool& string_pool, JfrChunkWriter&
return invoke(wsps);
}
typedef Content<EventFlushTypeSet, JfrCheckpointManager, &JfrCheckpointManager::flush_type_set> FlushTypeSetFunctor;
typedef Content<JfrCheckpointManager, &JfrCheckpointManager::flush_type_set> FlushTypeSetFunctor;
typedef WriteContent<FlushTypeSetFunctor> FlushTypeSet;
static u4 flush_typeset(JfrCheckpointManager& checkpoint_manager, JfrChunkWriter& chunkwriter) {
FlushTypeSetFunctor flush_type_set(checkpoint_manager);
FlushTypeSet fts(chunkwriter, flush_type_set);
return invoke_with_flush_event(fts);
return invoke(fts);
}
class MetadataEvent : public StackObj {
private:
JfrChunkWriter& _cw;
public:
typedef EventFlushMetadata EventType;
MetadataEvent(JfrChunkWriter& cw) : _cw(cw) {}
bool process() {
JfrMetadataEvent::write(_cw);
@ -319,7 +300,7 @@ static u4 flush_metadata(JfrChunkWriter& chunkwriter) {
assert(chunkwriter.is_valid(), "invariant");
MetadataEvent me(chunkwriter);
WriteMetadata wm(chunkwriter, me);
return invoke_with_flush_event(wm);
return invoke(wm);
}
static u4 write_metadata(JfrChunkWriter& chunkwriter) {
@ -651,7 +632,7 @@ size_t JfrRecorderService::flush() {
return total_elements;
}
typedef Content<EventFlush, JfrRecorderService, &JfrRecorderService::flush> FlushFunctor;
typedef Content<JfrRecorderService, &JfrRecorderService::flush> FlushFunctor;
typedef WriteContent<FlushFunctor> Flush;
void JfrRecorderService::invoke_flush() {
@ -671,7 +652,9 @@ void JfrRecorderService::invoke_flush() {
void JfrRecorderService::flushpoint() {
MutexLocker lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
invoke_flush();
if (_chunkwriter.is_valid()) {
invoke_flush();
}
}
void JfrRecorderService::process_full_buffers() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -1790,7 +1790,7 @@ bool FileMapInfo::map_heap_data(MemRegion **heap_mem, int first,
si->allow_exec());
if (base == NULL || base != addr) {
// dealloc the regions from java heap
dealloc_archive_heap_regions(regions, region_num, is_open_archive);
dealloc_archive_heap_regions(regions, region_num);
log_info(cds)("UseSharedSpaces: Unable to map at required address in java heap. "
INTPTR_FORMAT ", size = " SIZE_FORMAT " bytes",
p2i(addr), regions[i].byte_size());
@ -1799,7 +1799,7 @@ bool FileMapInfo::map_heap_data(MemRegion **heap_mem, int first,
if (VerifySharedSpaces && !region_crc_check(addr, regions[i].byte_size(), si->crc())) {
// dealloc the regions from java heap
dealloc_archive_heap_regions(regions, region_num, is_open_archive);
dealloc_archive_heap_regions(regions, region_num);
log_info(cds)("UseSharedSpaces: mapped heap regions are corrupt");
return false;
}
@ -1855,10 +1855,10 @@ void FileMapInfo::fixup_mapped_heap_regions() {
}
// dealloc the archive regions from java heap
void FileMapInfo::dealloc_archive_heap_regions(MemRegion* regions, int num, bool is_open) {
void FileMapInfo::dealloc_archive_heap_regions(MemRegion* regions, int num) {
if (num > 0) {
assert(regions != NULL, "Null archive ranges array with non-zero count");
G1CollectedHeap::heap()->dealloc_archive_regions(regions, num, is_open);
G1CollectedHeap::heap()->dealloc_archive_regions(regions, num);
}
}
#endif // INCLUDE_CDS_JAVA_HEAP
@ -2075,11 +2075,9 @@ void FileMapInfo::stop_sharing_and_unmap(const char* msg) {
// Dealloc the archive heap regions only without unmapping. The regions are part
// of the java heap. Unmapping of the heap regions are managed by GC.
map_info->dealloc_archive_heap_regions(open_archive_heap_ranges,
num_open_archive_heap_ranges,
true);
num_open_archive_heap_ranges);
map_info->dealloc_archive_heap_regions(closed_archive_heap_ranges,
num_closed_archive_heap_ranges,
false);
num_closed_archive_heap_ranges);
} else if (DumpSharedSpaces) {
fail_stop("%s", msg);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -538,7 +538,7 @@ public:
bool map_heap_data(MemRegion **heap_mem, int first, int max, int* num,
bool is_open = false) NOT_CDS_JAVA_HEAP_RETURN_(false);
bool region_crc_check(char* buf, size_t size, int expected_crc) NOT_CDS_RETURN_(false);
void dealloc_archive_heap_regions(MemRegion* regions, int num, bool is_open) NOT_CDS_JAVA_HEAP_RETURN;
void dealloc_archive_heap_regions(MemRegion* regions, int num) NOT_CDS_JAVA_HEAP_RETURN;
void map_heap_regions_impl() NOT_CDS_JAVA_HEAP_RETURN;
char* map_relocation_bitmap(size_t& bitmap_size);
MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@ -40,14 +40,6 @@
// HeapInspection
int KlassSizeStats::count(oop x) {
return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
}
int KlassSizeStats::count_array(objArrayOop x) {
return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
}
inline KlassInfoEntry::~KlassInfoEntry() {
if (_subclasses != NULL) {
delete _subclasses;
@ -277,67 +269,6 @@ void KlassInfoHisto::print_elements(outputStream* st) const {
total, totalw * HeapWordSize);
}
#define MAKE_COL_NAME(field, name, help) #name,
#define MAKE_COL_HELP(field, name, help) help,
static const char *name_table[] = {
HEAP_INSPECTION_COLUMNS_DO(MAKE_COL_NAME)
};
static const char *help_table[] = {
HEAP_INSPECTION_COLUMNS_DO(MAKE_COL_HELP)
};
bool KlassInfoHisto::is_selected(const char *col_name) {
if (_selected_columns == NULL) {
return true;
}
if (strcmp(_selected_columns, col_name) == 0) {
return true;
}
const char *start = strstr(_selected_columns, col_name);
if (start == NULL) {
return false;
}
// The following must be true, because _selected_columns != col_name
if (start > _selected_columns && start[-1] != ',') {
return false;
}
char x = start[strlen(col_name)];
if (x != ',' && x != '\0') {
return false;
}
return true;
}
void KlassInfoHisto::print_title(outputStream* st, bool csv_format,
bool selected[], int width_table[],
const char *name_table[]) {
if (csv_format) {
st->print("Index,Super");
for (int c=0; c<KlassSizeStats::_num_columns; c++) {
if (selected[c]) {st->print(",%s", name_table[c]);}
}
st->print(",ClassName");
} else {
st->print("Index Super");
for (int c = 0; c < KlassSizeStats::_num_columns; c++) {
if (selected[c]) {
st->print("%*s", width_table[c], name_table[c]);
}
}
st->print(" ClassName");
}
if (is_selected("ClassLoader")) {
st->print(",ClassLoader");
}
st->cr();
}
class HierarchyClosure : public KlassInfoClosure {
private:
GrowableArray<KlassInfoEntry*> *_elements;
@ -528,155 +459,10 @@ void KlassHierarchy::print_class(outputStream* st, KlassInfoEntry* cie, bool pri
}
}
void KlassInfoHisto::print_class_stats(outputStream* st,
bool csv_format, const char *columns) {
ResourceMark rm;
KlassSizeStats sz, sz_sum;
int i;
julong *col_table = (julong*)(&sz);
julong *colsum_table = (julong*)(&sz_sum);
int width_table[KlassSizeStats::_num_columns];
bool selected[KlassSizeStats::_num_columns];
_selected_columns = columns;
memset(&sz_sum, 0, sizeof(sz_sum));
for (int c=0; c<KlassSizeStats::_num_columns; c++) {
selected[c] = is_selected(name_table[c]);
}
for(i=0; i < elements()->length(); i++) {
elements()->at(i)->set_index(i+1);
}
// First iteration is for accumulating stats totals in colsum_table[].
// Second iteration is for printing stats for each class.
for (int pass=1; pass<=2; pass++) {
if (pass == 2) {
print_title(st, csv_format, selected, width_table, name_table);
}
for(i=0; i < elements()->length(); i++) {
KlassInfoEntry* e = (KlassInfoEntry*)elements()->at(i);
const Klass* k = e->klass();
// Get the stats for this class.
memset(&sz, 0, sizeof(sz));
sz._inst_count = e->count();
sz._inst_bytes = HeapWordSize * e->words();
k->collect_statistics(&sz);
sz._total_bytes = sz._ro_bytes + sz._rw_bytes;
if (pass == 1) {
// Add the stats for this class to the overall totals.
for (int c=0; c<KlassSizeStats::_num_columns; c++) {
colsum_table[c] += col_table[c];
}
} else {
int super_index = -1;
// Print the stats for this class.
if (k->is_instance_klass()) {
Klass* super = k->super();
if (super) {
KlassInfoEntry* super_e = _cit->lookup(super);
if (super_e) {
super_index = super_e->index();
}
}
}
if (csv_format) {
st->print("%ld,%d", e->index(), super_index);
for (int c=0; c<KlassSizeStats::_num_columns; c++) {
if (selected[c]) {st->print("," JULONG_FORMAT, col_table[c]);}
}
st->print(",%s",e->name());
} else {
st->print("%5ld %5d", e->index(), super_index);
for (int c=0; c<KlassSizeStats::_num_columns; c++) {
if (selected[c]) {print_julong(st, width_table[c], col_table[c]);}
}
st->print(" %s", e->name());
}
if (is_selected("ClassLoader")) {
ClassLoaderData* loader_data = k->class_loader_data();
st->print(",");
loader_data->print_value_on(st);
}
st->cr();
}
}
if (pass == 1) {
// Calculate the minimum width needed for the column by accounting for the
// column header width and the width of the largest value in the column.
for (int c=0; c<KlassSizeStats::_num_columns; c++) {
width_table[c] = col_width(colsum_table[c], name_table[c]);
}
}
}
sz_sum._inst_size = 0;
// Print the column totals.
if (csv_format) {
st->print(",");
for (int c=0; c<KlassSizeStats::_num_columns; c++) {
if (selected[c]) {st->print("," JULONG_FORMAT, colsum_table[c]);}
}
} else {
st->print(" ");
for (int c=0; c<KlassSizeStats::_num_columns; c++) {
if (selected[c]) {print_julong(st, width_table[c], colsum_table[c]);}
}
st->print(" Total");
if (sz_sum._total_bytes > 0) {
st->cr();
st->print(" ");
for (int c=0; c<KlassSizeStats::_num_columns; c++) {
if (selected[c]) {
switch (c) {
case KlassSizeStats::_index_inst_size:
case KlassSizeStats::_index_inst_count:
case KlassSizeStats::_index_method_count:
st->print("%*s", width_table[c], "-");
break;
default:
{
double perc = (double)(100) * (double)(colsum_table[c]) / (double)sz_sum._total_bytes;
st->print("%*.1f%%", width_table[c]-1, perc);
}
}
}
}
}
}
st->cr();
if (!csv_format) {
print_title(st, csv_format, selected, width_table, name_table);
}
}
julong KlassInfoHisto::annotations_bytes(Array<AnnotationArray*>* p) const {
julong bytes = 0;
if (p != NULL) {
for (int i = 0; i < p->length(); i++) {
bytes += count_bytes_array(p->at(i));
}
bytes += count_bytes_array(p);
}
return bytes;
}
void KlassInfoHisto::print_histo_on(outputStream* st, bool print_stats,
bool csv_format, const char *columns) {
if (print_stats) {
print_class_stats(st, csv_format, columns);
} else {
st->print_cr(" num #instances #bytes class name (module)");
st->print_cr("-------------------------------------------------------");
print_elements(st);
}
void KlassInfoHisto::print_histo_on(outputStream* st) {
st->print_cr(" num #instances #bytes class name (module)");
st->print_cr("-------------------------------------------------------");
print_elements(st);
}
class HistoClosure : public KlassInfoClosure {
@ -726,25 +512,7 @@ size_t HeapInspection::populate_table(KlassInfoTable* cit, BoolObjectClosure *fi
void HeapInspection::heap_inspection(outputStream* st) {
ResourceMark rm;
if (_print_help) {
for (int c=0; c<KlassSizeStats::_num_columns; c++) {
st->print("%s:\n\t", name_table[c]);
const int max_col = 60;
int col = 0;
for (const char *p = help_table[c]; *p; p++,col++) {
if (col >= max_col && *p == ' ') {
st->print("\n\t");
col = 0;
} else {
st->print("%c", *p);
}
}
st->print_cr(".\n");
}
return;
}
KlassInfoTable cit(_print_class_stats);
KlassInfoTable cit(true);
if (!cit.allocation_failed()) {
// populate table with object allocation info
size_t missed_count = populate_table(&cit);
@ -761,7 +529,7 @@ void HeapInspection::heap_inspection(outputStream* st) {
cit.iterate(&hc);
histo.sort();
histo.print_histo_on(st, _print_class_stats, _csv_format, _columns);
histo.print_histo_on(st);
} else {
st->print_cr("ERROR: Ran out of C-heap; histogram not generated");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@ -47,141 +47,6 @@
// to KlassInfoEntry's and is used to sort
// the entries.
#define HEAP_INSPECTION_COLUMNS_DO(f) \
f(inst_size, InstSize, \
"Size of each object instance of the Java class") \
f(inst_count, InstCount, \
"Number of object instances of the Java class") \
f(inst_bytes, InstBytes, \
"This is usually (InstSize * InstNum). The only exception is " \
"java.lang.Class, whose InstBytes also includes the slots " \
"used to store static fields. InstBytes is not counted in " \
"ROAll, RWAll or Total") \
f(mirror_bytes, Mirror, \
"Size of the Klass::java_mirror() object") \
f(klass_bytes, KlassBytes, \
"Size of the InstanceKlass or ArrayKlass for this class. " \
"Note that this includes VTab, ITab, OopMap") \
f(secondary_supers_bytes, K_secondary_supers, \
"Number of bytes used by the Klass::secondary_supers() array") \
f(vtab_bytes, VTab, \
"Size of the embedded vtable in InstanceKlass") \
f(itab_bytes, ITab, \
"Size of the embedded itable in InstanceKlass") \
f(nonstatic_oopmap_bytes, OopMap, \
"Size of the embedded nonstatic_oop_map in InstanceKlass") \
f(methods_array_bytes, IK_methods, \
"Number of bytes used by the InstanceKlass::methods() array") \
f(method_ordering_bytes, IK_method_ordering, \
"Number of bytes used by the InstanceKlass::method_ordering() array") \
f(default_methods_array_bytes, IK_default_methods, \
"Number of bytes used by the InstanceKlass::default_methods() array") \
f(default_vtable_indices_bytes, IK_default_vtable_indices, \
"Number of bytes used by the InstanceKlass::default_vtable_indices() array") \
f(local_interfaces_bytes, IK_local_interfaces, \
"Number of bytes used by the InstanceKlass::local_interfaces() array") \
f(transitive_interfaces_bytes, IK_transitive_interfaces, \
"Number of bytes used by the InstanceKlass::transitive_interfaces() array") \
f(fields_bytes, IK_fields, \
"Number of bytes used by the InstanceKlass::fields() array") \
f(inner_classes_bytes, IK_inner_classes, \
"Number of bytes used by the InstanceKlass::inner_classes() array") \
f(nest_members_bytes, IK_nest_members, \
"Number of bytes used by the InstanceKlass::nest_members() array") \
f(record_components_bytes, IK_record_components, \
"Number of bytes used by the InstanceKlass::record_components() array") \
f(signers_bytes, IK_signers, \
"Number of bytes used by the InstanceKlass::singers() array") \
f(class_annotations_bytes, class_annotations, \
"Size of class annotations") \
f(class_type_annotations_bytes, class_type_annotations, \
"Size of class type annotations") \
f(fields_annotations_bytes, fields_annotations, \
"Size of field annotations") \
f(fields_type_annotations_bytes, fields_type_annotations, \
"Size of field type annotations") \
f(methods_annotations_bytes, methods_annotations, \
"Size of method annotations") \
f(methods_parameter_annotations_bytes, methods_parameter_annotations, \
"Size of method parameter annotations") \
f(methods_type_annotations_bytes, methods_type_annotations, \
"Size of methods type annotations") \
f(methods_default_annotations_bytes, methods_default_annotations, \
"Size of methods default annotations") \
f(annotations_bytes, annotations, \
"Size of all annotations") \
f(cp_bytes, Cp, \
"Size of InstanceKlass::constants()") \
f(cp_tags_bytes, CpTags, \
"Size of InstanceKlass::constants()->tags()") \
f(cp_cache_bytes, CpCache, \
"Size of InstanceKlass::constants()->cache()") \
f(cp_operands_bytes, CpOperands, \
"Size of InstanceKlass::constants()->operands()") \
f(cp_refmap_bytes, CpRefMap, \
"Size of InstanceKlass::constants()->reference_map()") \
f(cp_all_bytes, CpAll, \
"Sum of Cp + CpTags + CpCache + CpOperands + CpRefMap") \
f(method_count, MethodCount, \
"Number of methods in this class") \
f(method_bytes, MethodBytes, \
"Size of the Method object") \
f(const_method_bytes, ConstMethod, \
"Size of the ConstMethod object") \
f(method_data_bytes, MethodData, \
"Size of the MethodData object") \
f(stackmap_bytes, StackMap, \
"Size of the stackmap_data") \
f(bytecode_bytes, Bytecodes, \
"Of the MethodBytes column, how much are the space taken up by bytecodes") \
f(method_all_bytes, MethodAll, \
"Sum of MethodBytes + Constmethod + Stackmap + Methoddata") \
f(ro_bytes, ROAll, \
"Size of all class meta data that could (potentially) be placed " \
"in read-only memory. (This could change with CDS design)") \
f(rw_bytes, RWAll, \
"Size of all class meta data that must be placed in read/write " \
"memory. (This could change with CDS design) ") \
f(total_bytes, Total, \
"ROAll + RWAll. Note that this does NOT include InstBytes.")
// Size statistics for a Klass - filled in by Klass::collect_statistics()
class KlassSizeStats {
public:
#define COUNT_KLASS_SIZE_STATS_FIELD(field, name, help) _index_ ## field,
#define DECLARE_KLASS_SIZE_STATS_FIELD(field, name, help) julong _ ## field;
enum {
HEAP_INSPECTION_COLUMNS_DO(COUNT_KLASS_SIZE_STATS_FIELD)
_num_columns
};
HEAP_INSPECTION_COLUMNS_DO(DECLARE_KLASS_SIZE_STATS_FIELD)
static int count(oop x);
static int count_array(objArrayOop x);
template <class T> static int count(T* x) {
return (HeapWordSize * ((x) ? (x)->size() : 0));
}
template <class T> static int count_array(T* x) {
if (x == NULL) {
return 0;
}
if (x->length() == 0) {
// This is a shared array, e.g., Universe::the_empty_int_array(). Don't
// count it to avoid double-counting.
return 0;
}
return HeapWordSize * x->size();
}
};
class KlassInfoEntry: public CHeapObj<mtInternal> {
private:
KlassInfoEntry* _next;
@ -281,13 +146,7 @@ class KlassInfoHisto : public StackObj {
GrowableArray<KlassInfoEntry*>* elements() const { return _elements; }
static int sort_helper(KlassInfoEntry** e1, KlassInfoEntry** e2);
void print_elements(outputStream* st) const;
void print_class_stats(outputStream* st, bool csv_format, const char *columns);
julong annotations_bytes(Array<AnnotationArray*>* p) const;
const char *_selected_columns;
bool is_selected(const char *col_name);
void print_title(outputStream* st, bool csv_format,
bool selected_columns_table[], int width_table[],
const char *name_table[]);
template <class T> static int count_bytes(T* x) {
return (HeapWordSize * ((x) ? (x)->size() : 0));
@ -339,7 +198,7 @@ class KlassInfoHisto : public StackObj {
KlassInfoHisto(KlassInfoTable* cit);
~KlassInfoHisto();
void add(KlassInfoEntry* cie);
void print_histo_on(outputStream* st, bool print_class_stats, bool csv_format, const char *columns);
void print_histo_on(outputStream* st);
void sort();
};
@ -351,15 +210,7 @@ class KlassInfoTable;
class KlassInfoClosure;
class HeapInspection : public StackObj {
bool _csv_format; // "comma separated values" format for spreadsheet.
bool _print_help;
bool _print_class_stats;
const char* _columns;
public:
HeapInspection(bool csv_format, bool print_help,
bool print_class_stats, const char *columns) :
_csv_format(csv_format), _print_help(print_help),
_print_class_stats(print_class_stats), _columns(columns) {}
void heap_inspection(outputStream* st) NOT_SERVICES_RETURN;
size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL) NOT_SERVICES_RETURN_(0);
static void find_instances_at_safepoint(Klass* k, GrowableArray<oop>* result) NOT_SERVICES_RETURN;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
@ -78,9 +78,7 @@ static ArchivableStaticFieldInfo closed_archive_subgraph_entry_fields[] = {
// Entry fields for subgraphs archived in the open archive heap region.
static ArchivableStaticFieldInfo open_archive_subgraph_entry_fields[] = {
{"jdk/internal/module/ArchivedModuleGraph", "archivedModuleGraph"},
{"java/util/ImmutableCollections$ListN", "EMPTY_LIST"},
{"java/util/ImmutableCollections$MapN", "EMPTY_MAP"},
{"java/util/ImmutableCollections$SetN", "EMPTY_SET"},
{"java/util/ImmutableCollections", "archivedObjects"},
{"java/lang/module/Configuration", "EMPTY_CONFIGURATION"},
{"jdk/internal/math/FDBigInteger", "archivedCaches"},
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
@ -25,7 +25,6 @@
#include "precompiled.hpp"
#include "classfile/classLoaderData.hpp"
#include "logging/log.hpp"
#include "memory/heapInspection.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/oopFactory.hpp"
@ -89,37 +88,6 @@ void Annotations::print_value_on(outputStream* st) const {
st->print("Annotations(" INTPTR_FORMAT ")", p2i(this));
}
#if INCLUDE_SERVICES
// Size Statistics
julong Annotations::count_bytes(Array<AnnotationArray*>* p) {
julong bytes = 0;
if (p != NULL) {
for (int i = 0; i < p->length(); i++) {
bytes += KlassSizeStats::count_array(p->at(i));
}
bytes += KlassSizeStats::count_array(p);
}
return bytes;
}
void Annotations::collect_statistics(KlassSizeStats *sz) const {
sz->_annotations_bytes = sz->count(this);
sz->_class_annotations_bytes = sz->count(class_annotations());
sz->_class_type_annotations_bytes = sz->count(class_type_annotations());
sz->_fields_annotations_bytes = count_bytes(fields_annotations());
sz->_fields_type_annotations_bytes = count_bytes(fields_type_annotations());
sz->_annotations_bytes +=
sz->_class_annotations_bytes +
sz->_class_type_annotations_bytes +
sz->_fields_annotations_bytes +
sz->_fields_type_annotations_bytes;
sz->_ro_bytes += sz->_annotations_bytes;
}
#endif // INCLUDE_SERVICES
#define BULLET " - "
#ifndef PRODUCT

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
@ -33,7 +33,6 @@
class ClassLoaderData;
class outputStream;
class KlassSizeStats;
typedef Array<u1> AnnotationArray;
@ -70,10 +69,6 @@ class Annotations: public MetaspaceObj {
// Annotations should be stored in the read-only region of CDS archive.
static bool is_read_only_by_default() { return true; }
#if INCLUDE_SERVICES
void collect_statistics(KlassSizeStats *sz) const;
#endif
// Constructor to initialize to null
Annotations() : _class_annotations(NULL),
_fields_annotations(NULL),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -104,14 +104,6 @@ class ArrayKlass: public Klass {
virtual void metaspace_pointers_do(MetaspaceClosure* iter);
#if INCLUDE_SERVICES
virtual void collect_statistics(KlassSizeStats *sz) const {
Klass::collect_statistics(sz);
// Do nothing for now, but remember to modify if you add new
// stuff to ArrayKlass.
}
#endif
// Iterators
void array_klasses_do(void f(Klass* k));
void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -24,7 +24,6 @@
#include "precompiled.hpp"
#include "interpreter/interpreter.hpp"
#include "memory/heapInspection.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/resourceArea.hpp"
@ -454,36 +453,6 @@ void ConstMethod::print_value_on(outputStream* st) const {
}
}
#if INCLUDE_SERVICES
// Size Statistics
void ConstMethod::collect_statistics(KlassSizeStats *sz) const {
int n1, n2, n3;
sz->_const_method_bytes += (n1 = sz->count(this));
sz->_bytecode_bytes += (n2 = code_size());
sz->_stackmap_bytes += (n3 = sz->count_array(stackmap_data()));
// Count method annotations
int a1 = 0, a2 = 0, a3 = 0, a4 = 0;
if (has_method_annotations()) {
sz->_methods_annotations_bytes += (a1 = sz->count_array(method_annotations()));
}
if (has_parameter_annotations()) {
sz->_methods_parameter_annotations_bytes += (a2 = sz->count_array(parameter_annotations()));
}
if (has_type_annotations()) {
sz->_methods_type_annotations_bytes += (a3 = sz->count_array(type_annotations()));
}
if (has_default_annotations()) {
sz->_methods_default_annotations_bytes += (a4 = sz->count_array(default_annotations()));
}
int size_annotations = a1 + a2 + a3 + a4;
sz->_method_all_bytes += n1 + n3 + size_annotations; // note: n2 is part of n3
sz->_ro_bytes += n1 + n3 + size_annotations;
}
#endif // INCLUDE_SERVICES
// Verification
void ConstMethod::verify_on(outputStream* st) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -122,7 +122,6 @@ class MethodParametersElement {
u2 flags;
};
class KlassSizeStats;
class AdapterHandlerEntry;
// Class to collect the sizes of ConstMethod inline tables
@ -379,10 +378,6 @@ public:
// ConstMethods should be stored in the read-only region of CDS archive.
static bool is_read_only_by_default() { return true; }
#if INCLUDE_SERVICES
void collect_statistics(KlassSizeStats *sz) const;
#endif
// code size
int code_size() const { return _code_size; }
void set_code_size(int size) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -33,7 +33,6 @@
#include "interpreter/bootstrapInfo.hpp"
#include "interpreter/linkResolver.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/heapInspection.hpp"
#include "memory/heapShared.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
@ -2379,21 +2378,6 @@ void ConstantPool::print_value_on(outputStream* st) const {
}
}
#if INCLUDE_SERVICES
// Size Statistics
void ConstantPool::collect_statistics(KlassSizeStats *sz) const {
sz->_cp_all_bytes += (sz->_cp_bytes = sz->count(this));
sz->_cp_all_bytes += (sz->_cp_tags_bytes = sz->count_array(tags()));
sz->_cp_all_bytes += (sz->_cp_cache_bytes = sz->count(cache()));
sz->_cp_all_bytes += (sz->_cp_operands_bytes = sz->count_array(operands()));
sz->_cp_all_bytes += (sz->_cp_refmap_bytes = sz->count_array(reference_map()));
sz->_ro_bytes += sz->_cp_operands_bytes + sz->_cp_tags_bytes +
sz->_cp_refmap_bytes;
sz->_rw_bytes += sz->_cp_bytes + sz->_cp_cache_bytes;
}
#endif // INCLUDE_SERVICES
// Verification
void ConstantPool::verify_on(outputStream* st) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -93,8 +93,6 @@ public:
}
};
class KlassSizeStats;
class ConstantPool : public Metadata {
friend class VMStructs;
friend class JVMCIVMStructs;
@ -773,9 +771,6 @@ class ConstantPool : public Metadata {
}
static int size(int length) { return align_metadata_size(header_size() + length); }
int size() const { return size(length()); }
#if INCLUDE_SERVICES
void collect_statistics(KlassSizeStats *sz) const;
#endif
// ConstantPools should be stored in the read-only region of CDS archive.
static bool is_read_only_by_default() { return true; }

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -46,7 +46,6 @@
#include "logging/logMessage.hpp"
#include "logging/logStream.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/heapInspection.hpp"
#include "memory/iterator.inline.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
@ -3541,61 +3540,6 @@ void InstanceKlass::print_class_load_logging(ClassLoaderData* loader_data,
}
}
#if INCLUDE_SERVICES
// Size Statistics
void InstanceKlass::collect_statistics(KlassSizeStats *sz) const {
Klass::collect_statistics(sz);
sz->_inst_size = wordSize * size_helper();
sz->_vtab_bytes = wordSize * vtable_length();
sz->_itab_bytes = wordSize * itable_length();
sz->_nonstatic_oopmap_bytes = wordSize * nonstatic_oop_map_size();
int n = 0;
n += (sz->_methods_array_bytes = sz->count_array(methods()));
n += (sz->_method_ordering_bytes = sz->count_array(method_ordering()));
n += (sz->_local_interfaces_bytes = sz->count_array(local_interfaces()));
n += (sz->_transitive_interfaces_bytes = sz->count_array(transitive_interfaces()));
n += (sz->_fields_bytes = sz->count_array(fields()));
n += (sz->_inner_classes_bytes = sz->count_array(inner_classes()));
n += (sz->_nest_members_bytes = sz->count_array(nest_members()));
n += (sz->_record_components_bytes = sz->count_array(record_components()));
sz->_ro_bytes += n;
const ConstantPool* cp = constants();
if (cp) {
cp->collect_statistics(sz);
}
const Annotations* anno = annotations();
if (anno) {
anno->collect_statistics(sz);
}
const Array<Method*>* methods_array = methods();
if (methods()) {
for (int i = 0; i < methods_array->length(); i++) {
Method* method = methods_array->at(i);
if (method) {
sz->_method_count ++;
method->collect_statistics(sz);
}
}
}
const Array<RecordComponent*>* components = record_components();
if (components != NULL) {
for (int i = 0; i < components->length(); i++) {
RecordComponent* component = components->at(i);
if (component != NULL) {
component->collect_statistics(sz);
}
}
}
}
#endif // INCLUDE_SERVICES
// Verification
class VerifyFieldClosure: public BasicOopIterateClosure {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -1066,9 +1066,6 @@ public:
is_unsafe_anonymous(),
has_stored_fingerprint());
}
#if INCLUDE_SERVICES
virtual void collect_statistics(KlassSizeStats *sz) const;
#endif
intptr_t* start_of_itable() const { return (intptr_t*)start_of_vtable() + vtable_length(); }
intptr_t* end_of_itable() const { return start_of_itable() + itable_length(); }

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -32,7 +32,6 @@
#include "classfile/vmSymbols.hpp"
#include "gc/shared/collectedHeap.inline.hpp"
#include "logging/log.hpp"
#include "memory/heapInspection.hpp"
#include "memory/heapShared.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
@ -756,18 +755,6 @@ void Klass::oop_print_value_on(oop obj, outputStream* st) {
obj->print_address_on(st);
}
#if INCLUDE_SERVICES
// Size Statistics
void Klass::collect_statistics(KlassSizeStats *sz) const {
sz->_klass_bytes = sz->count(this);
sz->_mirror_bytes = sz->count(java_mirror_no_keepalive());
sz->_secondary_supers_bytes = sz->count_array(secondary_supers());
sz->_ro_bytes += sz->_secondary_supers_bytes;
sz->_rw_bytes += sz->_klass_bytes + sz->_mirror_bytes;
}
#endif // INCLUDE_SERVICES
// Verification
void Klass::verify_on(outputStream* st) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -68,7 +68,6 @@ const uint KLASS_ID_COUNT = 6;
template <class T> class Array;
template <class T> class GrowableArray;
class fieldDescriptor;
class KlassSizeStats;
class klassVtable;
class ModuleEntry;
class PackageEntry;
@ -541,9 +540,6 @@ protected:
// Size of klass in word size.
virtual int size() const = 0;
#if INCLUDE_SERVICES
virtual void collect_statistics(KlassSizeStats *sz) const;
#endif
// Returns the Java name for a class (Resource allocated)
// For arrays, this returns the name of the element with a leading '['.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -39,7 +39,6 @@
#include "logging/log.hpp"
#include "logging/logTag.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/heapInspection.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/metaspaceShared.hpp"
@ -2427,23 +2426,6 @@ void Method::print_value_on(outputStream* st) const {
if (WizardMode && code() != NULL) st->print(" ((nmethod*)%p)", code());
}
#if INCLUDE_SERVICES
// Size Statistics
void Method::collect_statistics(KlassSizeStats *sz) const {
int mysize = sz->count(this);
sz->_method_bytes += mysize;
sz->_method_all_bytes += mysize;
sz->_rw_bytes += mysize;
if (constMethod()) {
constMethod()->collect_statistics(sz);
}
if (method_data()) {
method_data()->collect_statistics(sz);
}
}
#endif // INCLUDE_SERVICES
// LogTouchedMethods and PrintTouchedMethods
// TouchedMethodRecord -- we can't use a HashtableEntry<Method*> because

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -64,7 +64,6 @@ class MethodData;
class MethodCounters;
class ConstMethod;
class InlineTableSizes;
class KlassSizeStats;
class CompiledMethod;
class InterpreterOopMap;
@ -713,9 +712,6 @@ public:
}
static int size(bool is_native);
int size() const { return method_size(); }
#if INCLUDE_SERVICES
void collect_statistics(KlassSizeStats *sz) const;
#endif
void log_touched(TRAPS);
static void print_touched_methods(outputStream* out);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -29,7 +29,6 @@
#include "interpreter/bytecode.hpp"
#include "interpreter/bytecodeStream.hpp"
#include "interpreter/linkResolver.hpp"
#include "memory/heapInspection.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/resourceArea.hpp"
#include "oops/methodData.inline.hpp"
@ -1576,16 +1575,6 @@ void MethodData::print_data_on(outputStream* st) const {
}
}
#if INCLUDE_SERVICES
// Size Statistics
void MethodData::collect_statistics(KlassSizeStats *sz) const {
int n = sz->count(this);
sz->_method_data_bytes += n;
sz->_method_all_bytes += n;
sz->_rw_bytes += n;
}
#endif // INCLUDE_SERVICES
// Verification
void MethodData::verify_on(outputStream* st) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -33,7 +33,6 @@
#include "utilities/align.hpp"
class BytecodeStream;
class KlassSizeStats;
// The MethodData object collects counts and other profile information
// during zeroth-tier (interpretive) and first-tier execution.
@ -2181,9 +2180,6 @@ public:
// My size
int size_in_bytes() const { return _size; }
int size() const { return align_metadata_size(align_up(_size, BytesPerWord)/BytesPerWord); }
#if INCLUDE_SERVICES
void collect_statistics(KlassSizeStats *sz) const;
#endif
int creation_mileage() const { return _creation_mileage; }
void set_creation_mileage(int x) { _creation_mileage = x; }

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 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
@ -24,7 +24,6 @@
#include "precompiled.hpp"
#include "logging/log.hpp"
#include "memory/heapInspection.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspace.hpp"
#include "memory/metaspaceClosure.hpp"
@ -63,19 +62,6 @@ void RecordComponent::print_value_on(outputStream* st) const {
st->print("RecordComponent(" INTPTR_FORMAT ")", p2i(this));
}
#if INCLUDE_SERVICES
void RecordComponent::collect_statistics(KlassSizeStats *sz) const {
if (_annotations != NULL) {
sz->_annotations_bytes += sz->count(_annotations);
sz->_ro_bytes += sz->count(_annotations);
}
if (_type_annotations != NULL) {
sz->_annotations_bytes += sz->count(_type_annotations);
sz->_ro_bytes += sz->count(_type_annotations);
}
}
#endif
#ifndef PRODUCT
void RecordComponent::print_on(outputStream* st) const {
st->print("name_index: %d", _name_index);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 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
@ -29,8 +29,6 @@
#include "oops/metadata.hpp"
#include "utilities/globalDefinitions.hpp"
class KlassSizeStats;
// This class stores information extracted from the Record class attribute.
class RecordComponent: public MetaspaceObj {
private:
@ -91,10 +89,6 @@ class RecordComponent: public MetaspaceObj {
static bool is_read_only_by_default() { return true; }
DEBUG_ONLY(bool on_stack() { return false; }) // for template
#if INCLUDE_SERVICES
void collect_statistics(KlassSizeStats *sz) const;
#endif
bool is_klass() const { return false; }
#ifndef PRODUCT

View File

@ -2525,14 +2525,17 @@ void Matcher::do_postselect_cleanup() {
//----------------------------------------------------------------------
// Convert (leg)Vec to (leg)Vec[SDXYZ].
MachOper* Matcher::specialize_vector_operand_helper(MachNode* m, MachOper* original_opnd) {
const Type* t = m->bottom_type();
MachOper* Matcher::specialize_vector_operand_helper(MachNode* m, uint opnd_idx, const Type* t) {
MachOper* original_opnd = m->_opnds[opnd_idx];
uint ideal_reg = t->ideal_reg();
// Handle special cases
// Handle special cases.
if (t->isa_vect()) {
// RShiftCntV/RShiftCntV report wide vector type, but VecS as ideal register (see vectornode.hpp).
if (m->ideal_Opcode() == Op_RShiftCntV || m->ideal_Opcode() == Op_LShiftCntV) {
ideal_reg = TypeVect::VECTS->ideal_reg(); // ideal_reg == Op_VecS
// LShiftCntV/RShiftCntV report wide vector type, but Matcher::vector_shift_count_ideal_reg() as ideal register (see vectornode.hpp).
// Look for shift count use sites as well (at vector shift nodes).
int opc = m->ideal_Opcode();
if ((VectorNode::is_shift_count(opc) && opnd_idx == 0) || // DEF operand of LShiftCntV/RShiftCntV
(VectorNode::is_vector_shift(opc) && opnd_idx == 2)) { // shift operand of a vector shift node
ideal_reg = Matcher::vector_shift_count_ideal_reg(t->is_vect()->length_in_bytes());
}
} else {
// Chain instructions which convert scalar to vector (e.g., vshiftcntimm on x86) don't have vector type.
@ -2556,22 +2559,23 @@ void Matcher::specialize_temp_node(MachTempNode* tmp, MachNode* use, uint idx) {
}
// Compute concrete vector operand for a generic DEF/USE vector operand (of mach node m at index idx).
MachOper* Matcher::specialize_vector_operand(MachNode* m, uint idx) {
assert(Matcher::is_generic_vector(m->_opnds[idx]), "repeated updates");
if (idx == 0) { // DEF
// Use mach node itself to compute vector operand type.
return specialize_vector_operand_helper(m, m->_opnds[0]);
MachOper* Matcher::specialize_vector_operand(MachNode* m, uint opnd_idx) {
assert(Matcher::is_generic_vector(m->_opnds[opnd_idx]), "repeated updates");
Node* def = NULL;
if (opnd_idx == 0) { // DEF
def = m; // use mach node itself to compute vector operand type
} else {
// Use def node to compute operand type.
int base_idx = m->operand_index(idx);
MachNode* in = m->in(base_idx)->as_Mach();
if (in->is_MachTemp() && Matcher::is_generic_vector(in->_opnds[0])) {
specialize_temp_node(in->as_MachTemp(), m, base_idx); // MachTemp node use site
} else if (is_generic_reg2reg_move(in)) {
in = in->in(1)->as_Mach(); // skip over generic reg-to-reg moves
int base_idx = m->operand_index(opnd_idx);
def = m->in(base_idx);
if (def->is_Mach()) {
if (def->is_MachTemp() && Matcher::is_generic_vector(def->as_Mach()->_opnds[0])) {
specialize_temp_node(def->as_MachTemp(), m, base_idx); // MachTemp node use site
} else if (is_generic_reg2reg_move(def->as_Mach())) {
def = def->in(1); // skip over generic reg-to-reg moves
}
}
return specialize_vector_operand_helper(in, m->_opnds[idx]);
}
return specialize_vector_operand_helper(m, opnd_idx, def->bottom_type());
}
void Matcher::specialize_mach_node(MachNode* m) {

View File

@ -516,8 +516,8 @@ public:
void specialize_generic_vector_operands();
void specialize_mach_node(MachNode* m);
void specialize_temp_node(MachTempNode* tmp, MachNode* use, uint idx);
MachOper* specialize_vector_operand(MachNode* m, uint idx);
MachOper* specialize_vector_operand_helper(MachNode* m, MachOper* generic_opnd);
MachOper* specialize_vector_operand(MachNode* m, uint opnd_idx);
MachOper* specialize_vector_operand_helper(MachNode* m, uint opnd_idx, const Type* t);
static MachOper* specialize_generic_vector_operand(MachOper* generic_opnd, uint ideal_reg, bool is_temp);

View File

@ -4170,7 +4170,7 @@ intptr_t InitializeNode::find_next_fullword_store(uint start, PhaseGVN* phase) {
Node* InitializeNode::complete_stores(Node* rawctl, Node* rawmem, Node* rawptr,
intptr_t header_size,
Node* size_in_bytes,
PhaseGVN* phase) {
PhaseIterGVN* phase) {
assert(!is_complete(), "not already complete");
assert(stores_are_sane(phase), "");
assert(allocation() != NULL, "must be present");
@ -4262,7 +4262,7 @@ Node* InitializeNode::complete_stores(Node* rawctl, Node* rawmem, Node* rawptr,
}
// Collect the store and move on:
st->set_req(MemNode::Memory, inits);
phase->replace_input_of(st, MemNode::Memory, inits);
inits = st; // put it on the linearized chain
set_req(i, zmem); // unhook from previous position

View File

@ -1402,7 +1402,7 @@ public:
// Called when the associated AllocateNode is expanded into CFG.
Node* complete_stores(Node* rawctl, Node* rawmem, Node* rawptr,
intptr_t header_size, Node* size_in_bytes,
PhaseGVN* phase);
PhaseIterGVN* phase);
private:
void remove_extra_zeroes();

View File

@ -1048,11 +1048,11 @@ void Parse::jump_switch_ranges(Node* key_val, SwitchRange *lo, SwitchRange *hi,
// if there is a higher range, test for it and process it:
if (mid < hi && !eq_test_only) {
// two comparisons of same values--should enable 1 test for 2 branches
// Use BoolTest::le instead of BoolTest::gt
// Use BoolTest::lt instead of BoolTest::gt
float cnt = sum_of_cnts(lo, mid-1);
IfNode *iff_le = jump_if_fork_int(key_val, test_val, BoolTest::le, if_prob(cnt, total_cnt), if_cnt(cnt));
Node *iftrue = _gvn.transform( new IfTrueNode(iff_le) );
Node *iffalse = _gvn.transform( new IfFalseNode(iff_le) );
IfNode *iff_lt = jump_if_fork_int(key_val, test_val, BoolTest::lt, if_prob(cnt, total_cnt), if_cnt(cnt));
Node *iftrue = _gvn.transform( new IfTrueNode(iff_lt) );
Node *iffalse = _gvn.transform( new IfFalseNode(iff_lt) );
{ PreserveJVMState pjvms(this);
set_control(iffalse);
jump_switch_ranges(key_val, mid+1, hi, switch_depth+1);

View File

@ -485,6 +485,38 @@ VectorNode* VectorNode::shift_count(Node* shift, Node* cnt, uint vlen, BasicType
}
}
bool VectorNode::is_vector_shift(int opc) {
assert(opc > _last_machine_leaf && opc < _last_opcode, "invalid opcode");
switch (opc) {
case Op_LShiftVB:
case Op_LShiftVS:
case Op_LShiftVI:
case Op_LShiftVL:
case Op_RShiftVB:
case Op_RShiftVS:
case Op_RShiftVI:
case Op_RShiftVL:
case Op_URShiftVB:
case Op_URShiftVS:
case Op_URShiftVI:
case Op_URShiftVL:
return true;
default:
return false;
}
}
bool VectorNode::is_shift_count(int opc) {
assert(opc > _last_machine_leaf && opc < _last_opcode, "invalid opcode");
switch (opc) {
case Op_RShiftCntV:
case Op_LShiftCntV:
return true;
default:
return false;
}
}
// Return initial Pack node. Additional operands added with add_opd() calls.
PackNode* PackNode::make(Node* s, uint vlen, BasicType bt) {
const TypeVect* vt = TypeVect::make(bt, vlen);

View File

@ -74,6 +74,9 @@ class VectorNode : public TypeNode {
static bool is_invariant_vector(Node* n);
// [Start, end) half-open range defining which operands are vectors
static void vector_operands(Node* n, uint* start, uint* end);
static bool is_vector_shift(int opc);
static bool is_shift_count(int opc);
};
//===========================Vector=ALU=Operations=============================

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
@ -1986,6 +1986,14 @@ WB_ENTRY(jboolean, WB_IsCDSIncludedInVmBuild(JNIEnv* env))
#endif // INCLUDE_CDS
WB_END
WB_ENTRY(jboolean, WB_isC2OrJVMCIIncludedInVmBuild(JNIEnv* env))
#if COMPILER2_OR_JVMCI
return true;
#else
return false;
#endif
WB_END
WB_ENTRY(jboolean, WB_IsJavaHeapArchiveSupported(JNIEnv* env))
return HeapShared::is_heap_object_archiving_allowed();
WB_END
@ -2192,6 +2200,12 @@ WB_ENTRY(jint, WB_AotLibrariesCount(JNIEnv* env, jobject o))
return result;
WB_END
WB_ENTRY(jint, WB_GetKlassMetadataSize(JNIEnv* env, jobject wb, jclass mirror))
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(mirror));
// Return size in bytes.
return k->size() * wordSize;
WB_END
#define CC (char*)
static JNINativeMethod methods[] = {
@ -2411,6 +2425,7 @@ static JNINativeMethod methods[] = {
{CC"areOpenArchiveHeapObjectsMapped", CC"()Z", (void*)&WB_AreOpenArchiveHeapObjectsMapped},
{CC"isCDSIncludedInVmBuild", CC"()Z", (void*)&WB_IsCDSIncludedInVmBuild },
{CC"isJFRIncludedInVmBuild", CC"()Z", (void*)&WB_IsJFRIncludedInVmBuild },
{CC"isC2OrJVMCIIncludedInVmBuild", CC"()Z", (void*)&WB_isC2OrJVMCIIncludedInVmBuild },
{CC"isJavaHeapArchiveSupported", CC"()Z", (void*)&WB_IsJavaHeapArchiveSupported },
{CC"cdsMemoryMappingFailed", CC"()Z", (void*)&WB_CDSMemoryMappingFailed },
@ -2433,6 +2448,7 @@ static JNINativeMethod methods[] = {
{CC"resolvedMethodItemsCount", CC"()J", (void*)&WB_ResolvedMethodItemsCount },
{CC"protectionDomainRemovedCount", CC"()I", (void*)&WB_ProtectionDomainRemovedCount },
{CC"aotLibrariesCount", CC"()I", (void*)&WB_AotLibrariesCount },
{CC"getKlassMetadataSize", CC"(Ljava/lang/Class;)I",(void*)&WB_GetKlassMetadataSize},
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -108,7 +108,6 @@ class SafepointSynchronize : AllStatic {
// JavaThreads that need to block for the safepoint will stop on the
// _wait_barrier, where they can quickly be started again.
static WaitBarrier* _wait_barrier;
static long _end_of_last_safepoint; // Time of last safepoint in milliseconds
static julong _coalesced_vmop_count; // coalesced vmop count
// For debug long safepoint

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
@ -90,7 +90,6 @@ void DCmdRegistrant::register_dcmds(){
#if INCLUDE_SERVICES
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDictionaryDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
@ -554,57 +553,6 @@ int ClassHistogramDCmd::num_arguments() {
}
}
#define DEFAULT_COLUMNS "InstBytes,KlassBytes,CpAll,annotations,MethodCount,Bytecodes,MethodAll,ROAll,RWAll,Total"
ClassStatsDCmd::ClassStatsDCmd(outputStream* output, bool heap) :
DCmdWithParser(output, heap),
_all("-all", "Show all columns",
"BOOLEAN", false, "false"),
_csv("-csv", "Print in CSV (comma-separated values) format for spreadsheets",
"BOOLEAN", false, "false"),
_help("-help", "Show meaning of all the columns",
"BOOLEAN", false, "false"),
_columns("columns", "Comma-separated list of all the columns to show. "
"If not specified, the following columns are shown: " DEFAULT_COLUMNS,
"STRING", false) {
_dcmdparser.add_dcmd_option(&_all);
_dcmdparser.add_dcmd_option(&_csv);
_dcmdparser.add_dcmd_option(&_help);
_dcmdparser.add_dcmd_argument(&_columns);
}
void ClassStatsDCmd::execute(DCmdSource source, TRAPS) {
VM_GC_HeapInspection heapop(output(),
true /* request_full_gc */);
heapop.set_csv_format(_csv.value());
heapop.set_print_help(_help.value());
heapop.set_print_class_stats(true);
if (_all.value()) {
if (_columns.has_value()) {
output()->print_cr("Cannot specify -all and individual columns at the same time");
return;
} else {
heapop.set_columns(NULL);
}
} else {
if (_columns.has_value()) {
heapop.set_columns(_columns.value());
} else {
heapop.set_columns(DEFAULT_COLUMNS);
}
}
VMThread::execute(&heapop);
}
int ClassStatsDCmd::num_arguments() {
ResourceMark rm;
ClassStatsDCmd* dcmd = new ClassStatsDCmd(NULL, false);
if (dcmd != NULL) {
DCmdMark mark(dcmd);
return dcmd->_dcmdparser.num_arguments();
} else {
return 0;
}
}
#endif // INCLUDE_SERVICES
ThreadDumpDCmd::ThreadDumpDCmd(outputStream* output, bool heap) :

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
@ -376,28 +376,6 @@ public:
virtual void execute(DCmdSource source, TRAPS);
};
class ClassStatsDCmd : public DCmdWithParser {
protected:
DCmdArgument<bool> _all;
DCmdArgument<bool> _csv;
DCmdArgument<bool> _help;
DCmdArgument<char*> _columns;
public:
ClassStatsDCmd(outputStream* output, bool heap);
static const char* name() {
return "GC.class_stats";
}
static const char* description() {
return "(Deprecated) Provide statistics about Java class meta data.";
}
static const char* impact() {
return "High: Depends on Java heap size and content.";
}
static int num_arguments();
virtual void execute(DCmdSource source, TRAPS);
};
class ClassHierarchyDCmd : public DCmdWithParser {
protected:
DCmdArgument<bool> _print_interfaces; // true if inherited interfaces should be printed.

View File

@ -108,8 +108,8 @@ template <typename T> struct CountLeadingZerosImpl<T, 4> {
template <typename T> struct CountLeadingZerosImpl<T, 8> {
static unsigned doit(T v) {
unsigned long index;
#ifdef _LP64
unsigned long index;
_BitScanReverse64(&index, v);
return 63u - index;
#else

View File

@ -89,16 +89,15 @@ import sun.reflect.annotation.*;
import sun.reflect.misc.ReflectUtil;
/**
* Instances of the class {@code Class} represent classes and interfaces
* in a running Java application. An enum type is a kind of class and an
* annotation type is a kind of interface. Every array also
* belongs to a class that is reflected as a {@code Class} object
* that is shared by all arrays with the same element type and number
* of dimensions. The primitive Java types ({@code boolean},
* {@code byte}, {@code char}, {@code short},
* {@code int}, {@code long}, {@code float}, and
* {@code double}), and the keyword {@code void} are also
* represented as {@code Class} objects.
* Instances of the class {@code Class} represent classes and
* interfaces in a running Java application. An enum type and a record
* type are kinds of class; an annotation type is a kind of
* interface. Every array also belongs to a class that is reflected as
* a {@code Class} object that is shared by all arrays with the same
* element type and number of dimensions. The primitive Java types
* ({@code boolean}, {@code byte}, {@code char}, {@code short}, {@code
* int}, {@code long}, {@code float}, and {@code double}), and the
* keyword {@code void} are also represented as {@code Class} objects.
*
* <p> {@code Class} has no public constructor. Instead a {@code Class}
* object is constructed automatically by the Java Virtual Machine

View File

@ -71,7 +71,8 @@ package java.lang.annotation;
* @jls 4.1 The Kinds of Types and Values
*/
public enum ElementType {
/** Class, interface (including annotation type), or enum declaration */
/** Class, interface (including annotation type), enum, or record
* declaration */
TYPE,
/** Field declaration (includes enum constants) */

View File

@ -1451,7 +1451,7 @@ public class MethodHandles {
* <li>If the new lookup class is in the same module as the old lookup class,
* the new previous lookup class is the old previous lookup class.
* <li>If the new lookup class is in a different module from the old lookup class,
* the new previous lookup class is the the old lookup class.
* the new previous lookup class is the old lookup class.
*</ul>
* <p>
* The resulting lookup's capabilities for loading classes

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -29,9 +29,9 @@ import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import sun.net.idn.StringPrep;
import sun.net.idn.Punycode;
import sun.text.normalizer.UCharacterIterator;
import jdk.internal.icu.impl.Punycode;
import jdk.internal.icu.text.StringPrep;
import jdk.internal.icu.text.UCharacterIterator;
/**
* Provides methods to convert internationalized domain names (IDNs) between
@ -226,7 +226,7 @@ public final class IDN {
InputStream stream = null;
try {
final String IDN_PROFILE = "uidna.spp";
final String IDN_PROFILE = "/sun/net/idn/uidna.spp";
if (System.getSecurityManager() != null) {
stream = AccessController.doPrivileged(new PrivilegedAction<>() {
public InputStream run() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -35,7 +35,7 @@
package java.text;
import sun.text.bidi.BidiBase;
import jdk.internal.icu.text.BidiBase;
/**
* This class implements the Unicode Bidirectional Algorithm.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -41,7 +41,7 @@ package java.text;
import java.lang.Character;
import java.util.Vector;
import sun.text.CollatorUtilities;
import sun.text.normalizer.NormalizerBase;
import jdk.internal.icu.text.NormalizerBase;
/**
* The {@code CollationElementIterator} class is used as an iterator

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -37,7 +37,7 @@
package java.text;
import sun.text.normalizer.NormalizerBase;
import jdk.internal.icu.text.NormalizerBase;
/**
* This class provides the method {@code normalize} which transforms Unicode

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -42,8 +42,7 @@ import java.util.Vector;
import sun.text.UCompactIntArray;
import sun.text.IntHashtable;
import sun.text.ComposedCharIter;
import sun.text.CollatorUtilities;
import sun.text.normalizer.NormalizerImpl;
import jdk.internal.icu.impl.NormalizerImpl;
/**
* This class contains all the code to parse a RuleBasedCollator pattern

View File

@ -1133,7 +1133,7 @@ public class ArrayList<E> extends AbstractList<E>
this.parent = parent;
this.offset = parent.offset + fromIndex;
this.size = toIndex - fromIndex;
this.modCount = root.modCount;
this.modCount = parent.modCount;
}
public E set(int index, E element) {
@ -1286,7 +1286,7 @@ public class ArrayList<E> extends AbstractList<E>
return new ListIterator<E>() {
int cursor = index;
int lastRet = -1;
int expectedModCount = root.modCount;
int expectedModCount = SubList.this.modCount;
public boolean hasNext() {
return cursor != SubList.this.size;
@ -1330,7 +1330,7 @@ public class ArrayList<E> extends AbstractList<E>
final Object[] es = root.elementData;
if (offset + i >= es.length)
throw new ConcurrentModificationException();
for (; i < size && modCount == expectedModCount; i++)
for (; i < size && root.modCount == expectedModCount; i++)
action.accept(elementAt(es, offset + i));
// update once at end to reduce heap write traffic
cursor = i;
@ -1356,7 +1356,7 @@ public class ArrayList<E> extends AbstractList<E>
SubList.this.remove(lastRet);
cursor = lastRet;
lastRet = -1;
expectedModCount = root.modCount;
expectedModCount = SubList.this.modCount;
} catch (IndexOutOfBoundsException ex) {
throw new ConcurrentModificationException();
}
@ -1382,7 +1382,7 @@ public class ArrayList<E> extends AbstractList<E>
SubList.this.add(i, e);
cursor = i + 1;
lastRet = -1;
expectedModCount = root.modCount;
expectedModCount = SubList.this.modCount;
} catch (IndexOutOfBoundsException ex) {
throw new ConcurrentModificationException();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 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
@ -56,9 +56,47 @@ class ImmutableCollections {
* will vary between JVM runs.
*/
static final int SALT;
/**
* For set and map iteration, we will iterate in "reverse" stochastically,
* decided at bootstrap time.
*/
private static final boolean REVERSE;
static {
long nt = System.nanoTime();
SALT = (int)((nt >>> 32) ^ nt);
long color = 0x243F_6A88_85A3_08D3L; // pi slice
long seed = System.nanoTime();
SALT = (int)((color * seed) >> 16); // avoid LSB and MSB
REVERSE = SALT >= 0;
}
/**
* Constants following this might be initialized from the CDS archive via
* this array.
*/
private static Object[] archivedObjects;
private static final Object EMPTY;
static final ListN<?> EMPTY_LIST;
static final SetN<?> EMPTY_SET;
static final MapN<?,?> EMPTY_MAP;
static {
VM.initializeFromArchive(ImmutableCollections.class);
if (archivedObjects == null) {
EMPTY = new Object();
EMPTY_LIST = new ListN<>();
EMPTY_SET = new SetN<>();
EMPTY_MAP = new MapN<>();
archivedObjects = new Object[] { EMPTY, EMPTY_LIST, EMPTY_SET, EMPTY_MAP };
} else {
EMPTY = archivedObjects[0];
EMPTY_LIST = (ListN)archivedObjects[1];
EMPTY_SET = (SetN)archivedObjects[2];
EMPTY_MAP = (MapN)archivedObjects[3];
}
}
/** No instances. */
@ -386,11 +424,13 @@ class ImmutableCollections {
private final E e0;
@Stable
private final E e1;
private final Object e1;
List12(E e0) {
this.e0 = Objects.requireNonNull(e0);
this.e1 = null;
// Use EMPTY as a sentinel for an unused element: not using null
// enable constant folding optimizations over single-element lists
this.e1 = EMPTY;
}
List12(E e0, E e1) {
@ -400,7 +440,7 @@ class ImmutableCollections {
@Override
public int size() {
return e1 != null ? 2 : 1;
return e1 != EMPTY ? 2 : 1;
}
@Override
@ -409,11 +449,12 @@ class ImmutableCollections {
}
@Override
@SuppressWarnings("unchecked")
public E get(int index) {
if (index == 0) {
return e0;
} else if (index == 1 && e1 != null) {
return e1;
} else if (index == 1 && e1 != EMPTY) {
return (E)e1;
}
throw outOfBounds(index);
}
@ -425,7 +466,7 @@ class ImmutableCollections {
@java.io.Serial
private Object writeReplace() {
if (e1 == null) {
if (e1 == EMPTY) {
return new CollSer(CollSer.IMM_LIST, e0);
} else {
return new CollSer(CollSer.IMM_LIST, e0, e1);
@ -434,7 +475,7 @@ class ImmutableCollections {
@Override
public Object[] toArray() {
if (e1 == null) {
if (e1 == EMPTY) {
return new Object[] { e0 };
} else {
return new Object[] { e0, e1 };
@ -444,7 +485,7 @@ class ImmutableCollections {
@Override
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
int size = e1 == null ? 1 : 2;
int size = size();
T[] array = a.length >= size ? a :
(T[])Array.newInstance(a.getClass().getComponentType(), size);
array[0] = (T)e0;
@ -461,16 +502,6 @@ class ImmutableCollections {
static final class ListN<E> extends AbstractImmutableList<E>
implements Serializable {
// EMPTY_LIST may be initialized from the CDS archive.
static @Stable List<?> EMPTY_LIST;
static {
VM.initializeFromArchive(ListN.class);
if (EMPTY_LIST == null) {
EMPTY_LIST = new ListN<>();
}
}
@Stable
private final E[] elements;
@ -564,13 +595,16 @@ class ImmutableCollections {
implements Serializable {
@Stable
final E e0;
private final E e0;
@Stable
final E e1;
private final Object e1;
Set12(E e0) {
this.e0 = Objects.requireNonNull(e0);
this.e1 = null;
// Use EMPTY as a sentinel for an unused element: not using null
// enable constant folding optimizations over single-element sets
this.e1 = EMPTY;
}
Set12(E e0, E e1) {
@ -584,7 +618,7 @@ class ImmutableCollections {
@Override
public int size() {
return (e1 == null) ? 1 : 2;
return (e1 == EMPTY) ? 1 : 2;
}
@Override
@ -594,12 +628,12 @@ class ImmutableCollections {
@Override
public boolean contains(Object o) {
return o.equals(e0) || o.equals(e1); // implicit nullcheck of o
return o.equals(e0) || e1.equals(o); // implicit nullcheck of o
}
@Override
public int hashCode() {
return e0.hashCode() + (e1 == null ? 0 : e1.hashCode());
return e0.hashCode() + (e1 == EMPTY ? 0 : e1.hashCode());
}
@Override
@ -613,13 +647,14 @@ class ImmutableCollections {
}
@Override
@SuppressWarnings("unchecked")
public E next() {
if (idx == 1) {
idx = 0;
return SALT >= 0 || e1 == null ? e0 : e1;
return (REVERSE || e1 == EMPTY) ? e0 : (E)e1;
} else if (idx == 2) {
idx = 1;
return SALT >= 0 ? e1 : e0;
return REVERSE ? (E)e1 : e0;
} else {
throw new NoSuchElementException();
}
@ -634,7 +669,7 @@ class ImmutableCollections {
@java.io.Serial
private Object writeReplace() {
if (e1 == null) {
if (e1 == EMPTY) {
return new CollSer(CollSer.IMM_SET, e0);
} else {
return new CollSer(CollSer.IMM_SET, e0, e1);
@ -643,9 +678,9 @@ class ImmutableCollections {
@Override
public Object[] toArray() {
if (e1 == null) {
if (e1 == EMPTY) {
return new Object[] { e0 };
} else if (SALT >= 0) {
} else if (REVERSE) {
return new Object[] { e1, e0 };
} else {
return new Object[] { e0, e1 };
@ -655,12 +690,12 @@ class ImmutableCollections {
@Override
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
int size = e1 == null ? 1 : 2;
int size = size();
T[] array = a.length >= size ? a :
(T[])Array.newInstance(a.getClass().getComponentType(), size);
if (size == 1) {
array[0] = (T)e0;
} else if (SALT >= 0) {
} else if (REVERSE) {
array[0] = (T)e1;
array[1] = (T)e0;
} else {
@ -684,18 +719,9 @@ class ImmutableCollections {
static final class SetN<E> extends AbstractImmutableSet<E>
implements Serializable {
// EMPTY_SET may be initialized from the CDS archive.
static @Stable Set<?> EMPTY_SET;
static {
VM.initializeFromArchive(SetN.class);
if (EMPTY_SET == null) {
EMPTY_SET = new SetN<>();
}
}
@Stable
final E[] elements;
@Stable
final int size;
@ -752,7 +778,7 @@ class ImmutableCollections {
private int nextIndex() {
int idx = this.idx;
if (SALT >= 0) {
if (REVERSE) {
if (++idx >= elements.length) {
idx = 0;
}
@ -941,16 +967,6 @@ class ImmutableCollections {
*/
static final class MapN<K,V> extends AbstractImmutableMap<K,V> {
// EMPTY_MAP may be initialized from the CDS archive.
static @Stable Map<?,?> EMPTY_MAP;
static {
VM.initializeFromArchive(MapN.class);
if (EMPTY_MAP == null) {
EMPTY_MAP = new MapN<>();
}
}
@Stable
final Object[] table; // pairs of key, value
@ -1058,7 +1074,7 @@ class ImmutableCollections {
private int nextIndex() {
int idx = this.idx;
if (SALT >= 0) {
if (REVERSE) {
if ((idx += 2) >= table.length) {
idx = 0;
}
@ -1284,7 +1300,7 @@ final class CollSer implements Serializable {
return Set.of(array);
case IMM_MAP:
if (array.length == 0) {
return ImmutableCollections.MapN.EMPTY_MAP;
return ImmutableCollections.EMPTY_MAP;
} else if (array.length == 2) {
return new ImmutableCollections.Map1<>(array[0], array[1]);
} else {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -789,7 +789,7 @@ public interface List<E> extends Collection<E> {
*/
@SuppressWarnings("unchecked")
static <E> List<E> of() {
return (List<E>) ImmutableCollections.ListN.EMPTY_LIST;
return (List<E>) ImmutableCollections.EMPTY_LIST;
}
/**
@ -1033,7 +1033,7 @@ public interface List<E> extends Collection<E> {
switch (elements.length) { // implicit null check of elements
case 0:
@SuppressWarnings("unchecked")
var list = (List<E>) ImmutableCollections.ListN.EMPTY_LIST;
var list = (List<E>) ImmutableCollections.EMPTY_LIST;
return list;
case 1:
return new ImmutableCollections.List12<>(elements[0]);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -1288,7 +1288,7 @@ public interface Map<K, V> {
*/
@SuppressWarnings("unchecked")
static <K, V> Map<K, V> of() {
return (Map<K,V>) ImmutableCollections.MapN.EMPTY_MAP;
return (Map<K,V>) ImmutableCollections.EMPTY_MAP;
}
/**
@ -1606,7 +1606,7 @@ public interface Map<K, V> {
static <K, V> Map<K, V> ofEntries(Entry<? extends K, ? extends V>... entries) {
if (entries.length == 0) { // implicit null check of entries array
@SuppressWarnings("unchecked")
var map = (Map<K,V>) ImmutableCollections.MapN.EMPTY_MAP;
var map = (Map<K,V>) ImmutableCollections.EMPTY_MAP;
return map;
} else if (entries.length == 1) {
// implicit null check of the array slot

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -450,7 +450,7 @@ public interface Set<E> extends Collection<E> {
*/
@SuppressWarnings("unchecked")
static <E> Set<E> of() {
return (Set<E>) ImmutableCollections.SetN.EMPTY_SET;
return (Set<E>) ImmutableCollections.EMPTY_SET;
}
/**
@ -694,7 +694,7 @@ public interface Set<E> extends Collection<E> {
switch (elements.length) { // implicit null check of elements
case 0:
@SuppressWarnings("unchecked")
var set = (Set<E>) ImmutableCollections.SetN.EMPTY_SET;
var set = (Set<E>) ImmutableCollections.EMPTY_SET;
return set;
case 1:
return new ImmutableCollections.Set12<>(elements[0]);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -157,8 +157,10 @@ public class JarFile extends ZipFile {
private boolean jvInitialized;
private boolean verify;
private final Runtime.Version version; // current version
private final int versionFeature; // version.feature()
private final int versionFeature; // version.feature()
private boolean isMultiRelease; // is jar multi-release?
static final ThreadLocal<Boolean> isInitializing =
ThreadLocal.withInitial(() -> Boolean.FALSE);
// indicates if Class-Path attribute present
private boolean hasClassPathAttribute;
@ -1031,8 +1033,13 @@ public class JarFile extends ZipFile {
throw new RuntimeException(e);
}
if (jv != null && !jvInitialized) {
initializeVerifier();
jvInitialized = true;
isInitializing.set(Boolean.TRUE);
try {
initializeVerifier();
jvInitialized = true;
} finally {
isInitializing.set(Boolean.FALSE);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@ -68,4 +68,8 @@ class JavaUtilJarAccessImpl implements JavaUtilJarAccess {
public void ensureInitialization(JarFile jar) {
jar.ensureInitialization();
}
public Boolean isInitializing() {
return JarFile.isInitializing.get();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@ -45,4 +45,5 @@ public interface JavaUtilJarAccess {
public List<Object> getManifestDigests(JarFile jar);
public Attributes getTrustedAttributes(Manifest man, String name);
public void ensureInitialization(JarFile jar);
public Boolean isInitializing();
}

View File

@ -25,6 +25,11 @@
package jdk.internal.event;
import jdk.internal.access.JavaUtilJarAccess;
import jdk.internal.access.SharedSecrets;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
@ -37,14 +42,24 @@ import java.util.stream.IntStream;
public final class EventHelper {
private static final JavaUtilJarAccess JUJA = SharedSecrets.javaUtilJarAccess();
private static volatile boolean loggingSecurity;
private static volatile System.Logger securityLogger;
private static final VarHandle LOGGER_HANDLE;
static {
try {
LOGGER_HANDLE =
MethodHandles.lookup().findStaticVarHandle(
EventHelper.class, "securityLogger", System.Logger.class);
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
private static final System.Logger.Level LOG_LEVEL = System.Logger.Level.DEBUG;
// helper class used for logging security related events for now
private static final String SECURITY_LOGGER_NAME = "jdk.event.security";
private static final System.Logger SECURITY_LOGGER =
System.getLogger(SECURITY_LOGGER_NAME);
private static final boolean LOGGING_SECURITY =
SECURITY_LOGGER.isLoggable(LOG_LEVEL);
public static void logTLSHandshakeEvent(Instant start,
String peerHost,
@ -52,8 +67,9 @@ public final class EventHelper {
String cipherSuite,
String protocolVersion,
long peerCertId) {
assert securityLogger != null;
String prepend = getDurationString(start);
SECURITY_LOGGER.log(LOG_LEVEL, prepend +
securityLogger.log(LOG_LEVEL, prepend +
" TLSHandshake: {0}:{1,number,#}, {2}, {3}, {4,number,#}",
peerHost, peerPort, protocolVersion, cipherSuite, peerCertId);
}
@ -61,18 +77,18 @@ public final class EventHelper {
public static void logSecurityPropertyEvent(String key,
String value) {
if (isLoggingSecurity()) {
SECURITY_LOGGER.log(LOG_LEVEL,
"SecurityPropertyModification: key:{0}, value:{1}", key, value);
}
assert securityLogger != null;
securityLogger.log(LOG_LEVEL,
"SecurityPropertyModification: key:{0}, value:{1}", key, value);
}
public static void logX509ValidationEvent(int anchorCertId,
int[] certIds) {
assert securityLogger != null;
String codes = IntStream.of(certIds)
.mapToObj(Integer::toString)
.collect(Collectors.joining(", "));
SECURITY_LOGGER.log(LOG_LEVEL,
securityLogger.log(LOG_LEVEL,
"ValidationChain: {0,number,#}, {1}", anchorCertId, codes);
}
@ -85,7 +101,8 @@ public final class EventHelper {
long certId,
long beginDate,
long endDate) {
SECURITY_LOGGER.log(LOG_LEVEL, "X509Certificate: Alg:{0}, Serial:{1}" +
assert securityLogger != null;
securityLogger.log(LOG_LEVEL, "X509Certificate: Alg:{0}, Serial:{1}" +
", Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}" +
", Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}",
algId, serialNum, subject, issuer, keyType, length,
@ -124,6 +141,14 @@ public final class EventHelper {
* @return boolean indicating whether an event should be logged
*/
public static boolean isLoggingSecurity() {
return LOGGING_SECURITY;
// Avoid a bootstrap issue where the commitEvent attempts to
// trigger early loading of System Logger but where
// the verification process still has JarFiles locked
if (securityLogger == null && !JUJA.isInitializing()) {
LOGGER_HANDLE.compareAndSet( null, System.getLogger(SECURITY_LOGGER_NAME));
loggingSecurity = securityLogger.isLoggable(LOG_LEVEL);
}
return loggingSecurity;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -32,9 +32,10 @@
******************************************************************************
*/
package sun.text.normalizer;
package jdk.internal.icu.impl;
import sun.text.normalizer.UnicodeSet.SpanCondition;
import jdk.internal.icu.text.UnicodeSet.SpanCondition;
import jdk.internal.icu.util.OutputInt;
/**
* Helper class for frozen UnicodeSets, implements contains() and span() optimized for BMP code points.
@ -44,7 +45,7 @@ import sun.text.normalizer.UnicodeSet.SpanCondition;
* 3-byte characters: Use zero/one/mixed data per 64-block in U+0000..U+FFFF, with mixed for illegal ranges.
* Supplementary characters: Call contains() on the parent set.
*/
final class BMPSet {
public final class BMPSet {
/**
* One boolean ('true' or 'false') per Latin-1 character.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -30,7 +30,9 @@
******************************************************************************
*/
package sun.text.normalizer;
package jdk.internal.icu.impl;
import jdk.internal.icu.text.UTF16;
import java.io.DataInputStream;
import java.io.InputStream;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -35,17 +35,19 @@
*******************************************************************************
*/
package sun.text.normalizer;
package jdk.internal.icu.impl;
import java.text.CharacterIterator;
import jdk.internal.icu.text.UCharacterIterator;
/**
* This class is a wrapper around CharacterIterator and implements the
* UCharacterIterator protocol
* @author ram
*/
class CharacterIteratorWrapper extends UCharacterIterator {
public class CharacterIteratorWrapper extends UCharacterIterator {
private CharacterIterator iterator;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -30,9 +30,8 @@
*******************************************************************************
*/
package sun.text.normalizer;
package jdk.internal.icu.impl;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
@ -43,6 +42,8 @@ import java.util.Arrays;
import java.security.AccessController;
import java.security.PrivilegedAction;
import jdk.internal.icu.util.VersionInfo;
public final class ICUBinary {
private static final class IsAcceptable implements Authenticate {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -30,11 +30,14 @@
*******************************************************************************
*/
package sun.text.normalizer;
package jdk.internal.icu.impl;
import java.io.IOException;
final class Norm2AllModes {
import jdk.internal.icu.text.Normalizer2;
import jdk.internal.icu.util.VersionInfo;
public final class Norm2AllModes {
// Public API dispatch via Normalizer2 subclasses -------------------------- ***
// Normalizer2 implementation for the old UNORM_NONE.
@ -265,7 +268,9 @@ final class Norm2AllModes {
private static final class Norm2AllModesSingleton {
private Norm2AllModesSingleton(String name) {
try {
String DATA_FILE_NAME = "/sun/text/resources/" + name + ".nrm";
@SuppressWarnings("deprecation")
String DATA_FILE_NAME = "/jdk/internal/icu/impl/data/icudt" +
VersionInfo.ICU_DATA_VERSION_PATH + "/" + name + ".nrm";
NormalizerImpl impl=new NormalizerImpl().load(DATA_FILE_NAME);
allModes=new Norm2AllModes(impl);
} catch (RuntimeException e) {

Some files were not shown because too many files have changed in this diff Show More