This commit is contained in:
J. Duke 2017-07-05 21:21:58 +02:00
commit 31cbf182e1
324 changed files with 6288 additions and 3046 deletions

View File

@ -348,3 +348,4 @@ c4d72a1620835b5d657b7b6792c2879367d0154f jdk-9+101
47d6462e514b2097663305a57d9c844c15d5b609 jdk-9+103
9a38f8b4ba220708db198d08d82fd2144a64777d jdk-9+104
be58b02c11f90b88c67e4d0e2cb5e4cf2d9b3c57 jdk-9+105
54575d8783b3a39a2d710c28cda675d44261f9d9 jdk-9+106

View File

@ -508,3 +508,4 @@ d5239fc1b69749ae50793c61b899fcdacf3df857 jdk-9+102
c5f55130b1b69510d9a6f4a3105b58e21cd7ffe1 jdk-9+103
534c50395957c6025fb6627e93b35756f8d48a08 jdk-9+104
266fa9bb5297bf02cb2a7b038b10a109817d2b48 jdk-9+105
7232de4c17c37f60aecec4f3191090bd3d41d334 jdk-9+106

View File

@ -1,5 +1,5 @@
suite = {
"mxversion" : "5.6.11",
"mxversion" : "5.6.16",
"name" : "jvmci",
"url" : "http://openjdk.java.net/projects/graal",
"developer" : {

View File

@ -256,7 +256,7 @@ endif
# Compiler warnings are treated as errors
ifneq ($(COMPILER_WARNINGS_FATAL),false)
WARNINGS_ARE_ERRORS = -Werror
WARNINGS_ARE_ERRORS ?= -Werror
endif
ifeq ($(USE_CLANG), true)

View File

@ -203,7 +203,7 @@ else
endif
# Compiler warnings are treated as errors
WARNINGS_ARE_ERRORS = -Werror
WARNINGS_ARE_ERRORS ?= -Werror
ifeq ($(USE_CLANG), true)
# However we need to clean the code up before we can unrestrictedly enable this option with Clang

View File

@ -66,17 +66,21 @@ CXXFLAGS = $(SYSDEFS) $(INCLUDES)
CXXFLAGS += -DASSERT
ifndef USE_GCC
# We need libCstd.so for adlc
# We need libCstd.so for adlc
CFLAGS += -library=Cstd -g
LFLAGS += -library=Cstd -g
endif
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
CFLAGS_WARN = +w
# Compiler warnings are treated as errors
ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
CFLAGS_WARN = +w -errwarn
WARNINGS_ARE_ERRORS ?= -xwe
endif
# When using compiler version 5.13 (Solaris Studio 12.4), calls to explicitly
CFLAGS_WARN += $(WARNINGS_ARE_ERRORS)
# When using compiler version 5.13 (Solaris Studio 12.4), calls to explicitly
# instantiated template functions trigger this warning when +w is active.
ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 513), 1)
CFLAGS_WARN += -erroff=notemsource

View File

@ -117,7 +117,7 @@ endif
# Compiler warnings are treated as errors
WARNINGS_ARE_ERRORS = -Werror
WARNINGS_ARE_ERRORS ?= -Werror
# Enable these warnings. See 'info gcc' about details on these options
WARNING_FLAGS = -Wpointer-arith -Wconversion -Wsign-compare -Wundef -Wformat=2

View File

@ -145,7 +145,8 @@ endif
CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
# Compiler warnings are treated as errors
CFLAGS_WARN = -xwe
WARNINGS_ARE_ERRORS ?= -xwe
CFLAGS_WARN = $(WARNINGS_ARE_ERRORS)
################################################
# Begin current (>=5.9) Forte compiler options #

View File

@ -14928,7 +14928,22 @@ instruct string_equals(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt,
ins_pipe(pipe_class_memory);
%}
instruct array_equals(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,
instruct array_equalsB(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,
iRegP_R10 tmp, rFlagsReg cr)
%{
predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::LL);
match(Set result (AryEq ary1 ary2));
effect(KILL tmp, USE_KILL ary1, USE_KILL ary2, KILL cr);
format %{ "Array Equals $ary1,ary2 -> $result // KILL $tmp" %}
ins_encode %{
__ byte_arrays_equals($ary1$$Register, $ary2$$Register,
$result$$Register, $tmp$$Register);
%}
ins_pipe(pipe_class_memory);
%}
instruct array_equalsC(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,
iRegP_R10 tmp, rFlagsReg cr)
%{
predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::UU);

View File

@ -40,11 +40,7 @@ define_pd_global(bool, ImplicitNullChecks, true); // Generate code for im
define_pd_global(bool, TrapBasedNullChecks, false);
define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs past to check cast
#if defined(COMPILER2) || INCLUDE_JVMCI
define_pd_global(intx, CodeEntryAlignment, 64);
#else
define_pd_global(intx, CodeEntryAlignment, 16);
#endif // COMPILER2
define_pd_global(intx, OptoLoopAlignment, 16);
define_pd_global(intx, InlineFrequencyCount, 100);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -127,7 +127,10 @@ int MacroAssembler::pd_patch_instruction_size(address branch, address target) {
Instruction_aarch64::extract(insn2, 4, 0)) {
// movk #imm16<<32
Instruction_aarch64::patch(branch + 4, 20, 5, (uint64_t)target >> 32);
offset &= (1<<20)-1;
long dest = ((long)target & 0xffffffffL) | ((long)branch & 0xffff00000000L);
long pc_page = (long)branch >> 12;
long adr_page = (long)dest >> 12;
offset = adr_page - pc_page;
instructions = 2;
}
}
@ -898,23 +901,18 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
"caller must use same register for non-constant itable index as for method");
// Compute start of first itableOffsetEntry (which is at the end of the vtable)
int vtable_base = InstanceKlass::vtable_start_offset() * wordSize;
int vtable_base = in_bytes(Klass::vtable_start_offset());
int itentry_off = itableMethodEntry::method_offset_in_bytes();
int scan_step = itableOffsetEntry::size() * wordSize;
int vte_size = vtableEntry::size() * wordSize;
int vte_size = vtableEntry::size_in_bytes();
assert(vte_size == wordSize, "else adjust times_vte_scale");
ldrw(scan_temp, Address(recv_klass, InstanceKlass::vtable_length_offset() * wordSize));
ldrw(scan_temp, Address(recv_klass, Klass::vtable_length_offset()));
// %%% Could store the aligned, prescaled offset in the klassoop.
// lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base));
lea(scan_temp, Address(recv_klass, scan_temp, Address::lsl(3)));
add(scan_temp, scan_temp, vtable_base);
if (HeapWordsPerLong > 1) {
// Round up to align_object_offset boundary
// see code for instanceKlass::start_of_itable!
round_to(scan_temp, BytesPerLong);
}
// Adjust recv_klass by scaled itable_index, so we can free itable_index.
assert(itableMethodEntry::size() * wordSize == wordSize, "adjust the scaling in the code below");
@ -963,7 +961,7 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
void MacroAssembler::lookup_virtual_method(Register recv_klass,
RegisterOrConstant vtable_index,
Register method_result) {
const int base = InstanceKlass::vtable_start_offset() * wordSize;
const int base = in_bytes(Klass::vtable_start_offset());
assert(vtableEntry::size() * wordSize == 8,
"adjust the scaling in the code below");
int vtable_offset_in_bytes = base + vtableEntry::method_offset_in_bytes();
@ -3998,11 +3996,12 @@ void MacroAssembler::adrp(Register reg1, const Address &dest, unsigned long &byt
if (offset_high >= -(1<<20) && offset_low < (1<<20)) {
_adrp(reg1, dest.target());
} else {
unsigned long pc_page = (unsigned long)pc() >> 12;
long offset = dest_page - pc_page;
offset = (offset & ((1<<20)-1)) << 12;
_adrp(reg1, pc()+offset);
movk(reg1, (unsigned long)dest.target() >> 32, 32);
unsigned long target = (unsigned long)dest.target();
unsigned long adrp_target
= (target & 0xffffffffUL) | ((unsigned long)pc() & 0xffff00000000UL);
_adrp(reg1, (address)adrp_target);
movk(reg1, target >> 32, 32);
}
byte_offset = (unsigned long)dest.target() & 0xfff;
}
@ -4557,6 +4556,82 @@ void MacroAssembler::string_equals(Register str1, Register str2,
BLOCK_COMMENT("} string_equals");
}
void MacroAssembler::byte_arrays_equals(Register ary1, Register ary2,
Register result, Register tmp1)
{
Register cnt1 = rscratch1;
Register cnt2 = rscratch2;
Register tmp2 = rscratch2;
Label SAME, DIFFER, NEXT, TAIL07, TAIL03, TAIL01;
int length_offset = arrayOopDesc::length_offset_in_bytes();
int base_offset = arrayOopDesc::base_offset_in_bytes(T_BYTE);
BLOCK_COMMENT("byte_arrays_equals {");
// different until proven equal
mov(result, false);
// same array?
cmp(ary1, ary2);
br(Assembler::EQ, SAME);
// ne if either null
cbz(ary1, DIFFER);
cbz(ary2, DIFFER);
// lengths ne?
ldrw(cnt1, Address(ary1, length_offset));
ldrw(cnt2, Address(ary2, length_offset));
cmp(cnt1, cnt2);
br(Assembler::NE, DIFFER);
lea(ary1, Address(ary1, base_offset));
lea(ary2, Address(ary2, base_offset));
subs(cnt1, cnt1, 8);
br(LT, TAIL07);
BIND(NEXT);
ldr(tmp1, Address(post(ary1, 8)));
ldr(tmp2, Address(post(ary2, 8)));
subs(cnt1, cnt1, 8);
eor(tmp1, tmp1, tmp2);
cbnz(tmp1, DIFFER);
br(GE, NEXT);
BIND(TAIL07); // 0-7 bytes left, cnt1 = #bytes left - 4
tst(cnt1, 0b100);
br(EQ, TAIL03);
ldrw(tmp1, Address(post(ary1, 4)));
ldrw(tmp2, Address(post(ary2, 4)));
cmp(tmp1, tmp2);
br(NE, DIFFER);
BIND(TAIL03); // 0-3 bytes left, cnt1 = #bytes left - 4
tst(cnt1, 0b10);
br(EQ, TAIL01);
ldrh(tmp1, Address(post(ary1, 2)));
ldrh(tmp2, Address(post(ary2, 2)));
cmp(tmp1, tmp2);
br(NE, DIFFER);
BIND(TAIL01); // 0-1 byte left
tst(cnt1, 0b01);
br(EQ, SAME);
ldrb(tmp1, ary1);
ldrb(tmp2, ary2);
cmp(tmp1, tmp2);
br(NE, DIFFER);
BIND(SAME);
mov(result, true);
BIND(DIFFER); // result already set
BLOCK_COMMENT("} byte_arrays_equals");
}
// Compare char[] arrays aligned to 4 bytes
void MacroAssembler::char_arrays_equals(Register ary1, Register ary2,
Register result, Register tmp1)

View File

@ -1191,6 +1191,8 @@ public:
Register tmp1);
void char_arrays_equals(Register ary1, Register ary2,
Register result, Register tmp1);
void byte_arrays_equals(Register ary1, Register ary2,
Register result, Register tmp1);
void encode_iso_array(Register src, Register dst,
Register len, Register result,
FloatRegister Vtmp1, FloatRegister Vtmp2,

View File

@ -786,12 +786,19 @@ class StubGenerator: public StubCodeGenerator {
int offset;
const Register t0 = r3, t1 = r4, t2 = r5, t3 = r6,
t4 = r7, t5 = r10, t6 = r11, t7 = r12;
const Register stride = r13;
assert_different_registers(rscratch1, t0, t1, t2, t3, t4, t5, t6, t7);
assert_different_registers(s, d, count, rscratch1);
Label again, large, small;
__ align(6);
const char *stub_name;
if (direction == copy_forwards)
stub_name = "foward_copy_longs";
else
stub_name = "backward_copy_longs";
StubCodeMark mark(this, "StubRoutines", stub_name);
__ align(CodeEntryAlignment);
__ bind(start);
__ cmp(count, 8);
__ br(Assembler::LO, small);
@ -836,7 +843,7 @@ class StubGenerator: public StubCodeGenerator {
__ ret(lr);
__ align(6);
__ align(CodeEntryAlignment);
__ bind(large);
// Fill 8 registers
@ -845,10 +852,18 @@ class StubGenerator: public StubCodeGenerator {
__ ldp(t4, t5, Address(s, 6 * unit));
__ ldp(t6, t7, Address(__ pre(s, 8 * unit)));
int prefetch = PrefetchCopyIntervalInBytes;
bool use_stride = false;
if (direction == copy_backwards) {
use_stride = prefetch > 256;
prefetch = -prefetch;
if (use_stride) __ mov(stride, prefetch);
}
__ bind(again);
if (direction == copy_forwards && PrefetchCopyIntervalInBytes > 0)
__ prfm(Address(s, PrefetchCopyIntervalInBytes), PLDL1KEEP);
if (PrefetchCopyIntervalInBytes > 0)
__ prfm(use_stride ? Address(s, stride) : Address(s, prefetch), PLDL1KEEP);
__ stp(t0, t1, Address(d, 2 * unit));
__ ldp(t0, t1, Address(s, 2 * unit));
@ -1151,8 +1166,11 @@ class StubGenerator: public StubCodeGenerator {
// caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
BLOCK_COMMENT("Entry:");
}
__ cmp(d, s);
__ br(Assembler::LS, nooverlap_target);
// use fwd copy when (d-s) above_equal (count*size)
__ sub(rscratch1, d, s);
__ cmp(rscratch1, count, Assembler::LSL, exact_log2(size));
__ br(Assembler::HS, nooverlap_target);
if (is_oop) {
__ push(RegSet::of(d, count), sp);

View File

@ -120,7 +120,14 @@ void VM_Version::get_processor_features() {
FLAG_SET_DEFAULT(AllocatePrefetchStepSize, 64);
FLAG_SET_DEFAULT(PrefetchScanIntervalInBytes, 256);
FLAG_SET_DEFAULT(PrefetchFieldsAhead, 256);
FLAG_SET_DEFAULT(PrefetchCopyIntervalInBytes, 256);
if (FLAG_IS_DEFAULT(PrefetchCopyIntervalInBytes))
FLAG_SET_DEFAULT(PrefetchCopyIntervalInBytes, 256);
if ((PrefetchCopyIntervalInBytes & 7) || (PrefetchCopyIntervalInBytes >= 32768)) {
warning("PrefetchCopyIntervalInBytes must be a multiple of 8 and < 32768");
PrefetchCopyIntervalInBytes &= ~7;
if (PrefetchCopyIntervalInBytes >= 32768)
PrefetchCopyIntervalInBytes = 32760;
}
unsigned long auxv = getauxval(AT_HWCAP);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -73,7 +73,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
if (DebugVtables) {
Label L;
// check offset vs vtable length
__ ldrw(rscratch1, Address(r19, InstanceKlass::vtable_length_offset() * wordSize));
__ ldrw(rscratch1, Address(r19, Klass::vtable_length_offset()));
__ cmpw(rscratch1, vtable_index * vtableEntry::size());
__ br(Assembler::GT, L);
__ enter();

View File

@ -1583,13 +1583,13 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
"caller must use same register for non-constant itable index as for method");
// Compute start of first itableOffsetEntry (which is at the end of the vtable).
int vtable_base = InstanceKlass::vtable_start_offset() * wordSize;
int vtable_base = in_bytes(Klass::vtable_start_offset());
int itentry_off = itableMethodEntry::method_offset_in_bytes();
int logMEsize = exact_log2(itableMethodEntry::size() * wordSize);
int scan_step = itableOffsetEntry::size() * wordSize;
int log_vte_size= exact_log2(vtableEntry::size() * wordSize);
int log_vte_size= exact_log2(vtableEntry::size_in_bytes());
lwz(scan_temp, InstanceKlass::vtable_length_offset() * wordSize, recv_klass);
lwz(scan_temp, in_bytes(Klass::vtable_length_offset()), recv_klass);
// %%% We should store the aligned, prescaled offset in the klassoop.
// Then the next several instructions would fold away.
@ -1657,7 +1657,7 @@ void MacroAssembler::lookup_virtual_method(Register recv_klass,
assert_different_registers(recv_klass, method_result, vtable_index.register_or_noreg());
const int base = InstanceKlass::vtable_start_offset() * wordSize;
const int base = in_bytes(Klass::vtable_start_offset());
assert(vtableEntry::size() * wordSize == wordSize, "adjust the scaling in the code below");
if (vtable_index.is_register()) {

View File

@ -3568,8 +3568,8 @@ encode %{
__ load_klass(R11_scratch1, R3);
int entry_offset = InstanceKlass::vtable_start_offset() + _vtable_index * vtableEntry::size();
int v_off = entry_offset * wordSize + vtableEntry::method_offset_in_bytes();
int entry_offset = in_bytes(Klass::vtable_start_offset()) + _vtable_index * vtableEntry::size_in_bytes();
int v_off = entry_offset + vtableEntry::method_offset_in_bytes();
__ li(R19_method, v_off);
__ ldx(R19_method/*method oop*/, R19_method/*method offset*/, R11_scratch1/*class*/);
// NOTE: for vtable dispatches, the vtable entry will never be

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -3282,9 +3282,9 @@ void TemplateTable::generate_vtable_call(Register Rrecv_klass, Register Rindex,
const Register Rtarget_method = Rindex;
// Get target method & entry point.
const int base = InstanceKlass::vtable_start_offset() * wordSize;
const int base = in_bytes(Klass::vtable_start_offset());
// Calc vtable addr scale the vtable index by 8.
__ sldi(Rindex, Rindex, exact_log2(vtableEntry::size() * wordSize));
__ sldi(Rindex, Rindex, exact_log2(vtableEntry::size_in_bytes()));
// Load target.
__ addi(Rrecv_klass, Rrecv_klass, base + vtableEntry::method_offset_in_bytes());
__ ldx(Rtarget_method, Rindex, Rrecv_klass);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -80,14 +80,14 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
__ load_klass(rcvr_klass, R3);
// Set method (in case of interpreted method), and destination address.
int entry_offset = InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size();
int entry_offset = in_bytes(Klass::vtable_start_offset()) + vtable_index*vtableEntry::size_in_bytes();
#ifndef PRODUCT
if (DebugVtables) {
Label L;
// Check offset vs vtable length.
const Register vtable_len = R12_scratch2;
__ lwz(vtable_len, InstanceKlass::vtable_length_offset()*wordSize, rcvr_klass);
__ lwz(vtable_len, in_bytes(Klass::vtable_length_offset()), rcvr_klass);
__ cmpwi(CCR0, vtable_len, vtable_index*vtableEntry::size());
__ bge(CCR0, L);
__ li(R12_scratch2, vtable_index);
@ -96,7 +96,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
}
#endif
int v_off = entry_offset*wordSize + vtableEntry::method_offset_in_bytes();
int v_off = entry_offset + vtableEntry::method_offset_in_bytes();
__ ld(R19_method, v_off, rcvr_klass);
@ -163,13 +163,13 @@ VtableStub* VtableStubs::create_itable_stub(int vtable_index) {
__ load_klass(rcvr_klass, R3_ARG1);
BLOCK_COMMENT("Load start of itable entries into itable_entry.");
__ lwz(vtable_len, InstanceKlass::vtable_length_offset() * wordSize, rcvr_klass);
__ slwi(vtable_len, vtable_len, exact_log2(vtableEntry::size() * wordSize));
__ lwz(vtable_len, in_bytes(Klass::vtable_length_offset()), rcvr_klass);
__ slwi(vtable_len, vtable_len, exact_log2(vtableEntry::size_in_bytes()));
__ add(itable_entry_addr, vtable_len, rcvr_klass);
// Loop over all itable entries until desired interfaceOop(Rinterface) found.
BLOCK_COMMENT("Increment itable_entry_addr in loop.");
const int vtable_base_offset = InstanceKlass::vtable_start_offset() * wordSize;
const int vtable_base_offset = in_bytes(Klass::vtable_start_offset());
__ addi(itable_entry_addr, itable_entry_addr, vtable_base_offset + itableOffsetEntry::interface_offset_in_bytes());
const int itable_offset_search_inc = itableOffsetEntry::size() * wordSize;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -180,6 +180,9 @@ static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
typedef void (*_zero_Fn)(HeapWord* to, size_t count);
// Only used for heap objects, so align_object_offset.
// All other platforms pd_fill_to_aligned_words simply calls pd_fill_to_words, don't
// know why this one is different.
static void pd_fill_to_aligned_words(HeapWord* tohw, size_t count, juint value) {
assert(MinObjAlignmentInBytes >= BytesPerLong, "need alternate implementation");

View File

@ -2188,30 +2188,18 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
}
// Compute start of first itableOffsetEntry (which is at the end of the vtable)
int vtable_base = InstanceKlass::vtable_start_offset() * wordSize;
int vtable_base = in_bytes(Klass::vtable_start_offset());
int scan_step = itableOffsetEntry::size() * wordSize;
int vte_size = vtableEntry::size() * wordSize;
int vte_size = vtableEntry::size_in_bytes();
lduw(recv_klass, InstanceKlass::vtable_length_offset() * wordSize, scan_temp);
lduw(recv_klass, in_bytes(Klass::vtable_length_offset()), scan_temp);
// %%% We should store the aligned, prescaled offset in the klassoop.
// Then the next several instructions would fold away.
int round_to_unit = ((HeapWordsPerLong > 1) ? BytesPerLong : 0);
int itb_offset = vtable_base;
if (round_to_unit != 0) {
// hoist first instruction of round_to(scan_temp, BytesPerLong):
itb_offset += round_to_unit - wordSize;
}
int itb_scale = exact_log2(vtableEntry::size() * wordSize);
int itb_scale = exact_log2(vtableEntry::size_in_bytes());
sll(scan_temp, itb_scale, scan_temp);
add(scan_temp, itb_offset, scan_temp);
if (round_to_unit != 0) {
// Round up to align_object_offset boundary
// see code for InstanceKlass::start_of_itable!
// Was: round_to(scan_temp, BytesPerLong);
// Hoisted: add(scan_temp, BytesPerLong-1, scan_temp);
and3(scan_temp, -round_to_unit, scan_temp);
}
add(recv_klass, scan_temp, scan_temp);
// Adjust recv_klass by scaled itable_index, so we can free itable_index.
@ -2280,16 +2268,16 @@ void MacroAssembler::lookup_virtual_method(Register recv_klass,
Register method_result) {
assert_different_registers(recv_klass, method_result, vtable_index.register_or_noreg());
Register sethi_temp = method_result;
const int base = (InstanceKlass::vtable_start_offset() * wordSize +
// method pointer offset within the vtable entry:
vtableEntry::method_offset_in_bytes());
const int base = in_bytes(Klass::vtable_start_offset()) +
// method pointer offset within the vtable entry:
vtableEntry::method_offset_in_bytes();
RegisterOrConstant vtable_offset = vtable_index;
// Each of the following three lines potentially generates an instruction.
// But the total number of address formation instructions will always be
// at most two, and will often be zero. In any case, it will be optimal.
// If vtable_index is a register, we will have (sll_ptr N,x; inc_ptr B,x; ld_ptr k,x).
// If vtable_index is a constant, we will have at most (set B+X<<N,t; ld_ptr k,t).
vtable_offset = regcon_sll_ptr(vtable_index, exact_log2(vtableEntry::size() * wordSize), vtable_offset);
vtable_offset = regcon_sll_ptr(vtable_index, exact_log2(vtableEntry::size_in_bytes()), vtable_offset);
vtable_offset = regcon_inc_ptr(vtable_offset, base, vtable_offset, sethi_temp);
Address vtable_entry_addr(recv_klass, ensure_simm13_or_reg(vtable_offset, sethi_temp));
ld_ptr(vtable_entry_addr, method_result);

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@ -601,8 +601,8 @@ int MachCallDynamicJavaNode::ret_addr_offset() {
NativeCall::instruction_size); // sethi; setlo; call; delay slot
} else {
assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
int entry_offset = InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size();
int v_off = entry_offset*wordSize + vtableEntry::method_offset_in_bytes();
int entry_offset = in_bytes(Klass::vtable_start_offset()) + vtable_index*vtableEntry::size_in_bytes();
int v_off = entry_offset + vtableEntry::method_offset_in_bytes();
int klass_load_size;
if (UseCompressedClassPointers) {
assert(Universe::heap() != NULL, "java heap should be initialized");
@ -2658,8 +2658,8 @@ encode %{
} else {
klass_load_size = 1*BytesPerInstWord;
}
int entry_offset = InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size();
int v_off = entry_offset*wordSize + vtableEntry::method_offset_in_bytes();
int entry_offset = in_bytes(Klass::vtable_start_offset()) + vtable_index*vtableEntry::size_in_bytes();
int v_off = entry_offset + vtableEntry::method_offset_in_bytes();
if (Assembler::is_simm13(v_off)) {
__ ld_ptr(G3, v_off, G5_method);
} else {

View File

@ -3153,14 +3153,11 @@ void TemplateTable::invokeinterface(int byte_no) {
//
// compute start of first itableOffsetEntry (which is at end of vtable)
const int base = InstanceKlass::vtable_start_offset() * wordSize;
const int base = in_bytes(Klass::vtable_start_offset());
Label search;
Register Rtemp = O1_flags;
__ ld(O2_Klass, InstanceKlass::vtable_length_offset() * wordSize, Rtemp);
if (align_object_offset(1) > 1) {
__ round_to(Rtemp, align_object_offset(1));
}
__ ld(O2_Klass, in_bytes(Klass::vtable_length_offset()), Rtemp);
__ sll(Rtemp, LogBytesPerWord, Rtemp); // Rscratch *= 4;
if (Assembler::is_simm13(base)) {
__ add(Rtemp, base, Rtemp);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -78,7 +78,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
if (DebugVtables) {
Label L;
// check offset vs vtable length
__ ld(G3_scratch, InstanceKlass::vtable_length_offset()*wordSize, G5);
__ ld(G3_scratch, in_bytes(Klass::vtable_length_offset()), G5);
__ cmp_and_br_short(G5, vtable_index*vtableEntry::size(), Assembler::greaterUnsigned, Assembler::pt, L);
__ set(vtable_index, O2);
__ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), O0, O2);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -5867,22 +5867,17 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
"caller must use same register for non-constant itable index as for method");
// Compute start of first itableOffsetEntry (which is at the end of the vtable)
int vtable_base = InstanceKlass::vtable_start_offset() * wordSize;
int vtable_base = in_bytes(Klass::vtable_start_offset());
int itentry_off = itableMethodEntry::method_offset_in_bytes();
int scan_step = itableOffsetEntry::size() * wordSize;
int vte_size = vtableEntry::size() * wordSize;
int vte_size = vtableEntry::size_in_bytes();
Address::ScaleFactor times_vte_scale = Address::times_ptr;
assert(vte_size == wordSize, "else adjust times_vte_scale");
movl(scan_temp, Address(recv_klass, InstanceKlass::vtable_length_offset() * wordSize));
movl(scan_temp, Address(recv_klass, Klass::vtable_length_offset()));
// %%% Could store the aligned, prescaled offset in the klassoop.
lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base));
if (HeapWordsPerLong > 1) {
// Round up to align_object_offset boundary
// see code for InstanceKlass::start_of_itable!
round_to(scan_temp, BytesPerLong);
}
// Adjust recv_klass by scaled itable_index, so we can free itable_index.
assert(itableMethodEntry::size() * wordSize == wordSize, "adjust the scaling in the code below");
@ -5930,7 +5925,7 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
void MacroAssembler::lookup_virtual_method(Register recv_klass,
RegisterOrConstant vtable_index,
Register method_result) {
const int base = InstanceKlass::vtable_start_offset() * wordSize;
const int base = in_bytes(Klass::vtable_start_offset());
assert(vtableEntry::size() * wordSize == wordSize, "else adjust the scaling in the code below");
Address vtable_entry_addr(recv_klass,
vtable_index, Address::times_ptr,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -85,7 +85,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
if (DebugVtables) {
Label L;
// check offset vs vtable length
__ cmpl(Address(rax, InstanceKlass::vtable_length_offset()*wordSize), vtable_index*vtableEntry::size());
__ cmpl(Address(rax, Klass::vtable_length_offset()), vtable_index*vtableEntry::size());
__ jcc(Assembler::greater, L);
__ movl(rbx, vtable_index);
__ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), rcx, rbx);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -77,7 +77,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
if (DebugVtables) {
Label L;
// check offset vs vtable length
__ cmpl(Address(rax, InstanceKlass::vtable_length_offset() * wordSize),
__ cmpl(Address(rax, Klass::vtable_length_offset()),
vtable_index * vtableEntry::size());
__ jcc(Assembler::greater, L);
__ movl(rbx, vtable_index);

View File

@ -141,16 +141,20 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
return;
}
agent = new HotSpotAgent();
workerThread = new WorkerThread();
attachMenuItems = new java.util.ArrayList();
detachMenuItems = new java.util.ArrayList();
// Create frame first, to catch any GUI creation issues
// before we initialize agent
frame = new JFrame("HSDB - HotSpot Debugger");
frame.setSize(800, 600);
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
frame.addWindowListener(new CloseUI());
agent = new HotSpotAgent();
workerThread = new WorkerThread();
attachMenuItems = new java.util.ArrayList();
detachMenuItems = new java.util.ArrayList();
JMenuBar menuBar = new JMenuBar();
//

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,7 +48,6 @@ public class ArrayKlass extends Klass {
dimension = new CIntField(type.getCIntegerField("_dimension"), 0);
higherDimension = new MetadataField(type.getAddressField("_higher_dimension"), 0);
lowerDimension = new MetadataField(type.getAddressField("_lower_dimension"), 0);
vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), 0);
javaLangCloneableName = null;
javaLangObjectName = null;
javaIoSerializableName = null;
@ -61,7 +60,6 @@ public class ArrayKlass extends Klass {
private static CIntField dimension;
private static MetadataField higherDimension;
private static MetadataField lowerDimension;
private static CIntField vtableLen;
public Klass getJavaSuper() {
SystemDictionary sysDict = VM.getVM().getSystemDictionary();
@ -71,7 +69,6 @@ public class ArrayKlass extends Klass {
public long getDimension() { return dimension.getValue(this); }
public Klass getHigherDimension() { return (Klass) higherDimension.getValue(this); }
public Klass getLowerDimension() { return (Klass) lowerDimension.getValue(this); }
public long getVtableLen() { return vtableLen.getValue(this); }
// constant class names - javaLangCloneable, javaIoSerializable, javaLangObject
// Initialized lazily to avoid initialization ordering dependencies between ArrayKlass and SymbolTable
@ -140,6 +137,5 @@ public class ArrayKlass extends Klass {
visitor.doCInt(dimension, true);
visitor.doMetadata(higherDimension, true);
visitor.doMetadata(lowerDimension, true);
visitor.doCInt(vtableLen, true);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -696,7 +696,7 @@ public class ConstantPool extends Metadata implements ClassConstants {
}
public long getSize() {
return Oop.alignObjectSize(headerSize + getLength());
return alignSize(headerSize + getLength());
}
//----------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -70,7 +70,7 @@ public class ConstantPoolCache extends Metadata {
public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
public long getSize() {
return Oop.alignObjectSize(baseOffset + getLength() * elementSize);
return alignSize(baseOffset + getLength() * elementSize);
}
public ConstantPoolCacheEntry getEntryAt(int i) {
@ -79,8 +79,7 @@ public class ConstantPoolCache extends Metadata {
}
public int getIntAt(int entry, int fld) {
//alignObjectSize ?
long offset = baseOffset + /*alignObjectSize*/entry * elementSize + fld * intSize;
long offset = baseOffset + entry * elementSize + fld * intSize;
return (int) getAddress().getCIntegerAt(offset, intSize, true );
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -84,13 +84,12 @@ public class InstanceKlass extends Klass {
nonstaticOopMapSize = new CIntField(type.getCIntegerField("_nonstatic_oop_map_size"), 0);
isMarkedDependent = new CIntField(type.getCIntegerField("_is_marked_dependent"), 0);
initState = new CIntField(type.getCIntegerField("_init_state"), 0);
vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), 0);
itableLen = new CIntField(type.getCIntegerField("_itable_len"), 0);
breakpoints = type.getAddressField("_breakpoints");
genericSignatureIndex = new CIntField(type.getCIntegerField("_generic_signature_index"), 0);
majorVersion = new CIntField(type.getCIntegerField("_major_version"), 0);
minorVersion = new CIntField(type.getCIntegerField("_minor_version"), 0);
headerSize = Oop.alignObjectOffset(type.getSize());
headerSize = type.getSize();
// read field offset constants
ACCESS_FLAGS_OFFSET = db.lookupIntConstant("FieldInfo::access_flags_offset").intValue();
@ -143,7 +142,6 @@ public class InstanceKlass extends Klass {
private static CIntField nonstaticOopMapSize;
private static CIntField isMarkedDependent;
private static CIntField initState;
private static CIntField vtableLen;
private static CIntField itableLen;
private static AddressField breakpoints;
private static CIntField genericSignatureIndex;
@ -242,8 +240,7 @@ public class InstanceKlass extends Klass {
}
public long getSize() {
return Oop.alignObjectSize(getHeaderSize() + Oop.alignObjectOffset(getVtableLen()) +
Oop.alignObjectOffset(getItableLen()) + Oop.alignObjectOffset(getNonstaticOopMapSize()));
return alignSize(getHeaderSize() + getVtableLen() + getItableLen() + getNonstaticOopMapSize());
}
public static long getHeaderSize() { return headerSize; }
@ -352,7 +349,6 @@ public class InstanceKlass extends Klass {
public long getStaticOopFieldCount() { return staticOopFieldCount.getValue(this); }
public long getNonstaticOopMapSize() { return nonstaticOopMapSize.getValue(this); }
public boolean getIsMarkedDependent() { return isMarkedDependent.getValue(this) != 0; }
public long getVtableLen() { return vtableLen.getValue(this); }
public long getItableLen() { return itableLen.getValue(this); }
public long majorVersion() { return majorVersion.getValue(this); }
public long minorVersion() { return minorVersion.getValue(this); }
@ -548,7 +544,6 @@ public class InstanceKlass extends Klass {
visitor.doCInt(nonstaticOopMapSize, true);
visitor.doCInt(isMarkedDependent, true);
visitor.doCInt(initState, true);
visitor.doCInt(vtableLen, true);
visitor.doCInt(itableLen, true);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -61,6 +61,7 @@ public class Klass extends Metadata implements ClassConstants {
}
subklass = new MetadataField(type.getAddressField("_subklass"), 0);
nextSibling = new MetadataField(type.getAddressField("_next_sibling"), 0);
vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), 0);
LH_INSTANCE_SLOW_PATH_BIT = db.lookupIntConstant("Klass::_lh_instance_slow_path_bit").intValue();
LH_LOG2_ELEMENT_SIZE_SHIFT = db.lookupIntConstant("Klass::_lh_log2_element_size_shift").intValue();
@ -71,6 +72,7 @@ public class Klass extends Metadata implements ClassConstants {
LH_ARRAY_TAG_OBJ_VALUE = db.lookupIntConstant("Klass::_lh_array_tag_obj_value").intValue();
}
public Klass(Address addr) {
super(addr);
}
@ -91,6 +93,7 @@ public class Klass extends Metadata implements ClassConstants {
private static MetadataField subklass;
private static MetadataField nextSibling;
private static sun.jvm.hotspot.types.Field traceIDField;
private static CIntField vtableLen;
private Address getValue(AddressField field) {
return addr.getAddressAt(field.getOffset());
@ -111,6 +114,7 @@ public class Klass extends Metadata implements ClassConstants {
public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags()); }
public Klass getSubklassKlass() { return (Klass) subklass.getValue(this); }
public Klass getNextSiblingKlass() { return (Klass) nextSibling.getValue(this); }
public long getVtableLen() { return vtableLen.getValue(this); }
public long traceID() {
if (traceIDField == null) return 0;
@ -179,6 +183,7 @@ public class Klass extends Metadata implements ClassConstants {
visitor.doCInt(accessFlags, true);
visitor.doMetadata(subklass, true);
visitor.doMetadata(nextSibling, true);
visitor.doCInt(vtableLen, true);
}
public long getObjectSize() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -44,6 +44,11 @@ abstract public class Metadata extends VMObject {
super(addr);
}
public static long alignSize(long size) {
// natural word size.
return VM.getVM().alignUp(size, VM.getVM().getBytesPerWord());
}
private static VirtualBaseConstructor<Metadata> metadataConstructor;
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -252,7 +252,7 @@ public class MethodData extends Metadata implements MethodDataInterface<Klass,Me
}
int size() {
return (int)Oop.alignObjectSize(VM.getVM().alignUp(sizeInBytes(), VM.getVM().getBytesPerWord())/VM.getVM().getBytesPerWord());
return (int)alignSize(VM.getVM().alignUp(sizeInBytes(), VM.getVM().getBytesPerWord())/VM.getVM().getBytesPerWord());
}
ParametersTypeData<Klass,Method> parametersTypeData() {

View File

@ -35,7 +35,11 @@ public class WorkerThread {
public WorkerThread() {
mqb = new MessageQueueBackend();
mq = mqb.getFirstQueue();
new Thread(new MainLoop()).start();
// Enable to terminate this worker during runnning by daemonize.
Thread mqthread = new Thread(new MainLoop());
mqthread.setDaemon(true);
mqthread.start();
}
/** Runs the given Runnable in the thread represented by this

View File

@ -76,14 +76,14 @@ public class AArch64 extends Architecture {
public static final Register zr = r31;
public static final Register sp = r31;
// @formatter:off
public static final Register[] cpuRegisters = {
// @formatter:off
r0, r1, r2, r3, r4, r5, r6, r7,
r8, r9, r10, r11, r12, r13, r14, r15,
r16, r17, r18, r19, r20, r21, r22, r23,
r24, r25, r26, r27, r28, r29, r30, r31
// @formatter:on
};
// @formatter:on
public static final RegisterCategory SIMD = new RegisterCategory("SIMD");
@ -121,17 +121,17 @@ public class AArch64 extends Architecture {
public static final Register v30 = new Register(62, 30, "v30", SIMD);
public static final Register v31 = new Register(63, 31, "v31", SIMD);
// @formatter:off
public static final Register[] simdRegisters = {
// @formatter:off
v0, v1, v2, v3, v4, v5, v6, v7,
v8, v9, v10, v11, v12, v13, v14, v15,
v16, v17, v18, v19, v20, v21, v22, v23,
v24, v25, v26, v27, v28, v29, v30, v31
// @formatter:on
};
// @formatter:on
// @formatter:off
public static final Register[] allRegisters = {
// @formatter:off
r0, r1, r2, r3, r4, r5, r6, r7,
r8, r9, r10, r11, r12, r13, r14, r15,
r16, r17, r18, r19, r20, r21, r22, r23,
@ -141,14 +141,14 @@ public class AArch64 extends Architecture {
v8, v9, v10, v11, v12, v13, v14, v15,
v16, v17, v18, v19, v20, v21, v22, v23,
v24, v25, v26, v27, v28, v29, v30, v31
// @formatter:on
};
// @formatter:on
/**
* Basic set of CPU features mirroring what is returned from the cpuid instruction. See:
* {@code VM_Version::cpuFeatureFlags}.
*/
public static enum CPUFeature {
public enum CPUFeature {
FP,
ASIMD,
EVTSTRM,
@ -166,7 +166,7 @@ public class AArch64 extends Architecture {
/**
* Set of flags to control code emission.
*/
public static enum Flag {
public enum Flag {
UseBarriersForVolatile,
UseCRC32,
UseNeon

View File

@ -58,13 +58,13 @@ public enum AArch64Kind implements PlatformKind {
private final AArch64Kind scalar;
private final EnumKey<AArch64Kind> key = new EnumKey<>(this);
private AArch64Kind(int size) {
AArch64Kind(int size) {
this.size = size;
this.scalar = this;
this.vectorLength = 1;
}
private AArch64Kind(int size, AArch64Kind scalar) {
AArch64Kind(int size, AArch64Kind scalar) {
this.size = size;
this.scalar = scalar;

View File

@ -169,7 +169,7 @@ public class AMD64 extends Architecture {
* Basic set of CPU features mirroring what is returned from the cpuid instruction. See:
* {@code VM_Version::cpuFeatureFlags}.
*/
public static enum CPUFeature {
public enum CPUFeature {
CX8,
CMOV,
FXSR,
@ -210,7 +210,7 @@ public class AMD64 extends Architecture {
/**
* Set of flags to control code emission.
*/
public static enum Flag {
public enum Flag {
UseCountLeadingZerosInstruction,
UseCountTrailingZerosInstruction
}

View File

@ -74,13 +74,13 @@ public enum AMD64Kind implements PlatformKind {
private final AMD64Kind scalar;
private final EnumKey<AMD64Kind> key = new EnumKey<>(this);
private AMD64Kind(int size) {
AMD64Kind(int size) {
this.size = size;
this.scalar = this;
this.vectorLength = 1;
}
private AMD64Kind(int size, AMD64Kind scalar) {
AMD64Kind(int size, AMD64Kind scalar) {
this.size = size;
this.scalar = scalar;

View File

@ -23,7 +23,7 @@
package jdk.vm.ci.code;
/**
* Class representing a exception with a stack trace of the currently processed position in the
* Class representing an exception with a stack trace of the currently processed position in the
* compiled Java program instead of the stack trace of the compiler. The exception of the compiler
* is saved as the cause of this exception.
*/
@ -36,7 +36,7 @@ public abstract class SourceStackTrace extends BailoutException {
private static final long serialVersionUID = 6279381376051787907L;
@Override
public final synchronized Throwable fillInStackTrace() {
public synchronized Throwable fillInStackTrace() {
assert elements != null;
setStackTrace(elements);
return this;

View File

@ -49,7 +49,7 @@ public enum HotSpotCallingConventionType implements CallingConvention.Type {
public static final Type[] VALUES = values();
private HotSpotCallingConventionType(boolean out) {
HotSpotCallingConventionType(boolean out) {
this.out = out;
}
}

View File

@ -24,6 +24,7 @@ package jdk.vm.ci.hotspot;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.code.CompiledCode;
import jdk.vm.ci.code.StackSlot;
import jdk.vm.ci.code.site.DataPatch;
import jdk.vm.ci.code.site.Infopoint;
import jdk.vm.ci.code.site.Site;
@ -99,9 +100,9 @@ public class HotSpotCompiledCode implements CompiledCode {
protected final int totalFrameSize;
/**
* Offset in bytes for the custom stack area (relative to sp).
* The deopt rescue slot. Must be non-null if there is a safepoint in the method.
*/
protected final int customStackAreaOffset;
protected final StackSlot deoptRescueSlot;
public static class Comment {
@ -115,7 +116,7 @@ public class HotSpotCompiledCode implements CompiledCode {
}
public HotSpotCompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, int customStackAreaOffset) {
int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, StackSlot deoptRescueSlot) {
this.name = name;
this.targetCode = targetCode;
this.targetCodeSize = targetCodeSize;
@ -129,7 +130,7 @@ public class HotSpotCompiledCode implements CompiledCode {
this.dataSectionPatches = dataSectionPatches;
this.isImmutablePIC = isImmutablePIC;
this.totalFrameSize = totalFrameSize;
this.customStackAreaOffset = customStackAreaOffset;
this.deoptRescueSlot = deoptRescueSlot;
assert validateFrames();
}

View File

@ -22,6 +22,7 @@
*/
package jdk.vm.ci.hotspot;
import jdk.vm.ci.code.StackSlot;
import jdk.vm.ci.code.site.DataPatch;
import jdk.vm.ci.code.site.Site;
import jdk.vm.ci.inittimer.SuppressFBWarnings;
@ -55,9 +56,9 @@ public final class HotSpotCompiledNmethod extends HotSpotCompiledCode {
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "set by the VM") private String installationFailureMessage;
public HotSpotCompiledNmethod(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, int customStackAreaOffset, HotSpotResolvedJavaMethod method, int entryBCI,
int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, StackSlot deoptRescueSlot, HotSpotResolvedJavaMethod method, int entryBCI,
int id, long jvmciEnv, boolean hasUnsafeAccess) {
super(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC, totalFrameSize, customStackAreaOffset);
super(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC, totalFrameSize, deoptRescueSlot);
this.method = method;
this.entryBCI = entryBCI;
this.id = id;

View File

@ -126,7 +126,7 @@ final class HotSpotConstantPool implements ConstantPool, HotSpotProxified, Metas
private static final int InternalMin = config().jvmConstantInternalMin;
private static final int InternalMax = config().jvmConstantInternalMax;
private JVM_CONSTANT(int tag) {
JVM_CONSTANT(int tag) {
this.tag = tag;
}
@ -171,7 +171,7 @@ final class HotSpotConstantPool implements ConstantPool, HotSpotProxified, Metas
int lastCpi = Integer.MIN_VALUE;
JavaType javaType;
public LookupTypeCacheElement(int lastCpi, JavaType javaType) {
LookupTypeCacheElement(int lastCpi, JavaType javaType) {
super();
this.lastCpi = lastCpi;
this.javaType = javaType;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,9 @@
*/
package jdk.vm.ci.hotspot;
public class HotSpotForeignCallTarget {
import jdk.vm.ci.meta.InvokeTarget;
public class HotSpotForeignCallTarget implements InvokeTarget {
/**
* The entry point address of this call's target.

View File

@ -43,6 +43,7 @@ import jdk.vm.ci.code.CompiledCode;
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.inittimer.InitTimer;
import jdk.vm.ci.inittimer.SuppressFBWarnings;
import jdk.vm.ci.meta.JVMCIMetaAccessContext;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaType;
@ -115,7 +116,7 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider, H
private boolean isDefault;
private final String help;
private Option(Class<?> type, Object defaultValue, String help) {
Option(Class<?> type, Object defaultValue, String help) {
assert Character.isUpperCase(name().charAt(0)) : "Option name must start with upper-case letter: " + name();
this.type = type;
this.value = UNINITIALIZED;
@ -123,6 +124,7 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider, H
this.help = help;
}
@SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "sentinel must be String since it's a static final in an enum")
private Object getValue() {
if (value == UNINITIALIZED) {
String propertyValue = VM.getSavedProperty(JVMCI_OPTION_PROPERTY_PREFIX + name());

View File

@ -38,7 +38,7 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider, Ho
protected final HotSpotJVMCIRuntimeProvider runtime;
public HotSpotMemoryAccessProviderImpl(HotSpotJVMCIRuntimeProvider runtime) {
HotSpotMemoryAccessProviderImpl(HotSpotJVMCIRuntimeProvider runtime) {
this.runtime = runtime;
}

View File

@ -413,7 +413,7 @@ public final class HotSpotMethodData {
private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1);
private static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(config.methodDataCountOffset);
public CounterData() {
CounterData() {
super(Tag.CounterData, COUNTER_DATA_SIZE);
}
@ -442,7 +442,7 @@ public final class HotSpotMethodData {
protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(config.jumpDataTakenOffset);
protected static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(config.jumpDataDisplacementOffset);
public JumpData() {
JumpData() {
super(Tag.JumpData, JUMP_DATA_SIZE);
}
@ -476,7 +476,7 @@ public final class HotSpotMethodData {
final long[] counts;
final long totalCount;
public RawItemProfile(int entries, T[] items, long[] counts, long totalCount) {
RawItemProfile(int entries, T[] items, long[] counts, long totalCount) {
this.entries = entries;
this.items = items;
this.counts = counts;
@ -587,7 +587,7 @@ public final class HotSpotMethodData {
private static final int TYPE_CHECK_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
public ReceiverTypeData() {
ReceiverTypeData() {
super(Tag.ReceiverTypeData, TYPE_CHECK_DATA_SIZE);
}
@ -612,7 +612,7 @@ public final class HotSpotMethodData {
private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET = TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
public VirtualCallData() {
VirtualCallData() {
super(Tag.VirtualCallData, VIRTUAL_CALL_DATA_SIZE);
}
@ -714,7 +714,7 @@ public final class HotSpotMethodData {
private static class VirtualCallTypeData extends VirtualCallData {
public VirtualCallTypeData() {
VirtualCallTypeData() {
super(Tag.VirtualCallTypeData, 0);
}
@ -730,7 +730,7 @@ public final class HotSpotMethodData {
private static final int RET_DATA_ROW_SIZE = cellsToBytes(3);
private static final int RET_DATA_SIZE = cellIndexToOffset(1) + RET_DATA_ROW_SIZE * config.bciProfileWidth;
public RetData() {
RetData() {
super(Tag.RetData, RET_DATA_SIZE);
}
}
@ -740,7 +740,7 @@ public final class HotSpotMethodData {
private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3);
private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(config.branchDataNotTakenOffset);
public BranchData() {
BranchData() {
super(Tag.BranchData, BRANCH_DATA_SIZE);
}
@ -773,7 +773,7 @@ public final class HotSpotMethodData {
private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(config.arrayDataArrayLenOffset);
protected static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(config.arrayDataArrayStartOffset);
public ArrayData(Tag tag, int staticSize) {
ArrayData(Tag tag, int staticSize) {
super(tag, staticSize);
}
@ -800,7 +800,7 @@ public final class HotSpotMethodData {
private static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0);
private static final int MULTI_BRANCH_DATA_FIRST_DISPLACEMENT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(1);
public MultiBranchData() {
MultiBranchData() {
super(Tag.MultiBranchData, MULTI_BRANCH_DATA_SIZE);
}
@ -882,13 +882,13 @@ public final class HotSpotMethodData {
private static final int ARG_INFO_DATA_SIZE = cellIndexToOffset(1);
public ArgInfoData() {
ArgInfoData() {
super(Tag.ArgInfoData, ARG_INFO_DATA_SIZE);
}
}
private static class UnknownProfileData extends AbstractMethodData {
public UnknownProfileData(Tag tag) {
UnknownProfileData(Tag tag) {
super(tag, 0);
}

View File

@ -56,7 +56,7 @@ public interface HotSpotMethodDataAccessor {
private final int value;
private Tag(int value) {
Tag(int value) {
this.value = value;
}

View File

@ -34,7 +34,7 @@ final class HotSpotMethodUnresolved extends HotSpotMethod {
private final Signature signature;
protected JavaType holder;
public HotSpotMethodUnresolved(String name, Signature signature, JavaType holder) {
HotSpotMethodUnresolved(String name, Signature signature, JavaType holder) {
super(name);
this.holder = holder;
this.signature = signature;

View File

@ -56,7 +56,7 @@ class HotSpotResolvedJavaFieldImpl implements HotSpotResolvedJavaField, HotSpotP
public static class FieldLocationIdentity extends LocationIdentity {
HotSpotResolvedJavaField inner;
public FieldLocationIdentity(HotSpotResolvedJavaFieldImpl inner) {
FieldLocationIdentity(HotSpotResolvedJavaFieldImpl inner) {
this.inner = inner;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -597,7 +597,7 @@ final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSp
}
HotSpotVMConfig config = config();
final int vtableIndex = getVtableIndex((HotSpotResolvedObjectTypeImpl) resolved);
return config.instanceKlassVtableStartOffset() + vtableIndex * config.vtableEntrySize + config.vtableEntryMethodOffset;
return config.klassVtableStartOffset + vtableIndex * config.vtableEntrySize + config.vtableEntryMethodOffset;
}
@Override

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,6 @@ import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
@ -49,7 +48,6 @@ import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaType;
import jdk.vm.ci.meta.MetaUtil;
import jdk.vm.ci.meta.ModifiersProvider;
import jdk.vm.ci.meta.ResolvedJavaField;
import jdk.vm.ci.meta.ResolvedJavaMethod;
@ -472,8 +470,8 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem
/* Everything has the core vtable of java.lang.Object */
return config.baseVtableLength();
}
int result = UNSAFE.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) / (config.vtableEntrySize / config.heapWordSize);
assert result >= config.baseVtableLength() : UNSAFE.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) + " " + config.vtableEntrySize;
int result = UNSAFE.getInt(getMetaspaceKlass() + config.klassVtableLengthOffset) / (config.vtableEntrySize / config.heapWordSize);
assert result >= config.baseVtableLength() : UNSAFE.getInt(getMetaspaceKlass() + config.klassVtableLengthOffset) + " " + config.vtableEntrySize;
return result;
}
@ -555,7 +553,7 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem
*
* @param index index to the fields array
*/
public FieldInfo(int index) {
FieldInfo(int index) {
HotSpotVMConfig config = config();
// Get Klass::_fields
final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset);
@ -838,12 +836,6 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem
return null;
}
@Override
public URL getClassFilePath() {
Class<?> cls = mirror();
return cls.getResource(MetaUtil.getSimpleName(cls, true).replace('.', '$') + ".class");
}
@Override
public boolean isLocal() {
return mirror().isLocalClass();

View File

@ -27,7 +27,6 @@ import static java.util.Objects.requireNonNull;
import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.lang.reflect.Modifier;
import java.net.URL;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.meta.Assumptions.AssumptionResult;
@ -239,11 +238,6 @@ public final class HotSpotResolvedPrimitiveType extends HotSpotResolvedJavaType
return kind.toJavaClass();
}
@Override
public URL getClassFilePath() {
return null;
}
@Override
public boolean isLocal() {
return false;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -360,7 +360,7 @@ public class HotSpotVMConfig {
private final long address;
public VMFields(long address) {
VMFields(long address) {
this.address = address;
}
@ -477,7 +477,7 @@ public class HotSpotVMConfig {
private final long address;
public VMTypes(long address) {
VMTypes(long address) {
this.address = address;
}
@ -580,7 +580,7 @@ public class HotSpotVMConfig {
private final long address;
public VMIntConstants(long address) {
VMIntConstants(long address) {
this.address = address;
}
@ -639,7 +639,7 @@ public class HotSpotVMConfig {
private final long address;
public VMLongConstants(long address) {
VMLongConstants(long address) {
this.address = address;
}
@ -698,7 +698,7 @@ public class HotSpotVMConfig {
private final long address;
public VMAddresses(long address) {
VMAddresses(long address) {
this.address = address;
}
@ -753,7 +753,7 @@ public class HotSpotVMConfig {
private final long nameOffset;
private final long addrOffset;
public Flags(HashMap<String, VMFields.Field> vmStructs, HashMap<String, VMTypes.Type> vmTypes) {
Flags(HashMap<String, VMFields.Field> vmStructs, HashMap<String, VMTypes.Type> vmTypes) {
address = vmStructs.get("Flag::flags").getValue();
entrySize = vmTypes.get("Flag").getSize();
typeOffset = vmStructs.get("Flag::_type").getOffset();
@ -1031,19 +1031,12 @@ public class HotSpotVMConfig {
@HotSpotVMField(name = "InstanceKlass::_init_state", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassInitStateOffset;
@HotSpotVMField(name = "InstanceKlass::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassConstantsOffset;
@HotSpotVMField(name = "InstanceKlass::_fields", type = "Array<u2>*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassFieldsOffset;
@HotSpotVMField(name = "CompilerToVM::Data::InstanceKlass_vtable_start_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int instanceKlassVtableStartOffset;
@HotSpotVMField(name = "CompilerToVM::Data::InstanceKlass_vtable_length_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int instanceKlassVtableLengthOffset;
@HotSpotVMField(name = "CompilerToVM::Data::Klass_vtable_start_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int klassVtableStartOffset;
@HotSpotVMField(name = "CompilerToVM::Data::Klass_vtable_length_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int klassVtableLengthOffset;
@HotSpotVMConstant(name = "InstanceKlass::linked") @Stable public int instanceKlassStateLinked;
@HotSpotVMConstant(name = "InstanceKlass::fully_initialized") @Stable public int instanceKlassStateFullyInitialized;
/**
* See {@code InstanceKlass::vtable_start_offset()}.
*/
public final int instanceKlassVtableStartOffset() {
return instanceKlassVtableStartOffset * heapWordSize;
}
@HotSpotVMType(name = "arrayOopDesc", get = HotSpotVMType.Type.SIZE) @Stable public int arrayOopDescSize;
/**

View File

@ -59,7 +59,7 @@ public enum DeoptimizationAction {
private final boolean invalidatesCompilation;
private DeoptimizationAction(boolean invalidatesCompilation) {
DeoptimizationAction(boolean invalidatesCompilation) {
this.invalidatesCompilation = invalidatesCompilation;
}

View File

@ -72,7 +72,7 @@ public enum JavaKind {
private final Class<?> boxedJavaClass;
private final int slotCount;
private JavaKind(char typeChar, String javaName, int slotCount, boolean isStackInt, Class<?> primitiveJavaClass, Class<?> boxedJavaClass) {
JavaKind(char typeChar, String javaName, int slotCount, boolean isStackInt, Class<?> primitiveJavaClass, Class<?> boxedJavaClass) {
this.typeChar = typeChar;
this.javaName = javaName;
this.slotCount = slotCount;

View File

@ -57,7 +57,7 @@ import java.util.ArrayList;
*/
public final class LIRKind {
private static enum IllegalKind implements PlatformKind {
private enum IllegalKind implements PlatformKind {
ILLEGAL;
private final EnumKey<IllegalKind> key = new EnumKey<>(this);

View File

@ -35,7 +35,7 @@ public interface MethodHandleAccessProvider {
* Identification for methods defined on the class {@link MethodHandle} that are processed by
* the {@link MethodHandleAccessProvider}.
*/
public enum IntrinsicMethod {
enum IntrinsicMethod {
/** The method {@code MethodHandle.invokeBasic}. */
INVOKE_BASIC,
/** The method {@code MethodHandle.linkToStatic}. */

View File

@ -33,7 +33,7 @@ public interface PlatformKind {
}
public class EnumKey<E extends Enum<E>> implements Key {
class EnumKey<E extends Enum<E>> implements Key {
private final Enum<E> e;
public EnumKey(Enum<E> e) {

View File

@ -23,7 +23,6 @@
package jdk.vm.ci.meta;
import java.lang.annotation.Annotation;
import java.net.URL;
import jdk.vm.ci.meta.Assumptions.AssumptionResult;
@ -307,11 +306,6 @@ public interface ResolvedJavaType extends JavaType, ModifiersProvider {
*/
String getSourceFileName();
/**
* Returns the class file path - if available - of this type, or {@code null}.
*/
URL getClassFilePath();
/**
* Returns {@code true} if the type is a local type.
*/

View File

@ -47,13 +47,13 @@ public enum SPARCKind implements PlatformKind {
private final SPARCKind scalar;
private final EnumKey<SPARCKind> key = new EnumKey<>(this);
private SPARCKind(int size) {
SPARCKind(int size) {
this.size = size;
this.scalar = this;
this.vectorLength = 1;
}
private SPARCKind(int size, SPARCKind scalar) {
SPARCKind(int size, SPARCKind scalar) {
this.size = size;
this.scalar = scalar;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,7 +48,10 @@
"Load DLLs with executable-stack attribute in the VM Thread") \
\
product(bool, UseSHM, false, \
"Use SYSV shared memory for large pages")
"Use SYSV shared memory for large pages") \
\
diagnostic(bool, UseCpuAllocPath, false, \
"Use CPU_ALLOC code path in os::active_processor_count ")
//
// Defines Linux-specific default values. The flags are available on all

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,7 @@
#include "compiler/disassembler.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm_linux.h"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/filemap.hpp"
#include "mutex_linux.inline.hpp"
@ -106,6 +107,14 @@
# include <inttypes.h>
# include <sys/ioctl.h>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#include <sched.h>
#undef _GNU_SOURCE
#else
#include <sched.h>
#endif
// if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling
// getrusage() is prepared to handle the associated failure.
#ifndef RUSAGE_THREAD
@ -4762,12 +4771,72 @@ void os::make_polling_page_readable(void) {
}
}
// Get the current number of available processors for this process.
// This value can change at any time during a process's lifetime.
// sched_getaffinity gives an accurate answer as it accounts for cpusets.
// If it appears there may be more than 1024 processors then we do a
// dynamic check - see 6515172 for details.
// If anything goes wrong we fallback to returning the number of online
// processors - which can be greater than the number available to the process.
int os::active_processor_count() {
// Linux doesn't yet have a (official) notion of processor sets,
// so just return the number of online processors.
int online_cpus = ::sysconf(_SC_NPROCESSORS_ONLN);
assert(online_cpus > 0 && online_cpus <= processor_count(), "sanity check");
return online_cpus;
cpu_set_t cpus; // can represent at most 1024 (CPU_SETSIZE) processors
cpu_set_t* cpus_p = &cpus;
int cpus_size = sizeof(cpu_set_t);
int configured_cpus = processor_count(); // upper bound on available cpus
int cpu_count = 0;
// To enable easy testing of the dynamic path on different platforms we
// introduce a diagnostic flag: UseCpuAllocPath
if (configured_cpus >= CPU_SETSIZE || UseCpuAllocPath) {
// kernel may use a mask bigger than cpu_set_t
log_trace(os)("active_processor_count: using dynamic path %s"
"- configured processors: %d",
UseCpuAllocPath ? "(forced) " : "",
configured_cpus);
cpus_p = CPU_ALLOC(configured_cpus);
if (cpus_p != NULL) {
cpus_size = CPU_ALLOC_SIZE(configured_cpus);
// zero it just to be safe
CPU_ZERO_S(cpus_size, cpus_p);
}
else {
// failed to allocate so fallback to online cpus
int online_cpus = ::sysconf(_SC_NPROCESSORS_ONLN);
log_trace(os)("active_processor_count: "
"CPU_ALLOC failed (%s) - using "
"online processor count: %d",
strerror(errno), online_cpus);
return online_cpus;
}
}
else {
log_trace(os)("active_processor_count: using static path - configured processors: %d",
configured_cpus);
}
// pid 0 means the current thread - which we have to assume represents the process
if (sched_getaffinity(0, cpus_size, cpus_p) == 0) {
if (cpus_p != &cpus) {
cpu_count = CPU_COUNT_S(cpus_size, cpus_p);
}
else {
cpu_count = CPU_COUNT(cpus_p);
}
log_trace(os)("active_processor_count: sched_getaffinity processor count: %d", cpu_count);
}
else {
cpu_count = ::sysconf(_SC_NPROCESSORS_ONLN);
warning("sched_getaffinity failed (%s)- using online processor count (%d) "
"which may exceed available processors", strerror(errno), cpu_count);
}
if (cpus_p != &cpus) {
CPU_FREE(cpus_p);
}
assert(cpu_count > 0 && cpu_count <= processor_count(), "sanity check");
return cpu_count;
}
void os::set_native_thread_name(const char *name) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -5267,8 +5267,29 @@ bool os::check_heap(bool force) {
bool os::find(address addr, outputStream* st) {
// Nothing yet
return false;
int offset = -1;
bool result = false;
char buf[256];
if (os::dll_address_to_library_name(addr, buf, sizeof(buf), &offset)) {
st->print(PTR_FORMAT " ", addr);
if (strlen(buf) < sizeof(buf) - 1) {
char* p = strrchr(buf, '\\');
if (p) {
st->print("%s", p + 1);
} else {
st->print("%s", buf);
}
} else {
// The library name is probably truncated. Let's omit the library name.
// See also JDK-8147512.
}
if (os::dll_address_to_function_name(addr, buf, sizeof(buf), &offset)) {
st->print("::%s + 0x%x", buf, offset);
}
st->cr();
result = true;
}
return result;
}
LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) {

View File

@ -599,6 +599,7 @@ void os::print_register_info(outputStream *st, const void *context) {
// this is only for the "general purpose" registers
#ifdef AMD64
st->print("RIP="); print_location(st, uc->Rip);
st->print("RAX="); print_location(st, uc->Rax);
st->print("RBX="); print_location(st, uc->Rbx);
st->print("RCX="); print_location(st, uc->Rcx);
@ -616,6 +617,7 @@ void os::print_register_info(outputStream *st, const void *context) {
st->print("R14="); print_location(st, uc->R14);
st->print("R15="); print_location(st, uc->R15);
#else
st->print("EIP="); print_location(st, uc->Eip);
st->print("EAX="); print_location(st, uc->Eax);
st->print("EBX="); print_location(st, uc->Ebx);
st->print("ECX="); print_location(st, uc->Ecx);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -2972,8 +2972,8 @@ void LIRGenerator::do_Invoke(Invoke* x) {
SharedRuntime::get_resolve_virtual_call_stub(),
arg_list, info);
} else {
int entry_offset = InstanceKlass::vtable_start_offset() + x->vtable_index() * vtableEntry::size();
int vtable_offset = entry_offset * wordSize + vtableEntry::method_offset_in_bytes();
int entry_offset = in_bytes(Klass::vtable_start_offset()) + x->vtable_index() * vtableEntry::size_in_bytes();
int vtable_offset = entry_offset + vtableEntry::method_offset_in_bytes();
__ call_virtual(target, receiver, result_register, vtable_offset, arg_list, info);
}
break;

View File

@ -34,6 +34,7 @@
#include "classfile/verifier.hpp"
#include "classfile/vmSymbols.hpp"
#include "gc/shared/gcLocker.hpp"
#include "logging/log.hpp"
#include "memory/allocation.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/oopFactory.hpp"
@ -79,7 +80,7 @@
#define JAVA_CLASSFILE_MAGIC 0xCAFEBABE
#define JAVA_MIN_SUPPORTED_VERSION 45
#define JAVA_MAX_SUPPORTED_VERSION 52
#define JAVA_MAX_SUPPORTED_VERSION 53
#define JAVA_MAX_SUPPORTED_MINOR_VERSION 0
// Used for two backward compatibility reasons:
@ -100,6 +101,8 @@
// Extension method support.
#define JAVA_8_VERSION 52
#define JAVA_9_VERSION 53
enum { LegalClass, LegalField, LegalMethod }; // used to verify unqualified names
void ClassFileParser::parse_constant_pool_entries(const ClassFileStream* const stream,
@ -2705,7 +2708,7 @@ Method* ClassFileParser::parse_method(const ClassFileStream* const cfs,
ConstMethod::NORMAL,
CHECK_NULL);
ClassLoadingService::add_class_method_size(m->size()*HeapWordSize);
ClassLoadingService::add_class_method_size(m->size()*wordSize);
// Fill in information from fixed part (access_flags already set)
m->set_constants(_cp);
@ -4602,8 +4605,8 @@ void ClassFileParser::verify_legal_method_modifiers(jint flags,
}
} else if (major_gte_15) {
// Class file version in the interval [JAVA_1_5_VERSION, JAVA_8_VERSION)
if (!is_public || is_static || is_final || is_synchronized ||
is_native || !is_abstract || is_strict) {
if (!is_public || is_private || is_protected || is_static || is_final ||
is_synchronized || is_native || !is_abstract || is_strict) {
is_illegal = true;
}
} else {
@ -5347,30 +5350,12 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, TRAPS) {
ClassLoadingService::notify_class_loaded(ik, false /* not shared class */);
if (!is_internal()) {
if (TraceClassLoading) {
ResourceMark rm;
// print in a single call to reduce interleaving of output
if (_stream->source() != NULL) {
tty->print("[Loaded %s from %s]\n",
ik->external_name(),
_stream->source());
} else if (_loader_data->class_loader() == NULL) {
const Klass* const caller =
THREAD->is_Java_thread()
? ((JavaThread*)THREAD)->security_get_caller_class(1)
: NULL;
// caller can be NULL, for example, during a JVMTI VM_Init hook
if (caller != NULL) {
tty->print("[Loaded %s by instance of %s]\n",
ik->external_name(),
caller->external_name());
} else {
tty->print("[Loaded %s]\n", ik->external_name());
}
} else {
tty->print("[Loaded %s from %s]\n", ik->external_name(),
_loader_data->class_loader()->klass()->external_name());
}
if (log_is_enabled(Info, classload)) {
ik->print_loading_log(LogLevel::Info, _loader_data, _stream);
}
// No 'else' here as logging levels are not mutually exclusive
if (log_is_enabled(Debug, classload)) {
ik->print_loading_log(LogLevel::Debug, _loader_data, _stream);
}
if (log_is_enabled(Info, classresolve)) {

View File

@ -578,15 +578,14 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
}
}
}
if (TraceClassLoading || TraceClassPaths) {
if (TraceClassPaths) {
tty->print_cr("[Opened %s]", path);
}
log_info(classload)("opened: %s", path);
} else {
// Directory
new_entry = new ClassPathDirEntry(path);
if (TraceClassLoading) {
tty->print_cr("[Path %s]", path);
}
log_info(classload)("path: %s", path);
}
return new_entry;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -54,12 +54,14 @@
#include "classfile/systemDictionary.hpp"
#include "code/codeCache.hpp"
#include "gc/shared/gcLocker.hpp"
#include "logging/log.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/oopFactory.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/atomic.inline.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jniHandles.hpp"
#include "runtime/mutex.hpp"
#include "runtime/safepoint.hpp"
@ -286,9 +288,9 @@ void ClassLoaderData::add_class(Klass* k, bool publicize /* true */) {
_klasses = k;
}
if (publicize && TraceClassLoaderData && Verbose && k->class_loader_data() != NULL) {
if (publicize && k->class_loader_data() != NULL) {
ResourceMark rm;
tty->print_cr("[TraceClassLoaderData] Adding k: " PTR_FORMAT " %s to CLD: "
log_trace(classloaderdata)("Adding k: " PTR_FORMAT " %s to CLD: "
PTR_FORMAT " loader: " PTR_FORMAT " %s",
p2i(k),
k->external_name(),
@ -326,15 +328,16 @@ void ClassLoaderData::unload() {
// Tell serviceability tools these classes are unloading
classes_do(InstanceKlass::notify_unload_class);
if (TraceClassLoaderData) {
if (log_is_enabled(Debug, classloaderdata)) {
ResourceMark rm;
tty->print("[ClassLoaderData: unload loader data " INTPTR_FORMAT, p2i(this));
tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)class_loader()),
outputStream* log = LogHandle(classloaderdata)::debug_stream();
log->print(": unload loader data " INTPTR_FORMAT, p2i(this));
log->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)class_loader()),
loader_name());
if (is_anonymous()) {
tty->print(" for anonymous class " INTPTR_FORMAT " ", p2i(_klasses));
log->print(" for anonymous class " INTPTR_FORMAT " ", p2i(_klasses));
}
tty->print_cr("]");
log->cr();
}
}
@ -408,13 +411,13 @@ Metaspace* ClassLoaderData::metaspace_non_null() {
assert (class_loader() == NULL, "Must be");
set_metaspace(new Metaspace(_metaspace_lock, Metaspace::BootMetaspaceType));
} else if (is_anonymous()) {
if (TraceClassLoaderData && Verbose && class_loader() != NULL) {
tty->print_cr("is_anonymous: %s", class_loader()->klass()->internal_name());
if (class_loader() != NULL) {
log_trace(classloaderdata)("is_anonymous: %s", class_loader()->klass()->internal_name());
}
set_metaspace(new Metaspace(_metaspace_lock, Metaspace::AnonymousMetaspaceType));
} else if (class_loader()->is_a(SystemDictionary::reflect_DelegatingClassLoader_klass())) {
if (TraceClassLoaderData && Verbose && class_loader() != NULL) {
tty->print_cr("is_reflection: %s", class_loader()->klass()->internal_name());
if (class_loader() != NULL) {
log_trace(classloaderdata)("is_reflection: %s", class_loader()->klass()->internal_name());
}
set_metaspace(new Metaspace(_metaspace_lock, Metaspace::ReflectionMetaspaceType));
} else {
@ -601,21 +604,47 @@ ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_anonymous, TRA
cld->set_next(next);
ClassLoaderData* exchanged = (ClassLoaderData*)Atomic::cmpxchg_ptr(cld, list_head, next);
if (exchanged == next) {
if (TraceClassLoaderData) {
ResourceMark rm;
tty->print("[ClassLoaderData: ");
tty->print("create class loader data " INTPTR_FORMAT, p2i(cld));
tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()),
cld->loader_name());
tty->print_cr("]");
if (log_is_enabled(Debug, classloaderdata)) {
PauseNoSafepointVerifier pnsv(&no_safepoints); // Need safe points for JavaCalls::call_virtual
log_creation(loader, cld, CHECK_NULL);
}
return cld;
}
next = exchanged;
} while (true);
}
void ClassLoaderDataGraph::log_creation(Handle loader, ClassLoaderData* cld, TRAPS) {
Handle string;
if (loader.not_null()) {
// Include the result of loader.toString() in the output. This allows
// the user of the log to identify the class loader instance.
JavaValue result(T_OBJECT);
KlassHandle spec_klass(THREAD, SystemDictionary::ClassLoader_klass());
JavaCalls::call_virtual(&result,
loader,
spec_klass,
vmSymbols::toString_name(),
vmSymbols::void_string_signature(),
CHECK);
assert(result.get_type() == T_OBJECT, "just checking");
string = (oop)result.get_jobject();
}
ResourceMark rm;
outputStream* log = LogHandle(classloaderdata)::debug_stream();
log->print("create class loader data " INTPTR_FORMAT, p2i(cld));
log->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()),
cld->loader_name());
if (string.not_null()) {
log->print(": ");
java_lang_String::print(string(), log);
}
log->cr();
}
void ClassLoaderDataGraph::oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) {
for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
cld->oops_do(f, klass_closure, must_claim);
@ -709,10 +738,11 @@ GrowableArray<ClassLoaderData*>* ClassLoaderDataGraph::new_clds() {
if (!curr->claimed()) {
array->push(curr);
if (TraceClassLoaderData) {
tty->print("[ClassLoaderData] found new CLD: ");
curr->print_value_on(tty);
tty->cr();
if (log_is_enabled(Debug, classloaderdata)) {
outputStream* log = LogHandle(classloaderdata)::debug_stream();
log->print("found new CLD: ");
curr->print_value_on(log);
log->cr();
}
}

View File

@ -116,6 +116,7 @@ class ClassLoaderDataGraph : public AllStatic {
static void dump_on(outputStream * const out) PRODUCT_RETURN;
static void dump() { dump_on(tty); }
static void verify();
static void log_creation(Handle loader, ClassLoaderData* cld, TRAPS);
static bool unload_list_contains(const void* x);
#ifndef PRODUCT

View File

@ -365,14 +365,14 @@ bool HashtableTextDump::skip_newline() {
}
int HashtableTextDump::skip(char must_be_char) {
corrupted_if(remain() < 1);
corrupted_if(*_p++ != must_be_char);
corrupted_if(remain() < 1, "Truncated");
corrupted_if(*_p++ != must_be_char, "Unexpected character");
return 0;
}
void HashtableTextDump::skip_past(char c) {
for (;;) {
corrupted_if(remain() < 1);
corrupted_if(remain() < 1, "Truncated");
if (*_p++ == c) {
return;
}
@ -381,7 +381,7 @@ void HashtableTextDump::skip_past(char c) {
void HashtableTextDump::check_version(const char* ver) {
int len = (int)strlen(ver);
corrupted_if(remain() < len);
corrupted_if(remain() < len, "Truncated");
if (strncmp(_p, ver, len) != 0) {
quit("wrong version of hashtable dump file", _filename);
}
@ -451,7 +451,7 @@ int HashtableTextDump::scan_symbol_prefix() {
jchar HashtableTextDump::unescape(const char* from, const char* end, int count) {
jchar value = 0;
corrupted_if(from + count > end);
corrupted_if(from + count > end, "Truncated");
for (int i=0; i<count; i++) {
char c = *from++;
@ -486,7 +486,7 @@ void HashtableTextDump::get_utf8(char* utf8_buffer, int utf8_length) {
if (*from != '\\') {
*to++ = *from++;
} else {
corrupted_if(from + 2 > end);
corrupted_if(from + 2 > end, "Truncated");
char c = from[1];
from += 2;
switch (c) {
@ -507,7 +507,7 @@ void HashtableTextDump::get_utf8(char* utf8_buffer, int utf8_length) {
}
}
}
corrupted_if(n > 0); // expected more chars but file has ended
corrupted_if(n > 0, "Truncated"); // expected more chars but file has ended
_p = from;
skip_newline();
}

View File

@ -276,9 +276,9 @@ public:
void corrupted(const char *p, const char *msg);
inline void corrupted_if(bool cond) {
inline void corrupted_if(bool cond, const char *msg) {
if (cond) {
corrupted(_p, NULL);
corrupted(_p, msg);
}
}
@ -287,27 +287,30 @@ public:
void skip_past(char c);
void check_version(const char* ver);
inline bool get_num(char delim, int *utf8_length) {
inline void get_num(char delim, int *num) {
const char* p = _p;
const char* end = _end;
int num = 0;
u8 n = 0;
while (p < end) {
char c = *p ++;
if ('0' <= c && c <= '9') {
num = num * 10 + (c - '0');
n = n * 10 + (c - '0');
if (n > (u8)INT_MAX) {
corrupted(_p, "Num overflow");
}
} else if (c == delim) {
_p = p;
*utf8_length = num;
return true;
*num = (int)n;
return;
} else {
// Not [0-9], not 'delim'
return false;
corrupted(_p, "Unrecognized format");;
}
}
corrupted(_end, "Incorrect format");
ShouldNotReachHere();
return false;
}
void scan_prefix_type();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -129,7 +129,7 @@ compute_offset(int &dest_offset,
tty->print_cr(" name: %s, sig: %s, flags: %08x", fs.name()->as_C_string(), fs.signature()->as_C_string(), fs.access_flags().as_int());
}
#endif //PRODUCT
vm_exit_during_initialization("Invalid layout of preloaded class: use -XX:+TraceClassLoading to see the origin of the problem class");
vm_exit_during_initialization("Invalid layout of preloaded class: use -Xlog:classload=info to see the origin of the problem class");
}
dest_offset = fd.offset();
}
@ -3972,7 +3972,7 @@ int InjectedField::compute_offset() {
tty->print_cr(" name: %s, sig: %s, flags: %08x", fs.name()->as_C_string(), fs.signature()->as_C_string(), fs.access_flags().as_int());
}
#endif //PRODUCT
vm_exit_during_initialization("Invalid layout of preloaded class: use -XX:+TraceClassLoading to see the origin of the problem class");
vm_exit_during_initialization("Invalid layout of preloaded class: use -Xlog:classload=info to see the origin of the problem class");
return -1;
}

View File

@ -737,7 +737,7 @@ bool StringTable::copy_compact_table(char** top, char *end, GrowableArray<MemReg
return false;
}
ch_table.dump(top, end);
*top = (char*)align_pointer_up(*top, sizeof(void*));
*top = (char*)align_ptr_up(*top, sizeof(void*));
#endif
return true;
@ -760,7 +760,7 @@ const char* StringTable::init_shared_table(FileMapInfo *mapinfo, char *buffer) {
juint *p = (juint*)buffer;
const char* end = _shared_table.init(
CompactHashtable<oop, char>::_string_table, (char*)p);
const char* aligned_end = (const char*)align_pointer_up(end, sizeof(void*));
const char* aligned_end = (const char*)align_ptr_up(end, sizeof(void*));
if (_ignore_shared_strings) {
_shared_table.reset();

View File

@ -544,7 +544,7 @@ bool SymbolTable::copy_compact_table(char** top, char*end) {
ch_table.dump(top, end);
*top = (char*)align_pointer_up(*top, sizeof(void*));
*top = (char*)align_ptr_up(*top, sizeof(void*));
#endif
return true;
}
@ -552,7 +552,7 @@ bool SymbolTable::copy_compact_table(char** top, char*end) {
const char* SymbolTable::init_shared_table(const char* buffer) {
const char* end = _shared_table.init(
CompactHashtable<Symbol*, char>::_symbol_table, buffer);
return (const char*)align_pointer_up(end, sizeof(void*));
return (const char*)align_ptr_up(end, sizeof(void*));
}
//---------------------------------------------------------------------------
@ -600,7 +600,7 @@ void SymbolTable::print_histogram() {
tty->print_cr("Symbol Table Histogram:");
tty->print_cr(" Total number of symbols %7d", total_count);
tty->print_cr(" Total size in memory %7dK",
(total_size*HeapWordSize)/1024);
(total_size*wordSize)/1024);
tty->print_cr(" Total counted %7d", _symbols_counted);
tty->print_cr(" Total removed %7d", _symbols_removed);
if (_symbols_counted > 0) {
@ -617,11 +617,11 @@ void SymbolTable::print_histogram() {
tty->print_cr(" %6s %10s %10s", "Length", "#Symbols", "Size");
for (i = 0; i < results_length; i++) {
if (counts[i] > 0) {
tty->print_cr(" %6d %10d %10dK", i, counts[i], (sizes[i]*HeapWordSize)/1024);
tty->print_cr(" %6d %10d %10dK", i, counts[i], (sizes[i]*wordSize)/1024);
}
}
tty->print_cr(" >=%6d %10d %10dK\n", results_length,
out_of_range_count, (out_of_range_size*HeapWordSize)/1024);
out_of_range_count, (out_of_range_size*wordSize)/1024);
}
void SymbolTable::print() {

View File

@ -1302,14 +1302,13 @@ instanceKlassHandle SystemDictionary::load_shared_class(instanceKlassHandle ik,
ik->restore_unshareable_info(loader_data, protection_domain, CHECK_(nh));
}
if (TraceClassLoading) {
ResourceMark rm;
tty->print("[Loaded %s", ik->external_name());
tty->print(" from shared objects file");
if (class_loader.not_null()) {
tty->print(" by %s", loader_data->loader_name());
}
tty->print_cr("]");
if (log_is_enabled(Info, classload)) {
ik()->print_loading_log(LogLevel::Info, loader_data, NULL);
}
// No 'else' here as logging levels are not mutually exclusive
if (log_is_enabled(Debug, classload)) {
ik()->print_loading_log(LogLevel::Debug, loader_data, NULL);
}
if (DumpLoadedClassList != NULL && classlist_file->is_open()) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -651,6 +651,7 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
int ex_max = -1;
// Look through each item on the exception table. Each of the fields must refer
// to a legal instruction.
if (was_recursively_verified()) return;
verify_exception_handler_table(
code_length, code_data, ex_min, ex_max, CHECK_VERIFY(this));
@ -737,11 +738,14 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
// should be used for this check. So, do the check here before a possible
// local is added to the type state.
if (Bytecodes::is_store_into_local(opcode) && bci >= ex_min && bci < ex_max) {
if (was_recursively_verified()) return;
verify_exception_handler_targets(
bci, this_uninit, &current_frame, &stackmap_table, CHECK_VERIFY(this));
verified_exc_handlers = true;
}
if (was_recursively_verified()) return;
switch (opcode) {
case Bytecodes::_nop :
no_control_flow = false; break;
@ -1730,6 +1734,7 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
assert(!(verified_exc_handlers && this_uninit),
"Exception handler targets got verified before this_uninit got set");
if (!verified_exc_handlers && bci >= ex_min && bci < ex_max) {
if (was_recursively_verified()) return;
verify_exception_handler_targets(
bci, this_uninit, &current_frame, &stackmap_table, CHECK_VERIFY(this));
}
@ -1767,6 +1772,9 @@ char* ClassVerifier::generate_code_data(const methodHandle& m, u4 code_length, T
return code_data;
}
// Since this method references the constant pool, call was_recursively_verified()
// before calling this method to make sure a prior class load did not cause the
// current class to get verified.
void ClassVerifier::verify_exception_handler_table(u4 code_length, char* code_data, int& min, int& max, TRAPS) {
ExceptionTable exhandlers(_method());
int exlength = exhandlers.length();
@ -1874,7 +1882,11 @@ u2 ClassVerifier::verify_stackmap_table(u2 stackmap_index, u2 bci,
return stackmap_index;
}
void ClassVerifier::verify_exception_handler_targets(u2 bci, bool this_uninit, StackMapFrame* current_frame,
// Since this method references the constant pool, call was_recursively_verified()
// before calling this method to make sure a prior class load did not cause the
// current class to get verified.
void ClassVerifier::verify_exception_handler_targets(u2 bci, bool this_uninit,
StackMapFrame* current_frame,
StackMapTable* stackmap_table, TRAPS) {
constantPoolHandle cp (THREAD, _method->constants());
ExceptionTable exhandlers(_method());
@ -1889,6 +1901,7 @@ void ClassVerifier::verify_exception_handler_targets(u2 bci, bool this_uninit, S
if (this_uninit) { flags |= FLAG_THIS_UNINIT; }
StackMapFrame* new_frame = current_frame->frame_in_exception_handler(flags);
if (catch_type_index != 0) {
if (was_recursively_verified()) return;
// We know that this index refers to a subclass of Throwable
VerificationType catch_type = cp_index_to_type(
catch_type_index, cp, CHECK_VERIFY(this));
@ -2269,6 +2282,7 @@ void ClassVerifier::verify_field_instructions(RawBytecodeStream* bcs,
check_protected: {
if (_this_type == stack_object_type)
break; // stack_object_type must be assignable to _current_class_type
if (was_recursively_verified()) return;
Symbol* ref_class_name =
cp->klass_name_at(cp->klass_ref_index_at(index));
if (!name_in_supers(ref_class_name, current_class()))
@ -2531,6 +2545,7 @@ void ClassVerifier::verify_invoke_init(
// Check the exception handler target stackmaps with the locals from the
// incoming stackmap (before initialize_object() changes them to outgoing
// state).
if (was_recursively_verified()) return;
verify_exception_handler_targets(bci, true, current_frame,
stackmap_table, CHECK_VERIFY(this));
} // in_try_block
@ -2548,6 +2563,7 @@ void ClassVerifier::verify_invoke_init(
return;
}
u2 new_class_index = Bytes::get_Java_u2(new_bcp + 1);
if (was_recursively_verified()) return;
verify_cp_class_type(bci, new_class_index, cp, CHECK_VERIFY(this));
// The method must be an <init> method of the indicated class
@ -2567,6 +2583,7 @@ void ClassVerifier::verify_invoke_init(
VerificationType objectref_type = new_class_type;
if (name_in_supers(ref_class_type.name(), current_class())) {
Klass* ref_klass = load_class(ref_class_type.name(), CHECK);
if (was_recursively_verified()) return;
Method* m = InstanceKlass::cast(ref_klass)->uncached_lookup_method(
vmSymbols::object_initializer_name(),
cp->signature_ref_at(bcs->get_index_u2()),
@ -2591,6 +2608,7 @@ void ClassVerifier::verify_invoke_init(
// incoming stackmap (before initialize_object() changes them to outgoing
// state).
if (in_try_block) {
if (was_recursively_verified()) return;
verify_exception_handler_targets(bci, *this_uninit, current_frame,
stackmap_table, CHECK_VERIFY(this));
}
@ -2791,6 +2809,7 @@ void ClassVerifier::verify_invoke_instructions(
verify_invoke_init(bcs, index, ref_class_type, current_frame,
code_length, in_try_block, this_uninit, cp, stackmap_table,
CHECK_VERIFY(this));
if (was_recursively_verified()) return;
} else { // other methods
// Ensures that target class is assignable to method class.
if (opcode == Bytecodes::_invokespecial) {
@ -2816,6 +2835,7 @@ void ClassVerifier::verify_invoke_instructions(
VerificationType stack_object_type =
current_frame->pop_stack(ref_class_type, CHECK_VERIFY(this));
if (current_type() != stack_object_type) {
if (was_recursively_verified()) return;
assert(cp->cache() == NULL, "not rewritten yet");
Symbol* ref_class_name =
cp->klass_name_at(cp->klass_ref_index_at(index));
@ -2894,6 +2914,7 @@ void ClassVerifier::verify_anewarray(
current_frame->pop_stack(
VerificationType::integer_type(), CHECK_VERIFY(this));
if (was_recursively_verified()) return;
VerificationType component_type =
cp_index_to_type(index, cp, CHECK_VERIFY(this));
int length;

View File

@ -109,13 +109,13 @@
template(java_io_ByteArrayInputStream, "java/io/ByteArrayInputStream") \
template(java_io_Serializable, "java/io/Serializable") \
template(java_util_Arrays, "java/util/Arrays") \
template(java_util_Objects, "java/util/Objects") \
template(java_util_Objects, "java/util/Objects") \
template(java_util_Properties, "java/util/Properties") \
template(java_util_Vector, "java/util/Vector") \
template(java_util_AbstractList, "java/util/AbstractList") \
template(java_util_Hashtable, "java/util/Hashtable") \
template(java_lang_Compiler, "java/lang/Compiler") \
template(sun_misc_Signal, "sun/misc/Signal") \
template(jdk_internal_misc_Signal, "jdk/internal/misc/Signal") \
template(sun_misc_Launcher, "sun/misc/Launcher") \
template(java_lang_AssertionStatusDirectives, "java/lang/AssertionStatusDirectives") \
template(getBootClassPathEntryForClass_name, "getBootClassPathEntryForClass") \

View File

@ -1494,7 +1494,7 @@ void CodeCache::print_summary(outputStream* st, bool detailed) {
}
void CodeCache::print_codelist(outputStream* st) {
assert_locked_or_safepoint(CodeCache_lock);
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
NMethodIterator iter;
while(iter.next_alive()) {
@ -1508,9 +1508,8 @@ void CodeCache::print_codelist(outputStream* st) {
}
void CodeCache::print_layout(outputStream* st) {
assert_locked_or_safepoint(CodeCache_lock);
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
ResourceMark rm;
print_summary(st, true);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,6 +48,7 @@
#include "utilities/dtrace.hpp"
#include "utilities/events.hpp"
#include "utilities/xmlstream.hpp"
#include "logging/log.hpp"
#ifdef TARGET_ARCH_x86
# include "nativeInst_x86.hpp"
#endif
@ -321,9 +322,12 @@ address ExceptionCache::test_address(address addr) {
bool ExceptionCache::add_address_and_handler(address addr, address handler) {
if (test_address(addr) == handler) return true;
if (count() < cache_size) {
set_pc_at(count(),addr);
set_handler_at(count(), handler);
int index = count();
if (index < cache_size) {
set_pc_at(index, addr);
set_handler_at(index, handler);
OrderAccess::storestore();
increment_count();
return true;
}
@ -1310,13 +1314,14 @@ void nmethod::make_unloaded(BoolObjectClosure* is_alive, oop cause) {
flush_dependencies(is_alive);
// Break cycle between nmethod & method
if (TraceClassUnloading && WizardMode) {
tty->print_cr("[Class unloading: Making nmethod " INTPTR_FORMAT
" unloadable], Method*(" INTPTR_FORMAT
if (log_is_enabled(Trace, classunload)) {
outputStream* log = LogHandle(classunload)::trace_stream();
log->print_cr("making nmethod " INTPTR_FORMAT
" unloadable, Method*(" INTPTR_FORMAT
"), cause(" INTPTR_FORMAT ")",
p2i(this), p2i(_method), p2i(cause));
if (!Universe::heap()->is_gc_active())
cause->klass()->print();
cause->klass()->print_on(log);
}
// Unlink the osr method, so we do not look this up again
if (is_osr_method()) {

View File

@ -466,9 +466,16 @@ CompileQueue* CompileBroker::compile_queue(int comp_level) {
return NULL;
}
void CompileBroker::print_compile_queues(outputStream* st) {
st->print_cr("Current compiles: ");
MutexLocker locker(MethodCompileQueue_lock);
MutexLocker locker2(Threads_lock);
char buf[2000];
int buflen = sizeof(buf);
Threads::print_threads_compiling(st, buf, buflen);
st->cr();
if (_c1_compile_queue != NULL) {
_c1_compile_queue->print(st);
}
@ -479,8 +486,7 @@ void CompileBroker::print_compile_queues(outputStream* st) {
void CompileQueue::print(outputStream* st) {
assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
st->print_cr("Contents of %s", name());
st->print_cr("----------------------------");
st->print_cr("%s:", name());
CompileTask* task = _first;
if (task == NULL) {
st->print_cr("Empty");
@ -490,7 +496,7 @@ void CompileQueue::print(outputStream* st) {
task = task->next();
}
}
st->print_cr("----------------------------");
st->cr();
}
void CompileQueue::print_tty() {
@ -539,7 +545,7 @@ void CompileBroker::compilation_init(TRAPS) {
c1_count = JVMCIHostThreads;
}
if (!UseInterpreter) {
if (!UseInterpreter || !BackgroundCompilation) {
// Force initialization of JVMCI compiler otherwise JVMCI
// compilations will not block until JVMCI is initialized
ResourceMark rm;
@ -1340,49 +1346,55 @@ CompileTask* CompileBroker::create_compile_task(CompileQueue* queue,
}
#if INCLUDE_JVMCI
// The number of milliseconds to wait before checking if the
// JVMCI compiler thread is blocked.
static const long BLOCKING_JVMCI_COMPILATION_WAIT_TIMESLICE = 500;
// The number of milliseconds to wait before checking if
// JVMCI compilation has made progress.
static const long JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE = 500;
// The number of successive times the above check is allowed to
// see a blocked JVMCI compiler thread before unblocking the
// thread waiting for the compilation to finish.
static const int BLOCKING_JVMCI_COMPILATION_WAIT_TO_UNBLOCK_ATTEMPTS = 5;
// The number of JVMCI compilation progress checks that must fail
// before unblocking a thread waiting for a blocking compilation.
static const int JVMCI_COMPILATION_PROGRESS_WAIT_ATTEMPTS = 5;
/**
* Waits for a JVMCI compiler to complete a given task. This thread
* waits until either the task completes or it sees the JVMCI compiler
* thread is blocked for N consecutive milliseconds where N is
* BLOCKING_JVMCI_COMPILATION_WAIT_TIMESLICE *
* BLOCKING_JVMCI_COMPILATION_WAIT_TO_UNBLOCK_ATTEMPTS.
* waits until either the task completes or it sees no JVMCI compilation
* progress for N consecutive milliseconds where N is
* JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE *
* JVMCI_COMPILATION_PROGRESS_WAIT_ATTEMPTS.
*
* @return true if this thread needs to free/recycle the task
*/
bool CompileBroker::wait_for_jvmci_completion(CompileTask* task, JavaThread* thread) {
bool CompileBroker::wait_for_jvmci_completion(JVMCICompiler* jvmci, CompileTask* task, JavaThread* thread) {
MutexLocker waiter(task->lock(), thread);
int consecutively_blocked = 0;
while (task->lock()->wait(!Mutex::_no_safepoint_check_flag, BLOCKING_JVMCI_COMPILATION_WAIT_TIMESLICE)) {
int progress_wait_attempts = 0;
int methods_compiled = jvmci->methods_compiled();
while (!task->is_complete() && !is_compilation_disabled_forever() &&
task->lock()->wait(!Mutex::_no_safepoint_check_flag, JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE)) {
CompilerThread* jvmci_compiler_thread = task->jvmci_compiler_thread();
bool progress;
if (jvmci_compiler_thread != NULL) {
JavaThreadState state;
{
// A JVMCI compiler thread should not disappear at this point
// but let's be extra safe.
MutexLocker mu(Threads_lock, thread);
state = jvmci_compiler_thread->thread_state();
}
if (state == _thread_blocked) {
if (++consecutively_blocked == BLOCKING_JVMCI_COMPILATION_WAIT_TO_UNBLOCK_ATTEMPTS) {
if (PrintCompilation) {
task->print(tty, "wait for blocking compilation timed out");
}
break;
// If the JVMCI compiler thread is not blocked, we deem it to be making progress.
progress = jvmci_compiler_thread->thread_state() != _thread_blocked;
} else {
// Still waiting on JVMCI compiler queue. This thread may be holding a lock
// that all JVMCI compiler threads are blocked on. We use the counter for
// successful JVMCI compilations to determine whether JVMCI compilation
// is still making progress through the JVMCI compiler queue.
progress = jvmci->methods_compiled() != methods_compiled;
}
if (!progress) {
if (++progress_wait_attempts == JVMCI_COMPILATION_PROGRESS_WAIT_ATTEMPTS) {
if (PrintCompilation) {
task->print(tty, "wait for blocking compilation timed out");
}
} else {
consecutively_blocked = 0;
break;
}
} else {
// Still waiting on JVMCI compiler queue
progress_wait_attempts = 0;
if (jvmci_compiler_thread == NULL) {
methods_compiled = jvmci->methods_compiled();
}
}
}
task->clear_waiter();
@ -1407,8 +1419,9 @@ void CompileBroker::wait_for_completion(CompileTask* task) {
methodHandle method(thread, task->method());
bool free_task;
#if INCLUDE_JVMCI
if (compiler(task->comp_level())->is_jvmci()) {
free_task = wait_for_jvmci_completion(task, thread);
AbstractCompiler* comp = compiler(task->comp_level());
if (comp->is_jvmci()) {
free_task = wait_for_jvmci_completion((JVMCICompiler*) comp, task, thread);
} else
#endif
{
@ -2355,10 +2368,3 @@ void CompileBroker::print_last_compile() {
}
}
void CompileBroker::print_compiler_threads_on(outputStream* st) {
#ifndef PRODUCT
st->print_cr("Compiler thread printing unimplemented.");
st->cr();
#endif
}

View File

@ -32,6 +32,9 @@
#include "runtime/perfData.hpp"
#include "trace/tracing.hpp"
#include "utilities/stack.hpp"
#if INCLUDE_JVMCI
#include "jvmci/jvmciCompiler.hpp"
#endif
class nmethod;
class nmethodLocker;
@ -234,7 +237,7 @@ class CompileBroker: AllStatic {
bool blocking);
static void wait_for_completion(CompileTask* task);
#if INCLUDE_JVMCI
static bool wait_for_jvmci_completion(CompileTask* task, JavaThread* thread);
static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
#endif
static void invoke_compiler_on_method(CompileTask* task);
@ -350,8 +353,6 @@ public:
// Debugging output for failure
static void print_last_compile();
static void print_compiler_threads_on(outputStream* st);
// compiler name for debugging
static const char* compiler_name(int comp_level);

View File

@ -85,6 +85,7 @@ class Disassembler {
public:
static bool can_decode() {
ttyLocker tl;
return (_decode_instructions_virtual != NULL) ||
(_decode_instructions != NULL) ||
load_library();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@
#include "gc/shared/space.hpp"
#include "gc/shared/vmGCOperations.hpp"
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/arguments.hpp"
#include "runtime/globals_extension.hpp"
#include "runtime/handles.inline.hpp"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,15 +40,9 @@ class MarkFromRootsClosure;
class ParMarkFromRootsClosure;
// Decode the oop and call do_oop on it.
#define DO_OOP_WORK_DEFN \
void do_oop(oop obj); \
template <class T> inline void do_oop_work(T* p) { \
T heap_oop = oopDesc::load_heap_oop(p); \
if (!oopDesc::is_null(heap_oop)) { \
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); \
do_oop(obj); \
} \
}
#define DO_OOP_WORK_DEFN \
void do_oop(oop obj); \
template <class T> inline void do_oop_work(T* p);
// TODO: This duplication of the MetadataAwareOopClosure class is only needed
// because some CMS OopClosures derive from OopsInGenClosure. It would be
@ -131,8 +125,8 @@ class PushAndMarkClosure: public MetadataAwareOopClosure {
bool concurrent_precleaning);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
inline void do_oop_nv(oop* p) { PushAndMarkClosure::do_oop_work(p); }
inline void do_oop_nv(narrowOop* p) { PushAndMarkClosure::do_oop_work(p); }
inline void do_oop_nv(oop* p);
inline void do_oop_nv(narrowOop* p);
};
// In the parallel case, the bit map and the
@ -157,8 +151,8 @@ class ParPushAndMarkClosure: public MetadataAwareOopClosure {
OopTaskQueue* work_queue);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
inline void do_oop_nv(oop* p) { ParPushAndMarkClosure::do_oop_work(p); }
inline void do_oop_nv(narrowOop* p) { ParPushAndMarkClosure::do_oop_work(p); }
inline void do_oop_nv(oop* p);
inline void do_oop_nv(narrowOop* p);
};
// The non-parallel version (the parallel version appears further below).
@ -186,8 +180,8 @@ class MarkRefsIntoAndScanClosure: public MetadataAwareOopsInGenClosure {
bool concurrent_precleaning);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
inline void do_oop_nv(oop* p) { MarkRefsIntoAndScanClosure::do_oop_work(p); }
inline void do_oop_nv(narrowOop* p) { MarkRefsIntoAndScanClosure::do_oop_work(p); }
inline void do_oop_nv(oop* p);
inline void do_oop_nv(narrowOop* p);
void set_freelistLock(Mutex* m) {
_freelistLock = m;
@ -220,8 +214,8 @@ class ParMarkRefsIntoAndScanClosure: public MetadataAwareOopsInGenClosure {
OopTaskQueue* work_queue);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
inline void do_oop_nv(oop* p) { ParMarkRefsIntoAndScanClosure::do_oop_work(p); }
inline void do_oop_nv(narrowOop* p) { ParMarkRefsIntoAndScanClosure::do_oop_work(p); }
inline void do_oop_nv(oop* p);
inline void do_oop_nv(narrowOop* p);
void trim_queue(uint size);
};
@ -249,8 +243,8 @@ class PushOrMarkClosure: public MetadataAwareOopClosure {
MarkFromRootsClosure* parent);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
inline void do_oop_nv(oop* p) { PushOrMarkClosure::do_oop_work(p); }
inline void do_oop_nv(narrowOop* p) { PushOrMarkClosure::do_oop_work(p); }
inline void do_oop_nv(oop* p);
inline void do_oop_nv(narrowOop* p);
// Deal with a stack overflow condition
void handle_stack_overflow(HeapWord* lost);
@ -287,8 +281,8 @@ class ParPushOrMarkClosure: public MetadataAwareOopClosure {
ParMarkFromRootsClosure* parent);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
inline void do_oop_nv(oop* p) { ParPushOrMarkClosure::do_oop_work(p); }
inline void do_oop_nv(narrowOop* p) { ParPushOrMarkClosure::do_oop_work(p); }
inline void do_oop_nv(oop* p);
inline void do_oop_nv(narrowOop* p);
// Deal with a stack overflow condition
void handle_stack_overflow(HeapWord* lost);
@ -318,8 +312,8 @@ class CMSKeepAliveClosure: public MetadataAwareOopClosure {
bool concurrent_precleaning() const { return _concurrent_precleaning; }
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
inline void do_oop_nv(oop* p) { CMSKeepAliveClosure::do_oop_work(p); }
inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); }
inline void do_oop_nv(oop* p);
inline void do_oop_nv(narrowOop* p);
};
class CMSInnerParMarkAndPushClosure: public MetadataAwareOopClosure {
@ -336,8 +330,8 @@ class CMSInnerParMarkAndPushClosure: public MetadataAwareOopClosure {
OopTaskQueue* work_queue);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
inline void do_oop_nv(oop* p) { CMSInnerParMarkAndPushClosure::do_oop_work(p); }
inline void do_oop_nv(narrowOop* p) { CMSInnerParMarkAndPushClosure::do_oop_work(p); }
inline void do_oop_nv(oop* p);
inline void do_oop_nv(narrowOop* p);
};
// A parallel (MT) version of the above, used when

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,21 +30,6 @@
#include "gc/shared/taskqueue.inline.hpp"
#include "oops/oop.inline.hpp"
// Trim our work_queue so its length is below max at return
inline void ParMarkRefsIntoAndScanClosure::trim_queue(uint max) {
while (_work_queue->size() > max) {
oop newOop;
if (_work_queue->pop_local(newOop)) {
assert(newOop->is_oop(), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)newOop),
"only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing
// the ones in CMS heap (i.e. in _span).
newOop->oop_iterate(&_parPushAndMarkClosure);
}
}
}
// MetadataAwareOopClosure and MetadataAwareOopsInGenClosure are duplicated,
// until we get rid of OopsInGenClosure.
@ -61,4 +46,48 @@ inline void MetadataAwareOopsInGenClosure::do_cld_nv(ClassLoaderData* cld) {
cld->oops_do(_klass_closure._oop_closure, &_klass_closure, claim);
}
// Decode the oop and call do_oop on it.
#define DO_OOP_WORK_IMPL(cls) \
template <class T> void cls::do_oop_work(T* p) { \
T heap_oop = oopDesc::load_heap_oop(p); \
if (!oopDesc::is_null(heap_oop)) { \
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); \
do_oop(obj); \
} \
}
#define DO_OOP_WORK_NV_IMPL(cls) \
DO_OOP_WORK_IMPL(cls) \
void cls::do_oop_nv(oop* p) { cls::do_oop_work(p); } \
void cls::do_oop_nv(narrowOop* p) { cls::do_oop_work(p); }
DO_OOP_WORK_IMPL(MarkRefsIntoClosure)
DO_OOP_WORK_IMPL(ParMarkRefsIntoClosure)
DO_OOP_WORK_IMPL(MarkRefsIntoVerifyClosure)
DO_OOP_WORK_NV_IMPL(PushAndMarkClosure)
DO_OOP_WORK_NV_IMPL(ParPushAndMarkClosure)
DO_OOP_WORK_NV_IMPL(MarkRefsIntoAndScanClosure)
DO_OOP_WORK_NV_IMPL(ParMarkRefsIntoAndScanClosure)
// Trim our work_queue so its length is below max at return
inline void ParMarkRefsIntoAndScanClosure::trim_queue(uint max) {
while (_work_queue->size() > max) {
oop newOop;
if (_work_queue->pop_local(newOop)) {
assert(newOop->is_oop(), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)newOop),
"only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing
// the ones in CMS heap (i.e. in _span).
newOop->oop_iterate(&_parPushAndMarkClosure);
}
}
}
DO_OOP_WORK_NV_IMPL(PushOrMarkClosure)
DO_OOP_WORK_NV_IMPL(ParPushOrMarkClosure)
DO_OOP_WORK_NV_IMPL(CMSKeepAliveClosure)
DO_OOP_WORK_NV_IMPL(CMSInnerParMarkAndPushClosure)
DO_OOP_WORK_IMPL(CMSParKeepAliveClosure)
#endif // SHARE_VM_GC_CMS_CMSOOPCLOSURES_INLINE_HPP

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -219,6 +219,10 @@ void CompactibleFreeListSpace::initializeIndexedFreeListArray() {
}
}
size_t CompactibleFreeListSpace::obj_size(const HeapWord* addr) const {
return adjustObjectSize(oop(addr)->size());
}
void CompactibleFreeListSpace::resetIndexedFreeListArray() {
for (size_t i = 1; i < IndexSetSize; i++) {
assert(_indexedFreeList[i].size() == (size_t) i,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -313,9 +313,7 @@ class CompactibleFreeListSpace: public CompactibleSpace {
return adjustObjectSize(size);
}
inline size_t obj_size(const HeapWord* addr) const {
return adjustObjectSize(oop(addr)->size());
}
inline size_t obj_size(const HeapWord* addr) const;
protected:
// Reset the indexed free list to its initial empty condition.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1517,6 +1517,8 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
gch->pre_full_gc_dump(gc_timer);
GCTraceTime(Trace, gc) t("CMS:MSC");
// Temporarily widen the span of the weak reference processing to
@ -1593,6 +1595,8 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
_inter_sweep_timer.reset();
_inter_sweep_timer.start();
gch->post_full_gc_dump(gc_timer);
gc_timer->register_gc_end();
gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
@ -3324,6 +3328,8 @@ class ParConcMarkingClosure: public MetadataAwareOopClosure {
}
};
DO_OOP_WORK_IMPL(ParConcMarkingClosure)
// Grey object scanning during work stealing phase --
// the salient assumption here is that any references
// that are in these stolen objects being scanned must

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,7 +29,7 @@
#include "gc/cms/parOopClosures.inline.hpp"
#include "gc/serial/defNewGeneration.inline.hpp"
#include "gc/shared/adaptiveSizePolicy.hpp"
#include "gc/shared/ageTable.hpp"
#include "gc/shared/ageTable.inline.hpp"
#include "gc/shared/copyFailedInfo.hpp"
#include "gc/shared/gcHeapSummary.hpp"
#include "gc/shared/gcTimer.hpp"
@ -414,7 +414,7 @@ void ParScanThreadStateSet::print_taskqueue_stats_hdr(outputStream* const st) {
}
void ParScanThreadStateSet::print_taskqueue_stats() {
if (!develop_log_is_enabled(Trace, gc, task, stats)) {
if (!log_develop_is_enabled(Trace, gc, task, stats)) {
return;
}
LogHandle(gc, task, stats) log;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,31 @@
/////////////////////////////////////////////////////////////////////////
PromotedObject* PromotedObject::next() const {
assert(!((FreeChunk*)this)->is_free(), "Error");
PromotedObject* res;
if (UseCompressedOops) {
// The next pointer is a compressed oop stored in the top 32 bits
res = (PromotedObject*)oopDesc::decode_heap_oop(_data._narrow_next);
} else {
res = (PromotedObject*)(_next & next_mask);
}
assert(oop(res)->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(res)));
return res;
}
inline void PromotedObject::setNext(PromotedObject* x) {
assert(((intptr_t)x & ~next_mask) == 0, "Conflict in bit usage, "
"or insufficient alignment of objects");
if (UseCompressedOops) {
assert(_data._narrow_next == 0, "Overwrite?");
_data._narrow_next = oopDesc::encode_heap_oop(oop(x));
} else {
_next |= (intptr_t)x;
}
assert(!((FreeChunk*)this)->is_free(), "Error");
}
//////////////////////////////////////////////////////////////////////////////
// We go over the list of promoted objects, removing each from the list,
// and applying the closure (this may, in turn, add more elements to

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -64,29 +64,8 @@ class PromotedObject VALUE_OBJ_CLASS_SPEC {
Data _data;
};
public:
inline PromotedObject* next() const {
assert(!((FreeChunk*)this)->is_free(), "Error");
PromotedObject* res;
if (UseCompressedOops) {
// The next pointer is a compressed oop stored in the top 32 bits
res = (PromotedObject*)oopDesc::decode_heap_oop(_data._narrow_next);
} else {
res = (PromotedObject*)(_next & next_mask);
}
assert(oop(res)->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(res)));
return res;
}
inline void setNext(PromotedObject* x) {
assert(((intptr_t)x & ~next_mask) == 0, "Conflict in bit usage, "
"or insufficient alignment of objects");
if (UseCompressedOops) {
assert(_data._narrow_next == 0, "Overwrite?");
_data._narrow_next = oopDesc::encode_heap_oop(oop(x));
} else {
_next |= (intptr_t)x;
}
assert(!((FreeChunk*)this)->is_free(), "Error");
}
PromotedObject* next() const;
void setNext(PromotedObject* x);
inline void setPromotedMark() {
_next |= promoted_mask;
assert(!((FreeChunk*)this)->is_free(), "Error");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -59,10 +59,10 @@ ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread *nex
_monitor = DirtyCardQ_CBL_mon;
}
initialize();
create_and_start();
// set name
set_name("G1 Refine#%d", worker_id);
create_and_start();
}
void ConcurrentG1RefineThread::initialize() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@
SurrogateLockerThread*
ConcurrentMarkThread::_slt = NULL;
ConcurrentMarkThread::ConcurrentMarkThread(ConcurrentMark* cm) :
ConcurrentMarkThread::ConcurrentMarkThread(G1ConcurrentMark* cm) :
ConcurrentGCThread(),
_cm(cm),
_state(Idle),
@ -56,10 +56,10 @@ ConcurrentMarkThread::ConcurrentMarkThread(ConcurrentMark* cm) :
class CMCheckpointRootsFinalClosure: public VoidClosure {
ConcurrentMark* _cm;
G1ConcurrentMark* _cm;
public:
CMCheckpointRootsFinalClosure(ConcurrentMark* cm) :
CMCheckpointRootsFinalClosure(G1ConcurrentMark* cm) :
_cm(cm) {}
void do_void(){
@ -68,10 +68,10 @@ public:
};
class CMCleanUp: public VoidClosure {
ConcurrentMark* _cm;
G1ConcurrentMark* _cm;
public:
CMCleanUp(ConcurrentMark* cm) :
CMCleanUp(G1ConcurrentMark* cm) :
_cm(cm) {}
void do_void(){
@ -92,10 +92,10 @@ void ConcurrentMarkThread::delay_to_keep_mmu(G1CollectorPolicy* g1_policy, bool
}
class GCConcPhaseTimer : StackObj {
ConcurrentMark* _cm;
G1ConcurrentMark* _cm;
public:
GCConcPhaseTimer(ConcurrentMark* cm, const char* title) : _cm(cm) {
GCConcPhaseTimer(G1ConcurrentMark* cm, const char* title) : _cm(cm) {
_cm->register_concurrent_phase_start(title);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,10 +27,10 @@
#include "gc/shared/concurrentGCThread.hpp"
// The Concurrent Mark GC Thread triggers the parallel CMConcurrentMarkingTasks
// The Concurrent Mark GC Thread triggers the parallel G1CMConcurrentMarkingTasks
// as well as handling various marking cleanup.
class ConcurrentMark;
class G1ConcurrentMark;
class G1CollectorPolicy;
class ConcurrentMarkThread: public ConcurrentGCThread {
@ -45,7 +45,7 @@ class ConcurrentMarkThread: public ConcurrentGCThread {
virtual void run();
private:
ConcurrentMark* _cm;
G1ConcurrentMark* _cm;
enum State {
Idle,
@ -65,7 +65,7 @@ class ConcurrentMarkThread: public ConcurrentGCThread {
public:
// Constructor
ConcurrentMarkThread(ConcurrentMark* cm);
ConcurrentMarkThread(G1ConcurrentMark* cm);
static void makeSurrogateLockerThread(TRAPS);
static SurrogateLockerThread* slt() { return _slt; }
@ -75,7 +75,7 @@ class ConcurrentMarkThread: public ConcurrentGCThread {
// Marking virtual time so far this thread and concurrent marking tasks.
double vtime_mark_accum();
ConcurrentMark* cm() { return _cm; }
G1ConcurrentMark* cm() { return _cm; }
void set_idle() { assert(_state != Started, "must not be starting a new cycle"); _state = Idle; }
bool idle() { return _state == Idle; }

View File

@ -25,8 +25,8 @@
#ifndef SHARE_VM_GC_G1_CONCURRENTMARKTHREAD_INLINE_HPP
#define SHARE_VM_GC_G1_CONCURRENTMARKTHREAD_INLINE_HPP
#include "gc/g1/concurrentMark.hpp"
#include "gc/g1/concurrentMarkThread.hpp"
#include "gc/g1/g1ConcurrentMark.hpp"
// Total virtual time so far.
inline double ConcurrentMarkThread::vtime_accum() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -438,7 +438,7 @@ void G1ArchiveAllocator::complete_archive(GrowableArray<MemRegion>* ranges,
// If an end alignment was requested, insert filler objects.
if (end_alignment_in_bytes != 0) {
HeapWord* currtop = _allocation_region->top();
HeapWord* newtop = (HeapWord*)align_pointer_up(currtop, end_alignment_in_bytes);
HeapWord* newtop = (HeapWord*)align_ptr_up(currtop, end_alignment_in_bytes);
size_t fill_size = pointer_delta(newtop, currtop);
if (fill_size != 0) {
if (fill_size < CollectedHeap::min_fill_size()) {
@ -447,8 +447,8 @@ void G1ArchiveAllocator::complete_archive(GrowableArray<MemRegion>* ranges,
// region boundary because the max supported alignment is smaller than the min
// region size, and because the allocation code never leaves space smaller than
// the min_fill_size at the top of the current allocation region.
newtop = (HeapWord*)align_pointer_up(currtop + CollectedHeap::min_fill_size(),
end_alignment_in_bytes);
newtop = (HeapWord*)align_ptr_up(currtop + CollectedHeap::min_fill_size(),
end_alignment_in_bytes);
fill_size = pointer_delta(newtop, currtop);
}
HeapWord* fill = archive_mem_allocate(fill_size);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -74,10 +74,16 @@ class CodeRootSetTable : public Hashtable<nmethod*, mtGC> {
static size_t static_mem_size() {
return sizeof(_purge_list);
}
size_t mem_size();
};
CodeRootSetTable* volatile CodeRootSetTable::_purge_list = NULL;
size_t CodeRootSetTable::mem_size() {
return sizeof(CodeRootSetTable) + (entry_size() * number_of_entries()) + (sizeof(HashtableBucket<mtGC>) * table_size());
}
CodeRootSetTable::Entry* CodeRootSetTable::new_entry(nmethod* nm) {
unsigned int hash = compute_hash(nm);
Entry* entry = (Entry*) new_entry_free_list();
@ -232,7 +238,6 @@ void G1CodeRootSet::move_to_large() {
OrderAccess::release_store_ptr(&_table, temp);
}
void G1CodeRootSet::purge() {
CodeRootSetTable::purge();
}
@ -247,12 +252,13 @@ void G1CodeRootSet::add(nmethod* method) {
allocate_small_table();
}
added = _table->add(method);
if (_length == Threshold) {
move_to_large();
}
if (added) {
if (_length == Threshold) {
move_to_large();
}
++_length;
}
assert(_length == (size_t)_table->number_of_entries(), "sizes should match");
}
bool G1CodeRootSet::remove(nmethod* method) {
@ -266,11 +272,13 @@ bool G1CodeRootSet::remove(nmethod* method) {
clear();
}
}
assert((_length == 0 && _table == NULL) ||
(_length == (size_t)_table->number_of_entries()), "sizes should match");
return removed;
}
bool G1CodeRootSet::contains(nmethod* method) {
CodeRootSetTable* table = load_acquire_table();
CodeRootSetTable* table = load_acquire_table(); // contains() may be called outside of lock, so ensure mem sync.
if (table != NULL) {
return table->contains(method);
}
@ -284,8 +292,7 @@ void G1CodeRootSet::clear() {
}
size_t G1CodeRootSet::mem_size() {
return sizeof(*this) +
(_table != NULL ? sizeof(CodeRootSetTable) + _table->entry_size() * _length : 0);
return sizeof(*this) + (_table != NULL ? _table->mem_size() : 0);
}
void G1CodeRootSet::nmethods_do(CodeBlobClosure* blk) const {

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