Merge
This commit is contained in:
commit
aee9449305
@ -46,12 +46,18 @@ public class StubRoutines {
|
|||||||
Type type = db.lookupType("StubRoutines");
|
Type type = db.lookupType("StubRoutines");
|
||||||
|
|
||||||
callStubReturnAddressField = type.getAddressField("_call_stub_return_address");
|
callStubReturnAddressField = type.getAddressField("_call_stub_return_address");
|
||||||
// Only some platforms have specif return from compiled to call_stub
|
// Only some platforms have specific return from compiled to call_stub
|
||||||
try {
|
try {
|
||||||
callStubCompiledReturnAddressField = type.getAddressField("_call_stub_compiled_return");
|
type = db.lookupType("StubRoutines::x86");
|
||||||
|
if (type != null) {
|
||||||
|
callStubCompiledReturnAddressField = type.getAddressField("_call_stub_compiled_return");
|
||||||
|
}
|
||||||
} catch (RuntimeException re) {
|
} catch (RuntimeException re) {
|
||||||
callStubCompiledReturnAddressField = null;
|
callStubCompiledReturnAddressField = null;
|
||||||
}
|
}
|
||||||
|
if (callStubCompiledReturnAddressField == null && VM.getVM().getCPU().equals("x86")) {
|
||||||
|
throw new InternalError("Missing definition for _call_stub_compiled_return");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public StubRoutines() {
|
public StubRoutines() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -2615,12 +2615,12 @@ void MacroAssembler::cas_under_lock(Register top_ptr_reg, Register top_reg, Regi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisterConstant MacroAssembler::delayed_value(intptr_t* delayed_value_addr,
|
RegisterOrConstant MacroAssembler::delayed_value_impl(intptr_t* delayed_value_addr,
|
||||||
Register tmp,
|
Register tmp,
|
||||||
int offset) {
|
int offset) {
|
||||||
intptr_t value = *delayed_value_addr;
|
intptr_t value = *delayed_value_addr;
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
return RegisterConstant(value + offset);
|
return RegisterOrConstant(value + offset);
|
||||||
|
|
||||||
// load indirectly to solve generation ordering problem
|
// load indirectly to solve generation ordering problem
|
||||||
Address a(tmp, (address) delayed_value_addr);
|
Address a(tmp, (address) delayed_value_addr);
|
||||||
@ -2634,11 +2634,11 @@ RegisterConstant MacroAssembler::delayed_value(intptr_t* delayed_value_addr,
|
|||||||
if (offset != 0)
|
if (offset != 0)
|
||||||
add(tmp, offset, tmp);
|
add(tmp, offset, tmp);
|
||||||
|
|
||||||
return RegisterConstant(tmp);
|
return RegisterOrConstant(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::regcon_inc_ptr( RegisterConstant& dest, RegisterConstant src, Register temp ) {
|
void MacroAssembler::regcon_inc_ptr( RegisterOrConstant& dest, RegisterOrConstant src, Register temp ) {
|
||||||
assert(dest.register_or_noreg() != G0, "lost side effect");
|
assert(dest.register_or_noreg() != G0, "lost side effect");
|
||||||
if ((src.is_constant() && src.as_constant() == 0) ||
|
if ((src.is_constant() && src.as_constant() == 0) ||
|
||||||
(src.is_register() && src.as_register() == G0)) {
|
(src.is_register() && src.as_register() == G0)) {
|
||||||
@ -2647,15 +2647,15 @@ void MacroAssembler::regcon_inc_ptr( RegisterConstant& dest, RegisterConstant sr
|
|||||||
add(dest.as_register(), ensure_rs2(src, temp), dest.as_register());
|
add(dest.as_register(), ensure_rs2(src, temp), dest.as_register());
|
||||||
} else if (src.is_constant()) {
|
} else if (src.is_constant()) {
|
||||||
intptr_t res = dest.as_constant() + src.as_constant();
|
intptr_t res = dest.as_constant() + src.as_constant();
|
||||||
dest = RegisterConstant(res); // side effect seen by caller
|
dest = RegisterOrConstant(res); // side effect seen by caller
|
||||||
} else {
|
} else {
|
||||||
assert(temp != noreg, "cannot handle constant += register");
|
assert(temp != noreg, "cannot handle constant += register");
|
||||||
add(src.as_register(), ensure_rs2(dest, temp), temp);
|
add(src.as_register(), ensure_rs2(dest, temp), temp);
|
||||||
dest = RegisterConstant(temp); // side effect seen by caller
|
dest = RegisterOrConstant(temp); // side effect seen by caller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroAssembler::regcon_sll_ptr( RegisterConstant& dest, RegisterConstant src, Register temp ) {
|
void MacroAssembler::regcon_sll_ptr( RegisterOrConstant& dest, RegisterOrConstant src, Register temp ) {
|
||||||
assert(dest.register_or_noreg() != G0, "lost side effect");
|
assert(dest.register_or_noreg() != G0, "lost side effect");
|
||||||
if (!is_simm13(src.constant_or_zero()))
|
if (!is_simm13(src.constant_or_zero()))
|
||||||
src = (src.as_constant() & 0xFF);
|
src = (src.as_constant() & 0xFF);
|
||||||
@ -2666,12 +2666,12 @@ void MacroAssembler::regcon_sll_ptr( RegisterConstant& dest, RegisterConstant sr
|
|||||||
sll_ptr(dest.as_register(), src, dest.as_register());
|
sll_ptr(dest.as_register(), src, dest.as_register());
|
||||||
} else if (src.is_constant()) {
|
} else if (src.is_constant()) {
|
||||||
intptr_t res = dest.as_constant() << src.as_constant();
|
intptr_t res = dest.as_constant() << src.as_constant();
|
||||||
dest = RegisterConstant(res); // side effect seen by caller
|
dest = RegisterOrConstant(res); // side effect seen by caller
|
||||||
} else {
|
} else {
|
||||||
assert(temp != noreg, "cannot handle constant <<= register");
|
assert(temp != noreg, "cannot handle constant <<= register");
|
||||||
set(dest.as_constant(), temp);
|
set(dest.as_constant(), temp);
|
||||||
sll_ptr(temp, src, temp);
|
sll_ptr(temp, src, temp);
|
||||||
dest = RegisterConstant(temp); // side effect seen by caller
|
dest = RegisterOrConstant(temp); // side effect seen by caller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2683,7 +2683,7 @@ void MacroAssembler::regcon_sll_ptr( RegisterConstant& dest, RegisterConstant sr
|
|||||||
// On failure, execution transfers to the given label.
|
// On failure, execution transfers to the given label.
|
||||||
void MacroAssembler::lookup_interface_method(Register recv_klass,
|
void MacroAssembler::lookup_interface_method(Register recv_klass,
|
||||||
Register intf_klass,
|
Register intf_klass,
|
||||||
RegisterConstant itable_index,
|
RegisterOrConstant itable_index,
|
||||||
Register method_result,
|
Register method_result,
|
||||||
Register scan_temp,
|
Register scan_temp,
|
||||||
Register sethi_temp,
|
Register sethi_temp,
|
||||||
@ -2720,7 +2720,7 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
|
|||||||
add(recv_klass, scan_temp, scan_temp);
|
add(recv_klass, scan_temp, scan_temp);
|
||||||
|
|
||||||
// Adjust recv_klass by scaled itable_index, so we can free itable_index.
|
// Adjust recv_klass by scaled itable_index, so we can free itable_index.
|
||||||
RegisterConstant itable_offset = itable_index;
|
RegisterOrConstant itable_offset = itable_index;
|
||||||
regcon_sll_ptr(itable_offset, exact_log2(itableMethodEntry::size() * wordSize));
|
regcon_sll_ptr(itable_offset, exact_log2(itableMethodEntry::size() * wordSize));
|
||||||
regcon_inc_ptr(itable_offset, itableMethodEntry::method_offset_in_bytes());
|
regcon_inc_ptr(itable_offset, itableMethodEntry::method_offset_in_bytes());
|
||||||
add(recv_klass, ensure_rs2(itable_offset, sethi_temp), recv_klass);
|
add(recv_klass, ensure_rs2(itable_offset, sethi_temp), recv_klass);
|
||||||
@ -2805,7 +2805,7 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass,
|
|||||||
Label* L_success,
|
Label* L_success,
|
||||||
Label* L_failure,
|
Label* L_failure,
|
||||||
Label* L_slow_path,
|
Label* L_slow_path,
|
||||||
RegisterConstant super_check_offset,
|
RegisterOrConstant super_check_offset,
|
||||||
Register instanceof_hack) {
|
Register instanceof_hack) {
|
||||||
int sc_offset = (klassOopDesc::header_size() * HeapWordSize +
|
int sc_offset = (klassOopDesc::header_size() * HeapWordSize +
|
||||||
Klass::secondary_super_cache_offset_in_bytes());
|
Klass::secondary_super_cache_offset_in_bytes());
|
||||||
@ -2867,7 +2867,7 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass,
|
|||||||
if (must_load_sco) {
|
if (must_load_sco) {
|
||||||
// The super check offset is always positive...
|
// The super check offset is always positive...
|
||||||
lduw(super_klass, sco_offset, temp2_reg);
|
lduw(super_klass, sco_offset, temp2_reg);
|
||||||
super_check_offset = RegisterConstant(temp2_reg);
|
super_check_offset = RegisterOrConstant(temp2_reg);
|
||||||
}
|
}
|
||||||
ld_ptr(sub_klass, super_check_offset, temp_reg);
|
ld_ptr(sub_klass, super_check_offset, temp_reg);
|
||||||
cmp(super_klass, temp_reg);
|
cmp(super_klass, temp_reg);
|
||||||
@ -4472,7 +4472,7 @@ void MacroAssembler::card_write_barrier_post(Register store_addr, Register new_v
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loading values by size and signed-ness
|
// Loading values by size and signed-ness
|
||||||
void MacroAssembler::load_sized_value(Register s1, RegisterConstant s2, Register d,
|
void MacroAssembler::load_sized_value(Register s1, RegisterOrConstant s2, Register d,
|
||||||
int size_in_bytes, bool is_signed) {
|
int size_in_bytes, bool is_signed) {
|
||||||
switch (size_in_bytes ^ (is_signed ? -1 : 0)) {
|
switch (size_in_bytes ^ (is_signed ? -1 : 0)) {
|
||||||
case ~8: // fall through:
|
case ~8: // fall through:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1088,8 +1088,8 @@ public:
|
|||||||
inline void add( Register s1, Register s2, Register d );
|
inline void add( Register s1, Register s2, Register d );
|
||||||
inline void add( Register s1, int simm13a, Register d, relocInfo::relocType rtype = relocInfo::none);
|
inline void add( Register s1, int simm13a, Register d, relocInfo::relocType rtype = relocInfo::none);
|
||||||
inline void add( Register s1, int simm13a, Register d, RelocationHolder const& rspec);
|
inline void add( Register s1, int simm13a, Register d, RelocationHolder const& rspec);
|
||||||
inline void add( Register s1, RegisterConstant s2, Register d, int offset = 0);
|
inline void add( Register s1, RegisterOrConstant s2, Register d, int offset = 0);
|
||||||
inline void add( const Address& a, Register d, int offset = 0);
|
inline void add( const Address& a, Register d, int offset = 0);
|
||||||
|
|
||||||
void addcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
|
void addcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
|
||||||
void addcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
|
void addcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
|
||||||
@ -1305,15 +1305,15 @@ public:
|
|||||||
inline void ld( const Address& a, Register d, int offset = 0 );
|
inline void ld( const Address& a, Register d, int offset = 0 );
|
||||||
inline void ldd( const Address& a, Register d, int offset = 0 );
|
inline void ldd( const Address& a, Register d, int offset = 0 );
|
||||||
|
|
||||||
inline void ldub( Register s1, RegisterConstant s2, Register d );
|
inline void ldub( Register s1, RegisterOrConstant s2, Register d );
|
||||||
inline void ldsb( Register s1, RegisterConstant s2, Register d );
|
inline void ldsb( Register s1, RegisterOrConstant s2, Register d );
|
||||||
inline void lduh( Register s1, RegisterConstant s2, Register d );
|
inline void lduh( Register s1, RegisterOrConstant s2, Register d );
|
||||||
inline void ldsh( Register s1, RegisterConstant s2, Register d );
|
inline void ldsh( Register s1, RegisterOrConstant s2, Register d );
|
||||||
inline void lduw( Register s1, RegisterConstant s2, Register d );
|
inline void lduw( Register s1, RegisterOrConstant s2, Register d );
|
||||||
inline void ldsw( Register s1, RegisterConstant s2, Register d );
|
inline void ldsw( Register s1, RegisterOrConstant s2, Register d );
|
||||||
inline void ldx( Register s1, RegisterConstant s2, Register d );
|
inline void ldx( Register s1, RegisterOrConstant s2, Register d );
|
||||||
inline void ld( Register s1, RegisterConstant s2, Register d );
|
inline void ld( Register s1, RegisterOrConstant s2, Register d );
|
||||||
inline void ldd( Register s1, RegisterConstant s2, Register d );
|
inline void ldd( Register s1, RegisterOrConstant s2, Register d );
|
||||||
|
|
||||||
// pp 177
|
// pp 177
|
||||||
|
|
||||||
@ -1535,12 +1535,12 @@ public:
|
|||||||
inline void st( Register d, const Address& a, int offset = 0 );
|
inline void st( Register d, const Address& a, int offset = 0 );
|
||||||
inline void std( Register d, const Address& a, int offset = 0 );
|
inline void std( Register d, const Address& a, int offset = 0 );
|
||||||
|
|
||||||
inline void stb( Register d, Register s1, RegisterConstant s2 );
|
inline void stb( Register d, Register s1, RegisterOrConstant s2 );
|
||||||
inline void sth( Register d, Register s1, RegisterConstant s2 );
|
inline void sth( Register d, Register s1, RegisterOrConstant s2 );
|
||||||
inline void stw( Register d, Register s1, RegisterConstant s2 );
|
inline void stw( Register d, Register s1, RegisterOrConstant s2 );
|
||||||
inline void stx( Register d, Register s1, RegisterConstant s2 );
|
inline void stx( Register d, Register s1, RegisterOrConstant s2 );
|
||||||
inline void std( Register d, Register s1, RegisterConstant s2 );
|
inline void std( Register d, Register s1, RegisterOrConstant s2 );
|
||||||
inline void st( Register d, Register s1, RegisterConstant s2 );
|
inline void st( Register d, Register s1, RegisterOrConstant s2 );
|
||||||
|
|
||||||
// pp 177
|
// pp 177
|
||||||
|
|
||||||
@ -1859,7 +1859,7 @@ class MacroAssembler: public Assembler {
|
|||||||
// Functions for isolating 64 bit shifts for LP64
|
// Functions for isolating 64 bit shifts for LP64
|
||||||
inline void sll_ptr( Register s1, Register s2, Register d );
|
inline void sll_ptr( Register s1, Register s2, Register d );
|
||||||
inline void sll_ptr( Register s1, int imm6a, Register d );
|
inline void sll_ptr( Register s1, int imm6a, Register d );
|
||||||
inline void sll_ptr( Register s1, RegisterConstant s2, Register d );
|
inline void sll_ptr( Register s1, RegisterOrConstant s2, Register d );
|
||||||
inline void srl_ptr( Register s1, Register s2, Register d );
|
inline void srl_ptr( Register s1, Register s2, Register d );
|
||||||
inline void srl_ptr( Register s1, int imm6a, Register d );
|
inline void srl_ptr( Register s1, int imm6a, Register d );
|
||||||
|
|
||||||
@ -1965,26 +1965,26 @@ class MacroAssembler: public Assembler {
|
|||||||
// st_ptr will perform st for 32 bit VM's and stx for 64 bit VM's
|
// st_ptr will perform st for 32 bit VM's and stx for 64 bit VM's
|
||||||
inline void ld_ptr( Register s1, Register s2, Register d );
|
inline void ld_ptr( Register s1, Register s2, Register d );
|
||||||
inline void ld_ptr( Register s1, int simm13a, Register d);
|
inline void ld_ptr( Register s1, int simm13a, Register d);
|
||||||
inline void ld_ptr( Register s1, RegisterConstant s2, Register d );
|
inline void ld_ptr( Register s1, RegisterOrConstant s2, Register d );
|
||||||
inline void ld_ptr( const Address& a, Register d, int offset = 0 );
|
inline void ld_ptr( const Address& a, Register d, int offset = 0 );
|
||||||
inline void st_ptr( Register d, Register s1, Register s2 );
|
inline void st_ptr( Register d, Register s1, Register s2 );
|
||||||
inline void st_ptr( Register d, Register s1, int simm13a);
|
inline void st_ptr( Register d, Register s1, int simm13a);
|
||||||
inline void st_ptr( Register d, Register s1, RegisterConstant s2 );
|
inline void st_ptr( Register d, Register s1, RegisterOrConstant s2 );
|
||||||
inline void st_ptr( Register d, const Address& a, int offset = 0 );
|
inline void st_ptr( Register d, const Address& a, int offset = 0 );
|
||||||
|
|
||||||
// ld_long will perform ld for 32 bit VM's and ldx for 64 bit VM's
|
// ld_long will perform ld for 32 bit VM's and ldx for 64 bit VM's
|
||||||
// st_long will perform st for 32 bit VM's and stx for 64 bit VM's
|
// st_long will perform st for 32 bit VM's and stx for 64 bit VM's
|
||||||
inline void ld_long( Register s1, Register s2, Register d );
|
inline void ld_long( Register s1, Register s2, Register d );
|
||||||
inline void ld_long( Register s1, int simm13a, Register d );
|
inline void ld_long( Register s1, int simm13a, Register d );
|
||||||
inline void ld_long( Register s1, RegisterConstant s2, Register d );
|
inline void ld_long( Register s1, RegisterOrConstant s2, Register d );
|
||||||
inline void ld_long( const Address& a, Register d, int offset = 0 );
|
inline void ld_long( const Address& a, Register d, int offset = 0 );
|
||||||
inline void st_long( Register d, Register s1, Register s2 );
|
inline void st_long( Register d, Register s1, Register s2 );
|
||||||
inline void st_long( Register d, Register s1, int simm13a );
|
inline void st_long( Register d, Register s1, int simm13a );
|
||||||
inline void st_long( Register d, Register s1, RegisterConstant s2 );
|
inline void st_long( Register d, Register s1, RegisterOrConstant s2 );
|
||||||
inline void st_long( Register d, const Address& a, int offset = 0 );
|
inline void st_long( Register d, const Address& a, int offset = 0 );
|
||||||
|
|
||||||
// Loading values by size and signed-ness
|
// Loading values by size and signed-ness
|
||||||
void load_sized_value(Register s1, RegisterConstant s2, Register d,
|
void load_sized_value(Register s1, RegisterOrConstant s2, Register d,
|
||||||
int size_in_bytes, bool is_signed);
|
int size_in_bytes, bool is_signed);
|
||||||
|
|
||||||
// Helpers for address formation.
|
// Helpers for address formation.
|
||||||
@ -1994,11 +1994,11 @@ class MacroAssembler: public Assembler {
|
|||||||
// is required, and becomes the result.
|
// is required, and becomes the result.
|
||||||
// If dest is a register and src is a non-simm13 constant,
|
// If dest is a register and src is a non-simm13 constant,
|
||||||
// the temp argument is required, and is used to materialize the constant.
|
// the temp argument is required, and is used to materialize the constant.
|
||||||
void regcon_inc_ptr( RegisterConstant& dest, RegisterConstant src,
|
void regcon_inc_ptr( RegisterOrConstant& dest, RegisterOrConstant src,
|
||||||
Register temp = noreg );
|
Register temp = noreg );
|
||||||
void regcon_sll_ptr( RegisterConstant& dest, RegisterConstant src,
|
void regcon_sll_ptr( RegisterOrConstant& dest, RegisterOrConstant src,
|
||||||
Register temp = noreg );
|
Register temp = noreg );
|
||||||
RegisterConstant ensure_rs2(RegisterConstant rs2, Register sethi_temp) {
|
RegisterOrConstant ensure_rs2(RegisterOrConstant rs2, Register sethi_temp) {
|
||||||
guarantee(sethi_temp != noreg, "constant offset overflow");
|
guarantee(sethi_temp != noreg, "constant offset overflow");
|
||||||
if (is_simm13(rs2.constant_or_zero()))
|
if (is_simm13(rs2.constant_or_zero()))
|
||||||
return rs2; // register or short constant
|
return rs2; // register or short constant
|
||||||
@ -2322,7 +2322,7 @@ class MacroAssembler: public Assembler {
|
|||||||
// interface method calling
|
// interface method calling
|
||||||
void lookup_interface_method(Register recv_klass,
|
void lookup_interface_method(Register recv_klass,
|
||||||
Register intf_klass,
|
Register intf_klass,
|
||||||
RegisterConstant itable_index,
|
RegisterOrConstant itable_index,
|
||||||
Register method_result,
|
Register method_result,
|
||||||
Register temp_reg, Register temp2_reg,
|
Register temp_reg, Register temp2_reg,
|
||||||
Label& no_such_interface);
|
Label& no_such_interface);
|
||||||
@ -2341,7 +2341,7 @@ class MacroAssembler: public Assembler {
|
|||||||
Label* L_success,
|
Label* L_success,
|
||||||
Label* L_failure,
|
Label* L_failure,
|
||||||
Label* L_slow_path,
|
Label* L_slow_path,
|
||||||
RegisterConstant super_check_offset = RegisterConstant(-1),
|
RegisterOrConstant super_check_offset = RegisterOrConstant(-1),
|
||||||
Register instanceof_hack = noreg);
|
Register instanceof_hack = noreg);
|
||||||
|
|
||||||
// The rest of the type check; must be wired to a corresponding fast path.
|
// The rest of the type check; must be wired to a corresponding fast path.
|
||||||
@ -2381,7 +2381,7 @@ class MacroAssembler: public Assembler {
|
|||||||
// stack overflow + shadow pages. Clobbers tsp and scratch registers.
|
// stack overflow + shadow pages. Clobbers tsp and scratch registers.
|
||||||
void bang_stack_size(Register Rsize, Register Rtsp, Register Rscratch);
|
void bang_stack_size(Register Rsize, Register Rtsp, Register Rscratch);
|
||||||
|
|
||||||
virtual RegisterConstant delayed_value(intptr_t* delayed_value_addr, Register tmp, int offset);
|
virtual RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr, Register tmp, int offset);
|
||||||
|
|
||||||
void verify_tlab();
|
void verify_tlab();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -143,45 +143,45 @@ inline void Assembler::ld( Register s1, Register s2, Register d) { lduw( s1, s2
|
|||||||
inline void Assembler::ld( Register s1, int simm13a, Register d) { lduw( s1, simm13a, d); }
|
inline void Assembler::ld( Register s1, int simm13a, Register d) { lduw( s1, simm13a, d); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline void Assembler::ldub( Register s1, RegisterConstant s2, Register d) {
|
inline void Assembler::ldub( Register s1, RegisterOrConstant s2, Register d) {
|
||||||
if (s2.is_register()) ldsb(s1, s2.as_register(), d);
|
if (s2.is_register()) ldsb(s1, s2.as_register(), d);
|
||||||
else ldsb(s1, s2.as_constant(), d);
|
else ldsb(s1, s2.as_constant(), d);
|
||||||
}
|
}
|
||||||
inline void Assembler::ldsb( Register s1, RegisterConstant s2, Register d) {
|
inline void Assembler::ldsb( Register s1, RegisterOrConstant s2, Register d) {
|
||||||
if (s2.is_register()) ldsb(s1, s2.as_register(), d);
|
if (s2.is_register()) ldsb(s1, s2.as_register(), d);
|
||||||
else ldsb(s1, s2.as_constant(), d);
|
else ldsb(s1, s2.as_constant(), d);
|
||||||
}
|
}
|
||||||
inline void Assembler::lduh( Register s1, RegisterConstant s2, Register d) {
|
inline void Assembler::lduh( Register s1, RegisterOrConstant s2, Register d) {
|
||||||
if (s2.is_register()) ldsh(s1, s2.as_register(), d);
|
if (s2.is_register()) ldsh(s1, s2.as_register(), d);
|
||||||
else ldsh(s1, s2.as_constant(), d);
|
else ldsh(s1, s2.as_constant(), d);
|
||||||
}
|
}
|
||||||
inline void Assembler::ldsh( Register s1, RegisterConstant s2, Register d) {
|
inline void Assembler::ldsh( Register s1, RegisterOrConstant s2, Register d) {
|
||||||
if (s2.is_register()) ldsh(s1, s2.as_register(), d);
|
if (s2.is_register()) ldsh(s1, s2.as_register(), d);
|
||||||
else ldsh(s1, s2.as_constant(), d);
|
else ldsh(s1, s2.as_constant(), d);
|
||||||
}
|
}
|
||||||
inline void Assembler::lduw( Register s1, RegisterConstant s2, Register d) {
|
inline void Assembler::lduw( Register s1, RegisterOrConstant s2, Register d) {
|
||||||
if (s2.is_register()) ldsw(s1, s2.as_register(), d);
|
if (s2.is_register()) ldsw(s1, s2.as_register(), d);
|
||||||
else ldsw(s1, s2.as_constant(), d);
|
else ldsw(s1, s2.as_constant(), d);
|
||||||
}
|
}
|
||||||
inline void Assembler::ldsw( Register s1, RegisterConstant s2, Register d) {
|
inline void Assembler::ldsw( Register s1, RegisterOrConstant s2, Register d) {
|
||||||
if (s2.is_register()) ldsw(s1, s2.as_register(), d);
|
if (s2.is_register()) ldsw(s1, s2.as_register(), d);
|
||||||
else ldsw(s1, s2.as_constant(), d);
|
else ldsw(s1, s2.as_constant(), d);
|
||||||
}
|
}
|
||||||
inline void Assembler::ldx( Register s1, RegisterConstant s2, Register d) {
|
inline void Assembler::ldx( Register s1, RegisterOrConstant s2, Register d) {
|
||||||
if (s2.is_register()) ldx(s1, s2.as_register(), d);
|
if (s2.is_register()) ldx(s1, s2.as_register(), d);
|
||||||
else ldx(s1, s2.as_constant(), d);
|
else ldx(s1, s2.as_constant(), d);
|
||||||
}
|
}
|
||||||
inline void Assembler::ld( Register s1, RegisterConstant s2, Register d) {
|
inline void Assembler::ld( Register s1, RegisterOrConstant s2, Register d) {
|
||||||
if (s2.is_register()) ld(s1, s2.as_register(), d);
|
if (s2.is_register()) ld(s1, s2.as_register(), d);
|
||||||
else ld(s1, s2.as_constant(), d);
|
else ld(s1, s2.as_constant(), d);
|
||||||
}
|
}
|
||||||
inline void Assembler::ldd( Register s1, RegisterConstant s2, Register d) {
|
inline void Assembler::ldd( Register s1, RegisterOrConstant s2, Register d) {
|
||||||
if (s2.is_register()) ldd(s1, s2.as_register(), d);
|
if (s2.is_register()) ldd(s1, s2.as_register(), d);
|
||||||
else ldd(s1, s2.as_constant(), d);
|
else ldd(s1, s2.as_constant(), d);
|
||||||
}
|
}
|
||||||
|
|
||||||
// form effective addresses this way:
|
// form effective addresses this way:
|
||||||
inline void Assembler::add( Register s1, RegisterConstant s2, Register d, int offset) {
|
inline void Assembler::add( Register s1, RegisterOrConstant s2, Register d, int offset) {
|
||||||
if (s2.is_register()) add(s1, s2.as_register(), d);
|
if (s2.is_register()) add(s1, s2.as_register(), d);
|
||||||
else { add(s1, s2.as_constant() + offset, d); offset = 0; }
|
else { add(s1, s2.as_constant() + offset, d); offset = 0; }
|
||||||
if (offset != 0) add(d, offset, d);
|
if (offset != 0) add(d, offset, d);
|
||||||
@ -243,23 +243,23 @@ inline void Assembler::std( Register d, Register s1, int simm13a) { v9_dep(); a
|
|||||||
inline void Assembler::st( Register d, Register s1, Register s2) { stw(d, s1, s2); }
|
inline void Assembler::st( Register d, Register s1, Register s2) { stw(d, s1, s2); }
|
||||||
inline void Assembler::st( Register d, Register s1, int simm13a) { stw(d, s1, simm13a); }
|
inline void Assembler::st( Register d, Register s1, int simm13a) { stw(d, s1, simm13a); }
|
||||||
|
|
||||||
inline void Assembler::stb( Register d, Register s1, RegisterConstant s2) {
|
inline void Assembler::stb( Register d, Register s1, RegisterOrConstant s2) {
|
||||||
if (s2.is_register()) stb(d, s1, s2.as_register());
|
if (s2.is_register()) stb(d, s1, s2.as_register());
|
||||||
else stb(d, s1, s2.as_constant());
|
else stb(d, s1, s2.as_constant());
|
||||||
}
|
}
|
||||||
inline void Assembler::sth( Register d, Register s1, RegisterConstant s2) {
|
inline void Assembler::sth( Register d, Register s1, RegisterOrConstant s2) {
|
||||||
if (s2.is_register()) sth(d, s1, s2.as_register());
|
if (s2.is_register()) sth(d, s1, s2.as_register());
|
||||||
else sth(d, s1, s2.as_constant());
|
else sth(d, s1, s2.as_constant());
|
||||||
}
|
}
|
||||||
inline void Assembler::stx( Register d, Register s1, RegisterConstant s2) {
|
inline void Assembler::stx( Register d, Register s1, RegisterOrConstant s2) {
|
||||||
if (s2.is_register()) stx(d, s1, s2.as_register());
|
if (s2.is_register()) stx(d, s1, s2.as_register());
|
||||||
else stx(d, s1, s2.as_constant());
|
else stx(d, s1, s2.as_constant());
|
||||||
}
|
}
|
||||||
inline void Assembler::std( Register d, Register s1, RegisterConstant s2) {
|
inline void Assembler::std( Register d, Register s1, RegisterOrConstant s2) {
|
||||||
if (s2.is_register()) std(d, s1, s2.as_register());
|
if (s2.is_register()) std(d, s1, s2.as_register());
|
||||||
else std(d, s1, s2.as_constant());
|
else std(d, s1, s2.as_constant());
|
||||||
}
|
}
|
||||||
inline void Assembler::st( Register d, Register s1, RegisterConstant s2) {
|
inline void Assembler::st( Register d, Register s1, RegisterOrConstant s2) {
|
||||||
if (s2.is_register()) st(d, s1, s2.as_register());
|
if (s2.is_register()) st(d, s1, s2.as_register());
|
||||||
else st(d, s1, s2.as_constant());
|
else st(d, s1, s2.as_constant());
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ inline void MacroAssembler::ld_ptr( Register s1, int simm13a, Register d ) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MacroAssembler::ld_ptr( Register s1, RegisterConstant s2, Register d ) {
|
inline void MacroAssembler::ld_ptr( Register s1, RegisterOrConstant s2, Register d ) {
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
Assembler::ldx( s1, s2, d);
|
Assembler::ldx( s1, s2, d);
|
||||||
#else
|
#else
|
||||||
@ -340,7 +340,7 @@ inline void MacroAssembler::st_ptr( Register d, Register s1, int simm13a ) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MacroAssembler::st_ptr( Register d, Register s1, RegisterConstant s2 ) {
|
inline void MacroAssembler::st_ptr( Register d, Register s1, RegisterOrConstant s2 ) {
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
Assembler::stx( d, s1, s2);
|
Assembler::stx( d, s1, s2);
|
||||||
#else
|
#else
|
||||||
@ -373,7 +373,7 @@ inline void MacroAssembler::ld_long( Register s1, int simm13a, Register d ) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MacroAssembler::ld_long( Register s1, RegisterConstant s2, Register d ) {
|
inline void MacroAssembler::ld_long( Register s1, RegisterOrConstant s2, Register d ) {
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
Assembler::ldx(s1, s2, d);
|
Assembler::ldx(s1, s2, d);
|
||||||
#else
|
#else
|
||||||
@ -405,7 +405,7 @@ inline void MacroAssembler::st_long( Register d, Register s1, int simm13a ) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MacroAssembler::st_long( Register d, Register s1, RegisterConstant s2 ) {
|
inline void MacroAssembler::st_long( Register d, Register s1, RegisterOrConstant s2 ) {
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
Assembler::stx(d, s1, s2);
|
Assembler::stx(d, s1, s2);
|
||||||
#else
|
#else
|
||||||
@ -455,7 +455,7 @@ inline void MacroAssembler::srl_ptr( Register s1, int imm6a, Register d ) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MacroAssembler::sll_ptr( Register s1, RegisterConstant s2, Register d ) {
|
inline void MacroAssembler::sll_ptr( Register s1, RegisterOrConstant s2, Register d ) {
|
||||||
if (s2.is_register()) sll_ptr(s1, s2.as_register(), d);
|
if (s2.is_register()) sll_ptr(s1, s2.as_register(), d);
|
||||||
else sll_ptr(s1, s2.as_constant(), d);
|
else sll_ptr(s1, s2.as_constant(), d);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -2489,7 +2489,7 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
|
|||||||
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, noreg,
|
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, noreg,
|
||||||
(need_slow_path ? &done : NULL),
|
(need_slow_path ? &done : NULL),
|
||||||
stub->entry(), NULL,
|
stub->entry(), NULL,
|
||||||
RegisterConstant(k->super_check_offset()));
|
RegisterOrConstant(k->super_check_offset()));
|
||||||
} else {
|
} else {
|
||||||
// perform the fast part of the checking logic
|
// perform the fast part of the checking logic
|
||||||
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, O7,
|
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, O7,
|
||||||
@ -2550,14 +2550,14 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
|
|||||||
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, O7, noreg,
|
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, O7, noreg,
|
||||||
(need_slow_path ? &done : NULL),
|
(need_slow_path ? &done : NULL),
|
||||||
(need_slow_path ? &done : NULL), NULL,
|
(need_slow_path ? &done : NULL), NULL,
|
||||||
RegisterConstant(k->super_check_offset()),
|
RegisterOrConstant(k->super_check_offset()),
|
||||||
dst);
|
dst);
|
||||||
} else {
|
} else {
|
||||||
assert(dst != klass_RInfo && dst != k_RInfo, "need 3 registers");
|
assert(dst != klass_RInfo && dst != k_RInfo, "need 3 registers");
|
||||||
// perform the fast part of the checking logic
|
// perform the fast part of the checking logic
|
||||||
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, O7, dst,
|
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, O7, dst,
|
||||||
&done, &done, NULL,
|
&done, &done, NULL,
|
||||||
RegisterConstant(-1),
|
RegisterOrConstant(-1),
|
||||||
dst);
|
dst);
|
||||||
}
|
}
|
||||||
if (need_slow_path) {
|
if (need_slow_path) {
|
||||||
|
@ -46,6 +46,7 @@ define_pd_global(uintx, TLABSize, 0);
|
|||||||
define_pd_global(uintx, NewSize, ScaleForWordSize((2048 * K) + (2 * (64 * K))));
|
define_pd_global(uintx, NewSize, ScaleForWordSize((2048 * K) + (2 * (64 * K))));
|
||||||
define_pd_global(intx, SurvivorRatio, 8);
|
define_pd_global(intx, SurvivorRatio, 8);
|
||||||
define_pd_global(intx, InlineFrequencyCount, 50); // we can use more inlining on the SPARC
|
define_pd_global(intx, InlineFrequencyCount, 50); // we can use more inlining on the SPARC
|
||||||
|
define_pd_global(intx, InlineSmallCode, 1500);
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
// Stack slots are 2X larger in LP64 than in the 32 bit VM.
|
// Stack slots are 2X larger in LP64 than in the 32 bit VM.
|
||||||
define_pd_global(intx, ThreadStackSize, 1024);
|
define_pd_global(intx, ThreadStackSize, 1024);
|
||||||
|
@ -817,21 +817,6 @@ class StubGenerator: public StubCodeGenerator {
|
|||||||
Label _atomic_add_stub; // called from other stubs
|
Label _atomic_add_stub; // called from other stubs
|
||||||
|
|
||||||
|
|
||||||
// Support for void OrderAccess::fence().
|
|
||||||
//
|
|
||||||
address generate_fence() {
|
|
||||||
StubCodeMark mark(this, "StubRoutines", "fence");
|
|
||||||
address start = __ pc();
|
|
||||||
|
|
||||||
__ membar(Assembler::Membar_mask_bits(Assembler::LoadLoad | Assembler::LoadStore |
|
|
||||||
Assembler::StoreLoad | Assembler::StoreStore));
|
|
||||||
__ retl(false);
|
|
||||||
__ delayed()->nop();
|
|
||||||
|
|
||||||
return start;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------
|
||||||
// The following routine generates a subroutine to throw an asynchronous
|
// The following routine generates a subroutine to throw an asynchronous
|
||||||
// UnknownError when an unsafe access gets a fault that could not be
|
// UnknownError when an unsafe access gets a fault that could not be
|
||||||
@ -2861,7 +2846,6 @@ class StubGenerator: public StubCodeGenerator {
|
|||||||
StubRoutines::_atomic_cmpxchg_ptr_entry = StubRoutines::_atomic_cmpxchg_entry;
|
StubRoutines::_atomic_cmpxchg_ptr_entry = StubRoutines::_atomic_cmpxchg_entry;
|
||||||
StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
|
StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
|
||||||
StubRoutines::_atomic_add_ptr_entry = StubRoutines::_atomic_add_entry;
|
StubRoutines::_atomic_add_ptr_entry = StubRoutines::_atomic_add_entry;
|
||||||
StubRoutines::_fence_entry = generate_fence();
|
|
||||||
#endif // COMPILER2 !=> _LP64
|
#endif // COMPILER2 !=> _LP64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ void VM_Version::initialize() {
|
|||||||
if (is_niagara1()) {
|
if (is_niagara1()) {
|
||||||
// Indirect branch is the same cost as direct
|
// Indirect branch is the same cost as direct
|
||||||
if (FLAG_IS_DEFAULT(UseInlineCaches)) {
|
if (FLAG_IS_DEFAULT(UseInlineCaches)) {
|
||||||
UseInlineCaches = false;
|
FLAG_SET_DEFAULT(UseInlineCaches, false);
|
||||||
}
|
}
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
// Single issue niagara1 is slower for CompressedOops
|
// Single issue niagara1 is slower for CompressedOops
|
||||||
@ -79,15 +79,19 @@ void VM_Version::initialize() {
|
|||||||
#ifdef COMPILER2
|
#ifdef COMPILER2
|
||||||
// Indirect branch is the same cost as direct
|
// Indirect branch is the same cost as direct
|
||||||
if (FLAG_IS_DEFAULT(UseJumpTables)) {
|
if (FLAG_IS_DEFAULT(UseJumpTables)) {
|
||||||
UseJumpTables = true;
|
FLAG_SET_DEFAULT(UseJumpTables, true);
|
||||||
}
|
}
|
||||||
// Single-issue, so entry and loop tops are
|
// Single-issue, so entry and loop tops are
|
||||||
// aligned on a single instruction boundary
|
// aligned on a single instruction boundary
|
||||||
if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
|
if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
|
||||||
InteriorEntryAlignment = 4;
|
FLAG_SET_DEFAULT(InteriorEntryAlignment, 4);
|
||||||
}
|
}
|
||||||
if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
|
if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
|
||||||
OptoLoopAlignment = 4;
|
FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
|
||||||
|
}
|
||||||
|
if (is_niagara1_plus() && FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
|
||||||
|
// Use smaller prefetch distance on N2
|
||||||
|
FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -95,7 +99,7 @@ void VM_Version::initialize() {
|
|||||||
// Use hardware population count instruction if available.
|
// Use hardware population count instruction if available.
|
||||||
if (has_hardware_popc()) {
|
if (has_hardware_popc()) {
|
||||||
if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
|
if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
|
||||||
UsePopCountInstruction = true;
|
FLAG_SET_DEFAULT(UsePopCountInstruction, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1438,26 +1438,12 @@ void Assembler::lock() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serializes memory.
|
// Emit mfence instruction
|
||||||
void Assembler::mfence() {
|
void Assembler::mfence() {
|
||||||
// Memory barriers are only needed on multiprocessors
|
NOT_LP64(assert(VM_Version::supports_sse2(), "unsupported");)
|
||||||
if (os::is_MP()) {
|
emit_byte( 0x0F );
|
||||||
if( LP64_ONLY(true ||) VM_Version::supports_sse2() ) {
|
emit_byte( 0xAE );
|
||||||
emit_byte( 0x0F ); // MFENCE; faster blows no regs
|
emit_byte( 0xF0 );
|
||||||
emit_byte( 0xAE );
|
|
||||||
emit_byte( 0xF0 );
|
|
||||||
} else {
|
|
||||||
// All usable chips support "locked" instructions which suffice
|
|
||||||
// as barriers, and are much faster than the alternative of
|
|
||||||
// using cpuid instruction. We use here a locked add [esp],0.
|
|
||||||
// This is conveniently otherwise a no-op except for blowing
|
|
||||||
// flags (which we save and restore.)
|
|
||||||
pushf(); // Save eflags register
|
|
||||||
lock();
|
|
||||||
addl(Address(rsp, 0), 0);// Assert the lock# signal here
|
|
||||||
popf(); // Restore eflags register
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Assembler::mov(Register dst, Register src) {
|
void Assembler::mov(Register dst, Register src) {
|
||||||
@ -7218,7 +7204,7 @@ void MacroAssembler::trigfunc(char trig, int num_fpu_regs_in_use) {
|
|||||||
// On failure, execution transfers to the given label.
|
// On failure, execution transfers to the given label.
|
||||||
void MacroAssembler::lookup_interface_method(Register recv_klass,
|
void MacroAssembler::lookup_interface_method(Register recv_klass,
|
||||||
Register intf_klass,
|
Register intf_klass,
|
||||||
RegisterConstant itable_index,
|
RegisterOrConstant itable_index,
|
||||||
Register method_result,
|
Register method_result,
|
||||||
Register scan_temp,
|
Register scan_temp,
|
||||||
Label& L_no_such_interface) {
|
Label& L_no_such_interface) {
|
||||||
@ -7303,7 +7289,7 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass,
|
|||||||
Label* L_success,
|
Label* L_success,
|
||||||
Label* L_failure,
|
Label* L_failure,
|
||||||
Label* L_slow_path,
|
Label* L_slow_path,
|
||||||
RegisterConstant super_check_offset) {
|
RegisterOrConstant super_check_offset) {
|
||||||
assert_different_registers(sub_klass, super_klass, temp_reg);
|
assert_different_registers(sub_klass, super_klass, temp_reg);
|
||||||
bool must_load_sco = (super_check_offset.constant_or_zero() == -1);
|
bool must_load_sco = (super_check_offset.constant_or_zero() == -1);
|
||||||
if (super_check_offset.is_register()) {
|
if (super_check_offset.is_register()) {
|
||||||
@ -7352,7 +7338,7 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass,
|
|||||||
if (must_load_sco) {
|
if (must_load_sco) {
|
||||||
// Positive movl does right thing on LP64.
|
// Positive movl does right thing on LP64.
|
||||||
movl(temp_reg, super_check_offset_addr);
|
movl(temp_reg, super_check_offset_addr);
|
||||||
super_check_offset = RegisterConstant(temp_reg);
|
super_check_offset = RegisterOrConstant(temp_reg);
|
||||||
}
|
}
|
||||||
Address super_check_addr(sub_klass, super_check_offset, Address::times_1, 0);
|
Address super_check_addr(sub_klass, super_check_offset, Address::times_1, 0);
|
||||||
cmpptr(super_klass, super_check_addr); // load displayed supertype
|
cmpptr(super_klass, super_check_addr); // load displayed supertype
|
||||||
@ -7550,12 +7536,12 @@ void MacroAssembler::verify_oop(Register reg, const char* s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RegisterConstant MacroAssembler::delayed_value(intptr_t* delayed_value_addr,
|
RegisterOrConstant MacroAssembler::delayed_value_impl(intptr_t* delayed_value_addr,
|
||||||
Register tmp,
|
Register tmp,
|
||||||
int offset) {
|
int offset) {
|
||||||
intptr_t value = *delayed_value_addr;
|
intptr_t value = *delayed_value_addr;
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
return RegisterConstant(value + offset);
|
return RegisterOrConstant(value + offset);
|
||||||
|
|
||||||
// load indirectly to solve generation ordering problem
|
// load indirectly to solve generation ordering problem
|
||||||
movptr(tmp, ExternalAddress((address) delayed_value_addr));
|
movptr(tmp, ExternalAddress((address) delayed_value_addr));
|
||||||
@ -7571,7 +7557,7 @@ RegisterConstant MacroAssembler::delayed_value(intptr_t* delayed_value_addr,
|
|||||||
if (offset != 0)
|
if (offset != 0)
|
||||||
addptr(tmp, offset);
|
addptr(tmp, offset);
|
||||||
|
|
||||||
return RegisterConstant(tmp);
|
return RegisterOrConstant(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ class Address VALUE_OBJ_CLASS_SPEC {
|
|||||||
"inconsistent address");
|
"inconsistent address");
|
||||||
}
|
}
|
||||||
|
|
||||||
Address(Register base, RegisterConstant index, ScaleFactor scale = times_1, int disp = 0)
|
Address(Register base, RegisterOrConstant index, ScaleFactor scale = times_1, int disp = 0)
|
||||||
: _base (base),
|
: _base (base),
|
||||||
_index(index.register_or_noreg()),
|
_index(index.register_or_noreg()),
|
||||||
_scale(scale),
|
_scale(scale),
|
||||||
@ -256,7 +256,7 @@ class Address VALUE_OBJ_CLASS_SPEC {
|
|||||||
"inconsistent address");
|
"inconsistent address");
|
||||||
}
|
}
|
||||||
|
|
||||||
Address(Register base, RegisterConstant index, ScaleFactor scale, ByteSize disp)
|
Address(Register base, RegisterOrConstant index, ScaleFactor scale, ByteSize disp)
|
||||||
: _base (base),
|
: _base (base),
|
||||||
_index(index.register_or_noreg()),
|
_index(index.register_or_noreg()),
|
||||||
_scale(scale),
|
_scale(scale),
|
||||||
@ -1068,15 +1068,23 @@ private:
|
|||||||
LoadLoad = 1 << 0
|
LoadLoad = 1 << 0
|
||||||
};
|
};
|
||||||
|
|
||||||
// Serializes memory.
|
// Serializes memory and blows flags
|
||||||
void membar(Membar_mask_bits order_constraint) {
|
void membar(Membar_mask_bits order_constraint) {
|
||||||
// We only have to handle StoreLoad and LoadLoad
|
if (os::is_MP()) {
|
||||||
if (order_constraint & StoreLoad) {
|
// We only have to handle StoreLoad
|
||||||
// MFENCE subsumes LFENCE
|
if (order_constraint & StoreLoad) {
|
||||||
mfence();
|
// All usable chips support "locked" instructions which suffice
|
||||||
} /* [jk] not needed currently: else if (order_constraint & LoadLoad) {
|
// as barriers, and are much faster than the alternative of
|
||||||
lfence();
|
// using cpuid instruction. We use here a locked add [esp],0.
|
||||||
} */
|
// This is conveniently otherwise a no-op except for blowing
|
||||||
|
// flags.
|
||||||
|
// Any change to this code may need to revisit other places in
|
||||||
|
// the code where this idiom is used, in particular the
|
||||||
|
// orderAccess code.
|
||||||
|
lock();
|
||||||
|
addl(Address(rsp, 0), 0);// Assert the lock# signal here
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mfence();
|
void mfence();
|
||||||
@ -1802,7 +1810,7 @@ class MacroAssembler: public Assembler {
|
|||||||
// interface method calling
|
// interface method calling
|
||||||
void lookup_interface_method(Register recv_klass,
|
void lookup_interface_method(Register recv_klass,
|
||||||
Register intf_klass,
|
Register intf_klass,
|
||||||
RegisterConstant itable_index,
|
RegisterOrConstant itable_index,
|
||||||
Register method_result,
|
Register method_result,
|
||||||
Register scan_temp,
|
Register scan_temp,
|
||||||
Label& no_such_interface);
|
Label& no_such_interface);
|
||||||
@ -1819,7 +1827,7 @@ class MacroAssembler: public Assembler {
|
|||||||
Label* L_success,
|
Label* L_success,
|
||||||
Label* L_failure,
|
Label* L_failure,
|
||||||
Label* L_slow_path,
|
Label* L_slow_path,
|
||||||
RegisterConstant super_check_offset = RegisterConstant(-1));
|
RegisterOrConstant super_check_offset = RegisterOrConstant(-1));
|
||||||
|
|
||||||
// The rest of the type check; must be wired to a corresponding fast path.
|
// The rest of the type check; must be wired to a corresponding fast path.
|
||||||
// It does not repeat the fast path logic, so don't use it standalone.
|
// It does not repeat the fast path logic, so don't use it standalone.
|
||||||
@ -1883,9 +1891,9 @@ class MacroAssembler: public Assembler {
|
|||||||
// stack overflow + shadow pages. Also, clobbers tmp
|
// stack overflow + shadow pages. Also, clobbers tmp
|
||||||
void bang_stack_size(Register size, Register tmp);
|
void bang_stack_size(Register size, Register tmp);
|
||||||
|
|
||||||
virtual RegisterConstant delayed_value(intptr_t* delayed_value_addr,
|
virtual RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr,
|
||||||
Register tmp,
|
Register tmp,
|
||||||
int offset);
|
int offset);
|
||||||
|
|
||||||
// Support for serializing memory accesses between threads
|
// Support for serializing memory accesses between threads
|
||||||
void serialize_memory(Register thread, Register tmp);
|
void serialize_memory(Register thread, Register tmp);
|
||||||
|
@ -60,6 +60,7 @@ define_pd_global(uintx, NewSize, 1024 * K);
|
|||||||
define_pd_global(intx, StackShadowPages, 3 DEBUG_ONLY(+1));
|
define_pd_global(intx, StackShadowPages, 3 DEBUG_ONLY(+1));
|
||||||
#endif // AMD64
|
#endif // AMD64
|
||||||
define_pd_global(intx, InlineFrequencyCount, 100);
|
define_pd_global(intx, InlineFrequencyCount, 100);
|
||||||
|
define_pd_global(intx, InlineSmallCode, 1000);
|
||||||
define_pd_global(intx, PreInflateSpin, 10);
|
define_pd_global(intx, PreInflateSpin, 10);
|
||||||
|
|
||||||
define_pd_global(intx, StackYellowPages, 2);
|
define_pd_global(intx, StackYellowPages, 2);
|
||||||
|
@ -637,7 +637,7 @@ class StubGenerator: public StubCodeGenerator {
|
|||||||
address generate_orderaccess_fence() {
|
address generate_orderaccess_fence() {
|
||||||
StubCodeMark mark(this, "StubRoutines", "orderaccess_fence");
|
StubCodeMark mark(this, "StubRoutines", "orderaccess_fence");
|
||||||
address start = __ pc();
|
address start = __ pc();
|
||||||
__ mfence();
|
__ membar(Assembler::StoreLoad);
|
||||||
__ ret(0);
|
__ ret(0);
|
||||||
|
|
||||||
return start;
|
return start;
|
||||||
|
@ -4288,24 +4288,6 @@ encode %{
|
|||||||
emit_opcode(cbuf, 0xC8 + $src2$$reg);
|
emit_opcode(cbuf, 0xC8 + $src2$$reg);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
enc_class enc_membar_acquire %{
|
|
||||||
// Doug Lea believes this is not needed with current Sparcs and TSO.
|
|
||||||
// MacroAssembler masm(&cbuf);
|
|
||||||
// masm.membar();
|
|
||||||
%}
|
|
||||||
|
|
||||||
enc_class enc_membar_release %{
|
|
||||||
// Doug Lea believes this is not needed with current Sparcs and TSO.
|
|
||||||
// MacroAssembler masm(&cbuf);
|
|
||||||
// masm.membar();
|
|
||||||
%}
|
|
||||||
|
|
||||||
enc_class enc_membar_volatile %{
|
|
||||||
MacroAssembler masm(&cbuf);
|
|
||||||
masm.membar(Assembler::Membar_mask_bits(Assembler::StoreLoad |
|
|
||||||
Assembler::StoreStore));
|
|
||||||
%}
|
|
||||||
|
|
||||||
// Atomically load the volatile long
|
// Atomically load the volatile long
|
||||||
enc_class enc_loadL_volatile( memory mem, stackSlotL dst ) %{
|
enc_class enc_loadL_volatile( memory mem, stackSlotL dst ) %{
|
||||||
emit_opcode(cbuf,0xDF);
|
emit_opcode(cbuf,0xDF);
|
||||||
@ -7498,9 +7480,9 @@ instruct membar_acquire() %{
|
|||||||
ins_cost(400);
|
ins_cost(400);
|
||||||
|
|
||||||
size(0);
|
size(0);
|
||||||
format %{ "MEMBAR-acquire" %}
|
format %{ "MEMBAR-acquire ! (empty encoding)" %}
|
||||||
ins_encode( enc_membar_acquire );
|
ins_encode();
|
||||||
ins_pipe(pipe_slow);
|
ins_pipe(empty);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
instruct membar_acquire_lock() %{
|
instruct membar_acquire_lock() %{
|
||||||
@ -7519,9 +7501,9 @@ instruct membar_release() %{
|
|||||||
ins_cost(400);
|
ins_cost(400);
|
||||||
|
|
||||||
size(0);
|
size(0);
|
||||||
format %{ "MEMBAR-release" %}
|
format %{ "MEMBAR-release ! (empty encoding)" %}
|
||||||
ins_encode( enc_membar_release );
|
ins_encode( );
|
||||||
ins_pipe(pipe_slow);
|
ins_pipe(empty);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
instruct membar_release_lock() %{
|
instruct membar_release_lock() %{
|
||||||
@ -7535,12 +7517,22 @@ instruct membar_release_lock() %{
|
|||||||
ins_pipe(empty);
|
ins_pipe(empty);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
instruct membar_volatile() %{
|
instruct membar_volatile(eFlagsReg cr) %{
|
||||||
match(MemBarVolatile);
|
match(MemBarVolatile);
|
||||||
|
effect(KILL cr);
|
||||||
ins_cost(400);
|
ins_cost(400);
|
||||||
|
|
||||||
format %{ "MEMBAR-volatile" %}
|
format %{
|
||||||
ins_encode( enc_membar_volatile );
|
$$template
|
||||||
|
if (os::is_MP()) {
|
||||||
|
$$emit$$"LOCK ADDL [ESP + #0], 0\t! membar_volatile"
|
||||||
|
} else {
|
||||||
|
$$emit$$"MEMBAR-volatile ! (empty encoding)"
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
ins_encode %{
|
||||||
|
__ membar(Assembler::StoreLoad);
|
||||||
|
%}
|
||||||
ins_pipe(pipe_slow);
|
ins_pipe(pipe_slow);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -4162,33 +4162,6 @@ encode %{
|
|||||||
// done:
|
// done:
|
||||||
%}
|
%}
|
||||||
|
|
||||||
enc_class enc_membar_acquire
|
|
||||||
%{
|
|
||||||
// [jk] not needed currently, if you enable this and it really
|
|
||||||
// emits code don't forget to the remove the "size(0)" line in
|
|
||||||
// membar_acquire()
|
|
||||||
// MacroAssembler masm(&cbuf);
|
|
||||||
// masm.membar(Assembler::Membar_mask_bits(Assembler::LoadStore |
|
|
||||||
// Assembler::LoadLoad));
|
|
||||||
%}
|
|
||||||
|
|
||||||
enc_class enc_membar_release
|
|
||||||
%{
|
|
||||||
// [jk] not needed currently, if you enable this and it really
|
|
||||||
// emits code don't forget to the remove the "size(0)" line in
|
|
||||||
// membar_release()
|
|
||||||
// MacroAssembler masm(&cbuf);
|
|
||||||
// masm.membar(Assembler::Membar_mask_bits(Assembler::LoadStore |
|
|
||||||
// Assembler::StoreStore));
|
|
||||||
%}
|
|
||||||
|
|
||||||
enc_class enc_membar_volatile
|
|
||||||
%{
|
|
||||||
MacroAssembler masm(&cbuf);
|
|
||||||
masm.membar(Assembler::Membar_mask_bits(Assembler::StoreLoad |
|
|
||||||
Assembler::StoreStore));
|
|
||||||
%}
|
|
||||||
|
|
||||||
// Safepoint Poll. This polls the safepoint page, and causes an
|
// Safepoint Poll. This polls the safepoint page, and causes an
|
||||||
// exception if it is not readable. Unfortunately, it kills
|
// exception if it is not readable. Unfortunately, it kills
|
||||||
// RFLAGS in the process.
|
// RFLAGS in the process.
|
||||||
@ -7458,7 +7431,7 @@ instruct membar_acquire()
|
|||||||
ins_cost(0);
|
ins_cost(0);
|
||||||
|
|
||||||
size(0);
|
size(0);
|
||||||
format %{ "MEMBAR-acquire" %}
|
format %{ "MEMBAR-acquire ! (empty encoding)" %}
|
||||||
ins_encode();
|
ins_encode();
|
||||||
ins_pipe(empty);
|
ins_pipe(empty);
|
||||||
%}
|
%}
|
||||||
@ -7481,7 +7454,7 @@ instruct membar_release()
|
|||||||
ins_cost(0);
|
ins_cost(0);
|
||||||
|
|
||||||
size(0);
|
size(0);
|
||||||
format %{ "MEMBAR-release" %}
|
format %{ "MEMBAR-release ! (empty encoding)" %}
|
||||||
ins_encode();
|
ins_encode();
|
||||||
ins_pipe(empty);
|
ins_pipe(empty);
|
||||||
%}
|
%}
|
||||||
@ -7498,13 +7471,22 @@ instruct membar_release_lock()
|
|||||||
ins_pipe(empty);
|
ins_pipe(empty);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
instruct membar_volatile()
|
instruct membar_volatile(rFlagsReg cr) %{
|
||||||
%{
|
|
||||||
match(MemBarVolatile);
|
match(MemBarVolatile);
|
||||||
|
effect(KILL cr);
|
||||||
ins_cost(400);
|
ins_cost(400);
|
||||||
|
|
||||||
format %{ "MEMBAR-volatile" %}
|
format %{
|
||||||
ins_encode(enc_membar_volatile);
|
$$template
|
||||||
|
if (os::is_MP()) {
|
||||||
|
$$emit$$"lock addl [rsp + #0], 0\t! membar_volatile"
|
||||||
|
} else {
|
||||||
|
$$emit$$"MEMBAR-volatile ! (empty encoding)"
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
ins_encode %{
|
||||||
|
__ membar(Assembler::StoreLoad);
|
||||||
|
%}
|
||||||
ins_pipe(pipe_slow);
|
ins_pipe(pipe_slow);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -29,13 +29,11 @@
|
|||||||
static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
|
static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
|
||||||
static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
|
static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
|
||||||
static jint (*atomic_add_func) (jint, volatile jint*);
|
static jint (*atomic_add_func) (jint, volatile jint*);
|
||||||
static void (*fence_func) ();
|
|
||||||
|
|
||||||
static jint atomic_xchg_bootstrap (jint, volatile jint*);
|
static jint atomic_xchg_bootstrap (jint, volatile jint*);
|
||||||
static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
|
static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
|
||||||
static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
|
static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
|
||||||
static jint atomic_add_bootstrap (jint, volatile jint*);
|
static jint atomic_add_bootstrap (jint, volatile jint*);
|
||||||
static void fence_bootstrap ();
|
|
||||||
|
|
||||||
static void setup_fpu() {}
|
static void setup_fpu() {}
|
||||||
|
|
||||||
|
@ -44,11 +44,12 @@ inline void OrderAccess::release() {
|
|||||||
|
|
||||||
inline void OrderAccess::fence() {
|
inline void OrderAccess::fence() {
|
||||||
if (os::is_MP()) {
|
if (os::is_MP()) {
|
||||||
|
// always use locked addl since mfence is sometimes expensive
|
||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
__asm__ __volatile__ ("mfence":::"memory");
|
__asm__ volatile ("lock; addl $0,0(%%rsp)" : : : "cc", "memory");
|
||||||
#else
|
#else
|
||||||
__asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
|
__asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
|
||||||
#endif // AMD64
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,22 +60,10 @@ inline void OrderAccess::release() {
|
|||||||
dummy = 0;
|
dummy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(COMPILER2) || defined(_LP64)
|
|
||||||
|
|
||||||
inline void OrderAccess::fence() {
|
inline void OrderAccess::fence() {
|
||||||
_OrderAccess_fence();
|
_OrderAccess_fence();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // defined(COMPILER2) || defined(_LP64)
|
|
||||||
|
|
||||||
inline void OrderAccess::fence() {
|
|
||||||
if (os::is_MP()) {
|
|
||||||
(*os::fence_func)();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // defined(COMPILER2) || defined(_LP64)
|
|
||||||
|
|
||||||
#endif // _GNU_SOURCE
|
#endif // _GNU_SOURCE
|
||||||
|
|
||||||
inline jbyte OrderAccess::load_acquire(volatile jbyte* p) { return *p; }
|
inline jbyte OrderAccess::load_acquire(volatile jbyte* p) { return *p; }
|
||||||
|
@ -619,7 +619,6 @@ typedef jint xchg_func_t (jint, volatile jint*);
|
|||||||
typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
|
typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
|
||||||
typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
|
typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
|
||||||
typedef jint add_func_t (jint, volatile jint*);
|
typedef jint add_func_t (jint, volatile jint*);
|
||||||
typedef void fence_func_t ();
|
|
||||||
|
|
||||||
jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
|
jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
|
||||||
// try to use the stub:
|
// try to use the stub:
|
||||||
@ -681,25 +680,10 @@ jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
|
|||||||
return (*dest) += add_value;
|
return (*dest) += add_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void os::fence_bootstrap() {
|
|
||||||
// try to use the stub:
|
|
||||||
fence_func_t* func = CAST_TO_FN_PTR(fence_func_t*, StubRoutines::fence_entry());
|
|
||||||
|
|
||||||
if (func != NULL) {
|
|
||||||
os::fence_func = func;
|
|
||||||
(*func)();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
assert(Threads::number_of_threads() == 0, "for bootstrap only");
|
|
||||||
|
|
||||||
// don't have to do anything for a single thread
|
|
||||||
}
|
|
||||||
|
|
||||||
xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap;
|
xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap;
|
||||||
cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
|
cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
|
||||||
cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
|
cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
|
||||||
add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
|
add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
|
||||||
fence_func_t* os::fence_func = os::fence_bootstrap;
|
|
||||||
|
|
||||||
#endif // !_LP64 && !COMPILER2
|
#endif // !_LP64 && !COMPILER2
|
||||||
|
|
||||||
|
@ -29,13 +29,11 @@
|
|||||||
static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
|
static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
|
||||||
static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
|
static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
|
||||||
static jint (*atomic_add_func) (jint, volatile jint*);
|
static jint (*atomic_add_func) (jint, volatile jint*);
|
||||||
static void (*fence_func) ();
|
|
||||||
|
|
||||||
static jint atomic_xchg_bootstrap (jint, volatile jint*);
|
static jint atomic_xchg_bootstrap (jint, volatile jint*);
|
||||||
static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
|
static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
|
||||||
static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
|
static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
|
||||||
static jint atomic_add_bootstrap (jint, volatile jint*);
|
static jint atomic_add_bootstrap (jint, volatile jint*);
|
||||||
static void fence_bootstrap ();
|
|
||||||
|
|
||||||
static void setup_fpu() {}
|
static void setup_fpu() {}
|
||||||
|
|
||||||
|
@ -61,11 +61,8 @@ extern "C" {
|
|||||||
#endif // AMD64
|
#endif // AMD64
|
||||||
}
|
}
|
||||||
inline void _OrderAccess_fence() {
|
inline void _OrderAccess_fence() {
|
||||||
#ifdef AMD64
|
// Always use locked addl since mfence is sometimes expensive
|
||||||
__asm__ __volatile__ ("mfence":::"memory");
|
|
||||||
#else
|
|
||||||
__asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
|
__asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
|
||||||
#endif // AMD64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -794,7 +794,6 @@ typedef jint xchg_func_t (jint, volatile jint*);
|
|||||||
typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
|
typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
|
||||||
typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
|
typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
|
||||||
typedef jint add_func_t (jint, volatile jint*);
|
typedef jint add_func_t (jint, volatile jint*);
|
||||||
typedef void fence_func_t ();
|
|
||||||
|
|
||||||
jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
|
jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
|
||||||
// try to use the stub:
|
// try to use the stub:
|
||||||
@ -856,25 +855,10 @@ jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
|
|||||||
return (*dest) += add_value;
|
return (*dest) += add_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void os::fence_bootstrap() {
|
|
||||||
// try to use the stub:
|
|
||||||
fence_func_t* func = CAST_TO_FN_PTR(fence_func_t*, StubRoutines::fence_entry());
|
|
||||||
|
|
||||||
if (func != NULL) {
|
|
||||||
os::fence_func = func;
|
|
||||||
(*func)();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
assert(Threads::number_of_threads() == 0, "for bootstrap only");
|
|
||||||
|
|
||||||
// don't have to do anything for a single thread
|
|
||||||
}
|
|
||||||
|
|
||||||
xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap;
|
xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap;
|
||||||
cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
|
cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
|
||||||
cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
|
cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
|
||||||
add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
|
add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
|
||||||
fence_func_t* os::fence_func = os::fence_bootstrap;
|
|
||||||
|
|
||||||
extern "C" _solaris_raw_setup_fpu(address ptr);
|
extern "C" _solaris_raw_setup_fpu(address ptr);
|
||||||
void os::setup_fpu() {
|
void os::setup_fpu() {
|
||||||
|
@ -32,13 +32,11 @@
|
|||||||
static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
|
static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
|
||||||
static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
|
static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
|
||||||
static jint (*atomic_add_func) (jint, volatile jint*);
|
static jint (*atomic_add_func) (jint, volatile jint*);
|
||||||
static void (*fence_func) ();
|
|
||||||
|
|
||||||
static jint atomic_xchg_bootstrap (jint, volatile jint*);
|
static jint atomic_xchg_bootstrap (jint, volatile jint*);
|
||||||
static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
|
static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
|
||||||
static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
|
static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
|
||||||
static jint atomic_add_bootstrap (jint, volatile jint*);
|
static jint atomic_add_bootstrap (jint, volatile jint*);
|
||||||
static void fence_bootstrap ();
|
|
||||||
|
|
||||||
static void setup_fpu();
|
static void setup_fpu();
|
||||||
#endif // AMD64
|
#endif // AMD64
|
||||||
|
@ -46,7 +46,7 @@ inline void OrderAccess::release() {
|
|||||||
|
|
||||||
inline void OrderAccess::fence() {
|
inline void OrderAccess::fence() {
|
||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
(*os::fence_func)();
|
StubRoutines_fence();
|
||||||
#else
|
#else
|
||||||
if (os::is_MP()) {
|
if (os::is_MP()) {
|
||||||
__asm {
|
__asm {
|
||||||
|
@ -196,7 +196,6 @@ typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
|
|||||||
typedef jlong cmpxchg_long_func_t (jlong, volatile jlong*, jlong);
|
typedef jlong cmpxchg_long_func_t (jlong, volatile jlong*, jlong);
|
||||||
typedef jint add_func_t (jint, volatile jint*);
|
typedef jint add_func_t (jint, volatile jint*);
|
||||||
typedef intptr_t add_ptr_func_t (intptr_t, volatile intptr_t*);
|
typedef intptr_t add_ptr_func_t (intptr_t, volatile intptr_t*);
|
||||||
typedef void fence_func_t ();
|
|
||||||
|
|
||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
|
|
||||||
@ -292,27 +291,11 @@ intptr_t os::atomic_add_ptr_bootstrap(intptr_t add_value, volatile intptr_t* des
|
|||||||
return (*dest) += add_value;
|
return (*dest) += add_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void os::fence_bootstrap() {
|
|
||||||
// try to use the stub:
|
|
||||||
fence_func_t* func = CAST_TO_FN_PTR(fence_func_t*, StubRoutines::fence_entry());
|
|
||||||
|
|
||||||
if (func != NULL) {
|
|
||||||
os::fence_func = func;
|
|
||||||
(*func)();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
assert(Threads::number_of_threads() == 0, "for bootstrap only");
|
|
||||||
|
|
||||||
// don't have to do anything for a single thread
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap;
|
xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap;
|
||||||
xchg_ptr_func_t* os::atomic_xchg_ptr_func = os::atomic_xchg_ptr_bootstrap;
|
xchg_ptr_func_t* os::atomic_xchg_ptr_func = os::atomic_xchg_ptr_bootstrap;
|
||||||
cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
|
cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
|
||||||
add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
|
add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
|
||||||
add_ptr_func_t* os::atomic_add_ptr_func = os::atomic_add_ptr_bootstrap;
|
add_ptr_func_t* os::atomic_add_ptr_func = os::atomic_add_ptr_bootstrap;
|
||||||
fence_func_t* os::fence_func = os::fence_bootstrap;
|
|
||||||
|
|
||||||
#endif // AMD64
|
#endif // AMD64
|
||||||
|
|
||||||
|
@ -35,9 +35,6 @@
|
|||||||
static jint (*atomic_add_func) (jint, volatile jint*);
|
static jint (*atomic_add_func) (jint, volatile jint*);
|
||||||
static intptr_t (*atomic_add_ptr_func) (intptr_t, volatile intptr_t*);
|
static intptr_t (*atomic_add_ptr_func) (intptr_t, volatile intptr_t*);
|
||||||
|
|
||||||
static void (*fence_func) ();
|
|
||||||
|
|
||||||
|
|
||||||
static jint atomic_xchg_bootstrap (jint, volatile jint*);
|
static jint atomic_xchg_bootstrap (jint, volatile jint*);
|
||||||
static intptr_t atomic_xchg_ptr_bootstrap (intptr_t, volatile intptr_t*);
|
static intptr_t atomic_xchg_ptr_bootstrap (intptr_t, volatile intptr_t*);
|
||||||
|
|
||||||
@ -53,8 +50,6 @@
|
|||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
static jint atomic_add_bootstrap (jint, volatile jint*);
|
static jint atomic_add_bootstrap (jint, volatile jint*);
|
||||||
static intptr_t atomic_add_ptr_bootstrap (intptr_t, volatile intptr_t*);
|
static intptr_t atomic_add_ptr_bootstrap (intptr_t, volatile intptr_t*);
|
||||||
|
|
||||||
static void fence_bootstrap ();
|
|
||||||
#endif // AMD64
|
#endif // AMD64
|
||||||
|
|
||||||
static void setup_fpu();
|
static void setup_fpu();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -143,15 +143,15 @@ class Label VALUE_OBJ_CLASS_SPEC {
|
|||||||
// A union type for code which has to assemble both constant and
|
// A union type for code which has to assemble both constant and
|
||||||
// non-constant operands, when the distinction cannot be made
|
// non-constant operands, when the distinction cannot be made
|
||||||
// statically.
|
// statically.
|
||||||
class RegisterConstant VALUE_OBJ_CLASS_SPEC {
|
class RegisterOrConstant VALUE_OBJ_CLASS_SPEC {
|
||||||
private:
|
private:
|
||||||
Register _r;
|
Register _r;
|
||||||
intptr_t _c;
|
intptr_t _c;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RegisterConstant(): _r(noreg), _c(0) {}
|
RegisterOrConstant(): _r(noreg), _c(0) {}
|
||||||
RegisterConstant(Register r): _r(r), _c(0) {}
|
RegisterOrConstant(Register r): _r(r), _c(0) {}
|
||||||
RegisterConstant(intptr_t c): _r(noreg), _c(c) {}
|
RegisterOrConstant(intptr_t c): _r(noreg), _c(c) {}
|
||||||
|
|
||||||
Register as_register() const { assert(is_register(),""); return _r; }
|
Register as_register() const { assert(is_register(),""); return _r; }
|
||||||
intptr_t as_constant() const { assert(is_constant(),""); return _c; }
|
intptr_t as_constant() const { assert(is_constant(),""); return _c; }
|
||||||
@ -310,13 +310,13 @@ class AbstractAssembler : public ResourceObj {
|
|||||||
// offsets in code which must be generated before the object class is loaded.
|
// offsets in code which must be generated before the object class is loaded.
|
||||||
// Field offsets are never zero, since an object's header (mark word)
|
// Field offsets are never zero, since an object's header (mark word)
|
||||||
// is located at offset zero.
|
// is located at offset zero.
|
||||||
RegisterConstant delayed_value(int(*value_fn)(), Register tmp, int offset = 0) {
|
RegisterOrConstant delayed_value(int(*value_fn)(), Register tmp, int offset = 0) {
|
||||||
return delayed_value(delayed_value_addr(value_fn), tmp, offset);
|
return delayed_value_impl(delayed_value_addr(value_fn), tmp, offset);
|
||||||
}
|
}
|
||||||
RegisterConstant delayed_value(address(*value_fn)(), Register tmp, int offset = 0) {
|
RegisterOrConstant delayed_value(address(*value_fn)(), Register tmp, int offset = 0) {
|
||||||
return delayed_value(delayed_value_addr(value_fn), tmp, offset);
|
return delayed_value_impl(delayed_value_addr(value_fn), tmp, offset);
|
||||||
}
|
}
|
||||||
virtual RegisterConstant delayed_value(intptr_t* delayed_value_addr, Register tmp, int offset) = 0;
|
virtual RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr, Register tmp, int offset) = 0;
|
||||||
// Last overloading is platform-dependent; look in assembler_<arch>.cpp.
|
// Last overloading is platform-dependent; look in assembler_<arch>.cpp.
|
||||||
static intptr_t* delayed_value_addr(int(*constant_fn)());
|
static intptr_t* delayed_value_addr(int(*constant_fn)());
|
||||||
static intptr_t* delayed_value_addr(address(*constant_fn)());
|
static intptr_t* delayed_value_addr(address(*constant_fn)());
|
||||||
|
@ -2237,7 +2237,6 @@ ciTypeFlow::Block* ciTypeFlow::clone_loop_head(Loop* lp, StateVector* temp_vecto
|
|||||||
for (SuccIter iter(tail); !iter.done(); iter.next()) {
|
for (SuccIter iter(tail); !iter.done(); iter.next()) {
|
||||||
if (iter.succ() == head) {
|
if (iter.succ() == head) {
|
||||||
iter.set_succ(clone);
|
iter.set_succ(clone);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flow_block(tail, temp_vector, temp_set);
|
flow_block(tail, temp_vector, temp_set);
|
||||||
|
@ -239,22 +239,20 @@ symbolHandle java_lang_String::as_symbol(Handle java_string, TRAPS) {
|
|||||||
typeArrayOop value = java_lang_String::value(obj);
|
typeArrayOop value = java_lang_String::value(obj);
|
||||||
int offset = java_lang_String::offset(obj);
|
int offset = java_lang_String::offset(obj);
|
||||||
int length = java_lang_String::length(obj);
|
int length = java_lang_String::length(obj);
|
||||||
|
jchar* base = value->char_at_addr(offset);
|
||||||
ResourceMark rm(THREAD);
|
symbolOop sym = SymbolTable::lookup_unicode(base, length, THREAD);
|
||||||
symbolHandle result;
|
return symbolHandle(THREAD, sym);
|
||||||
|
|
||||||
if (length > 0) {
|
|
||||||
int utf8_length = UNICODE::utf8_length(value->char_at_addr(offset), length);
|
|
||||||
char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1);
|
|
||||||
UNICODE::convert_to_utf8(value->char_at_addr(offset), length, chars);
|
|
||||||
// Allocate the symbol
|
|
||||||
result = oopFactory::new_symbol_handle(chars, utf8_length, CHECK_(symbolHandle()));
|
|
||||||
} else {
|
|
||||||
result = oopFactory::new_symbol_handle("", 0, CHECK_(symbolHandle()));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
symbolOop java_lang_String::as_symbol_or_null(oop java_string) {
|
||||||
|
typeArrayOop value = java_lang_String::value(java_string);
|
||||||
|
int offset = java_lang_String::offset(java_string);
|
||||||
|
int length = java_lang_String::length(java_string);
|
||||||
|
jchar* base = value->char_at_addr(offset);
|
||||||
|
return SymbolTable::probe_unicode(base, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int java_lang_String::utf8_length(oop java_string) {
|
int java_lang_String::utf8_length(oop java_string) {
|
||||||
typeArrayOop value = java_lang_String::value(java_string);
|
typeArrayOop value = java_lang_String::value(java_string);
|
||||||
int offset = java_lang_String::offset(java_string);
|
int offset = java_lang_String::offset(java_string);
|
||||||
@ -385,6 +383,48 @@ klassOop java_lang_Class::as_klassOop(oop java_class) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void java_lang_Class::print_signature(oop java_class, outputStream* st) {
|
||||||
|
assert(java_lang_Class::is_instance(java_class), "must be a Class object");
|
||||||
|
symbolOop name = NULL;
|
||||||
|
bool is_instance = false;
|
||||||
|
if (is_primitive(java_class)) {
|
||||||
|
name = vmSymbols::type_signature(primitive_type(java_class));
|
||||||
|
} else {
|
||||||
|
klassOop k = as_klassOop(java_class);
|
||||||
|
is_instance = Klass::cast(k)->oop_is_instance();
|
||||||
|
name = Klass::cast(k)->name();
|
||||||
|
}
|
||||||
|
if (name == NULL) {
|
||||||
|
st->print("<null>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (is_instance) st->print("L");
|
||||||
|
st->write((char*) name->base(), (int) name->utf8_length());
|
||||||
|
if (is_instance) st->print(";");
|
||||||
|
}
|
||||||
|
|
||||||
|
symbolOop java_lang_Class::as_signature(oop java_class, bool intern_if_not_found, TRAPS) {
|
||||||
|
assert(java_lang_Class::is_instance(java_class), "must be a Class object");
|
||||||
|
symbolOop name = NULL;
|
||||||
|
if (is_primitive(java_class)) {
|
||||||
|
return vmSymbols::type_signature(primitive_type(java_class));
|
||||||
|
} else {
|
||||||
|
klassOop k = as_klassOop(java_class);
|
||||||
|
if (!Klass::cast(k)->oop_is_instance()) {
|
||||||
|
return Klass::cast(k)->name();
|
||||||
|
} else {
|
||||||
|
ResourceMark rm;
|
||||||
|
const char* sigstr = Klass::cast(k)->signature_name();
|
||||||
|
int siglen = (int) strlen(sigstr);
|
||||||
|
if (!intern_if_not_found)
|
||||||
|
return SymbolTable::probe(sigstr, siglen);
|
||||||
|
else
|
||||||
|
return oopFactory::new_symbol(sigstr, siglen, THREAD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
klassOop java_lang_Class::array_klass(oop java_class) {
|
klassOop java_lang_Class::array_klass(oop java_class) {
|
||||||
klassOop k = klassOop(java_class->obj_field(array_klass_offset));
|
klassOop k = klassOop(java_class->obj_field(array_klass_offset));
|
||||||
assert(k == NULL || k->is_klass() && Klass::cast(k)->oop_is_javaArray(), "should be array klass");
|
assert(k == NULL || k->is_klass() && Klass::cast(k)->oop_is_javaArray(), "should be array klass");
|
||||||
@ -412,6 +452,8 @@ void java_lang_Class::set_resolved_constructor(oop java_class, methodOop constru
|
|||||||
|
|
||||||
|
|
||||||
bool java_lang_Class::is_primitive(oop java_class) {
|
bool java_lang_Class::is_primitive(oop java_class) {
|
||||||
|
// should assert:
|
||||||
|
//assert(java_lang_Class::is_instance(java_class), "must be a Class object");
|
||||||
klassOop k = klassOop(java_class->obj_field(klass_offset));
|
klassOop k = klassOop(java_class->obj_field(klass_offset));
|
||||||
return k == NULL;
|
return k == NULL;
|
||||||
}
|
}
|
||||||
@ -431,6 +473,19 @@ BasicType java_lang_Class::primitive_type(oop java_class) {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BasicType java_lang_Class::as_BasicType(oop java_class, klassOop* reference_klass) {
|
||||||
|
assert(java_lang_Class::is_instance(java_class), "must be a Class object");
|
||||||
|
if (is_primitive(java_class)) {
|
||||||
|
if (reference_klass != NULL)
|
||||||
|
(*reference_klass) = NULL;
|
||||||
|
return primitive_type(java_class);
|
||||||
|
} else {
|
||||||
|
if (reference_klass != NULL)
|
||||||
|
(*reference_klass) = as_klassOop(java_class);
|
||||||
|
return T_OBJECT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
oop java_lang_Class::primitive_mirror(BasicType t) {
|
oop java_lang_Class::primitive_mirror(BasicType t) {
|
||||||
oop mirror = Universe::java_mirror(t);
|
oop mirror = Universe::java_mirror(t);
|
||||||
@ -1988,6 +2043,21 @@ BasicType java_lang_boxing_object::set_value(oop box, jvalue* value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void java_lang_boxing_object::print(BasicType type, jvalue* value, outputStream* st) {
|
||||||
|
switch (type) {
|
||||||
|
case T_BOOLEAN: st->print("%s", value->z ? "true" : "false"); break;
|
||||||
|
case T_CHAR: st->print("%d", value->c); break;
|
||||||
|
case T_BYTE: st->print("%d", value->b); break;
|
||||||
|
case T_SHORT: st->print("%d", value->s); break;
|
||||||
|
case T_INT: st->print("%d", value->i); break;
|
||||||
|
case T_LONG: st->print(INT64_FORMAT, value->j); break;
|
||||||
|
case T_FLOAT: st->print("%f", value->f); break;
|
||||||
|
case T_DOUBLE: st->print("%lf", value->d); break;
|
||||||
|
default: st->print("type %d?", type); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Support for java_lang_ref_Reference
|
// Support for java_lang_ref_Reference
|
||||||
oop java_lang_ref_Reference::pending_list_lock() {
|
oop java_lang_ref_Reference::pending_list_lock() {
|
||||||
instanceKlass* ik = instanceKlass::cast(SystemDictionary::reference_klass());
|
instanceKlass* ik = instanceKlass::cast(SystemDictionary::reference_klass());
|
||||||
|
@ -107,6 +107,7 @@ class java_lang_String : AllStatic {
|
|||||||
|
|
||||||
// Conversion
|
// Conversion
|
||||||
static symbolHandle as_symbol(Handle java_string, TRAPS);
|
static symbolHandle as_symbol(Handle java_string, TRAPS);
|
||||||
|
static symbolOop as_symbol_or_null(oop java_string);
|
||||||
|
|
||||||
// Testers
|
// Testers
|
||||||
static bool is_instance(oop obj) {
|
static bool is_instance(oop obj) {
|
||||||
@ -149,6 +150,9 @@ class java_lang_Class : AllStatic {
|
|||||||
static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
|
static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
|
||||||
// Conversion
|
// Conversion
|
||||||
static klassOop as_klassOop(oop java_class);
|
static klassOop as_klassOop(oop java_class);
|
||||||
|
static BasicType as_BasicType(oop java_class, klassOop* reference_klass = NULL);
|
||||||
|
static symbolOop as_signature(oop java_class, bool intern_if_not_found, TRAPS);
|
||||||
|
static void print_signature(oop java_class, outputStream *st);
|
||||||
// Testing
|
// Testing
|
||||||
static bool is_instance(oop obj) {
|
static bool is_instance(oop obj) {
|
||||||
return obj != NULL && obj->klass() == SystemDictionary::class_klass();
|
return obj != NULL && obj->klass() == SystemDictionary::class_klass();
|
||||||
@ -668,6 +672,8 @@ class java_lang_boxing_object: AllStatic {
|
|||||||
static BasicType basic_type(oop box);
|
static BasicType basic_type(oop box);
|
||||||
static bool is_instance(oop box) { return basic_type(box) != T_ILLEGAL; }
|
static bool is_instance(oop box) { return basic_type(box) != T_ILLEGAL; }
|
||||||
static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; }
|
static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; }
|
||||||
|
static void print(oop box, outputStream* st) { jvalue value; print(get_value(box, &value), &value, st); }
|
||||||
|
static void print(BasicType type, jvalue* value, outputStream* st);
|
||||||
|
|
||||||
static int value_offset_in_bytes(BasicType type) {
|
static int value_offset_in_bytes(BasicType type) {
|
||||||
return ( type == T_LONG || type == T_DOUBLE ) ? long_value_offset :
|
return ( type == T_LONG || type == T_DOUBLE ) ? long_value_offset :
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -60,8 +60,10 @@ public:
|
|||||||
bool add_entry(symbolHandle name, klassOop klass1, Handle loader1,
|
bool add_entry(symbolHandle name, klassOop klass1, Handle loader1,
|
||||||
klassOop klass2, Handle loader2);
|
klassOop klass2, Handle loader2);
|
||||||
|
|
||||||
void check_signature_loaders(symbolHandle signature, Handle loader1,
|
// Note: The main entry point for this module is via SystemDictionary.
|
||||||
Handle loader2, bool is_method, TRAPS);
|
// SystemDictionary::check_signature_loaders(symbolHandle signature,
|
||||||
|
// Handle loader1, Handle loader2,
|
||||||
|
// bool is_method, TRAPS)
|
||||||
|
|
||||||
klassOop find_constrained_klass(symbolHandle name, Handle loader);
|
klassOop find_constrained_klass(symbolHandle name, Handle loader);
|
||||||
klassOop find_constrained_elem_klass(symbolHandle name, symbolHandle elem_name,
|
klassOop find_constrained_elem_klass(symbolHandle name, symbolHandle elem_name,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -109,6 +109,40 @@ symbolOop SymbolTable::lookup_only(const char* name, int len,
|
|||||||
return the_table()->lookup(index, name, len, hash);
|
return the_table()->lookup(index, name, len, hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Suggestion: Push unicode-based lookup all the way into the hashing
|
||||||
|
// and probing logic, so there is no need for convert_to_utf8 until
|
||||||
|
// an actual new symbolOop is created.
|
||||||
|
symbolOop SymbolTable::lookup_unicode(const jchar* name, int utf16_length, TRAPS) {
|
||||||
|
int utf8_length = UNICODE::utf8_length((jchar*) name, utf16_length);
|
||||||
|
char stack_buf[128];
|
||||||
|
if (utf8_length < (int) sizeof(stack_buf)) {
|
||||||
|
char* chars = stack_buf;
|
||||||
|
UNICODE::convert_to_utf8(name, utf16_length, chars);
|
||||||
|
return lookup(chars, utf8_length, THREAD);
|
||||||
|
} else {
|
||||||
|
ResourceMark rm(THREAD);
|
||||||
|
char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1);;
|
||||||
|
UNICODE::convert_to_utf8(name, utf16_length, chars);
|
||||||
|
return lookup(chars, utf8_length, THREAD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
symbolOop SymbolTable::lookup_only_unicode(const jchar* name, int utf16_length,
|
||||||
|
unsigned int& hash) {
|
||||||
|
int utf8_length = UNICODE::utf8_length((jchar*) name, utf16_length);
|
||||||
|
char stack_buf[128];
|
||||||
|
if (utf8_length < (int) sizeof(stack_buf)) {
|
||||||
|
char* chars = stack_buf;
|
||||||
|
UNICODE::convert_to_utf8(name, utf16_length, chars);
|
||||||
|
return lookup_only(chars, utf8_length, hash);
|
||||||
|
} else {
|
||||||
|
ResourceMark rm;
|
||||||
|
char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1);;
|
||||||
|
UNICODE::convert_to_utf8(name, utf16_length, chars);
|
||||||
|
return lookup_only(chars, utf8_length, hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SymbolTable::add(constantPoolHandle cp, int names_count,
|
void SymbolTable::add(constantPoolHandle cp, int names_count,
|
||||||
const char** names, int* lengths, int* cp_indices,
|
const char** names, int* lengths, int* cp_indices,
|
||||||
unsigned int* hashValues, TRAPS) {
|
unsigned int* hashValues, TRAPS) {
|
||||||
@ -126,15 +160,6 @@ void SymbolTable::add(constantPoolHandle cp, int names_count,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needed for preloading classes in signatures when compiling.
|
|
||||||
|
|
||||||
symbolOop SymbolTable::probe(const char* name, int len) {
|
|
||||||
unsigned int hashValue = hash_symbol(name, len);
|
|
||||||
int index = the_table()->hash_to_index(hashValue);
|
|
||||||
return the_table()->lookup(index, name, len, hashValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
symbolOop SymbolTable::basic_add(int index, u1 *name, int len,
|
symbolOop SymbolTable::basic_add(int index, u1 *name, int len,
|
||||||
unsigned int hashValue, TRAPS) {
|
unsigned int hashValue, TRAPS) {
|
||||||
assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(),
|
assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -91,6 +91,10 @@ public:
|
|||||||
// Only copy to C string to be added if lookup failed.
|
// Only copy to C string to be added if lookup failed.
|
||||||
static symbolOop lookup(symbolHandle sym, int begin, int end, TRAPS);
|
static symbolOop lookup(symbolHandle sym, int begin, int end, TRAPS);
|
||||||
|
|
||||||
|
// jchar (utf16) version of lookups
|
||||||
|
static symbolOop lookup_unicode(const jchar* name, int len, TRAPS);
|
||||||
|
static symbolOop lookup_only_unicode(const jchar* name, int len, unsigned int& hash);
|
||||||
|
|
||||||
static void add(constantPoolHandle cp, int names_count,
|
static void add(constantPoolHandle cp, int names_count,
|
||||||
const char** names, int* lengths, int* cp_indices,
|
const char** names, int* lengths, int* cp_indices,
|
||||||
unsigned int* hashValues, TRAPS);
|
unsigned int* hashValues, TRAPS);
|
||||||
@ -112,7 +116,14 @@ public:
|
|||||||
// Needed for preloading classes in signatures when compiling.
|
// Needed for preloading classes in signatures when compiling.
|
||||||
// Returns the symbol is already present in symbol table, otherwise
|
// Returns the symbol is already present in symbol table, otherwise
|
||||||
// NULL. NO ALLOCATION IS GUARANTEED!
|
// NULL. NO ALLOCATION IS GUARANTEED!
|
||||||
static symbolOop probe(const char* name, int len);
|
static symbolOop probe(const char* name, int len) {
|
||||||
|
unsigned int ignore_hash;
|
||||||
|
return lookup_only(name, len, ignore_hash);
|
||||||
|
}
|
||||||
|
static symbolOop probe_unicode(const jchar* name, int len) {
|
||||||
|
unsigned int ignore_hash;
|
||||||
|
return lookup_only_unicode(name, len, ignore_hash);
|
||||||
|
}
|
||||||
|
|
||||||
// Histogram
|
// Histogram
|
||||||
static void print_histogram() PRODUCT_RETURN;
|
static void print_histogram() PRODUCT_RETURN;
|
||||||
|
@ -1964,6 +1964,13 @@ BasicType SystemDictionary::box_klass_type(klassOop k) {
|
|||||||
return T_OBJECT;
|
return T_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KlassHandle SystemDictionaryHandles::box_klass(BasicType t) {
|
||||||
|
if (t >= T_BOOLEAN && t <= T_VOID)
|
||||||
|
return KlassHandle(&SystemDictionary::_box_klasses[t], true);
|
||||||
|
else
|
||||||
|
return KlassHandle();
|
||||||
|
}
|
||||||
|
|
||||||
// Constraints on class loaders. The details of the algorithm can be
|
// Constraints on class loaders. The details of the algorithm can be
|
||||||
// found in the OOPSLA'98 paper "Dynamic Class Loading in the Java
|
// found in the OOPSLA'98 paper "Dynamic Class Loading in the Java
|
||||||
// Virtual Machine" by Sheng Liang and Gilad Bracha. The basic idea is
|
// Virtual Machine" by Sheng Liang and Gilad Bracha. The basic idea is
|
||||||
@ -2174,11 +2181,56 @@ symbolOop SystemDictionary::find_resolution_error(constantPoolHandle pool, int w
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Signature constraints ensure that callers and callees agree about
|
||||||
|
// the meaning of type names in their signatures. This routine is the
|
||||||
|
// intake for constraints. It collects them from several places:
|
||||||
|
//
|
||||||
|
// * LinkResolver::resolve_method (if check_access is true) requires
|
||||||
|
// that the resolving class (the caller) and the defining class of
|
||||||
|
// the resolved method (the callee) agree on each type in the
|
||||||
|
// method's signature.
|
||||||
|
//
|
||||||
|
// * LinkResolver::resolve_interface_method performs exactly the same
|
||||||
|
// checks.
|
||||||
|
//
|
||||||
|
// * LinkResolver::resolve_field requires that the constant pool
|
||||||
|
// attempting to link to a field agree with the field's defining
|
||||||
|
// class about the type of the field signature.
|
||||||
|
//
|
||||||
|
// * klassVtable::initialize_vtable requires that, when a class
|
||||||
|
// overrides a vtable entry allocated by a superclass, that the
|
||||||
|
// overriding method (i.e., the callee) agree with the superclass
|
||||||
|
// on each type in the method's signature.
|
||||||
|
//
|
||||||
|
// * klassItable::initialize_itable requires that, when a class fills
|
||||||
|
// in its itables, for each non-abstract method installed in an
|
||||||
|
// itable, the method (i.e., the callee) agree with the interface
|
||||||
|
// on each type in the method's signature.
|
||||||
|
//
|
||||||
|
// All those methods have a boolean (check_access, checkconstraints)
|
||||||
|
// which turns off the checks. This is used from specialized contexts
|
||||||
|
// such as bootstrapping, dumping, and debugging.
|
||||||
|
//
|
||||||
|
// No direct constraint is placed between the class and its
|
||||||
|
// supertypes. Constraints are only placed along linked relations
|
||||||
|
// between callers and callees. When a method overrides or implements
|
||||||
|
// an abstract method in a supertype (superclass or interface), the
|
||||||
|
// constraints are placed as if the supertype were the caller to the
|
||||||
|
// overriding method. (This works well, since callers to the
|
||||||
|
// supertype have already established agreement between themselves and
|
||||||
|
// the supertype.) As a result of all this, a class can disagree with
|
||||||
|
// its supertype about the meaning of a type name, as long as that
|
||||||
|
// class neither calls a relevant method of the supertype, nor is
|
||||||
|
// called (perhaps via an override) from the supertype.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// SystemDictionary::check_signature_loaders(sig, l1, l2)
|
||||||
|
//
|
||||||
// Make sure all class components (including arrays) in the given
|
// Make sure all class components (including arrays) in the given
|
||||||
// signature will be resolved to the same class in both loaders.
|
// signature will be resolved to the same class in both loaders.
|
||||||
// Returns the name of the type that failed a loader constraint check, or
|
// Returns the name of the type that failed a loader constraint check, or
|
||||||
// NULL if no constraint failed. The returned C string needs cleaning up
|
// NULL if no constraint failed. The returned C string needs cleaning up
|
||||||
// with a ResourceMark in the caller
|
// with a ResourceMark in the caller. No exception except OOME is thrown.
|
||||||
char* SystemDictionary::check_signature_loaders(symbolHandle signature,
|
char* SystemDictionary::check_signature_loaders(symbolHandle signature,
|
||||||
Handle loader1, Handle loader2,
|
Handle loader1, Handle loader2,
|
||||||
bool is_method, TRAPS) {
|
bool is_method, TRAPS) {
|
||||||
|
@ -161,6 +161,7 @@ class ResolutionErrorTable;
|
|||||||
class SystemDictionary : AllStatic {
|
class SystemDictionary : AllStatic {
|
||||||
friend class VMStructs;
|
friend class VMStructs;
|
||||||
friend class CompactingPermGenGen;
|
friend class CompactingPermGenGen;
|
||||||
|
friend class SystemDictionaryHandles;
|
||||||
NOT_PRODUCT(friend class instanceKlassKlass;)
|
NOT_PRODUCT(friend class instanceKlassKlass;)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -595,3 +596,18 @@ private:
|
|||||||
static bool _has_loadClassInternal;
|
static bool _has_loadClassInternal;
|
||||||
static bool _has_checkPackageAccess;
|
static bool _has_checkPackageAccess;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Cf. vmSymbols vs. vmSymbolHandles
|
||||||
|
class SystemDictionaryHandles : AllStatic {
|
||||||
|
public:
|
||||||
|
#define WK_KLASS_HANDLE_DECLARE(name, ignore_symbol, option) \
|
||||||
|
static KlassHandle name() { \
|
||||||
|
SystemDictionary::name(); \
|
||||||
|
klassOop* loc = &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]; \
|
||||||
|
return KlassHandle(loc, true); \
|
||||||
|
}
|
||||||
|
WK_KLASSES_DO(WK_KLASS_HANDLE_DECLARE);
|
||||||
|
#undef WK_KLASS_HANDLE_DECLARE
|
||||||
|
|
||||||
|
static KlassHandle box_klass(BasicType t);
|
||||||
|
};
|
||||||
|
@ -49,6 +49,8 @@
|
|||||||
template(java_lang_Object, "java/lang/Object") \
|
template(java_lang_Object, "java/lang/Object") \
|
||||||
template(java_lang_Class, "java/lang/Class") \
|
template(java_lang_Class, "java/lang/Class") \
|
||||||
template(java_lang_String, "java/lang/String") \
|
template(java_lang_String, "java/lang/String") \
|
||||||
|
template(java_lang_StringValue, "java/lang/StringValue") \
|
||||||
|
template(java_lang_StringCache, "java/lang/StringValue$StringCache") \
|
||||||
template(java_lang_Thread, "java/lang/Thread") \
|
template(java_lang_Thread, "java/lang/Thread") \
|
||||||
template(java_lang_ThreadGroup, "java/lang/ThreadGroup") \
|
template(java_lang_ThreadGroup, "java/lang/ThreadGroup") \
|
||||||
template(java_lang_Cloneable, "java/lang/Cloneable") \
|
template(java_lang_Cloneable, "java/lang/Cloneable") \
|
||||||
@ -285,6 +287,7 @@
|
|||||||
template(frontCacheEnabled_name, "frontCacheEnabled") \
|
template(frontCacheEnabled_name, "frontCacheEnabled") \
|
||||||
template(stringCacheEnabled_name, "stringCacheEnabled") \
|
template(stringCacheEnabled_name, "stringCacheEnabled") \
|
||||||
template(bitCount_name, "bitCount") \
|
template(bitCount_name, "bitCount") \
|
||||||
|
template(profile_name, "profile") \
|
||||||
\
|
\
|
||||||
/* non-intrinsic name/signature pairs: */ \
|
/* non-intrinsic name/signature pairs: */ \
|
||||||
template(register_method_name, "register") \
|
template(register_method_name, "register") \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -825,6 +825,7 @@ HeapWord* ParallelScavengeHeap::block_start(const void* addr) const {
|
|||||||
if (young_gen()->is_in_reserved(addr)) {
|
if (young_gen()->is_in_reserved(addr)) {
|
||||||
assert(young_gen()->is_in(addr),
|
assert(young_gen()->is_in(addr),
|
||||||
"addr should be in allocated part of young gen");
|
"addr should be in allocated part of young gen");
|
||||||
|
if (Debugging) return NULL; // called from find() in debug.cpp
|
||||||
Unimplemented();
|
Unimplemented();
|
||||||
} else if (old_gen()->is_in_reserved(addr)) {
|
} else if (old_gen()->is_in_reserved(addr)) {
|
||||||
assert(old_gen()->is_in(addr),
|
assert(old_gen()->is_in(addr),
|
||||||
|
@ -3154,6 +3154,8 @@ oopsHierarchy.cpp thread.hpp
|
|||||||
oopsHierarchy.cpp thread_<os_family>.inline.hpp
|
oopsHierarchy.cpp thread_<os_family>.inline.hpp
|
||||||
|
|
||||||
orderAccess.cpp orderAccess.hpp
|
orderAccess.cpp orderAccess.hpp
|
||||||
|
orderAccess.cpp stubRoutines.hpp
|
||||||
|
orderAccess.cpp thread.hpp
|
||||||
|
|
||||||
orderAccess.hpp allocation.hpp
|
orderAccess.hpp allocation.hpp
|
||||||
orderAccess.hpp os.hpp
|
orderAccess.hpp os.hpp
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1813,6 +1813,8 @@ bool instanceKlass::is_same_class_package(oop class_loader1, symbolOop class_nam
|
|||||||
oop class_loader2, symbolOop class_name2) {
|
oop class_loader2, symbolOop class_name2) {
|
||||||
if (class_loader1 != class_loader2) {
|
if (class_loader1 != class_loader2) {
|
||||||
return false;
|
return false;
|
||||||
|
} else if (class_name1 == class_name2) {
|
||||||
|
return true; // skip painful bytewise comparison
|
||||||
} else {
|
} else {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
|
|
||||||
@ -1879,6 +1881,56 @@ bool instanceKlass::is_override(methodHandle super_method, Handle targetclassloa
|
|||||||
return(is_same_class_package(targetclassloader(), targetclassname()));
|
return(is_same_class_package(targetclassloader(), targetclassname()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* defined for now in jvm.cpp, for historical reasons *--
|
||||||
|
klassOop instanceKlass::compute_enclosing_class_impl(instanceKlassHandle self,
|
||||||
|
symbolOop& simple_name_result, TRAPS) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// tell if two classes have the same enclosing class (at package level)
|
||||||
|
bool instanceKlass::is_same_package_member_impl(instanceKlassHandle class1,
|
||||||
|
klassOop class2_oop, TRAPS) {
|
||||||
|
if (class2_oop == class1->as_klassOop()) return true;
|
||||||
|
if (!Klass::cast(class2_oop)->oop_is_instance()) return false;
|
||||||
|
instanceKlassHandle class2(THREAD, class2_oop);
|
||||||
|
|
||||||
|
// must be in same package before we try anything else
|
||||||
|
if (!class1->is_same_class_package(class2->class_loader(), class2->name()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// As long as there is an outer1.getEnclosingClass,
|
||||||
|
// shift the search outward.
|
||||||
|
instanceKlassHandle outer1 = class1;
|
||||||
|
for (;;) {
|
||||||
|
// As we walk along, look for equalities between outer1 and class2.
|
||||||
|
// Eventually, the walks will terminate as outer1 stops
|
||||||
|
// at the top-level class around the original class.
|
||||||
|
symbolOop ignore_name;
|
||||||
|
klassOop next = outer1->compute_enclosing_class(ignore_name, CHECK_false);
|
||||||
|
if (next == NULL) break;
|
||||||
|
if (next == class2()) return true;
|
||||||
|
outer1 = instanceKlassHandle(THREAD, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now do the same for class2.
|
||||||
|
instanceKlassHandle outer2 = class2;
|
||||||
|
for (;;) {
|
||||||
|
symbolOop ignore_name;
|
||||||
|
klassOop next = outer2->compute_enclosing_class(ignore_name, CHECK_false);
|
||||||
|
if (next == NULL) break;
|
||||||
|
// Might as well check the new outer against all available values.
|
||||||
|
if (next == class1()) return true;
|
||||||
|
if (next == outer1()) return true;
|
||||||
|
outer2 = instanceKlassHandle(THREAD, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If by this point we have not found an equality between the
|
||||||
|
// two classes, we know they are in separate package members.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
jint instanceKlass::compute_modifier_flags(TRAPS) const {
|
jint instanceKlass::compute_modifier_flags(TRAPS) const {
|
||||||
klassOop k = as_klassOop();
|
klassOop k = as_klassOop();
|
||||||
jint access = access_flags().as_int();
|
jint access = access_flags().as_int();
|
||||||
@ -2015,9 +2067,11 @@ nmethod* instanceKlass::lookup_osr_nmethod(const methodOop m, int bci) const {
|
|||||||
|
|
||||||
// Printing
|
// Printing
|
||||||
|
|
||||||
|
#define BULLET " - "
|
||||||
|
|
||||||
void FieldPrinter::do_field(fieldDescriptor* fd) {
|
void FieldPrinter::do_field(fieldDescriptor* fd) {
|
||||||
if (fd->is_static() == (_obj == NULL)) {
|
_st->print(BULLET);
|
||||||
_st->print(" - ");
|
if (fd->is_static() || (_obj == NULL)) {
|
||||||
fd->print_on(_st);
|
fd->print_on(_st);
|
||||||
_st->cr();
|
_st->cr();
|
||||||
} else {
|
} else {
|
||||||
@ -2038,7 +2092,7 @@ void instanceKlass::oop_print_on(oop obj, outputStream* st) {
|
|||||||
value->is_typeArray() &&
|
value->is_typeArray() &&
|
||||||
offset <= (juint) value->length() &&
|
offset <= (juint) value->length() &&
|
||||||
offset + length <= (juint) value->length()) {
|
offset + length <= (juint) value->length()) {
|
||||||
st->print("string: ");
|
st->print(BULLET"string: ");
|
||||||
Handle h_obj(obj);
|
Handle h_obj(obj);
|
||||||
java_lang_String::print(h_obj, st);
|
java_lang_String::print(h_obj, st);
|
||||||
st->cr();
|
st->cr();
|
||||||
@ -2046,22 +2100,25 @@ void instanceKlass::oop_print_on(oop obj, outputStream* st) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
st->print_cr("fields:");
|
st->print_cr(BULLET"---- fields (total size %d words):", oop_size(obj));
|
||||||
FieldPrinter print_nonstatic_field(st, obj);
|
FieldPrinter print_nonstatic_field(st, obj);
|
||||||
do_nonstatic_fields(&print_nonstatic_field);
|
do_nonstatic_fields(&print_nonstatic_field);
|
||||||
|
|
||||||
if (as_klassOop() == SystemDictionary::class_klass()) {
|
if (as_klassOop() == SystemDictionary::class_klass()) {
|
||||||
|
st->print(BULLET"signature: ");
|
||||||
|
java_lang_Class::print_signature(obj, st);
|
||||||
|
st->cr();
|
||||||
klassOop mirrored_klass = java_lang_Class::as_klassOop(obj);
|
klassOop mirrored_klass = java_lang_Class::as_klassOop(obj);
|
||||||
st->print(" - fake entry for mirror: ");
|
st->print(BULLET"fake entry for mirror: ");
|
||||||
mirrored_klass->print_value_on(st);
|
mirrored_klass->print_value_on(st);
|
||||||
st->cr();
|
st->cr();
|
||||||
st->print(" - fake entry resolved_constructor: ");
|
st->print(BULLET"fake entry resolved_constructor: ");
|
||||||
methodOop ctor = java_lang_Class::resolved_constructor(obj);
|
methodOop ctor = java_lang_Class::resolved_constructor(obj);
|
||||||
ctor->print_value_on(st);
|
ctor->print_value_on(st);
|
||||||
klassOop array_klass = java_lang_Class::array_klass(obj);
|
klassOop array_klass = java_lang_Class::array_klass(obj);
|
||||||
st->print(" - fake entry for array: ");
|
|
||||||
array_klass->print_value_on(st);
|
|
||||||
st->cr();
|
st->cr();
|
||||||
|
st->print(BULLET"fake entry for array: ");
|
||||||
|
array_klass->print_value_on(st);
|
||||||
st->cr();
|
st->cr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2070,6 +2127,28 @@ void instanceKlass::oop_print_value_on(oop obj, outputStream* st) {
|
|||||||
st->print("a ");
|
st->print("a ");
|
||||||
name()->print_value_on(st);
|
name()->print_value_on(st);
|
||||||
obj->print_address_on(st);
|
obj->print_address_on(st);
|
||||||
|
if (as_klassOop() == SystemDictionary::string_klass()
|
||||||
|
&& java_lang_String::value(obj) != NULL) {
|
||||||
|
ResourceMark rm;
|
||||||
|
int len = java_lang_String::length(obj);
|
||||||
|
int plen = (len < 24 ? len : 12);
|
||||||
|
char* str = java_lang_String::as_utf8_string(obj, 0, plen);
|
||||||
|
st->print(" = \"%s\"", str);
|
||||||
|
if (len > plen)
|
||||||
|
st->print("...[%d]", len);
|
||||||
|
} else if (as_klassOop() == SystemDictionary::class_klass()) {
|
||||||
|
klassOop k = java_lang_Class::as_klassOop(obj);
|
||||||
|
st->print(" = ");
|
||||||
|
if (k != NULL) {
|
||||||
|
k->print_value_on(st);
|
||||||
|
} else {
|
||||||
|
const char* tname = type2name(java_lang_Class::primitive_type(obj));
|
||||||
|
st->print("%s", tname ? tname : "type?");
|
||||||
|
}
|
||||||
|
} else if (java_lang_boxing_object::is_instance(obj)) {
|
||||||
|
st->print(" = ");
|
||||||
|
java_lang_boxing_object::print(obj, st);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ndef PRODUCT
|
#endif // ndef PRODUCT
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -311,6 +311,22 @@ class instanceKlass: public Klass {
|
|||||||
bool is_same_class_package(oop classloader2, symbolOop classname2);
|
bool is_same_class_package(oop classloader2, symbolOop classname2);
|
||||||
static bool is_same_class_package(oop class_loader1, symbolOop class_name1, oop class_loader2, symbolOop class_name2);
|
static bool is_same_class_package(oop class_loader1, symbolOop class_name1, oop class_loader2, symbolOop class_name2);
|
||||||
|
|
||||||
|
// find an enclosing class (defined where original code was, in jvm.cpp!)
|
||||||
|
klassOop compute_enclosing_class(symbolOop& simple_name_result, TRAPS) {
|
||||||
|
instanceKlassHandle self(THREAD, this->as_klassOop());
|
||||||
|
return compute_enclosing_class_impl(self, simple_name_result, THREAD);
|
||||||
|
}
|
||||||
|
static klassOop compute_enclosing_class_impl(instanceKlassHandle self,
|
||||||
|
symbolOop& simple_name_result, TRAPS);
|
||||||
|
|
||||||
|
// tell if two classes have the same enclosing class (at package level)
|
||||||
|
bool is_same_package_member(klassOop class2, TRAPS) {
|
||||||
|
instanceKlassHandle self(THREAD, this->as_klassOop());
|
||||||
|
return is_same_package_member_impl(self, class2, THREAD);
|
||||||
|
}
|
||||||
|
static bool is_same_package_member_impl(instanceKlassHandle self,
|
||||||
|
klassOop class2, TRAPS);
|
||||||
|
|
||||||
// initialization state
|
// initialization state
|
||||||
bool is_loaded() const { return _init_state >= loaded; }
|
bool is_loaded() const { return _init_state >= loaded; }
|
||||||
bool is_linked() const { return _init_state >= linked; }
|
bool is_linked() const { return _init_state >= linked; }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -487,6 +487,8 @@ klassOop instanceKlassKlass::allocate_instance_klass(int vtable_len, int itable_
|
|||||||
|
|
||||||
// Printing
|
// Printing
|
||||||
|
|
||||||
|
#define BULLET " - "
|
||||||
|
|
||||||
static const char* state_names[] = {
|
static const char* state_names[] = {
|
||||||
"unparseable_by_gc", "allocated", "loaded", "linked", "being_initialized", "fully_initialized", "initialization_error"
|
"unparseable_by_gc", "allocated", "loaded", "linked", "being_initialized", "fully_initialized", "initialization_error"
|
||||||
};
|
};
|
||||||
@ -497,13 +499,13 @@ void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) {
|
|||||||
instanceKlass* ik = instanceKlass::cast(klassOop(obj));
|
instanceKlass* ik = instanceKlass::cast(klassOop(obj));
|
||||||
klassKlass::oop_print_on(obj, st);
|
klassKlass::oop_print_on(obj, st);
|
||||||
|
|
||||||
st->print(" - instance size: %d", ik->size_helper()); st->cr();
|
st->print(BULLET"instance size: %d", ik->size_helper()); st->cr();
|
||||||
st->print(" - klass size: %d", ik->object_size()); st->cr();
|
st->print(BULLET"klass size: %d", ik->object_size()); st->cr();
|
||||||
st->print(" - access: "); ik->access_flags().print_on(st); st->cr();
|
st->print(BULLET"access: "); ik->access_flags().print_on(st); st->cr();
|
||||||
st->print(" - state: "); st->print_cr(state_names[ik->_init_state]);
|
st->print(BULLET"state: "); st->print_cr(state_names[ik->_init_state]);
|
||||||
st->print(" - name: "); ik->name()->print_value_on(st); st->cr();
|
st->print(BULLET"name: "); ik->name()->print_value_on(st); st->cr();
|
||||||
st->print(" - super: "); ik->super()->print_value_on(st); st->cr();
|
st->print(BULLET"super: "); ik->super()->print_value_on(st); st->cr();
|
||||||
st->print(" - sub: ");
|
st->print(BULLET"sub: ");
|
||||||
Klass* sub = ik->subklass();
|
Klass* sub = ik->subklass();
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; sub != NULL; n++, sub = sub->next_sibling()) {
|
for (n = 0; sub != NULL; n++, sub = sub->next_sibling()) {
|
||||||
@ -516,12 +518,12 @@ void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) {
|
|||||||
st->cr();
|
st->cr();
|
||||||
|
|
||||||
if (ik->is_interface()) {
|
if (ik->is_interface()) {
|
||||||
st->print_cr(" - nof implementors: %d", ik->nof_implementors());
|
st->print_cr(BULLET"nof implementors: %d", ik->nof_implementors());
|
||||||
int print_impl = 0;
|
int print_impl = 0;
|
||||||
for (int i = 0; i < instanceKlass::implementors_limit; i++) {
|
for (int i = 0; i < instanceKlass::implementors_limit; i++) {
|
||||||
if (ik->implementor(i) != NULL) {
|
if (ik->implementor(i) != NULL) {
|
||||||
if (++print_impl == 1)
|
if (++print_impl == 1)
|
||||||
st->print_cr(" - implementor: ");
|
st->print_cr(BULLET"implementor: ");
|
||||||
st->print(" ");
|
st->print(" ");
|
||||||
ik->implementor(i)->print_value_on(st);
|
ik->implementor(i)->print_value_on(st);
|
||||||
}
|
}
|
||||||
@ -529,34 +531,33 @@ void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) {
|
|||||||
if (print_impl > 0) st->cr();
|
if (print_impl > 0) st->cr();
|
||||||
}
|
}
|
||||||
|
|
||||||
st->print(" - arrays: "); ik->array_klasses()->print_value_on(st); st->cr();
|
st->print(BULLET"arrays: "); ik->array_klasses()->print_value_on(st); st->cr();
|
||||||
st->print(" - methods: "); ik->methods()->print_value_on(st); st->cr();
|
st->print(BULLET"methods: "); ik->methods()->print_value_on(st); st->cr();
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
objArrayOop methods = ik->methods();
|
objArrayOop methods = ik->methods();
|
||||||
for(int i = 0; i < methods->length(); i++) {
|
for(int i = 0; i < methods->length(); i++) {
|
||||||
tty->print("%d : ", i); methods->obj_at(i)->print_value(); tty->cr();
|
tty->print("%d : ", i); methods->obj_at(i)->print_value(); tty->cr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
st->print(" - method ordering: "); ik->method_ordering()->print_value_on(st); st->cr();
|
st->print(BULLET"method ordering: "); ik->method_ordering()->print_value_on(st); st->cr();
|
||||||
st->print(" - local interfaces: "); ik->local_interfaces()->print_value_on(st); st->cr();
|
st->print(BULLET"local interfaces: "); ik->local_interfaces()->print_value_on(st); st->cr();
|
||||||
st->print(" - trans. interfaces: "); ik->transitive_interfaces()->print_value_on(st); st->cr();
|
st->print(BULLET"trans. interfaces: "); ik->transitive_interfaces()->print_value_on(st); st->cr();
|
||||||
st->print(" - constants: "); ik->constants()->print_value_on(st); st->cr();
|
st->print(BULLET"constants: "); ik->constants()->print_value_on(st); st->cr();
|
||||||
st->print(" - class loader: "); ik->class_loader()->print_value_on(st); st->cr();
|
st->print(BULLET"class loader: "); ik->class_loader()->print_value_on(st); st->cr();
|
||||||
st->print(" - protection domain: "); ik->protection_domain()->print_value_on(st); st->cr();
|
st->print(BULLET"protection domain: "); ik->protection_domain()->print_value_on(st); st->cr();
|
||||||
st->print(" - host class: "); ik->host_klass()->print_value_on(st); st->cr();
|
st->print(BULLET"host class: "); ik->host_klass()->print_value_on(st); st->cr();
|
||||||
st->print(" - signers: "); ik->signers()->print_value_on(st); st->cr();
|
st->print(BULLET"signers: "); ik->signers()->print_value_on(st); st->cr();
|
||||||
if (ik->source_file_name() != NULL) {
|
if (ik->source_file_name() != NULL) {
|
||||||
st->print(" - source file: ");
|
st->print(BULLET"source file: ");
|
||||||
ik->source_file_name()->print_value_on(st);
|
ik->source_file_name()->print_value_on(st);
|
||||||
st->cr();
|
st->cr();
|
||||||
}
|
}
|
||||||
if (ik->source_debug_extension() != NULL) {
|
if (ik->source_debug_extension() != NULL) {
|
||||||
st->print(" - source debug extension: ");
|
st->print(BULLET"source debug extension: ");
|
||||||
ik->source_debug_extension()->print_value_on(st);
|
ik->source_debug_extension()->print_value_on(st);
|
||||||
st->cr();
|
st->cr();
|
||||||
}
|
}
|
||||||
|
|
||||||
st->print_cr(" - previous version: ");
|
|
||||||
{
|
{
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
// PreviousVersionInfo objects returned via PreviousVersionWalker
|
// PreviousVersionInfo objects returned via PreviousVersionWalker
|
||||||
@ -564,38 +565,43 @@ void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) {
|
|||||||
// GrowableArray _after_ the PreviousVersionWalker destructor
|
// GrowableArray _after_ the PreviousVersionWalker destructor
|
||||||
// has destroyed the handles.
|
// has destroyed the handles.
|
||||||
{
|
{
|
||||||
|
bool have_pv = false;
|
||||||
PreviousVersionWalker pvw(ik);
|
PreviousVersionWalker pvw(ik);
|
||||||
for (PreviousVersionInfo * pv_info = pvw.next_previous_version();
|
for (PreviousVersionInfo * pv_info = pvw.next_previous_version();
|
||||||
pv_info != NULL; pv_info = pvw.next_previous_version()) {
|
pv_info != NULL; pv_info = pvw.next_previous_version()) {
|
||||||
|
if (!have_pv)
|
||||||
|
st->print(BULLET"previous version: ");
|
||||||
|
have_pv = true;
|
||||||
pv_info->prev_constant_pool_handle()()->print_value_on(st);
|
pv_info->prev_constant_pool_handle()()->print_value_on(st);
|
||||||
}
|
}
|
||||||
st->cr();
|
if (have_pv) st->cr();
|
||||||
} // pvw is cleaned up
|
} // pvw is cleaned up
|
||||||
} // rm is cleaned up
|
} // rm is cleaned up
|
||||||
|
|
||||||
if (ik->generic_signature() != NULL) {
|
if (ik->generic_signature() != NULL) {
|
||||||
st->print(" - generic signature: ");
|
st->print(BULLET"generic signature: ");
|
||||||
ik->generic_signature()->print_value_on(st);
|
ik->generic_signature()->print_value_on(st);
|
||||||
|
st->cr();
|
||||||
}
|
}
|
||||||
st->print(" - inner classes: "); ik->inner_classes()->print_value_on(st); st->cr();
|
st->print(BULLET"inner classes: "); ik->inner_classes()->print_value_on(st); st->cr();
|
||||||
st->print(" - java mirror: "); ik->java_mirror()->print_value_on(st); st->cr();
|
st->print(BULLET"java mirror: "); ik->java_mirror()->print_value_on(st); st->cr();
|
||||||
st->print(" - vtable length %d (start addr: " INTPTR_FORMAT ")", ik->vtable_length(), ik->start_of_vtable()); st->cr();
|
st->print(BULLET"vtable length %d (start addr: " INTPTR_FORMAT ")", ik->vtable_length(), ik->start_of_vtable()); st->cr();
|
||||||
st->print(" - itable length %d (start addr: " INTPTR_FORMAT ")", ik->itable_length(), ik->start_of_itable()); st->cr();
|
st->print(BULLET"itable length %d (start addr: " INTPTR_FORMAT ")", ik->itable_length(), ik->start_of_itable()); st->cr();
|
||||||
st->print_cr(" - static fields:");
|
st->print_cr(BULLET"---- static fields (%d words):", ik->static_field_size());
|
||||||
FieldPrinter print_static_field(st);
|
FieldPrinter print_static_field(st);
|
||||||
ik->do_local_static_fields(&print_static_field);
|
ik->do_local_static_fields(&print_static_field);
|
||||||
st->print_cr(" - non-static fields:");
|
st->print_cr(BULLET"---- non-static fields (%d words):", ik->nonstatic_field_size());
|
||||||
FieldPrinter print_nonstatic_field(st, obj);
|
FieldPrinter print_nonstatic_field(st);
|
||||||
ik->do_nonstatic_fields(&print_nonstatic_field);
|
ik->do_nonstatic_fields(&print_nonstatic_field);
|
||||||
|
|
||||||
st->print(" - static oop maps: ");
|
st->print(BULLET"static oop maps: ");
|
||||||
if (ik->static_oop_field_size() > 0) {
|
if (ik->static_oop_field_size() > 0) {
|
||||||
int first_offset = ik->offset_of_static_fields();
|
int first_offset = ik->offset_of_static_fields();
|
||||||
st->print("%d-%d", first_offset, first_offset + ik->static_oop_field_size() - 1);
|
st->print("%d-%d", first_offset, first_offset + ik->static_oop_field_size() - 1);
|
||||||
}
|
}
|
||||||
st->cr();
|
st->cr();
|
||||||
|
|
||||||
st->print(" - non-static oop maps: ");
|
st->print(BULLET"non-static oop maps: ");
|
||||||
OopMapBlock* map = ik->start_of_nonstatic_oop_maps();
|
OopMapBlock* map = ik->start_of_nonstatic_oop_maps();
|
||||||
OopMapBlock* end_map = map + ik->nonstatic_oop_map_size();
|
OopMapBlock* end_map = map + ik->nonstatic_oop_map_size();
|
||||||
while (map < end_map) {
|
while (map < end_map) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1148,6 +1148,27 @@ int klassItable::compute_itable_index(methodOop m) {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// inverse to compute_itable_index
|
||||||
|
methodOop klassItable::method_for_itable_index(klassOop intf, int itable_index) {
|
||||||
|
assert(instanceKlass::cast(intf)->is_interface(), "sanity check");
|
||||||
|
objArrayOop methods = instanceKlass::cast(intf)->methods();
|
||||||
|
|
||||||
|
int index = itable_index;
|
||||||
|
// Adjust for <clinit>, which is left out of table if first method
|
||||||
|
if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) {
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itable_index < 0 || index >= methods->length())
|
||||||
|
return NULL; // help caller defend against bad indexes
|
||||||
|
|
||||||
|
methodOop m = (methodOop)methods->obj_at(index);
|
||||||
|
assert(compute_itable_index(m) == itable_index, "correct inverse");
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
void klassVtable::verify(outputStream* st, bool forced) {
|
void klassVtable::verify(outputStream* st, bool forced) {
|
||||||
// make sure table is initialized
|
// make sure table is initialized
|
||||||
if (!Universe::is_fully_initialized()) return;
|
if (!Universe::is_fully_initialized()) return;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -301,6 +301,8 @@ class klassItable : public ResourceObj {
|
|||||||
|
|
||||||
// Resolving of method to index
|
// Resolving of method to index
|
||||||
static int compute_itable_index(methodOop m);
|
static int compute_itable_index(methodOop m);
|
||||||
|
// ...and back again:
|
||||||
|
static methodOop method_for_itable_index(klassOop klass, int itable_index);
|
||||||
|
|
||||||
// Debugging/Statistics
|
// Debugging/Statistics
|
||||||
static void print_statistics() PRODUCT_RETURN;
|
static void print_statistics() PRODUCT_RETURN;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -247,9 +247,14 @@ void methodKlass::oop_print_on(oop obj, outputStream* st) {
|
|||||||
st->print_cr(" - size of params: %d", m->size_of_parameters());
|
st->print_cr(" - size of params: %d", m->size_of_parameters());
|
||||||
st->print_cr(" - method size: %d", m->method_size());
|
st->print_cr(" - method size: %d", m->method_size());
|
||||||
st->print_cr(" - vtable index: %d", m->_vtable_index);
|
st->print_cr(" - vtable index: %d", m->_vtable_index);
|
||||||
|
st->print_cr(" - i2i entry: " INTPTR_FORMAT, m->interpreter_entry());
|
||||||
|
st->print_cr(" - adapter: " INTPTR_FORMAT, m->adapter());
|
||||||
|
st->print_cr(" - compiled entry " INTPTR_FORMAT, m->from_compiled_entry());
|
||||||
st->print_cr(" - code size: %d", m->code_size());
|
st->print_cr(" - code size: %d", m->code_size());
|
||||||
st->print_cr(" - code start: " INTPTR_FORMAT, m->code_base());
|
if (m->code_size() != 0) {
|
||||||
st->print_cr(" - code end (excl): " INTPTR_FORMAT, m->code_base() + m->code_size());
|
st->print_cr(" - code start: " INTPTR_FORMAT, m->code_base());
|
||||||
|
st->print_cr(" - code end (excl): " INTPTR_FORMAT, m->code_base() + m->code_size());
|
||||||
|
}
|
||||||
if (m->method_data() != NULL) {
|
if (m->method_data() != NULL) {
|
||||||
st->print_cr(" - method data: " INTPTR_FORMAT, (address)m->method_data());
|
st->print_cr(" - method data: " INTPTR_FORMAT, (address)m->method_data());
|
||||||
}
|
}
|
||||||
@ -293,6 +298,10 @@ void methodKlass::oop_print_on(oop obj, outputStream* st) {
|
|||||||
m->code()->print_value_on(st);
|
m->code()->print_value_on(st);
|
||||||
st->cr();
|
st->cr();
|
||||||
}
|
}
|
||||||
|
if (m->is_native()) {
|
||||||
|
st->print_cr(" - native function: " INTPTR_FORMAT, m->native_function());
|
||||||
|
st->print_cr(" - signature handler: " INTPTR_FORMAT, m->signature_handler());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -502,12 +502,25 @@ void objArrayKlass::oop_print_on(oop obj, outputStream* st) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int max_objArray_print_length = 4;
|
||||||
|
|
||||||
void objArrayKlass::oop_print_value_on(oop obj, outputStream* st) {
|
void objArrayKlass::oop_print_value_on(oop obj, outputStream* st) {
|
||||||
assert(obj->is_objArray(), "must be objArray");
|
assert(obj->is_objArray(), "must be objArray");
|
||||||
|
st->print("a ");
|
||||||
element_klass()->print_value_on(st);
|
element_klass()->print_value_on(st);
|
||||||
st->print("a [%d] ", objArrayOop(obj)->length());
|
int len = objArrayOop(obj)->length();
|
||||||
as_klassOop()->klass()->print_value_on(st);
|
st->print("[%d] ", len);
|
||||||
|
obj->print_address_on(st);
|
||||||
|
if (PrintOopAddress || PrintMiscellaneous && (WizardMode || Verbose)) {
|
||||||
|
st->print("{");
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
if (i > max_objArray_print_length) {
|
||||||
|
st->print("..."); break;
|
||||||
|
}
|
||||||
|
st->print(" "INTPTR_FORMAT, (intptr_t)(void*)objArrayOop(obj)->obj_at(i));
|
||||||
|
}
|
||||||
|
st->print(" }");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PRODUCT
|
#endif // PRODUCT
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -65,11 +65,7 @@ void oopDesc::print_value_on(outputStream* st) const {
|
|||||||
|
|
||||||
void oopDesc::print_address_on(outputStream* st) const {
|
void oopDesc::print_address_on(outputStream* st) const {
|
||||||
if (PrintOopAddress) {
|
if (PrintOopAddress) {
|
||||||
st->print("{");
|
st->print("{"INTPTR_FORMAT"}", this);
|
||||||
if (PrintOopAddress) {
|
|
||||||
st->print(INTPTR_FORMAT, this);
|
|
||||||
}
|
|
||||||
st->print("}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,6 +371,7 @@ class PhaseCFG : public Phase {
|
|||||||
Block *_broot; // Basic block of root
|
Block *_broot; // Basic block of root
|
||||||
uint _rpo_ctr;
|
uint _rpo_ctr;
|
||||||
CFGLoop* _root_loop;
|
CFGLoop* _root_loop;
|
||||||
|
float _outer_loop_freq; // Outmost loop frequency
|
||||||
|
|
||||||
// Per node latency estimation, valid only during GCM
|
// Per node latency estimation, valid only during GCM
|
||||||
GrowableArray<uint> _node_latency;
|
GrowableArray<uint> _node_latency;
|
||||||
@ -537,6 +538,7 @@ class CFGLoop : public CFGElement {
|
|||||||
void compute_loop_depth(int depth);
|
void compute_loop_depth(int depth);
|
||||||
void compute_freq(); // compute frequency with loop assuming head freq 1.0f
|
void compute_freq(); // compute frequency with loop assuming head freq 1.0f
|
||||||
void scale_freq(); // scale frequency by loop trip count (including outer loops)
|
void scale_freq(); // scale frequency by loop trip count (including outer loops)
|
||||||
|
float outer_loop_freq() const; // frequency of outer loop
|
||||||
bool in_loop_nest(Block* b);
|
bool in_loop_nest(Block* b);
|
||||||
float trip_count() const { return 1.0f / _exit_prob; }
|
float trip_count() const { return 1.0f / _exit_prob; }
|
||||||
virtual bool is_loop() { return true; }
|
virtual bool is_loop() { return true; }
|
||||||
|
@ -232,6 +232,14 @@ const char* InlineTree::shouldNotInline(ciMethod *callee_method, ciMethod* calle
|
|||||||
return "disallowed by CompilerOracle";
|
return "disallowed by CompilerOracle";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UseStringCache) {
|
||||||
|
// Do not inline StringCache::profile() method used only at the beginning.
|
||||||
|
if (callee_method->name() == ciSymbol::profile_name() &&
|
||||||
|
callee_method->holder()->name() == ciSymbol::java_lang_StringCache()) {
|
||||||
|
return "profiling method";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@
|
|||||||
product(intx, EliminateAllocationArraySizeLimit, 64, \
|
product(intx, EliminateAllocationArraySizeLimit, 64, \
|
||||||
"Array size (number of elements) limit for scalar replacement") \
|
"Array size (number of elements) limit for scalar replacement") \
|
||||||
\
|
\
|
||||||
product(bool, UseOptoBiasInlining, true, \
|
product(bool, UseOptoBiasInlining, true, \
|
||||||
"Generate biased locking code in C2 ideal graph") \
|
"Generate biased locking code in C2 ideal graph") \
|
||||||
\
|
\
|
||||||
product(intx, ValueSearchLimit, 1000, \
|
product(intx, ValueSearchLimit, 1000, \
|
||||||
@ -410,7 +410,7 @@
|
|||||||
"Miniumum %% of a successor (predecessor) for which block layout "\
|
"Miniumum %% of a successor (predecessor) for which block layout "\
|
||||||
"a will allow a fork (join) in a single chain") \
|
"a will allow a fork (join) in a single chain") \
|
||||||
\
|
\
|
||||||
product(bool, BlockLayoutRotateLoops, false, \
|
product(bool, BlockLayoutRotateLoops, true, \
|
||||||
"Allow back branches to be fall throughs in the block layour") \
|
"Allow back branches to be fall throughs in the block layour") \
|
||||||
|
|
||||||
C2_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG)
|
C2_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG)
|
||||||
|
@ -149,6 +149,9 @@ PhaseChaitin::PhaseChaitin(uint unique, PhaseCFG &cfg, Matcher &matcher)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
NOT_PRODUCT( Compile::TracePhase t3("ctorChaitin", &_t_ctorChaitin, TimeCompiler); )
|
NOT_PRODUCT( Compile::TracePhase t3("ctorChaitin", &_t_ctorChaitin, TimeCompiler); )
|
||||||
|
|
||||||
|
_high_frequency_lrg = MIN2(float(OPTO_LRG_HIGH_FREQ), _cfg._outer_loop_freq);
|
||||||
|
|
||||||
uint i,j;
|
uint i,j;
|
||||||
// Build a list of basic blocks, sorted by frequency
|
// Build a list of basic blocks, sorted by frequency
|
||||||
_blks = NEW_RESOURCE_ARRAY( Block *, _cfg._num_blocks );
|
_blks = NEW_RESOURCE_ARRAY( Block *, _cfg._num_blocks );
|
||||||
|
@ -338,6 +338,8 @@ class PhaseChaitin : public PhaseRegAlloc {
|
|||||||
|
|
||||||
Block **_blks; // Array of blocks sorted by frequency for coalescing
|
Block **_blks; // Array of blocks sorted by frequency for coalescing
|
||||||
|
|
||||||
|
float _high_frequency_lrg; // Frequency at which LRG will be spilled for debug info
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
bool _trace_spilling;
|
bool _trace_spilling;
|
||||||
#endif
|
#endif
|
||||||
@ -360,6 +362,8 @@ public:
|
|||||||
|
|
||||||
uint n2lidx( const Node *n ) const { return _names[n->_idx]; }
|
uint n2lidx( const Node *n ) const { return _names[n->_idx]; }
|
||||||
|
|
||||||
|
float high_frequency_lrg() const { return _high_frequency_lrg; }
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
bool trace_spilling() const { return _trace_spilling; }
|
bool trace_spilling() const { return _trace_spilling; }
|
||||||
#endif
|
#endif
|
||||||
|
@ -473,7 +473,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) {
|
|||||||
} // End of is two-adr
|
} // End of is two-adr
|
||||||
|
|
||||||
// Insert a copy at a debug use for a lrg which has high frequency
|
// Insert a copy at a debug use for a lrg which has high frequency
|
||||||
if( (b->_freq < OPTO_DEBUG_SPLIT_FREQ) && n->is_MachSafePoint() ) {
|
if( b->_freq < OPTO_DEBUG_SPLIT_FREQ || b->is_uncommon(_phc._cfg._bbs) ) {
|
||||||
// Walk the debug inputs to the node and check for lrg freq
|
// Walk the debug inputs to the node and check for lrg freq
|
||||||
JVMState* jvms = n->jvms();
|
JVMState* jvms = n->jvms();
|
||||||
uint debug_start = jvms ? jvms->debug_start() : 999999;
|
uint debug_start = jvms ? jvms->debug_start() : 999999;
|
||||||
@ -487,7 +487,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) {
|
|||||||
LRG &lrg = lrgs(nidx);
|
LRG &lrg = lrgs(nidx);
|
||||||
|
|
||||||
// If this lrg has a high frequency use/def
|
// If this lrg has a high frequency use/def
|
||||||
if( lrg._maxfreq >= OPTO_LRG_HIGH_FREQ ) {
|
if( lrg._maxfreq >= _phc.high_frequency_lrg() ) {
|
||||||
// If the live range is also live out of this block (like it
|
// If the live range is also live out of this block (like it
|
||||||
// would be for a fast/slow idiom), the normal spill mechanism
|
// would be for a fast/slow idiom), the normal spill mechanism
|
||||||
// does an excellent job. If it is not live out of this block
|
// does an excellent job. If it is not live out of this block
|
||||||
|
@ -1374,6 +1374,9 @@ void PhaseCFG::Estimate_Block_Frequency() {
|
|||||||
_root_loop->_freq = 1.0;
|
_root_loop->_freq = 1.0;
|
||||||
_root_loop->scale_freq();
|
_root_loop->scale_freq();
|
||||||
|
|
||||||
|
// Save outmost loop frequency for LRG frequency threshold
|
||||||
|
_outer_loop_freq = _root_loop->outer_loop_freq();
|
||||||
|
|
||||||
// force paths ending at uncommon traps to be infrequent
|
// force paths ending at uncommon traps to be infrequent
|
||||||
if (!C->do_freq_based_layout()) {
|
if (!C->do_freq_based_layout()) {
|
||||||
Block_List worklist;
|
Block_List worklist;
|
||||||
@ -1898,6 +1901,7 @@ bool CFGLoop::in_loop_nest(Block* b) {
|
|||||||
// Do a top down traversal of loop tree (visit outer loops first.)
|
// Do a top down traversal of loop tree (visit outer loops first.)
|
||||||
void CFGLoop::scale_freq() {
|
void CFGLoop::scale_freq() {
|
||||||
float loop_freq = _freq * trip_count();
|
float loop_freq = _freq * trip_count();
|
||||||
|
_freq = loop_freq;
|
||||||
for (int i = 0; i < _members.length(); i++) {
|
for (int i = 0; i < _members.length(); i++) {
|
||||||
CFGElement* s = _members.at(i);
|
CFGElement* s = _members.at(i);
|
||||||
float block_freq = s->_freq * loop_freq;
|
float block_freq = s->_freq * loop_freq;
|
||||||
@ -1912,6 +1916,14 @@ void CFGLoop::scale_freq() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Frequency of outer loop
|
||||||
|
float CFGLoop::outer_loop_freq() const {
|
||||||
|
if (_child != NULL) {
|
||||||
|
return _child->_freq;
|
||||||
|
}
|
||||||
|
return _freq;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
//------------------------------dump_tree--------------------------------------
|
//------------------------------dump_tree--------------------------------------
|
||||||
void CFGLoop::dump_tree() const {
|
void CFGLoop::dump_tree() const {
|
||||||
|
@ -340,6 +340,10 @@ const class TypePtr *MachNode::adr_type() const {
|
|||||||
if (base == NodeSentinel) return TypePtr::BOTTOM;
|
if (base == NodeSentinel) return TypePtr::BOTTOM;
|
||||||
|
|
||||||
const Type* t = base->bottom_type();
|
const Type* t = base->bottom_type();
|
||||||
|
if (UseCompressedOops && Universe::narrow_oop_shift() == 0) {
|
||||||
|
// 32-bit unscaled narrow oop can be the base of any address expression
|
||||||
|
t = t->make_ptr();
|
||||||
|
}
|
||||||
if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) {
|
if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) {
|
||||||
// We cannot assert that the offset does not look oop-ish here.
|
// We cannot assert that the offset does not look oop-ish here.
|
||||||
// Depending on the heap layout the cardmark base could land
|
// Depending on the heap layout the cardmark base could land
|
||||||
@ -353,6 +357,7 @@ const class TypePtr *MachNode::adr_type() const {
|
|||||||
|
|
||||||
// be conservative if we do not recognize the type
|
// be conservative if we do not recognize the type
|
||||||
if (tp == NULL) {
|
if (tp == NULL) {
|
||||||
|
assert(false, "this path may produce not optimal code");
|
||||||
return TypePtr::BOTTOM;
|
return TypePtr::BOTTOM;
|
||||||
}
|
}
|
||||||
assert(tp->base() != Type::AnyPtr, "not a bare pointer");
|
assert(tp->base() != Type::AnyPtr, "not a bare pointer");
|
||||||
|
@ -639,8 +639,8 @@ const Type *CmpPNode::sub( const Type *t1, const Type *t2 ) const {
|
|||||||
int kps = (p0->isa_klassptr()?1:0) + (p1->isa_klassptr()?1:0);
|
int kps = (p0->isa_klassptr()?1:0) + (p1->isa_klassptr()?1:0);
|
||||||
if (klass0 && klass1 &&
|
if (klass0 && klass1 &&
|
||||||
kps != 1 && // both or neither are klass pointers
|
kps != 1 && // both or neither are klass pointers
|
||||||
!klass0->is_interface() && // do not trust interfaces
|
klass0->is_loaded() && !klass0->is_interface() && // do not trust interfaces
|
||||||
!klass1->is_interface()) {
|
klass1->is_loaded() && !klass1->is_interface()) {
|
||||||
bool unrelated_classes = false;
|
bool unrelated_classes = false;
|
||||||
// See if neither subclasses the other, or if the class on top
|
// See if neither subclasses the other, or if the class on top
|
||||||
// is precise. In either of these cases, the compare is known
|
// is precise. In either of these cases, the compare is known
|
||||||
|
@ -454,9 +454,13 @@ void SuperWord::mem_slice_preds(Node* start, Node* stop, GrowableArray<Node*> &p
|
|||||||
// or need to run igvn.optimize() again before SLP
|
// or need to run igvn.optimize() again before SLP
|
||||||
} else if (out->is_Phi() && out->bottom_type() == Type::MEMORY && !in_bb(out)) {
|
} else if (out->is_Phi() && out->bottom_type() == Type::MEMORY && !in_bb(out)) {
|
||||||
// Ditto. Not sure what else to check further.
|
// Ditto. Not sure what else to check further.
|
||||||
} else if (out->Opcode() == Op_StoreCM && out->in(4) == n) {
|
} else if (out->Opcode() == Op_StoreCM && out->in(MemNode::OopStore) == n) {
|
||||||
// StoreCM has an input edge used as a precedence edge.
|
// StoreCM has an input edge used as a precedence edge.
|
||||||
// Maybe an issue when oop stores are vectorized.
|
// Maybe an issue when oop stores are vectorized.
|
||||||
|
} else if( out->is_MergeMem() && prev &&
|
||||||
|
prev->Opcode() == Op_StoreCM && out == prev->in(MemNode::OopStore)) {
|
||||||
|
// Oop store is a MergeMem! This should not happen. Temporarily remove the assertion
|
||||||
|
// for this case because it could not be superwordized anyway.
|
||||||
} else {
|
} else {
|
||||||
assert(out == prev || prev == NULL, "no branches off of store slice");
|
assert(out == prev || prev == NULL, "no branches off of store slice");
|
||||||
}
|
}
|
||||||
@ -912,54 +916,175 @@ void SuperWord::schedule() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------co_locate_pack---------------------------
|
//-------------------------------remove_and_insert-------------------
|
||||||
// Within a pack, move stores down to the last executed store,
|
//remove "current" from its current position in the memory graph and insert
|
||||||
// and move loads up to the first executed load.
|
//it after the appropriate insertion point (lip or uip)
|
||||||
|
void SuperWord::remove_and_insert(MemNode *current, MemNode *prev, MemNode *lip,
|
||||||
|
Node *uip, Unique_Node_List &sched_before) {
|
||||||
|
Node* my_mem = current->in(MemNode::Memory);
|
||||||
|
_igvn.hash_delete(current);
|
||||||
|
_igvn.hash_delete(my_mem);
|
||||||
|
|
||||||
|
//remove current_store from its current position in the memmory graph
|
||||||
|
for (DUIterator i = current->outs(); current->has_out(i); i++) {
|
||||||
|
Node* use = current->out(i);
|
||||||
|
if (use->is_Mem()) {
|
||||||
|
assert(use->in(MemNode::Memory) == current, "must be");
|
||||||
|
_igvn.hash_delete(use);
|
||||||
|
if (use == prev) { // connect prev to my_mem
|
||||||
|
use->set_req(MemNode::Memory, my_mem);
|
||||||
|
} else if (sched_before.member(use)) {
|
||||||
|
_igvn.hash_delete(uip);
|
||||||
|
use->set_req(MemNode::Memory, uip);
|
||||||
|
} else {
|
||||||
|
_igvn.hash_delete(lip);
|
||||||
|
use->set_req(MemNode::Memory, lip);
|
||||||
|
}
|
||||||
|
_igvn._worklist.push(use);
|
||||||
|
--i; //deleted this edge; rescan position
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool sched_up = sched_before.member(current);
|
||||||
|
Node *insert_pt = sched_up ? uip : lip;
|
||||||
|
_igvn.hash_delete(insert_pt);
|
||||||
|
|
||||||
|
// all uses of insert_pt's memory state should use current's instead
|
||||||
|
for (DUIterator i = insert_pt->outs(); insert_pt->has_out(i); i++) {
|
||||||
|
Node* use = insert_pt->out(i);
|
||||||
|
if (use->is_Mem()) {
|
||||||
|
assert(use->in(MemNode::Memory) == insert_pt, "must be");
|
||||||
|
_igvn.hash_delete(use);
|
||||||
|
use->set_req(MemNode::Memory, current);
|
||||||
|
_igvn._worklist.push(use);
|
||||||
|
--i; //deleted this edge; rescan position
|
||||||
|
} else if (!sched_up && use->is_Phi() && use->bottom_type() == Type::MEMORY) {
|
||||||
|
uint pos; //lip (lower insert point) must be the last one in the memory slice
|
||||||
|
_igvn.hash_delete(use);
|
||||||
|
for (pos=1; pos < use->req(); pos++) {
|
||||||
|
if (use->in(pos) == insert_pt) break;
|
||||||
|
}
|
||||||
|
use->set_req(pos, current);
|
||||||
|
_igvn._worklist.push(use);
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//connect current to insert_pt
|
||||||
|
current->set_req(MemNode::Memory, insert_pt);
|
||||||
|
_igvn._worklist.push(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------co_locate_pack----------------------------------
|
||||||
|
// To schedule a store pack, we need to move any sandwiched memory ops either before
|
||||||
|
// or after the pack, based upon dependence information:
|
||||||
|
// (1) If any store in the pack depends on the sandwiched memory op, the
|
||||||
|
// sandwiched memory op must be scheduled BEFORE the pack;
|
||||||
|
// (2) If a sandwiched memory op depends on any store in the pack, the
|
||||||
|
// sandwiched memory op must be scheduled AFTER the pack;
|
||||||
|
// (3) If a sandwiched memory op (say, memA) depends on another sandwiched
|
||||||
|
// memory op (say memB), memB must be scheduled before memA. So, if memA is
|
||||||
|
// scheduled before the pack, memB must also be scheduled before the pack;
|
||||||
|
// (4) If there is no dependence restriction for a sandwiched memory op, we simply
|
||||||
|
// schedule this store AFTER the pack
|
||||||
|
// (5) We know there is no dependence cycle, so there in no other case;
|
||||||
|
// (6) Finally, all memory ops in another single pack should be moved in the same direction.
|
||||||
|
//
|
||||||
|
// To schedule a load pack: the memory edge of every loads in the pack must be
|
||||||
|
// the same as the memory edge of the last executed load in the pack
|
||||||
void SuperWord::co_locate_pack(Node_List* pk) {
|
void SuperWord::co_locate_pack(Node_List* pk) {
|
||||||
if (pk->at(0)->is_Store()) {
|
if (pk->at(0)->is_Store()) {
|
||||||
// Push Stores down towards last executed pack member
|
|
||||||
MemNode* first = executed_first(pk)->as_Mem();
|
MemNode* first = executed_first(pk)->as_Mem();
|
||||||
MemNode* last = executed_last(pk)->as_Mem();
|
MemNode* last = executed_last(pk)->as_Mem();
|
||||||
MemNode* insert_pt = last;
|
Unique_Node_List schedule_before_pack;
|
||||||
|
Unique_Node_List memops;
|
||||||
|
|
||||||
MemNode* current = last->in(MemNode::Memory)->as_Mem();
|
MemNode* current = last->in(MemNode::Memory)->as_Mem();
|
||||||
|
MemNode* previous = last;
|
||||||
while (true) {
|
while (true) {
|
||||||
assert(in_bb(current), "stay in block");
|
assert(in_bb(current), "stay in block");
|
||||||
|
memops.push(previous);
|
||||||
|
for (DUIterator i = current->outs(); current->has_out(i); i++) {
|
||||||
|
Node* use = current->out(i);
|
||||||
|
if (use->is_Mem() && use != previous)
|
||||||
|
memops.push(use);
|
||||||
|
}
|
||||||
|
if(current == first) break;
|
||||||
|
previous = current;
|
||||||
|
current = current->in(MemNode::Memory)->as_Mem();
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine which memory operations should be scheduled before the pack
|
||||||
|
for (uint i = 1; i < memops.size(); i++) {
|
||||||
|
Node *s1 = memops.at(i);
|
||||||
|
if (!in_pack(s1, pk) && !schedule_before_pack.member(s1)) {
|
||||||
|
for (uint j = 0; j< i; j++) {
|
||||||
|
Node *s2 = memops.at(j);
|
||||||
|
if (!independent(s1, s2)) {
|
||||||
|
if (in_pack(s2, pk) || schedule_before_pack.member(s2)) {
|
||||||
|
schedule_before_pack.push(s1); //s1 must be scheduled before
|
||||||
|
Node_List* mem_pk = my_pack(s1);
|
||||||
|
if (mem_pk != NULL) {
|
||||||
|
for (uint ii = 0; ii < mem_pk->size(); ii++) {
|
||||||
|
Node* s = mem_pk->at(ii); // follow partner
|
||||||
|
if (memops.member(s) && !schedule_before_pack.member(s))
|
||||||
|
schedule_before_pack.push(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MemNode* lower_insert_pt = last;
|
||||||
|
Node* upper_insert_pt = first->in(MemNode::Memory);
|
||||||
|
previous = last; //previous store in pk
|
||||||
|
current = last->in(MemNode::Memory)->as_Mem();
|
||||||
|
|
||||||
|
//start scheduling from "last" to "first"
|
||||||
|
while (true) {
|
||||||
|
assert(in_bb(current), "stay in block");
|
||||||
|
assert(in_pack(previous, pk), "previous stays in pack");
|
||||||
Node* my_mem = current->in(MemNode::Memory);
|
Node* my_mem = current->in(MemNode::Memory);
|
||||||
|
|
||||||
if (in_pack(current, pk)) {
|
if (in_pack(current, pk)) {
|
||||||
// Forward users of my memory state to my input memory state
|
// Forward users of my memory state (except "previous) to my input memory state
|
||||||
_igvn.hash_delete(current);
|
_igvn.hash_delete(current);
|
||||||
_igvn.hash_delete(my_mem);
|
|
||||||
for (DUIterator i = current->outs(); current->has_out(i); i++) {
|
for (DUIterator i = current->outs(); current->has_out(i); i++) {
|
||||||
Node* use = current->out(i);
|
Node* use = current->out(i);
|
||||||
if (use->is_Mem()) {
|
if (use->is_Mem() && use != previous) {
|
||||||
assert(use->in(MemNode::Memory) == current, "must be");
|
assert(use->in(MemNode::Memory) == current, "must be");
|
||||||
_igvn.hash_delete(use);
|
_igvn.hash_delete(use);
|
||||||
use->set_req(MemNode::Memory, my_mem);
|
if (schedule_before_pack.member(use)) {
|
||||||
|
_igvn.hash_delete(upper_insert_pt);
|
||||||
|
use->set_req(MemNode::Memory, upper_insert_pt);
|
||||||
|
} else {
|
||||||
|
_igvn.hash_delete(lower_insert_pt);
|
||||||
|
use->set_req(MemNode::Memory, lower_insert_pt);
|
||||||
|
}
|
||||||
_igvn._worklist.push(use);
|
_igvn._worklist.push(use);
|
||||||
--i; // deleted this edge; rescan position
|
--i; // deleted this edge; rescan position
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// put current immediately before insert_pt
|
previous = current;
|
||||||
current->set_req(MemNode::Memory, insert_pt->in(MemNode::Memory));
|
} else { // !in_pack(current, pk) ==> a sandwiched store
|
||||||
_igvn.hash_delete(insert_pt);
|
remove_and_insert(current, previous, lower_insert_pt, upper_insert_pt, schedule_before_pack);
|
||||||
insert_pt->set_req(MemNode::Memory, current);
|
|
||||||
_igvn._worklist.push(insert_pt);
|
|
||||||
_igvn._worklist.push(current);
|
|
||||||
insert_pt = current;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current == first) break;
|
if (current == first) break;
|
||||||
current = my_mem->as_Mem();
|
current = my_mem->as_Mem();
|
||||||
}
|
} // end while
|
||||||
} else if (pk->at(0)->is_Load()) {
|
} else if (pk->at(0)->is_Load()) { //load
|
||||||
// Pull Loads up towards first executed pack member
|
// all use the memory state that the last executed load uses
|
||||||
LoadNode* first = executed_first(pk)->as_Load();
|
LoadNode* last_load = executed_last(pk)->as_Load();
|
||||||
Node* first_mem = first->in(MemNode::Memory);
|
Node* last_mem = last_load->in(MemNode::Memory);
|
||||||
_igvn.hash_delete(first_mem);
|
_igvn.hash_delete(last_mem);
|
||||||
// Give each load same memory state as first
|
// Give each load same memory state as last
|
||||||
for (uint i = 0; i < pk->size(); i++) {
|
for (uint i = 0; i < pk->size(); i++) {
|
||||||
LoadNode* ld = pk->at(i)->as_Load();
|
LoadNode* ld = pk->at(i)->as_Load();
|
||||||
_igvn.hash_delete(ld);
|
_igvn.hash_delete(ld);
|
||||||
ld->set_req(MemNode::Memory, first_mem);
|
ld->set_req(MemNode::Memory, last_mem);
|
||||||
_igvn._worklist.push(ld);
|
_igvn._worklist.push(ld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,8 +341,11 @@ class SuperWord : public ResourceObj {
|
|||||||
void filter_packs();
|
void filter_packs();
|
||||||
// Adjust the memory graph for the packed operations
|
// Adjust the memory graph for the packed operations
|
||||||
void schedule();
|
void schedule();
|
||||||
// Within a pack, move stores down to the last executed store,
|
// Remove "current" from its current position in the memory graph and insert
|
||||||
// and move loads up to the first executed load.
|
// it after the appropriate insert points (lip or uip);
|
||||||
|
void remove_and_insert(MemNode *current, MemNode *prev, MemNode *lip, Node *uip, Unique_Node_List &schd_before);
|
||||||
|
// Within a store pack, schedule stores together by moving out the sandwiched memory ops according
|
||||||
|
// to dependence info; and within a load pack, move loads down to the last executed load.
|
||||||
void co_locate_pack(Node_List* p);
|
void co_locate_pack(Node_List* p);
|
||||||
// Convert packs into vector node operations
|
// Convert packs into vector node operations
|
||||||
void output();
|
void output();
|
||||||
|
@ -1252,7 +1252,7 @@ JVM_ENTRY(jobjectArray, JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass))
|
|||||||
|
|
||||||
// Throws an exception if outer klass has not declared k as
|
// Throws an exception if outer klass has not declared k as
|
||||||
// an inner klass
|
// an inner klass
|
||||||
Reflection::check_for_inner_class(k, inner_klass, CHECK_NULL);
|
Reflection::check_for_inner_class(k, inner_klass, true, CHECK_NULL);
|
||||||
|
|
||||||
result->obj_at_put(members, inner_klass->java_mirror());
|
result->obj_at_put(members, inner_klass->java_mirror());
|
||||||
members++;
|
members++;
|
||||||
@ -1275,16 +1275,29 @@ JVM_END
|
|||||||
|
|
||||||
|
|
||||||
JVM_ENTRY(jclass, JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass))
|
JVM_ENTRY(jclass, JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass))
|
||||||
const int inner_class_info_index = 0;
|
{
|
||||||
const int outer_class_info_index = 1;
|
|
||||||
|
|
||||||
// ofClass is a reference to a java_lang_Class object.
|
// ofClass is a reference to a java_lang_Class object.
|
||||||
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
|
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
|
||||||
! Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) {
|
! Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
instanceKlassHandle k(thread, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)));
|
symbolOop simple_name = NULL;
|
||||||
|
klassOop outer_klass
|
||||||
|
= instanceKlass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass))
|
||||||
|
)->compute_enclosing_class(simple_name, CHECK_NULL);
|
||||||
|
if (outer_klass == NULL) return NULL; // already a top-level class
|
||||||
|
if (simple_name == NULL) return NULL; // an anonymous class (inside a method)
|
||||||
|
return (jclass) JNIHandles::make_local(env, Klass::cast(outer_klass)->java_mirror());
|
||||||
|
}
|
||||||
|
JVM_END
|
||||||
|
|
||||||
|
// should be in instanceKlass.cpp, but is here for historical reasons
|
||||||
|
klassOop instanceKlass::compute_enclosing_class_impl(instanceKlassHandle k,
|
||||||
|
symbolOop& simple_name_result, TRAPS) {
|
||||||
|
Thread* thread = THREAD;
|
||||||
|
const int inner_class_info_index = inner_class_inner_class_info_offset;
|
||||||
|
const int outer_class_info_index = inner_class_outer_class_info_offset;
|
||||||
|
|
||||||
if (k->inner_classes()->length() == 0) {
|
if (k->inner_classes()->length() == 0) {
|
||||||
// No inner class info => no declaring class
|
// No inner class info => no declaring class
|
||||||
@ -1298,35 +1311,51 @@ JVM_ENTRY(jclass, JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass))
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
klassOop ok;
|
klassOop ok;
|
||||||
instanceKlassHandle outer_klass;
|
instanceKlassHandle outer_klass;
|
||||||
|
bool inner_is_member = false;
|
||||||
|
int simple_name_index = 0;
|
||||||
|
|
||||||
// Find inner_klass attribute
|
// Find inner_klass attribute
|
||||||
for(int i = 0; i < i_length && !found; i+= 4) {
|
for (int i = 0; i < i_length && !found; i += inner_class_next_offset) {
|
||||||
int ioff = i_icls->ushort_at(i + inner_class_info_index);
|
int ioff = i_icls->ushort_at(i + inner_class_info_index);
|
||||||
int ooff = i_icls->ushort_at(i + outer_class_info_index);
|
int ooff = i_icls->ushort_at(i + outer_class_info_index);
|
||||||
|
int noff = i_icls->ushort_at(i + inner_class_inner_name_offset);
|
||||||
if (ioff != 0 && ooff != 0) {
|
if (ioff != 0) {
|
||||||
// Check to see if the name matches the class we're looking for
|
// Check to see if the name matches the class we're looking for
|
||||||
// before attempting to find the class.
|
// before attempting to find the class.
|
||||||
if (i_cp->klass_name_at_matches(k, ioff)) {
|
if (i_cp->klass_name_at_matches(k, ioff)) {
|
||||||
klassOop inner_klass = i_cp->klass_at(ioff, CHECK_NULL);
|
klassOop inner_klass = i_cp->klass_at(ioff, CHECK_NULL);
|
||||||
if (k() == inner_klass) {
|
found = (k() == inner_klass);
|
||||||
found = true;
|
if (found && ooff != 0) {
|
||||||
ok = i_cp->klass_at(ooff, CHECK_NULL);
|
ok = i_cp->klass_at(ooff, CHECK_NULL);
|
||||||
outer_klass = instanceKlassHandle(thread, ok);
|
outer_klass = instanceKlassHandle(thread, ok);
|
||||||
|
simple_name_index = noff;
|
||||||
|
inner_is_member = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (found && outer_klass.is_null()) {
|
||||||
|
// It may be anonymous; try for that.
|
||||||
|
int encl_method_class_idx = k->enclosing_method_class_index();
|
||||||
|
if (encl_method_class_idx != 0) {
|
||||||
|
ok = i_cp->klass_at(encl_method_class_idx, CHECK_NULL);
|
||||||
|
outer_klass = instanceKlassHandle(thread, ok);
|
||||||
|
inner_is_member = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If no inner class attribute found for this class.
|
// If no inner class attribute found for this class.
|
||||||
if (!found) return NULL;
|
if (outer_klass.is_null()) return NULL;
|
||||||
|
|
||||||
// Throws an exception if outer klass has not declared k as an inner klass
|
// Throws an exception if outer klass has not declared k as an inner klass
|
||||||
Reflection::check_for_inner_class(outer_klass, k, CHECK_NULL);
|
// We need evidence that each klass knows about the other, or else
|
||||||
|
// the system could allow a spoof of an inner class to gain access rights.
|
||||||
return (jclass)JNIHandles::make_local(env, outer_klass->java_mirror());
|
Reflection::check_for_inner_class(outer_klass, k, inner_is_member, CHECK_NULL);
|
||||||
JVM_END
|
|
||||||
|
|
||||||
|
simple_name_result = (inner_is_member ? i_cp->symbol_at(simple_name_index) : symbolOop(NULL));
|
||||||
|
return outer_klass();
|
||||||
|
}
|
||||||
|
|
||||||
JVM_ENTRY(jstring, JVM_GetClassSignature(JNIEnv *env, jclass cls))
|
JVM_ENTRY(jstring, JVM_GetClassSignature(JNIEnv *env, jclass cls))
|
||||||
assert (cls != NULL, "illegal class");
|
assert (cls != NULL, "illegal class");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -107,13 +107,14 @@ void fieldDescriptor::print_on(outputStream* st) const {
|
|||||||
void fieldDescriptor::print_on_for(outputStream* st, oop obj) {
|
void fieldDescriptor::print_on_for(outputStream* st, oop obj) {
|
||||||
print_on(st);
|
print_on(st);
|
||||||
BasicType ft = field_type();
|
BasicType ft = field_type();
|
||||||
jint as_int;
|
jint as_int = 0;
|
||||||
switch (ft) {
|
switch (ft) {
|
||||||
case T_BYTE:
|
case T_BYTE:
|
||||||
as_int = (jint)obj->byte_field(offset());
|
as_int = (jint)obj->byte_field(offset());
|
||||||
st->print(" %d", obj->byte_field(offset()));
|
st->print(" %d", obj->byte_field(offset()));
|
||||||
break;
|
break;
|
||||||
case T_CHAR:
|
case T_CHAR:
|
||||||
|
as_int = (jint)obj->char_field(offset());
|
||||||
{
|
{
|
||||||
jchar c = obj->char_field(offset());
|
jchar c = obj->char_field(offset());
|
||||||
as_int = c;
|
as_int = c;
|
||||||
@ -128,6 +129,7 @@ void fieldDescriptor::print_on_for(outputStream* st, oop obj) {
|
|||||||
st->print(" %f", obj->float_field(offset()));
|
st->print(" %f", obj->float_field(offset()));
|
||||||
break;
|
break;
|
||||||
case T_INT:
|
case T_INT:
|
||||||
|
as_int = obj->int_field(offset());
|
||||||
st->print(" %d", obj->int_field(offset()));
|
st->print(" %d", obj->int_field(offset()));
|
||||||
break;
|
break;
|
||||||
case T_LONG:
|
case T_LONG:
|
||||||
@ -144,12 +146,12 @@ void fieldDescriptor::print_on_for(outputStream* st, oop obj) {
|
|||||||
break;
|
break;
|
||||||
case T_ARRAY:
|
case T_ARRAY:
|
||||||
st->print(" ");
|
st->print(" ");
|
||||||
as_int = obj->int_field(offset());
|
NOT_LP64(as_int = obj->int_field(offset()));
|
||||||
obj->obj_field(offset())->print_value_on(st);
|
obj->obj_field(offset())->print_value_on(st);
|
||||||
break;
|
break;
|
||||||
case T_OBJECT:
|
case T_OBJECT:
|
||||||
st->print(" ");
|
st->print(" ");
|
||||||
as_int = obj->int_field(offset());
|
NOT_LP64(as_int = obj->int_field(offset()));
|
||||||
obj->obj_field(offset())->print_value_on(st);
|
obj->obj_field(offset())->print_value_on(st);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -158,9 +160,9 @@ void fieldDescriptor::print_on_for(outputStream* st, oop obj) {
|
|||||||
}
|
}
|
||||||
// Print a hint as to the underlying integer representation. This can be wrong for
|
// Print a hint as to the underlying integer representation. This can be wrong for
|
||||||
// pointers on an LP64 machine
|
// pointers on an LP64 machine
|
||||||
if (ft == T_LONG || ft == T_DOUBLE) {
|
if (ft == T_LONG || ft == T_DOUBLE LP64_ONLY(|| !is_java_primitive(ft)) ) {
|
||||||
st->print(" (%x %x)", obj->int_field(offset()), obj->int_field(offset()+sizeof(jint)));
|
st->print(" (%x %x)", obj->int_field(offset()), obj->int_field(offset()+sizeof(jint)));
|
||||||
} else {
|
} else if (as_int < 0 || as_int > 9) {
|
||||||
st->print(" (%x)", as_int);
|
st->print(" (%x)", as_int);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ define_pd_global(intx, Tier4BackEdgeThreshold, 0);
|
|||||||
define_pd_global(intx, OnStackReplacePercentage, 0);
|
define_pd_global(intx, OnStackReplacePercentage, 0);
|
||||||
define_pd_global(bool, ResizeTLAB, false);
|
define_pd_global(bool, ResizeTLAB, false);
|
||||||
define_pd_global(intx, FreqInlineSize, 0);
|
define_pd_global(intx, FreqInlineSize, 0);
|
||||||
|
define_pd_global(intx, InlineSmallCode, 0);
|
||||||
define_pd_global(intx, NewSizeThreadIncrease, 4*K);
|
define_pd_global(intx, NewSizeThreadIncrease, 4*K);
|
||||||
define_pd_global(intx, NewRatio, 4);
|
define_pd_global(intx, NewRatio, 4);
|
||||||
define_pd_global(intx, InlineClassNatives, true);
|
define_pd_global(intx, InlineClassNatives, true);
|
||||||
@ -2616,7 +2617,7 @@ class CommandLineFlags {
|
|||||||
develop(intx, MaxRecursiveInlineLevel, 1, \
|
develop(intx, MaxRecursiveInlineLevel, 1, \
|
||||||
"maximum number of nested recursive calls that are inlined") \
|
"maximum number of nested recursive calls that are inlined") \
|
||||||
\
|
\
|
||||||
product(intx, InlineSmallCode, 1000, \
|
product_pd(intx, InlineSmallCode, \
|
||||||
"Only inline already compiled methods if their code size is " \
|
"Only inline already compiled methods if their code size is " \
|
||||||
"less than this") \
|
"less than this") \
|
||||||
\
|
\
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -137,6 +137,14 @@ class KlassHandle: public Handle {
|
|||||||
assert(is_null() || obj()->is_klass(), "not a klassOop");
|
assert(is_null() || obj()->is_klass(), "not a klassOop");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Direct interface, use very sparingly.
|
||||||
|
// Used by SystemDictionaryHandles to create handles on existing WKKs.
|
||||||
|
// The obj of such a klass handle may be null, because the handle is formed
|
||||||
|
// during system bootstrapping.
|
||||||
|
KlassHandle(klassOop *handle, bool dummy) : Handle((oop*)handle, dummy) {
|
||||||
|
assert(SharedSkipVerify || is_null() || obj() == NULL || obj()->is_klass(), "not a klassOop");
|
||||||
|
}
|
||||||
|
|
||||||
// General access
|
// General access
|
||||||
klassOop operator () () const { return obj(); }
|
klassOop operator () () const { return obj(); }
|
||||||
Klass* operator -> () const { return as_klass(); }
|
Klass* operator -> () const { return as_klass(); }
|
||||||
|
@ -26,3 +26,15 @@
|
|||||||
# include "incls/_orderAccess.cpp.incl"
|
# include "incls/_orderAccess.cpp.incl"
|
||||||
|
|
||||||
volatile intptr_t OrderAccess::dummy = 0;
|
volatile intptr_t OrderAccess::dummy = 0;
|
||||||
|
|
||||||
|
void OrderAccess::StubRoutines_fence() {
|
||||||
|
// Use a stub if it exists. It may not exist during bootstrap so do
|
||||||
|
// nothing in that case but assert if no fence code exists after threads have been created
|
||||||
|
void (*func)() = CAST_TO_FN_PTR(void (*)(), StubRoutines::fence_entry());
|
||||||
|
|
||||||
|
if (func != NULL) {
|
||||||
|
(*func)();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assert(Threads::number_of_threads() == 0, "for bootstrap only");
|
||||||
|
}
|
||||||
|
@ -300,4 +300,10 @@ class OrderAccess : AllStatic {
|
|||||||
// In order to force a memory access, implementations may
|
// In order to force a memory access, implementations may
|
||||||
// need a volatile externally visible dummy variable.
|
// need a volatile externally visible dummy variable.
|
||||||
static volatile intptr_t dummy;
|
static volatile intptr_t dummy;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// This is a helper that invokes the StubRoutines::fence_entry()
|
||||||
|
// routine if it exists, It should only be used by platforms that
|
||||||
|
// don't another way to do the inline eassembly.
|
||||||
|
static void StubRoutines_fence();
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -554,10 +554,18 @@ bool Reflection::is_same_class_package(klassOop class1, klassOop class2) {
|
|||||||
return instanceKlass::cast(class1)->is_same_class_package(class2);
|
return instanceKlass::cast(class1)->is_same_class_package(class2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Reflection::is_same_package_member(klassOop class1, klassOop class2, TRAPS) {
|
||||||
|
return instanceKlass::cast(class1)->is_same_package_member(class2, THREAD);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Checks that the 'outer' klass has declared 'inner' as being an inner klass. If not,
|
// Checks that the 'outer' klass has declared 'inner' as being an inner klass. If not,
|
||||||
// throw an incompatible class change exception
|
// throw an incompatible class change exception
|
||||||
void Reflection::check_for_inner_class(instanceKlassHandle outer, instanceKlassHandle inner, TRAPS) {
|
// If inner_is_member, require the inner to be a member of the outer.
|
||||||
|
// If !inner_is_member, require the inner to be anonymous (a non-member).
|
||||||
|
// Caller is responsible for figuring out in advance which case must be true.
|
||||||
|
void Reflection::check_for_inner_class(instanceKlassHandle outer, instanceKlassHandle inner,
|
||||||
|
bool inner_is_member, TRAPS) {
|
||||||
const int inner_class_info_index = 0;
|
const int inner_class_info_index = 0;
|
||||||
const int outer_class_info_index = 1;
|
const int outer_class_info_index = 1;
|
||||||
|
|
||||||
@ -567,7 +575,7 @@ void Reflection::check_for_inner_class(instanceKlassHandle outer, instanceKlassH
|
|||||||
int ioff = icls->ushort_at(i + inner_class_info_index);
|
int ioff = icls->ushort_at(i + inner_class_info_index);
|
||||||
int ooff = icls->ushort_at(i + outer_class_info_index);
|
int ooff = icls->ushort_at(i + outer_class_info_index);
|
||||||
|
|
||||||
if (ioff != 0 && ooff != 0) {
|
if (inner_is_member && ioff != 0 && ooff != 0) {
|
||||||
klassOop o = cp->klass_at(ooff, CHECK);
|
klassOop o = cp->klass_at(ooff, CHECK);
|
||||||
if (o == outer()) {
|
if (o == outer()) {
|
||||||
klassOop i = cp->klass_at(ioff, CHECK);
|
klassOop i = cp->klass_at(ioff, CHECK);
|
||||||
@ -576,6 +584,13 @@ void Reflection::check_for_inner_class(instanceKlassHandle outer, instanceKlassH
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!inner_is_member && ioff != 0 && ooff == 0 &&
|
||||||
|
cp->klass_name_at_matches(inner, ioff)) {
|
||||||
|
klassOop i = cp->klass_at(ioff, CHECK);
|
||||||
|
if (i == inner()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'inner' not declared as an inner klass in outer
|
// 'inner' not declared as an inner klass in outer
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -87,12 +87,18 @@ class Reflection: public AllStatic {
|
|||||||
bool classloader_only,
|
bool classloader_only,
|
||||||
bool protected_restriction = false);
|
bool protected_restriction = false);
|
||||||
static bool is_same_class_package(klassOop class1, klassOop class2);
|
static bool is_same_class_package(klassOop class1, klassOop class2);
|
||||||
|
static bool is_same_package_member(klassOop class1, klassOop class2, TRAPS);
|
||||||
|
|
||||||
static bool can_relax_access_check_for(
|
static bool can_relax_access_check_for(
|
||||||
klassOop accessor, klassOop accesee, bool classloader_only);
|
klassOop accessor, klassOop accesee, bool classloader_only);
|
||||||
|
|
||||||
// inner class reflection
|
// inner class reflection
|
||||||
static void check_for_inner_class(instanceKlassHandle outer, instanceKlassHandle inner, TRAPS);
|
// raise an ICCE unless the required relationship can be proven to hold
|
||||||
|
// If inner_is_member, require the inner to be a member of the outer.
|
||||||
|
// If !inner_is_member, require the inner to be anonymous (a non-member).
|
||||||
|
// Caller is responsible for figuring out in advance which case must be true.
|
||||||
|
static void check_for_inner_class(instanceKlassHandle outer, instanceKlassHandle inner,
|
||||||
|
bool inner_is_member, TRAPS);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Support for reflection based on dynamic bytecode generation (JDK 1.4)
|
// Support for reflection based on dynamic bytecode generation (JDK 1.4)
|
||||||
|
@ -675,48 +675,6 @@ JRT_ENTRY(void, SharedRuntime::yield_all(JavaThread* thread, int attempts))
|
|||||||
JRT_END
|
JRT_END
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------
|
|
||||||
// Non-product code
|
|
||||||
#ifndef PRODUCT
|
|
||||||
|
|
||||||
void SharedRuntime::verify_caller_frame(frame caller_frame, methodHandle callee_method) {
|
|
||||||
ResourceMark rm;
|
|
||||||
assert (caller_frame.is_interpreted_frame(), "sanity check");
|
|
||||||
assert (callee_method->has_compiled_code(), "callee must be compiled");
|
|
||||||
methodHandle caller_method (Thread::current(), caller_frame.interpreter_frame_method());
|
|
||||||
jint bci = caller_frame.interpreter_frame_bci();
|
|
||||||
methodHandle method = find_callee_method_inside_interpreter(caller_frame, caller_method, bci);
|
|
||||||
assert (callee_method == method, "incorrect method");
|
|
||||||
}
|
|
||||||
|
|
||||||
methodHandle SharedRuntime::find_callee_method_inside_interpreter(frame caller_frame, methodHandle caller_method, int bci) {
|
|
||||||
EXCEPTION_MARK;
|
|
||||||
Bytecode_invoke* bytecode = Bytecode_invoke_at(caller_method, bci);
|
|
||||||
methodHandle staticCallee = bytecode->static_target(CATCH); // Non-product code
|
|
||||||
|
|
||||||
bytecode = Bytecode_invoke_at(caller_method, bci);
|
|
||||||
int bytecode_index = bytecode->index();
|
|
||||||
Bytecodes::Code bc = bytecode->adjusted_invoke_code();
|
|
||||||
|
|
||||||
Handle receiver;
|
|
||||||
if (bc == Bytecodes::_invokeinterface ||
|
|
||||||
bc == Bytecodes::_invokevirtual ||
|
|
||||||
bc == Bytecodes::_invokespecial) {
|
|
||||||
symbolHandle signature (THREAD, staticCallee->signature());
|
|
||||||
receiver = Handle(THREAD, retrieve_receiver(signature, caller_frame));
|
|
||||||
} else {
|
|
||||||
receiver = Handle();
|
|
||||||
}
|
|
||||||
CallInfo result;
|
|
||||||
constantPoolHandle constants (THREAD, caller_method->constants());
|
|
||||||
LinkResolver::resolve_invoke(result, receiver, constants, bytecode_index, bc, CATCH); // Non-product code
|
|
||||||
methodHandle calleeMethod = result.selected_method();
|
|
||||||
return calleeMethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // PRODUCT
|
|
||||||
|
|
||||||
|
|
||||||
JRT_ENTRY_NO_ASYNC(void, SharedRuntime::register_finalizer(JavaThread* thread, oopDesc* obj))
|
JRT_ENTRY_NO_ASYNC(void, SharedRuntime::register_finalizer(JavaThread* thread, oopDesc* obj))
|
||||||
assert(obj->is_oop(), "must be a valid oop");
|
assert(obj->is_oop(), "must be a valid oop");
|
||||||
assert(obj->klass()->klass_part()->has_finalizer(), "shouldn't be here otherwise");
|
assert(obj->klass()->klass_part()->has_finalizer(), "shouldn't be here otherwise");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -180,9 +180,6 @@ class SharedRuntime: AllStatic {
|
|||||||
|
|
||||||
static oop retrieve_receiver( symbolHandle sig, frame caller );
|
static oop retrieve_receiver( symbolHandle sig, frame caller );
|
||||||
|
|
||||||
static void verify_caller_frame(frame caller_frame, methodHandle callee_method) PRODUCT_RETURN;
|
|
||||||
static methodHandle find_callee_method_inside_interpreter(frame caller_frame, methodHandle caller_method, int bci) PRODUCT_RETURN_(return methodHandle(););
|
|
||||||
|
|
||||||
static void register_finalizer(JavaThread* thread, oopDesc* obj);
|
static void register_finalizer(JavaThread* thread, oopDesc* obj);
|
||||||
|
|
||||||
// dtrace notifications
|
// dtrace notifications
|
||||||
|
@ -3007,17 +3007,19 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (UseStringCache) {
|
if (UseStringCache) {
|
||||||
// Forcibly initialize java/lang/String and mutate the private
|
// Forcibly initialize java/lang/StringValue and mutate the private
|
||||||
// static final "stringCacheEnabled" field before we start creating instances
|
// static final "stringCacheEnabled" field before we start creating instances
|
||||||
klassOop k_o = SystemDictionary::resolve_or_null(vmSymbolHandles::java_lang_String(), Handle(), Handle(), CHECK_0);
|
klassOop k_o = SystemDictionary::resolve_or_null(vmSymbolHandles::java_lang_StringValue(), Handle(), Handle(), CHECK_0);
|
||||||
KlassHandle k = KlassHandle(THREAD, k_o);
|
// Possible that StringValue isn't present: if so, silently don't break
|
||||||
guarantee(k.not_null(), "Must find java/lang/String");
|
if (k_o != NULL) {
|
||||||
instanceKlassHandle ik = instanceKlassHandle(THREAD, k());
|
KlassHandle k = KlassHandle(THREAD, k_o);
|
||||||
ik->initialize(CHECK_0);
|
instanceKlassHandle ik = instanceKlassHandle(THREAD, k());
|
||||||
fieldDescriptor fd;
|
ik->initialize(CHECK_0);
|
||||||
// Possible we might not find this field; if so, don't break
|
fieldDescriptor fd;
|
||||||
if (ik->find_local_field(vmSymbols::stringCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) {
|
// Possible we might not find this field: if so, silently don't break
|
||||||
k()->bool_field_put(fd.offset(), true);
|
if (ik->find_local_field(vmSymbols::stringCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) {
|
||||||
|
k()->bool_field_put(fd.offset(), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
67
hotspot/test/compiler/6636138/Test1.java
Normal file
67
hotspot/test/compiler/6636138/Test1.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @bug 6636138
|
||||||
|
* @summary SuperWord::co_locate_pack(Node_List* p) generates memory graph that leads to memory order violation.
|
||||||
|
*
|
||||||
|
* @run main/othervm -server -Xbatch -XX:CompileOnly=Test1.init -XX:+UseSuperword Test1
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Test1 {
|
||||||
|
|
||||||
|
public static void init(int src[], int [] dst, int[] ref) {
|
||||||
|
// initialize the arrays
|
||||||
|
for (int i =0; i<src.length; i++) {
|
||||||
|
src[i] = i;
|
||||||
|
dst[i] = 2; // yes, dst[i] needed(otherwise src[i] will be replaced with i)
|
||||||
|
ref[i] = src[i]; // src[i] depends on the store src[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void verify(int src[], int[] ref) {
|
||||||
|
// check whether src and ref are equal
|
||||||
|
for (int i = 0; i < src.length; i++) {
|
||||||
|
if (src[i] != ref[i]) {
|
||||||
|
System.out.println("Error: src and ref don't match at " + i);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void test() {
|
||||||
|
int[] src = new int[34];
|
||||||
|
int[] dst = new int[34];
|
||||||
|
int[] ref = new int[34];
|
||||||
|
|
||||||
|
init(src, dst, ref);
|
||||||
|
verify(src, ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
for (int i=0; i< 2000; i++) {
|
||||||
|
test();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
70
hotspot/test/compiler/6636138/Test2.java
Normal file
70
hotspot/test/compiler/6636138/Test2.java
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @bug 6636138
|
||||||
|
* @summary SuperWord::co_locate_pack(Node_List* p) generates memory graph that leads to memory order violation.
|
||||||
|
*
|
||||||
|
* @run main/othervm -server -Xbatch -XX:CompileOnly=Test2.shift -XX:+UseSuperword Test2
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Test2 {
|
||||||
|
|
||||||
|
public static void init(int src[]) {
|
||||||
|
// Initialize the array
|
||||||
|
for (int i = 0; i < src.length; i++)
|
||||||
|
src[i] = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void shift(int src[]) {
|
||||||
|
//left-shift the array
|
||||||
|
for (int i = src.length-1; i > 0; i--){
|
||||||
|
int tmp = src[i];
|
||||||
|
src[i] = src[i-1];
|
||||||
|
src[i-1] = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void verify(int src[]) {
|
||||||
|
for (int i = 0; i < src.length; i++){
|
||||||
|
int value = (i-1 + src.length)%src.length; // correct value after shifting
|
||||||
|
if (src[i] != value) {
|
||||||
|
System.out.println("Error: src["+i+"] should be "+ value + " instead of " + src[i]);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void test() {
|
||||||
|
int[] src = new int[10];
|
||||||
|
init(src);
|
||||||
|
shift(src);
|
||||||
|
verify(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
for (int i=0; i< 2000; i++)
|
||||||
|
test();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user