Merge
This commit is contained in:
commit
0f5c57752d
@ -121,6 +121,8 @@ public class VM {
|
|||||||
private Flag[] commandLineFlags;
|
private Flag[] commandLineFlags;
|
||||||
private Map flagsMap;
|
private Map flagsMap;
|
||||||
|
|
||||||
|
private static Type intType;
|
||||||
|
private static Type uintType;
|
||||||
private static Type intxType;
|
private static Type intxType;
|
||||||
private static Type uintxType;
|
private static Type uintxType;
|
||||||
private static Type sizetType;
|
private static Type sizetType;
|
||||||
@ -170,6 +172,28 @@ public class VM {
|
|||||||
return addr.getCIntegerAt(0, boolType.getSize(), boolType.isUnsigned()) != 0;
|
return addr.getCIntegerAt(0, boolType.getSize(), boolType.isUnsigned()) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInt() {
|
||||||
|
return type.equals("int");
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getInt() {
|
||||||
|
if (Assert.ASSERTS_ENABLED) {
|
||||||
|
Assert.that(isInt(), "not an int flag!");
|
||||||
|
}
|
||||||
|
return addr.getCIntegerAt(0, intType.getSize(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUInt() {
|
||||||
|
return type.equals("uint");
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getUInt() {
|
||||||
|
if (Assert.ASSERTS_ENABLED) {
|
||||||
|
Assert.that(isUInt(), "not a uint flag!");
|
||||||
|
}
|
||||||
|
return addr.getCIntegerAt(0, uintType.getSize(), false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isIntx() {
|
public boolean isIntx() {
|
||||||
return type.equals("intx");
|
return type.equals("intx");
|
||||||
}
|
}
|
||||||
@ -206,6 +230,10 @@ public class VM {
|
|||||||
public String getValue() {
|
public String getValue() {
|
||||||
if (isBool()) {
|
if (isBool()) {
|
||||||
return new Boolean(getBool()).toString();
|
return new Boolean(getBool()).toString();
|
||||||
|
} else if (isInt()) {
|
||||||
|
return new Long(getInt()).toString();
|
||||||
|
} else if (isUInt()) {
|
||||||
|
return new Long(getUInt()).toString();
|
||||||
} else if (isIntx()) {
|
} else if (isIntx()) {
|
||||||
return new Long(getIntx()).toString();
|
return new Long(getIntx()).toString();
|
||||||
} else if (isUIntx()) {
|
} else if (isUIntx()) {
|
||||||
@ -334,6 +362,8 @@ public class VM {
|
|||||||
heapWordSize = db.lookupIntConstant("HeapWordSize").intValue();
|
heapWordSize = db.lookupIntConstant("HeapWordSize").intValue();
|
||||||
oopSize = db.lookupIntConstant("oopSize").intValue();
|
oopSize = db.lookupIntConstant("oopSize").intValue();
|
||||||
|
|
||||||
|
intType = db.lookupType("int");
|
||||||
|
uintType = db.lookupType("uint");
|
||||||
intxType = db.lookupType("intx");
|
intxType = db.lookupType("intx");
|
||||||
uintxType = db.lookupType("uintx");
|
uintxType = db.lookupType("uintx");
|
||||||
sizetType = db.lookupType("size_t");
|
sizetType = db.lookupType("size_t");
|
||||||
|
@ -228,6 +228,9 @@ void VM_Version::get_processor_features() {
|
|||||||
warning("SHA512 instruction (for SHA-384 and SHA-512) is not available on this CPU.");
|
warning("SHA512 instruction (for SHA-384 and SHA-512) is not available on this CPU.");
|
||||||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||||
}
|
}
|
||||||
|
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
|
||||||
|
FLAG_SET_DEFAULT(UseSHA, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This machine allows unaligned memory accesses
|
// This machine allows unaligned memory accesses
|
||||||
|
@ -71,8 +71,7 @@
|
|||||||
// Loaded method.
|
// Loaded method.
|
||||||
ciMethod::ciMethod(methodHandle h_m, ciInstanceKlass* holder) :
|
ciMethod::ciMethod(methodHandle h_m, ciInstanceKlass* holder) :
|
||||||
ciMetadata(h_m()),
|
ciMetadata(h_m()),
|
||||||
_holder(holder),
|
_holder(holder)
|
||||||
_has_injected_profile(false)
|
|
||||||
{
|
{
|
||||||
assert(h_m() != NULL, "no null method");
|
assert(h_m() != NULL, "no null method");
|
||||||
|
|
||||||
@ -170,8 +169,7 @@ ciMethod::ciMethod(ciInstanceKlass* holder,
|
|||||||
_liveness( NULL),
|
_liveness( NULL),
|
||||||
_can_be_statically_bound(false),
|
_can_be_statically_bound(false),
|
||||||
_method_blocks( NULL),
|
_method_blocks( NULL),
|
||||||
_method_data( NULL),
|
_method_data( NULL)
|
||||||
_has_injected_profile( false)
|
|
||||||
#if defined(COMPILER2) || defined(SHARK)
|
#if defined(COMPILER2) || defined(SHARK)
|
||||||
,
|
,
|
||||||
_flow( NULL),
|
_flow( NULL),
|
||||||
|
@ -81,7 +81,6 @@ class ciMethod : public ciMetadata {
|
|||||||
bool _is_c1_compilable;
|
bool _is_c1_compilable;
|
||||||
bool _is_c2_compilable;
|
bool _is_c2_compilable;
|
||||||
bool _can_be_statically_bound;
|
bool _can_be_statically_bound;
|
||||||
bool _has_injected_profile;
|
|
||||||
|
|
||||||
// Lazy fields, filled in on demand
|
// Lazy fields, filled in on demand
|
||||||
address _code;
|
address _code;
|
||||||
@ -179,9 +178,9 @@ class ciMethod : public ciMetadata {
|
|||||||
// Code size for inlining decisions.
|
// Code size for inlining decisions.
|
||||||
int code_size_for_inlining();
|
int code_size_for_inlining();
|
||||||
|
|
||||||
bool caller_sensitive() { return get_Method()->caller_sensitive(); }
|
bool caller_sensitive() const { return get_Method()->caller_sensitive(); }
|
||||||
bool force_inline() { return get_Method()->force_inline(); }
|
bool force_inline() const { return get_Method()->force_inline(); }
|
||||||
bool dont_inline() { return get_Method()->dont_inline(); }
|
bool dont_inline() const { return get_Method()->dont_inline(); }
|
||||||
|
|
||||||
int comp_level();
|
int comp_level();
|
||||||
int highest_osr_comp_level();
|
int highest_osr_comp_level();
|
||||||
@ -289,9 +288,6 @@ class ciMethod : public ciMetadata {
|
|||||||
int instructions_size();
|
int instructions_size();
|
||||||
int scale_count(int count, float prof_factor = 1.); // make MDO count commensurate with IIC
|
int scale_count(int count, float prof_factor = 1.); // make MDO count commensurate with IIC
|
||||||
|
|
||||||
bool has_injected_profile() const { return _has_injected_profile; }
|
|
||||||
void set_injected_profile(bool x) { _has_injected_profile = x; }
|
|
||||||
|
|
||||||
// Stack walking support
|
// Stack walking support
|
||||||
bool is_ignored_by_security_stack_walk() const;
|
bool is_ignored_by_security_stack_walk() const;
|
||||||
|
|
||||||
|
@ -1742,6 +1742,10 @@ ClassFileParser::AnnotationCollector::annotation_index(ClassLoaderData* loader_d
|
|||||||
if (_location != _in_method) break; // only allow for methods
|
if (_location != _in_method) break; // only allow for methods
|
||||||
if (!privileged) break; // only allow in privileged code
|
if (!privileged) break; // only allow in privileged code
|
||||||
return _method_DontInline;
|
return _method_DontInline;
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_InjectedProfile_signature):
|
||||||
|
if (_location != _in_method) break; // only allow for methods
|
||||||
|
if (!privileged) break; // only allow in privileged code
|
||||||
|
return _method_InjectedProfile;
|
||||||
case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
|
||||||
if (_location != _in_method) break; // only allow for methods
|
if (_location != _in_method) break; // only allow for methods
|
||||||
if (!privileged) break; // only allow in privileged code
|
if (!privileged) break; // only allow in privileged code
|
||||||
@ -1783,6 +1787,8 @@ void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) {
|
|||||||
m->set_force_inline(true);
|
m->set_force_inline(true);
|
||||||
if (has_annotation(_method_DontInline))
|
if (has_annotation(_method_DontInline))
|
||||||
m->set_dont_inline(true);
|
m->set_dont_inline(true);
|
||||||
|
if (has_annotation(_method_InjectedProfile))
|
||||||
|
m->set_has_injected_profile(true);
|
||||||
if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none)
|
if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none)
|
||||||
m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
|
m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
|
||||||
if (has_annotation(_method_LambdaForm_Hidden))
|
if (has_annotation(_method_LambdaForm_Hidden))
|
||||||
|
@ -127,6 +127,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
|
|||||||
_method_CallerSensitive,
|
_method_CallerSensitive,
|
||||||
_method_ForceInline,
|
_method_ForceInline,
|
||||||
_method_DontInline,
|
_method_DontInline,
|
||||||
|
_method_InjectedProfile,
|
||||||
_method_LambdaForm_Compiled,
|
_method_LambdaForm_Compiled,
|
||||||
_method_LambdaForm_Hidden,
|
_method_LambdaForm_Hidden,
|
||||||
_sun_misc_Contended,
|
_sun_misc_Contended,
|
||||||
|
@ -278,6 +278,7 @@
|
|||||||
template(java_lang_invoke_LambdaForm, "java/lang/invoke/LambdaForm") \
|
template(java_lang_invoke_LambdaForm, "java/lang/invoke/LambdaForm") \
|
||||||
template(java_lang_invoke_ForceInline_signature, "Ljava/lang/invoke/ForceInline;") \
|
template(java_lang_invoke_ForceInline_signature, "Ljava/lang/invoke/ForceInline;") \
|
||||||
template(java_lang_invoke_DontInline_signature, "Ljava/lang/invoke/DontInline;") \
|
template(java_lang_invoke_DontInline_signature, "Ljava/lang/invoke/DontInline;") \
|
||||||
|
template(java_lang_invoke_InjectedProfile_signature, "Ljava/lang/invoke/InjectedProfile;") \
|
||||||
template(java_lang_invoke_Stable_signature, "Ljava/lang/invoke/Stable;") \
|
template(java_lang_invoke_Stable_signature, "Ljava/lang/invoke/Stable;") \
|
||||||
template(java_lang_invoke_LambdaForm_Compiled_signature, "Ljava/lang/invoke/LambdaForm$Compiled;") \
|
template(java_lang_invoke_LambdaForm_Compiled_signature, "Ljava/lang/invoke/LambdaForm$Compiled;") \
|
||||||
template(java_lang_invoke_LambdaForm_Hidden_signature, "Ljava/lang/invoke/LambdaForm$Hidden;") \
|
template(java_lang_invoke_LambdaForm_Hidden_signature, "Ljava/lang/invoke/LambdaForm$Hidden;") \
|
||||||
|
@ -96,7 +96,7 @@ void PSMarkSweep::invoke(bool maximum_heap_compaction) {
|
|||||||
heap->collector_policy()->should_clear_all_soft_refs();
|
heap->collector_policy()->should_clear_all_soft_refs();
|
||||||
|
|
||||||
uint count = maximum_heap_compaction ? 1 : MarkSweepAlwaysCompactCount;
|
uint count = maximum_heap_compaction ? 1 : MarkSweepAlwaysCompactCount;
|
||||||
UIntFlagSetting flag_setting(MarkSweepAlwaysCompactCount, count);
|
UIntXFlagSetting flag_setting(MarkSweepAlwaysCompactCount, count);
|
||||||
PSMarkSweep::invoke_no_policy(clear_all_soft_refs || maximum_heap_compaction);
|
PSMarkSweep::invoke_no_policy(clear_all_soft_refs || maximum_heap_compaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,7 +785,7 @@ HeapWord* GenCollectorPolicy::satisfy_failed_allocation(size_t size,
|
|||||||
// free memory should be here, especially if they are expensive. If this
|
// free memory should be here, especially if they are expensive. If this
|
||||||
// attempt fails, an OOM exception will be thrown.
|
// attempt fails, an OOM exception will be thrown.
|
||||||
{
|
{
|
||||||
UIntFlagSetting flag_change(MarkSweepAlwaysCompactCount, 1); // Make sure the heap is fully compacted
|
UIntXFlagSetting flag_change(MarkSweepAlwaysCompactCount, 1); // Make sure the heap is fully compacted
|
||||||
|
|
||||||
gch->do_collection(true /* full */,
|
gch->do_collection(true /* full */,
|
||||||
true /* clear_all_soft_refs */,
|
true /* clear_all_soft_refs */,
|
||||||
|
@ -93,6 +93,7 @@ Method::Method(ConstMethod* xconst, AccessFlags access_flags, int size) {
|
|||||||
set_force_inline(false);
|
set_force_inline(false);
|
||||||
set_hidden(false);
|
set_hidden(false);
|
||||||
set_dont_inline(false);
|
set_dont_inline(false);
|
||||||
|
set_has_injected_profile(false);
|
||||||
set_method_data(NULL);
|
set_method_data(NULL);
|
||||||
clear_method_counters();
|
clear_method_counters();
|
||||||
set_vtable_index(Method::garbage_vtable_index);
|
set_vtable_index(Method::garbage_vtable_index);
|
||||||
|
@ -76,12 +76,13 @@ class Method : public Metadata {
|
|||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
enum Flags {
|
enum Flags {
|
||||||
_jfr_towrite = 1 << 0,
|
_jfr_towrite = 1 << 0,
|
||||||
_caller_sensitive = 1 << 1,
|
_caller_sensitive = 1 << 1,
|
||||||
_force_inline = 1 << 2,
|
_force_inline = 1 << 2,
|
||||||
_dont_inline = 1 << 3,
|
_dont_inline = 1 << 3,
|
||||||
_hidden = 1 << 4,
|
_hidden = 1 << 4,
|
||||||
_running_emcp = 1 << 5
|
_has_injected_profile = 1 << 5,
|
||||||
|
_running_emcp = 1 << 6
|
||||||
};
|
};
|
||||||
u1 _flags;
|
u1 _flags;
|
||||||
|
|
||||||
@ -814,6 +815,13 @@ class Method : public Metadata {
|
|||||||
_flags = x ? (_flags | _hidden) : (_flags & ~_hidden);
|
_flags = x ? (_flags | _hidden) : (_flags & ~_hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool has_injected_profile() {
|
||||||
|
return (_flags & _has_injected_profile) != 0;
|
||||||
|
}
|
||||||
|
void set_has_injected_profile(bool x) {
|
||||||
|
_flags = x ? (_flags | _has_injected_profile) : (_flags & ~_has_injected_profile);
|
||||||
|
}
|
||||||
|
|
||||||
ConstMethod::MethodType method_type() const {
|
ConstMethod::MethodType method_type() const {
|
||||||
return _constMethod->method_type();
|
return _constMethod->method_type();
|
||||||
}
|
}
|
||||||
|
@ -438,11 +438,17 @@ bool ArrayCopyNode::finish_transform(PhaseGVN *phase, bool can_reshape,
|
|||||||
// replace fallthrough projections of the ArrayCopyNode by the
|
// replace fallthrough projections of the ArrayCopyNode by the
|
||||||
// new memory, control and the input IO.
|
// new memory, control and the input IO.
|
||||||
CallProjections callprojs;
|
CallProjections callprojs;
|
||||||
extract_projections(&callprojs, true);
|
extract_projections(&callprojs, true, false);
|
||||||
|
|
||||||
igvn->replace_node(callprojs.fallthrough_ioproj, in(TypeFunc::I_O));
|
if (callprojs.fallthrough_ioproj != NULL) {
|
||||||
igvn->replace_node(callprojs.fallthrough_memproj, mem);
|
igvn->replace_node(callprojs.fallthrough_ioproj, in(TypeFunc::I_O));
|
||||||
igvn->replace_node(callprojs.fallthrough_catchproj, ctl);
|
}
|
||||||
|
if (callprojs.fallthrough_memproj != NULL) {
|
||||||
|
igvn->replace_node(callprojs.fallthrough_memproj, mem);
|
||||||
|
}
|
||||||
|
if (callprojs.fallthrough_catchproj != NULL) {
|
||||||
|
igvn->replace_node(callprojs.fallthrough_catchproj, ctl);
|
||||||
|
}
|
||||||
|
|
||||||
// The ArrayCopyNode is not disconnected. It still has the
|
// The ArrayCopyNode is not disconnected. It still has the
|
||||||
// projections for the exception case. Replace current
|
// projections for the exception case. Replace current
|
||||||
|
@ -724,6 +724,26 @@ uint CallNode::match_edge(uint idx) const {
|
|||||||
//
|
//
|
||||||
bool CallNode::may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase) {
|
bool CallNode::may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase) {
|
||||||
assert((t_oop != NULL), "sanity");
|
assert((t_oop != NULL), "sanity");
|
||||||
|
if (is_call_to_arraycopystub()) {
|
||||||
|
const TypeTuple* args = _tf->domain();
|
||||||
|
Node* dest = NULL;
|
||||||
|
// Stubs that can be called once an ArrayCopyNode is expanded have
|
||||||
|
// different signatures. Look for the second pointer argument,
|
||||||
|
// that is the destination of the copy.
|
||||||
|
for (uint i = TypeFunc::Parms, j = 0; i < args->cnt(); i++) {
|
||||||
|
if (args->field_at(i)->isa_ptr()) {
|
||||||
|
j++;
|
||||||
|
if (j == 2) {
|
||||||
|
dest = in(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!dest->is_top() && may_modify_arraycopy_helper(phase->type(dest)->is_oopptr(), t_oop, phase)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (t_oop->is_known_instance()) {
|
if (t_oop->is_known_instance()) {
|
||||||
// The instance_id is set only for scalar-replaceable allocations which
|
// The instance_id is set only for scalar-replaceable allocations which
|
||||||
// are not passed as arguments according to Escape Analysis.
|
// are not passed as arguments according to Escape Analysis.
|
||||||
@ -810,7 +830,7 @@ Node *CallNode::result_cast() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CallNode::extract_projections(CallProjections* projs, bool separate_io_proj) {
|
void CallNode::extract_projections(CallProjections* projs, bool separate_io_proj, bool do_asserts) {
|
||||||
projs->fallthrough_proj = NULL;
|
projs->fallthrough_proj = NULL;
|
||||||
projs->fallthrough_catchproj = NULL;
|
projs->fallthrough_catchproj = NULL;
|
||||||
projs->fallthrough_ioproj = NULL;
|
projs->fallthrough_ioproj = NULL;
|
||||||
@ -873,17 +893,18 @@ void CallNode::extract_projections(CallProjections* projs, bool separate_io_proj
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The resproj may not exist because the result couuld be ignored
|
// The resproj may not exist because the result could be ignored
|
||||||
// and the exception object may not exist if an exception handler
|
// and the exception object may not exist if an exception handler
|
||||||
// swallows the exception but all the other must exist and be found.
|
// swallows the exception but all the other must exist and be found.
|
||||||
assert(projs->fallthrough_proj != NULL, "must be found");
|
assert(projs->fallthrough_proj != NULL, "must be found");
|
||||||
assert(Compile::current()->inlining_incrementally() || projs->fallthrough_catchproj != NULL, "must be found");
|
do_asserts = do_asserts && !Compile::current()->inlining_incrementally();
|
||||||
assert(Compile::current()->inlining_incrementally() || projs->fallthrough_memproj != NULL, "must be found");
|
assert(!do_asserts || projs->fallthrough_catchproj != NULL, "must be found");
|
||||||
assert(Compile::current()->inlining_incrementally() || projs->fallthrough_ioproj != NULL, "must be found");
|
assert(!do_asserts || projs->fallthrough_memproj != NULL, "must be found");
|
||||||
assert(Compile::current()->inlining_incrementally() || projs->catchall_catchproj != NULL, "must be found");
|
assert(!do_asserts || projs->fallthrough_ioproj != NULL, "must be found");
|
||||||
|
assert(!do_asserts || projs->catchall_catchproj != NULL, "must be found");
|
||||||
if (separate_io_proj) {
|
if (separate_io_proj) {
|
||||||
assert(Compile::current()->inlining_incrementally() || projs->catchall_memproj != NULL, "must be found");
|
assert(!do_asserts || projs->catchall_memproj != NULL, "must be found");
|
||||||
assert(Compile::current()->inlining_incrementally() || projs->catchall_ioproj != NULL, "must be found");
|
assert(!do_asserts || projs->catchall_ioproj != NULL, "must be found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -909,6 +930,12 @@ Node *CallNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
|||||||
return SafePointNode::Ideal(phase, can_reshape);
|
return SafePointNode::Ideal(phase, can_reshape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CallNode::is_call_to_arraycopystub() const {
|
||||||
|
if (_name != NULL && strstr(_name, "arraycopy") != 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
uint CallJavaNode::size_of() const { return sizeof(*this); }
|
uint CallJavaNode::size_of() const { return sizeof(*this); }
|
||||||
@ -1007,14 +1034,6 @@ void CallRuntimeNode::calling_convention( BasicType* sig_bt, VMRegPair *parm_reg
|
|||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
bool CallLeafNode::is_call_to_arraycopystub() const {
|
|
||||||
if (_name != NULL && strstr(_name, "arraycopy") != 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
void CallLeafNode::dump_spec(outputStream *st) const {
|
void CallLeafNode::dump_spec(outputStream *st) const {
|
||||||
st->print("# ");
|
st->print("# ");
|
||||||
@ -1930,26 +1949,3 @@ bool CallNode::may_modify_arraycopy_helper(const TypeOopPtr* dest_t, const TypeO
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CallLeafNode::may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase) {
|
|
||||||
if (is_call_to_arraycopystub()) {
|
|
||||||
const TypeTuple* args = _tf->domain();
|
|
||||||
Node* dest = NULL;
|
|
||||||
// Stubs that can be called once an ArrayCopyNode is expanded have
|
|
||||||
// different signatures. Look for the second pointer argument,
|
|
||||||
// that is the destination of the copy.
|
|
||||||
for (uint i = TypeFunc::Parms, j = 0; i < args->cnt(); i++) {
|
|
||||||
if (args->field_at(i)->isa_ptr()) {
|
|
||||||
j++;
|
|
||||||
if (j == 2) {
|
|
||||||
dest = in(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!dest->is_top() && may_modify_arraycopy_helper(phase->type(dest)->is_oopptr(), t_oop, phase)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return CallNode::may_modify(t_oop, phase);
|
|
||||||
}
|
|
||||||
|
@ -565,13 +565,15 @@ public:
|
|||||||
address _entry_point; // Address of method being called
|
address _entry_point; // Address of method being called
|
||||||
float _cnt; // Estimate of number of times called
|
float _cnt; // Estimate of number of times called
|
||||||
CallGenerator* _generator; // corresponding CallGenerator for some late inline calls
|
CallGenerator* _generator; // corresponding CallGenerator for some late inline calls
|
||||||
|
const char *_name; // Printable name, if _method is NULL
|
||||||
|
|
||||||
CallNode(const TypeFunc* tf, address addr, const TypePtr* adr_type)
|
CallNode(const TypeFunc* tf, address addr, const TypePtr* adr_type)
|
||||||
: SafePointNode(tf->domain()->cnt(), NULL, adr_type),
|
: SafePointNode(tf->domain()->cnt(), NULL, adr_type),
|
||||||
_tf(tf),
|
_tf(tf),
|
||||||
_entry_point(addr),
|
_entry_point(addr),
|
||||||
_cnt(COUNT_UNKNOWN),
|
_cnt(COUNT_UNKNOWN),
|
||||||
_generator(NULL)
|
_generator(NULL),
|
||||||
|
_name(NULL)
|
||||||
{
|
{
|
||||||
init_class_id(Class_Call);
|
init_class_id(Class_Call);
|
||||||
}
|
}
|
||||||
@ -626,10 +628,12 @@ public:
|
|||||||
// Collect all the interesting edges from a call for use in
|
// Collect all the interesting edges from a call for use in
|
||||||
// replacing the call by something else. Used by macro expansion
|
// replacing the call by something else. Used by macro expansion
|
||||||
// and the late inlining support.
|
// and the late inlining support.
|
||||||
void extract_projections(CallProjections* projs, bool separate_io_proj);
|
void extract_projections(CallProjections* projs, bool separate_io_proj, bool do_asserts = true);
|
||||||
|
|
||||||
virtual uint match_edge(uint idx) const;
|
virtual uint match_edge(uint idx) const;
|
||||||
|
|
||||||
|
bool is_call_to_arraycopystub() const;
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
virtual void dump_req(outputStream *st = tty) const;
|
virtual void dump_req(outputStream *st = tty) const;
|
||||||
virtual void dump_spec(outputStream *st) const;
|
virtual void dump_spec(outputStream *st) const;
|
||||||
@ -683,7 +687,7 @@ class CallStaticJavaNode : public CallJavaNode {
|
|||||||
virtual uint size_of() const; // Size is bigger
|
virtual uint size_of() const; // Size is bigger
|
||||||
public:
|
public:
|
||||||
CallStaticJavaNode(Compile* C, const TypeFunc* tf, address addr, ciMethod* method, int bci)
|
CallStaticJavaNode(Compile* C, const TypeFunc* tf, address addr, ciMethod* method, int bci)
|
||||||
: CallJavaNode(tf, addr, method, bci), _name(NULL) {
|
: CallJavaNode(tf, addr, method, bci) {
|
||||||
init_class_id(Class_CallStaticJava);
|
init_class_id(Class_CallStaticJava);
|
||||||
if (C->eliminate_boxing() && (method != NULL) && method->is_boxing_method()) {
|
if (C->eliminate_boxing() && (method != NULL) && method->is_boxing_method()) {
|
||||||
init_flags(Flag_is_macro);
|
init_flags(Flag_is_macro);
|
||||||
@ -694,14 +698,14 @@ public:
|
|||||||
}
|
}
|
||||||
CallStaticJavaNode(const TypeFunc* tf, address addr, const char* name, int bci,
|
CallStaticJavaNode(const TypeFunc* tf, address addr, const char* name, int bci,
|
||||||
const TypePtr* adr_type)
|
const TypePtr* adr_type)
|
||||||
: CallJavaNode(tf, addr, NULL, bci), _name(name) {
|
: CallJavaNode(tf, addr, NULL, bci) {
|
||||||
init_class_id(Class_CallStaticJava);
|
init_class_id(Class_CallStaticJava);
|
||||||
// This node calls a runtime stub, which often has narrow memory effects.
|
// This node calls a runtime stub, which often has narrow memory effects.
|
||||||
_adr_type = adr_type;
|
_adr_type = adr_type;
|
||||||
_is_scalar_replaceable = false;
|
_is_scalar_replaceable = false;
|
||||||
_is_non_escaping = false;
|
_is_non_escaping = false;
|
||||||
|
_name = name;
|
||||||
}
|
}
|
||||||
const char *_name; // Runtime wrapper name
|
|
||||||
|
|
||||||
// Result of Escape Analysis
|
// Result of Escape Analysis
|
||||||
bool _is_scalar_replaceable;
|
bool _is_scalar_replaceable;
|
||||||
@ -754,13 +758,12 @@ class CallRuntimeNode : public CallNode {
|
|||||||
public:
|
public:
|
||||||
CallRuntimeNode(const TypeFunc* tf, address addr, const char* name,
|
CallRuntimeNode(const TypeFunc* tf, address addr, const char* name,
|
||||||
const TypePtr* adr_type)
|
const TypePtr* adr_type)
|
||||||
: CallNode(tf, addr, adr_type),
|
: CallNode(tf, addr, adr_type)
|
||||||
_name(name)
|
|
||||||
{
|
{
|
||||||
init_class_id(Class_CallRuntime);
|
init_class_id(Class_CallRuntime);
|
||||||
|
_name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *_name; // Printable name, if _method is NULL
|
|
||||||
virtual int Opcode() const;
|
virtual int Opcode() const;
|
||||||
virtual void calling_convention( BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt ) const;
|
virtual void calling_convention( BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt ) const;
|
||||||
|
|
||||||
@ -785,8 +788,6 @@ public:
|
|||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
virtual void dump_spec(outputStream *st) const;
|
virtual void dump_spec(outputStream *st) const;
|
||||||
#endif
|
#endif
|
||||||
bool is_call_to_arraycopystub() const;
|
|
||||||
virtual bool may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------CallLeafNoFPNode-------------------------------
|
//------------------------------CallLeafNoFPNode-------------------------------
|
||||||
|
@ -3390,9 +3390,6 @@ bool Compile::final_graph_reshaping() {
|
|||||||
bool Compile::too_many_traps(ciMethod* method,
|
bool Compile::too_many_traps(ciMethod* method,
|
||||||
int bci,
|
int bci,
|
||||||
Deoptimization::DeoptReason reason) {
|
Deoptimization::DeoptReason reason) {
|
||||||
if (method->has_injected_profile()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ciMethodData* md = method->method_data();
|
ciMethodData* md = method->method_data();
|
||||||
if (md->is_empty()) {
|
if (md->is_empty()) {
|
||||||
// Assume the trap has not occurred, or that it occurred only
|
// Assume the trap has not occurred, or that it occurred only
|
||||||
@ -3442,9 +3439,6 @@ bool Compile::too_many_traps(Deoptimization::DeoptReason reason,
|
|||||||
bool Compile::too_many_recompiles(ciMethod* method,
|
bool Compile::too_many_recompiles(ciMethod* method,
|
||||||
int bci,
|
int bci,
|
||||||
Deoptimization::DeoptReason reason) {
|
Deoptimization::DeoptReason reason) {
|
||||||
if (method->has_injected_profile()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ciMethodData* md = method->method_data();
|
ciMethodData* md = method->method_data();
|
||||||
if (md->is_empty()) {
|
if (md->is_empty()) {
|
||||||
// Assume the trap has not occurred, or that it occurred only
|
// Assume the trap has not occurred, or that it occurred only
|
||||||
|
@ -6125,8 +6125,6 @@ bool LibraryCallKit::inline_profileBoolean() {
|
|||||||
jint false_cnt = aobj->element_value(0).as_int();
|
jint false_cnt = aobj->element_value(0).as_int();
|
||||||
jint true_cnt = aobj->element_value(1).as_int();
|
jint true_cnt = aobj->element_value(1).as_int();
|
||||||
|
|
||||||
method()->set_injected_profile(true);
|
|
||||||
|
|
||||||
if (C->log() != NULL) {
|
if (C->log() != NULL) {
|
||||||
C->log()->elem("observe source='profileBoolean' false='%d' true='%d'",
|
C->log()->elem("observe source='profileBoolean' false='%d' true='%d'",
|
||||||
false_cnt, true_cnt);
|
false_cnt, true_cnt);
|
||||||
|
@ -108,11 +108,10 @@ extern void print_alias_types();
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool membar_for_arraycopy_helper(const TypeOopPtr *t_oop, MergeMemNode* mm, PhaseTransform *phase) {
|
static bool membar_for_arraycopy_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase) {
|
||||||
if (mm->memory_at(Compile::AliasIdxRaw)->is_Proj()) {
|
if (n->is_Proj()) {
|
||||||
Node* n = mm->memory_at(Compile::AliasIdxRaw)->in(0);
|
n = n->in(0);
|
||||||
if ((n->is_ArrayCopy() && n->as_ArrayCopy()->may_modify(t_oop, phase)) ||
|
if (n->is_Call() && n->as_Call()->may_modify(t_oop, phase)) {
|
||||||
(n->is_CallLeaf() && n->as_CallLeaf()->may_modify(t_oop, phase))) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,16 +120,22 @@ static bool membar_for_arraycopy_helper(const TypeOopPtr *t_oop, MergeMemNode* m
|
|||||||
|
|
||||||
static bool membar_for_arraycopy(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase) {
|
static bool membar_for_arraycopy(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase) {
|
||||||
Node* mem = mb->in(TypeFunc::Memory);
|
Node* mem = mb->in(TypeFunc::Memory);
|
||||||
|
|
||||||
if (mem->is_MergeMem()) {
|
if (mem->is_MergeMem()) {
|
||||||
return membar_for_arraycopy_helper(t_oop, mem->as_MergeMem(), phase);
|
Node* n = mem->as_MergeMem()->memory_at(Compile::AliasIdxRaw);
|
||||||
} else if (mem->is_Phi()) {
|
if (membar_for_arraycopy_helper(t_oop, n, phase)) {
|
||||||
// after macro expansion of an ArrayCopyNode we may have a Phi
|
return true;
|
||||||
for (uint i = 1; i < mem->req(); i++) {
|
} else if (n->is_Phi()) {
|
||||||
if (mem->in(i) != NULL && mem->in(i)->is_MergeMem() && membar_for_arraycopy_helper(t_oop, mem->in(i)->as_MergeMem(), phase)) {
|
for (uint i = 1; i < n->req(); i++) {
|
||||||
return true;
|
if (n->in(i) != NULL) {
|
||||||
|
if (membar_for_arraycopy_helper(t_oop, n->in(i), phase)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "runtime/deoptimization.hpp"
|
#include "runtime/deoptimization.hpp"
|
||||||
#include "runtime/relocator.hpp"
|
#include "runtime/relocator.hpp"
|
||||||
#include "utilities/bitMap.inline.hpp"
|
#include "utilities/bitMap.inline.hpp"
|
||||||
|
#include "utilities/events.hpp"
|
||||||
|
|
||||||
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
|
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
|
||||||
|
|
||||||
@ -174,6 +175,9 @@ void VM_RedefineClasses::doit_epilogue() {
|
|||||||
// Free os::malloc allocated memory.
|
// Free os::malloc allocated memory.
|
||||||
os::free(_scratch_classes);
|
os::free(_scratch_classes);
|
||||||
|
|
||||||
|
// Reset the_class_oop to null for error printing.
|
||||||
|
_the_class_oop = NULL;
|
||||||
|
|
||||||
if (RC_TRACE_ENABLED(0x00000004)) {
|
if (RC_TRACE_ENABLED(0x00000004)) {
|
||||||
// Used to have separate timers for "doit" and "all", but the timer
|
// Used to have separate timers for "doit" and "all", but the timer
|
||||||
// overhead skewed the measurements.
|
// overhead skewed the measurements.
|
||||||
@ -4105,6 +4109,13 @@ void VM_RedefineClasses::redefine_single_class(jclass the_jclass,
|
|||||||
java_lang_Class::classRedefinedCount(the_class_mirror),
|
java_lang_Class::classRedefinedCount(the_class_mirror),
|
||||||
os::available_memory() >> 10));
|
os::available_memory() >> 10));
|
||||||
|
|
||||||
|
{
|
||||||
|
ResourceMark rm(THREAD);
|
||||||
|
Events::log_redefinition(THREAD, "redefined class name=%s, count=%d",
|
||||||
|
the_class->external_name(),
|
||||||
|
java_lang_Class::classRedefinedCount(the_class_mirror));
|
||||||
|
|
||||||
|
}
|
||||||
RC_TIMER_STOP(_timer_rsc_phase2);
|
RC_TIMER_STOP(_timer_rsc_phase2);
|
||||||
} // end redefine_single_class()
|
} // end redefine_single_class()
|
||||||
|
|
||||||
@ -4249,3 +4260,11 @@ void VM_RedefineClasses::dump_methods() {
|
|||||||
tty->cr();
|
tty->cr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VM_RedefineClasses::print_on_error(outputStream* st) const {
|
||||||
|
VM_Operation::print_on_error(st);
|
||||||
|
if (_the_class_oop != NULL) {
|
||||||
|
ResourceMark rm;
|
||||||
|
st->print_cr(", redefining class %s", _the_class_oop->external_name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. 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
|
||||||
@ -539,5 +539,8 @@ class VM_RedefineClasses: public VM_Operation {
|
|||||||
static unsigned char * get_cached_class_file_bytes(JvmtiCachedClassFileData *cache) {
|
static unsigned char * get_cached_class_file_bytes(JvmtiCachedClassFileData *cache) {
|
||||||
return cache == NULL ? NULL : cache->data;
|
return cache == NULL ? NULL : cache->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Error printing
|
||||||
|
void print_on_error(outputStream* st) const;
|
||||||
};
|
};
|
||||||
#endif // SHARE_VM_PRIMS_JVMTIREDEFINECLASSES_HPP
|
#endif // SHARE_VM_PRIMS_JVMTIREDEFINECLASSES_HPP
|
||||||
|
@ -710,6 +710,24 @@ WB_ENTRY(jobject, WB_GetBooleanVMFlag(JNIEnv* env, jobject o, jstring name))
|
|||||||
return NULL;
|
return NULL;
|
||||||
WB_END
|
WB_END
|
||||||
|
|
||||||
|
WB_ENTRY(jobject, WB_GetIntVMFlag(JNIEnv* env, jobject o, jstring name))
|
||||||
|
int result;
|
||||||
|
if (GetVMFlag <int> (thread, env, name, &result, &CommandLineFlags::intAt)) {
|
||||||
|
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
|
||||||
|
return longBox(thread, env, result);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
WB_END
|
||||||
|
|
||||||
|
WB_ENTRY(jobject, WB_GetUintVMFlag(JNIEnv* env, jobject o, jstring name))
|
||||||
|
uint result;
|
||||||
|
if (GetVMFlag <uint> (thread, env, name, &result, &CommandLineFlags::uintAt)) {
|
||||||
|
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
|
||||||
|
return longBox(thread, env, result);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
WB_END
|
||||||
|
|
||||||
WB_ENTRY(jobject, WB_GetIntxVMFlag(JNIEnv* env, jobject o, jstring name))
|
WB_ENTRY(jobject, WB_GetIntxVMFlag(JNIEnv* env, jobject o, jstring name))
|
||||||
intx result;
|
intx result;
|
||||||
if (GetVMFlag <intx> (thread, env, name, &result, &CommandLineFlags::intxAt)) {
|
if (GetVMFlag <intx> (thread, env, name, &result, &CommandLineFlags::intxAt)) {
|
||||||
@ -771,6 +789,16 @@ WB_ENTRY(void, WB_SetBooleanVMFlag(JNIEnv* env, jobject o, jstring name, jboolea
|
|||||||
SetVMFlag <bool> (thread, env, name, &result, &CommandLineFlags::boolAtPut);
|
SetVMFlag <bool> (thread, env, name, &result, &CommandLineFlags::boolAtPut);
|
||||||
WB_END
|
WB_END
|
||||||
|
|
||||||
|
WB_ENTRY(void, WB_SetIntVMFlag(JNIEnv* env, jobject o, jstring name, jlong value))
|
||||||
|
int result = value;
|
||||||
|
SetVMFlag <int> (thread, env, name, &result, &CommandLineFlags::intAtPut);
|
||||||
|
WB_END
|
||||||
|
|
||||||
|
WB_ENTRY(void, WB_SetUintVMFlag(JNIEnv* env, jobject o, jstring name, jlong value))
|
||||||
|
uint result = value;
|
||||||
|
SetVMFlag <uint> (thread, env, name, &result, &CommandLineFlags::uintAtPut);
|
||||||
|
WB_END
|
||||||
|
|
||||||
WB_ENTRY(void, WB_SetIntxVMFlag(JNIEnv* env, jobject o, jstring name, jlong value))
|
WB_ENTRY(void, WB_SetIntxVMFlag(JNIEnv* env, jobject o, jstring name, jlong value))
|
||||||
intx result = value;
|
intx result = value;
|
||||||
SetVMFlag <intx> (thread, env, name, &result, &CommandLineFlags::intxAtPut);
|
SetVMFlag <intx> (thread, env, name, &result, &CommandLineFlags::intxAtPut);
|
||||||
@ -1336,6 +1364,8 @@ static JNINativeMethod methods[] = {
|
|||||||
{CC"isConstantVMFlag", CC"(Ljava/lang/String;)Z", (void*)&WB_IsConstantVMFlag},
|
{CC"isConstantVMFlag", CC"(Ljava/lang/String;)Z", (void*)&WB_IsConstantVMFlag},
|
||||||
{CC"isLockedVMFlag", CC"(Ljava/lang/String;)Z", (void*)&WB_IsLockedVMFlag},
|
{CC"isLockedVMFlag", CC"(Ljava/lang/String;)Z", (void*)&WB_IsLockedVMFlag},
|
||||||
{CC"setBooleanVMFlag", CC"(Ljava/lang/String;Z)V",(void*)&WB_SetBooleanVMFlag},
|
{CC"setBooleanVMFlag", CC"(Ljava/lang/String;Z)V",(void*)&WB_SetBooleanVMFlag},
|
||||||
|
{CC"setIntVMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetIntVMFlag},
|
||||||
|
{CC"setUintVMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetUintVMFlag},
|
||||||
{CC"setIntxVMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetIntxVMFlag},
|
{CC"setIntxVMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetIntxVMFlag},
|
||||||
{CC"setUintxVMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetUintxVMFlag},
|
{CC"setUintxVMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetUintxVMFlag},
|
||||||
{CC"setUint64VMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetUint64VMFlag},
|
{CC"setUint64VMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetUint64VMFlag},
|
||||||
@ -1345,6 +1375,10 @@ static JNINativeMethod methods[] = {
|
|||||||
(void*)&WB_SetStringVMFlag},
|
(void*)&WB_SetStringVMFlag},
|
||||||
{CC"getBooleanVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Boolean;",
|
{CC"getBooleanVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Boolean;",
|
||||||
(void*)&WB_GetBooleanVMFlag},
|
(void*)&WB_GetBooleanVMFlag},
|
||||||
|
{CC"getIntVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Long;",
|
||||||
|
(void*)&WB_GetIntVMFlag},
|
||||||
|
{CC"getUintVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Long;",
|
||||||
|
(void*)&WB_GetUintVMFlag},
|
||||||
{CC"getIntxVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Long;",
|
{CC"getIntxVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Long;",
|
||||||
(void*)&WB_GetIntxVMFlag},
|
(void*)&WB_GetIntxVMFlag},
|
||||||
{CC"getUintxVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Long;",
|
{CC"getUintxVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Long;",
|
||||||
|
@ -586,11 +586,12 @@ static bool set_fp_numeric_flag(char* name, char* value, Flag::Flags origin) {
|
|||||||
|
|
||||||
static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) {
|
static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) {
|
||||||
julong v;
|
julong v;
|
||||||
|
int int_v;
|
||||||
intx intx_v;
|
intx intx_v;
|
||||||
bool is_neg = false;
|
bool is_neg = false;
|
||||||
// Check the sign first since atomull() parses only unsigned values.
|
// Check the sign first since atomull() parses only unsigned values.
|
||||||
if (*value == '-') {
|
if (*value == '-') {
|
||||||
if (!CommandLineFlags::intxAt(name, &intx_v)) {
|
if (!CommandLineFlags::intxAt(name, &intx_v) && !CommandLineFlags::intAt(name, &int_v)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
value++;
|
value++;
|
||||||
@ -599,6 +600,17 @@ static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) {
|
|||||||
if (!atomull(value, &v)) {
|
if (!atomull(value, &v)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
int_v = (int) v;
|
||||||
|
if (is_neg) {
|
||||||
|
int_v = -int_v;
|
||||||
|
}
|
||||||
|
if (CommandLineFlags::intAtPut(name, &int_v, origin)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
uint uint_v = (uint) v;
|
||||||
|
if (!is_neg && CommandLineFlags::uintAtPut(name, &uint_v, origin)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
intx_v = (intx) v;
|
intx_v = (intx) v;
|
||||||
if (is_neg) {
|
if (is_neg) {
|
||||||
intx_v = -intx_v;
|
intx_v = -intx_v;
|
||||||
|
@ -1460,7 +1460,11 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint tra
|
|||||||
//
|
//
|
||||||
// The other actions cause immediate removal of the present code.
|
// The other actions cause immediate removal of the present code.
|
||||||
|
|
||||||
bool update_trap_state = (reason != Reason_tenured);
|
// Traps caused by injected profile shouldn't pollute trap counts.
|
||||||
|
bool injected_profile_trap = trap_method->has_injected_profile() &&
|
||||||
|
(reason == Reason_intrinsic || reason == Reason_unreached);
|
||||||
|
|
||||||
|
bool update_trap_state = (reason != Reason_tenured) && !injected_profile_trap;
|
||||||
bool make_not_entrant = false;
|
bool make_not_entrant = false;
|
||||||
bool make_not_compilable = false;
|
bool make_not_compilable = false;
|
||||||
bool reprofile = false;
|
bool reprofile = false;
|
||||||
|
@ -93,6 +93,32 @@ void Flag::set_bool(bool value) {
|
|||||||
*((bool*) _addr) = value;
|
*((bool*) _addr) = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Flag::is_int() const {
|
||||||
|
return strcmp(_type, "int") == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Flag::get_int() const {
|
||||||
|
return *((int*) _addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Flag::set_int(int value) {
|
||||||
|
check_writable();
|
||||||
|
*((int*) _addr) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Flag::is_uint() const {
|
||||||
|
return strcmp(_type, "uint") == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint Flag::get_uint() const {
|
||||||
|
return *((uint*) _addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Flag::set_uint(uint value) {
|
||||||
|
check_writable();
|
||||||
|
*((uint*) _addr) = value;
|
||||||
|
}
|
||||||
|
|
||||||
bool Flag::is_intx() const {
|
bool Flag::is_intx() const {
|
||||||
return strcmp(_type, "intx") == 0;
|
return strcmp(_type, "intx") == 0;
|
||||||
}
|
}
|
||||||
@ -316,6 +342,12 @@ void Flag::print_on(outputStream* st, bool withComments) {
|
|||||||
if (is_bool()) {
|
if (is_bool()) {
|
||||||
st->print("%-16s", get_bool() ? "true" : "false");
|
st->print("%-16s", get_bool() ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
if (is_int()) {
|
||||||
|
st->print("%-16d", get_int());
|
||||||
|
}
|
||||||
|
if (is_uint()) {
|
||||||
|
st->print("%-16u", get_uint());
|
||||||
|
}
|
||||||
if (is_intx()) {
|
if (is_intx()) {
|
||||||
st->print("%-16ld", get_intx());
|
st->print("%-16ld", get_intx());
|
||||||
}
|
}
|
||||||
@ -411,6 +443,10 @@ void Flag::print_kind(outputStream* st) {
|
|||||||
void Flag::print_as_flag(outputStream* st) {
|
void Flag::print_as_flag(outputStream* st) {
|
||||||
if (is_bool()) {
|
if (is_bool()) {
|
||||||
st->print("-XX:%s%s", get_bool() ? "+" : "-", _name);
|
st->print("-XX:%s%s", get_bool() ? "+" : "-", _name);
|
||||||
|
} else if (is_int()) {
|
||||||
|
st->print("-XX:%s=%d", _name, get_int());
|
||||||
|
} else if (is_uint()) {
|
||||||
|
st->print("-XX:%s=%u", _name, get_uint());
|
||||||
} else if (is_intx()) {
|
} else if (is_intx()) {
|
||||||
st->print("-XX:%s=" INTX_FORMAT, _name, get_intx());
|
st->print("-XX:%s=" INTX_FORMAT, _name, get_intx());
|
||||||
} else if (is_uintx()) {
|
} else if (is_uintx()) {
|
||||||
@ -663,6 +699,62 @@ void CommandLineFlagsEx::boolAtPut(CommandLineFlagWithType flag, bool value, Fla
|
|||||||
faddr->set_origin(origin);
|
faddr->set_origin(origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CommandLineFlags::intAt(const char* name, size_t len, int* value, bool allow_locked, bool return_flag) {
|
||||||
|
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag);
|
||||||
|
if (result == NULL) return false;
|
||||||
|
if (!result->is_int()) return false;
|
||||||
|
*value = result->get_int();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CommandLineFlags::intAtPut(const char* name, size_t len, int* value, Flag::Flags origin) {
|
||||||
|
Flag* result = Flag::find_flag(name, len);
|
||||||
|
if (result == NULL) return false;
|
||||||
|
if (!result->is_int()) return false;
|
||||||
|
int old_value = result->get_int();
|
||||||
|
trace_flag_changed<EventIntFlagChanged, s4>(name, old_value, *value, origin);
|
||||||
|
result->set_int(*value);
|
||||||
|
*value = old_value;
|
||||||
|
result->set_origin(origin);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandLineFlagsEx::intAtPut(CommandLineFlagWithType flag, int value, Flag::Flags origin) {
|
||||||
|
Flag* faddr = address_of_flag(flag);
|
||||||
|
guarantee(faddr != NULL && faddr->is_int(), "wrong flag type");
|
||||||
|
trace_flag_changed<EventIntFlagChanged, s4>(faddr->_name, faddr->get_int(), value, origin);
|
||||||
|
faddr->set_int(value);
|
||||||
|
faddr->set_origin(origin);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CommandLineFlags::uintAt(const char* name, size_t len, uint* value, bool allow_locked, bool return_flag) {
|
||||||
|
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag);
|
||||||
|
if (result == NULL) return false;
|
||||||
|
if (!result->is_uint()) return false;
|
||||||
|
*value = result->get_uint();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CommandLineFlags::uintAtPut(const char* name, size_t len, uint* value, Flag::Flags origin) {
|
||||||
|
Flag* result = Flag::find_flag(name, len);
|
||||||
|
if (result == NULL) return false;
|
||||||
|
if (!result->is_uint()) return false;
|
||||||
|
uint old_value = result->get_uint();
|
||||||
|
trace_flag_changed<EventUnsignedIntFlagChanged, u4>(name, old_value, *value, origin);
|
||||||
|
result->set_uint(*value);
|
||||||
|
*value = old_value;
|
||||||
|
result->set_origin(origin);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandLineFlagsEx::uintAtPut(CommandLineFlagWithType flag, uint value, Flag::Flags origin) {
|
||||||
|
Flag* faddr = address_of_flag(flag);
|
||||||
|
guarantee(faddr != NULL && faddr->is_uint(), "wrong flag type");
|
||||||
|
trace_flag_changed<EventUnsignedIntFlagChanged, u4>(faddr->_name, faddr->get_uint(), value, origin);
|
||||||
|
faddr->set_uint(value);
|
||||||
|
faddr->set_origin(origin);
|
||||||
|
}
|
||||||
|
|
||||||
bool CommandLineFlags::intxAt(const char* name, size_t len, intx* value, bool allow_locked, bool return_flag) {
|
bool CommandLineFlags::intxAt(const char* name, size_t len, intx* value, bool allow_locked, bool return_flag) {
|
||||||
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag);
|
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag);
|
||||||
if (result == NULL) return false;
|
if (result == NULL) return false;
|
||||||
|
@ -279,6 +279,14 @@ struct Flag {
|
|||||||
bool get_bool() const;
|
bool get_bool() const;
|
||||||
void set_bool(bool value);
|
void set_bool(bool value);
|
||||||
|
|
||||||
|
bool is_int() const;
|
||||||
|
int get_int() const;
|
||||||
|
void set_int(int value);
|
||||||
|
|
||||||
|
bool is_uint() const;
|
||||||
|
uint get_uint() const;
|
||||||
|
void set_uint(uint value);
|
||||||
|
|
||||||
bool is_intx() const;
|
bool is_intx() const;
|
||||||
intx get_intx() const;
|
intx get_intx() const;
|
||||||
void set_intx(intx value);
|
void set_intx(intx value);
|
||||||
@ -363,13 +371,28 @@ class CounterSetting {
|
|||||||
~CounterSetting() { (*counter)--; }
|
~CounterSetting() { (*counter)--; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class IntFlagSetting {
|
||||||
|
int val;
|
||||||
|
int* flag;
|
||||||
|
public:
|
||||||
|
IntFlagSetting(int& fl, int newValue) { flag = &fl; val = fl; fl = newValue; }
|
||||||
|
~IntFlagSetting() { *flag = val; }
|
||||||
|
};
|
||||||
|
|
||||||
class UIntFlagSetting {
|
class UIntFlagSetting {
|
||||||
|
uint val;
|
||||||
|
uint* flag;
|
||||||
|
public:
|
||||||
|
UIntFlagSetting(uint& fl, uint newValue) { flag = &fl; val = fl; fl = newValue; }
|
||||||
|
~UIntFlagSetting() { *flag = val; }
|
||||||
|
};
|
||||||
|
|
||||||
|
class UIntXFlagSetting {
|
||||||
uintx val;
|
uintx val;
|
||||||
uintx* flag;
|
uintx* flag;
|
||||||
public:
|
public:
|
||||||
UIntFlagSetting(uintx& fl, uintx newValue) { flag = &fl; val = fl; fl = newValue; }
|
UIntXFlagSetting(uintx& fl, uintx newValue) { flag = &fl; val = fl; fl = newValue; }
|
||||||
~UIntFlagSetting() { *flag = val; }
|
~UIntXFlagSetting() { *flag = val; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DoubleFlagSetting {
|
class DoubleFlagSetting {
|
||||||
@ -396,6 +419,16 @@ class CommandLineFlags {
|
|||||||
static bool boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin);
|
static bool boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin);
|
||||||
static bool boolAtPut(const char* name, bool* value, Flag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); }
|
static bool boolAtPut(const char* name, bool* value, Flag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); }
|
||||||
|
|
||||||
|
static bool intAt(const char* name, size_t len, int* value, bool allow_locked = false, bool return_flag = false);
|
||||||
|
static bool intAt(const char* name, int* value, bool allow_locked = false, bool return_flag = false) { return intAt(name, strlen(name), value, allow_locked, return_flag); }
|
||||||
|
static bool intAtPut(const char* name, size_t len, int* value, Flag::Flags origin);
|
||||||
|
static bool intAtPut(const char* name, int* value, Flag::Flags origin) { return intAtPut(name, strlen(name), value, origin); }
|
||||||
|
|
||||||
|
static bool uintAt(const char* name, size_t len, uint* value, bool allow_locked = false, bool return_flag = false);
|
||||||
|
static bool uintAt(const char* name, uint* value, bool allow_locked = false, bool return_flag = false) { return uintAt(name, strlen(name), value, allow_locked, return_flag); }
|
||||||
|
static bool uintAtPut(const char* name, size_t len, uint* value, Flag::Flags origin);
|
||||||
|
static bool uintAtPut(const char* name, uint* value, Flag::Flags origin) { return uintAtPut(name, strlen(name), value, origin); }
|
||||||
|
|
||||||
static bool intxAt(const char* name, size_t len, intx* value, bool allow_locked = false, bool return_flag = false);
|
static bool intxAt(const char* name, size_t len, intx* value, bool allow_locked = false, bool return_flag = false);
|
||||||
static bool intxAt(const char* name, intx* value, bool allow_locked = false, bool return_flag = false) { return intxAt(name, strlen(name), value, allow_locked, return_flag); }
|
static bool intxAt(const char* name, intx* value, bool allow_locked = false, bool return_flag = false) { return intxAt(name, strlen(name), value, allow_locked, return_flag); }
|
||||||
static bool intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin);
|
static bool intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin);
|
||||||
|
@ -197,6 +197,8 @@ typedef enum {
|
|||||||
class CommandLineFlagsEx : CommandLineFlags {
|
class CommandLineFlagsEx : CommandLineFlags {
|
||||||
public:
|
public:
|
||||||
static void boolAtPut(CommandLineFlagWithType flag, bool value, Flag::Flags origin);
|
static void boolAtPut(CommandLineFlagWithType flag, bool value, Flag::Flags origin);
|
||||||
|
static void intAtPut(CommandLineFlagWithType flag, int value, Flag::Flags origin);
|
||||||
|
static void uintAtPut(CommandLineFlagWithType flag, uint value, Flag::Flags origin);
|
||||||
static void intxAtPut(CommandLineFlagWithType flag, intx value, Flag::Flags origin);
|
static void intxAtPut(CommandLineFlagWithType flag, intx value, Flag::Flags origin);
|
||||||
static void uintxAtPut(CommandLineFlagWithType flag, uintx value, Flag::Flags origin);
|
static void uintxAtPut(CommandLineFlagWithType flag, uintx value, Flag::Flags origin);
|
||||||
static void uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, Flag::Flags origin);
|
static void uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, Flag::Flags origin);
|
||||||
|
@ -192,7 +192,7 @@ class VM_Operation: public CHeapObj<mtInternal> {
|
|||||||
static const char* mode_to_string(Mode mode);
|
static const char* mode_to_string(Mode mode);
|
||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
void print_on_error(outputStream* st) const;
|
virtual void print_on_error(outputStream* st) const;
|
||||||
const char* name() const { return _names[type()]; }
|
const char* name() const { return _names[type()]; }
|
||||||
static const char* name(int type) {
|
static const char* name(int type) {
|
||||||
assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type");
|
assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type");
|
||||||
|
@ -1558,6 +1558,12 @@ bool add_global_entry(JNIEnv* env, Handle name, jmmVMGlobal *global, Flag *flag,
|
|||||||
if (flag->is_bool()) {
|
if (flag->is_bool()) {
|
||||||
global->value.z = flag->get_bool() ? JNI_TRUE : JNI_FALSE;
|
global->value.z = flag->get_bool() ? JNI_TRUE : JNI_FALSE;
|
||||||
global->type = JMM_VMGLOBAL_TYPE_JBOOLEAN;
|
global->type = JMM_VMGLOBAL_TYPE_JBOOLEAN;
|
||||||
|
} else if (flag->is_int()) {
|
||||||
|
global->value.j = (jlong)flag->get_int();
|
||||||
|
global->type = JMM_VMGLOBAL_TYPE_JLONG;
|
||||||
|
} else if (flag->is_uint()) {
|
||||||
|
global->value.j = (jlong)flag->get_uint();
|
||||||
|
global->type = JMM_VMGLOBAL_TYPE_JLONG;
|
||||||
} else if (flag->is_intx()) {
|
} else if (flag->is_intx()) {
|
||||||
global->value.j = (jlong)flag->get_intx();
|
global->value.j = (jlong)flag->get_intx();
|
||||||
global->type = JMM_VMGLOBAL_TYPE_JLONG;
|
global->type = JMM_VMGLOBAL_TYPE_JLONG;
|
||||||
|
@ -44,6 +44,36 @@ int WriteableFlags::set_bool_flag(const char* name, bool value, Flag::Flags orig
|
|||||||
return CommandLineFlags::boolAtPut((char*)name, &value, origin) ? SUCCESS : ERR_OTHER;
|
return CommandLineFlags::boolAtPut((char*)name, &value, origin) ? SUCCESS : ERR_OTHER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set a int global flag
|
||||||
|
int WriteableFlags::set_int_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
|
int value;
|
||||||
|
|
||||||
|
if (sscanf(arg, "%d", &value)) {
|
||||||
|
return set_int_flag(name, value, origin, err_msg);
|
||||||
|
}
|
||||||
|
err_msg.print("flag value must be an integer");
|
||||||
|
return WRONG_FORMAT;
|
||||||
|
}
|
||||||
|
|
||||||
|
int WriteableFlags::set_int_flag(const char* name, int value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
|
return CommandLineFlags::intAtPut((char*)name, &value, origin) ? SUCCESS : ERR_OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set a uint global flag
|
||||||
|
int WriteableFlags::set_uint_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
|
uint value;
|
||||||
|
|
||||||
|
if (sscanf(arg, "%u", &value)) {
|
||||||
|
return set_uint_flag(name, value, origin, err_msg);
|
||||||
|
}
|
||||||
|
err_msg.print("flag value must be an unsigned integer");
|
||||||
|
return WRONG_FORMAT;
|
||||||
|
}
|
||||||
|
|
||||||
|
int WriteableFlags::set_uint_flag(const char* name, uint value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
|
return CommandLineFlags::uintAtPut((char*)name, &value, origin) ? SUCCESS : ERR_OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
// set a intx global flag
|
// set a intx global flag
|
||||||
int WriteableFlags::set_intx_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
|
int WriteableFlags::set_intx_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
intx value;
|
intx value;
|
||||||
@ -173,6 +203,10 @@ int WriteableFlags::set_flag_from_char(Flag* f, const void* value, Flag::Flags o
|
|||||||
}
|
}
|
||||||
if (f->is_bool()) {
|
if (f->is_bool()) {
|
||||||
return set_bool_flag(f->_name, flag_value, origin, err_msg);
|
return set_bool_flag(f->_name, flag_value, origin, err_msg);
|
||||||
|
} else if (f->is_int()) {
|
||||||
|
return set_int_flag(f->_name, flag_value, origin, err_msg);
|
||||||
|
} else if (f->is_uint()) {
|
||||||
|
return set_uint_flag(f->_name, flag_value, origin, err_msg);
|
||||||
} else if (f->is_intx()) {
|
} else if (f->is_intx()) {
|
||||||
return set_intx_flag(f->_name, flag_value, origin, err_msg);
|
return set_intx_flag(f->_name, flag_value, origin, err_msg);
|
||||||
} else if (f->is_uintx()) {
|
} else if (f->is_uintx()) {
|
||||||
@ -195,6 +229,12 @@ int WriteableFlags::set_flag_from_jvalue(Flag* f, const void* value, Flag::Flags
|
|||||||
if (f->is_bool()) {
|
if (f->is_bool()) {
|
||||||
bool bvalue = (new_value.z == JNI_TRUE ? true : false);
|
bool bvalue = (new_value.z == JNI_TRUE ? true : false);
|
||||||
return set_bool_flag(f->_name, bvalue, origin, err_msg);
|
return set_bool_flag(f->_name, bvalue, origin, err_msg);
|
||||||
|
} else if (f->is_int()) {
|
||||||
|
int ivalue = (int)new_value.j;
|
||||||
|
return set_int_flag(f->_name, ivalue, origin, err_msg);
|
||||||
|
} else if (f->is_uint()) {
|
||||||
|
uint uvalue = (uint)new_value.j;
|
||||||
|
return set_uint_flag(f->_name, uvalue, origin, err_msg);
|
||||||
} else if (f->is_intx()) {
|
} else if (f->is_intx()) {
|
||||||
intx ivalue = (intx)new_value.j;
|
intx ivalue = (intx)new_value.j;
|
||||||
return set_intx_flag(f->_name, ivalue, origin, err_msg);
|
return set_intx_flag(f->_name, ivalue, origin, err_msg);
|
||||||
|
@ -56,6 +56,10 @@ private:
|
|||||||
|
|
||||||
// set a boolean global flag
|
// set a boolean global flag
|
||||||
static int set_bool_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
static int set_bool_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
||||||
|
// set a int global flag
|
||||||
|
static int set_int_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
||||||
|
// set a uint global flag
|
||||||
|
static int set_uint_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
||||||
// set a intx global flag
|
// set a intx global flag
|
||||||
static int set_intx_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
static int set_intx_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
||||||
// set a uintx global flag
|
// set a uintx global flag
|
||||||
@ -66,6 +70,10 @@ private:
|
|||||||
static int set_size_t_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
static int set_size_t_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
||||||
// set a boolean global flag
|
// set a boolean global flag
|
||||||
static int set_bool_flag(const char* name, bool value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
static int set_bool_flag(const char* name, bool value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
||||||
|
// set a int global flag
|
||||||
|
static int set_int_flag(const char* name, int value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
||||||
|
// set a uint global flag
|
||||||
|
static int set_uint_flag(const char* name, uint value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
||||||
// set a intx global flag
|
// set a intx global flag
|
||||||
static int set_intx_flag(const char* name, intx value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
static int set_intx_flag(const char* name, intx value, Flag::Flags origin, FormatBuffer<80>& err_msg);
|
||||||
// set a uintx global flag
|
// set a uintx global flag
|
||||||
|
@ -122,6 +122,22 @@ Declares a structure type that can be used in other events.
|
|||||||
<value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
|
<value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
<event id="IntFlagChanged" path="vm/flag/int_changed" label="Int Flag Changed"
|
||||||
|
is_instant="true">
|
||||||
|
<value type="UTF8" field="name" label="Name" />
|
||||||
|
<value type="INTEGER" field="old_value" label="Old Value" />
|
||||||
|
<value type="INTEGER" field="new_value" label="New Value" />
|
||||||
|
<value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event id="UnsignedIntFlagChanged" path="vm/flag/uint_changed" label="Unsigned Int Flag Changed"
|
||||||
|
is_instant="true">
|
||||||
|
<value type="UTF8" field="name" label="Name" />
|
||||||
|
<value type="UINT" field="old_value" label="Old Value" />
|
||||||
|
<value type="UINT" field="new_value" label="New Value" />
|
||||||
|
<value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
|
||||||
|
</event>
|
||||||
|
|
||||||
<event id="LongFlagChanged" path="vm/flag/long_changed" label="Long Flag Changed"
|
<event id="LongFlagChanged" path="vm/flag/long_changed" label="Long Flag Changed"
|
||||||
is_instant="true">
|
is_instant="true">
|
||||||
<value type="UTF8" field="name" label="Name" />
|
<value type="UTF8" field="name" label="Name" />
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. 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
|
||||||
@ -37,6 +37,7 @@
|
|||||||
EventLog* Events::_logs = NULL;
|
EventLog* Events::_logs = NULL;
|
||||||
StringEventLog* Events::_messages = NULL;
|
StringEventLog* Events::_messages = NULL;
|
||||||
StringEventLog* Events::_exceptions = NULL;
|
StringEventLog* Events::_exceptions = NULL;
|
||||||
|
StringEventLog* Events::_redefinitions = NULL;
|
||||||
StringEventLog* Events::_deopt_messages = NULL;
|
StringEventLog* Events::_deopt_messages = NULL;
|
||||||
|
|
||||||
EventLog::EventLog() {
|
EventLog::EventLog() {
|
||||||
@ -66,6 +67,7 @@ void Events::init() {
|
|||||||
if (LogEvents) {
|
if (LogEvents) {
|
||||||
_messages = new StringEventLog("Events");
|
_messages = new StringEventLog("Events");
|
||||||
_exceptions = new StringEventLog("Internal exceptions");
|
_exceptions = new StringEventLog("Internal exceptions");
|
||||||
|
_redefinitions = new StringEventLog("Classes redefined");
|
||||||
_deopt_messages = new StringEventLog("Deoptimization events");
|
_deopt_messages = new StringEventLog("Deoptimization events");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. 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
|
||||||
@ -186,6 +186,9 @@ class Events : AllStatic {
|
|||||||
// Deoptization related messages
|
// Deoptization related messages
|
||||||
static StringEventLog* _deopt_messages;
|
static StringEventLog* _deopt_messages;
|
||||||
|
|
||||||
|
// Redefinition related messages
|
||||||
|
static StringEventLog* _redefinitions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void print_all(outputStream* out);
|
static void print_all(outputStream* out);
|
||||||
|
|
||||||
@ -198,6 +201,8 @@ class Events : AllStatic {
|
|||||||
// Log exception related message
|
// Log exception related message
|
||||||
static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
|
static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
|
||||||
|
|
||||||
|
static void log_redefinition(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
|
||||||
|
|
||||||
static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
|
static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
|
||||||
|
|
||||||
// Register default loggers
|
// Register default loggers
|
||||||
@ -222,6 +227,15 @@ inline void Events::log_exception(Thread* thread, const char* format, ...) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void Events::log_redefinition(Thread* thread, const char* format, ...) {
|
||||||
|
if (LogEvents) {
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
_redefinitions->logv(thread, format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inline void Events::log_deopt_message(Thread* thread, const char* format, ...) {
|
inline void Events::log_deopt_message(Thread* thread, const char* format, ...) {
|
||||||
if (LogEvents) {
|
if (LogEvents) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
71
hotspot/test/compiler/arraycopy/TestLoadBypassArrayCopy.java
Normal file
71
hotspot/test/compiler/arraycopy/TestLoadBypassArrayCopy.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8086046
|
||||||
|
* @summary load bypasses arraycopy that sets the value after the ArrayCopyNode is expanded
|
||||||
|
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestLoadBypassArrayCopy::test_helper -XX:-TieredCompilation TestLoadBypassArrayCopy
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TestLoadBypassArrayCopy {
|
||||||
|
|
||||||
|
static long i;
|
||||||
|
static boolean test_helper() {
|
||||||
|
i++;
|
||||||
|
if ((i%10) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int test(int[] src, int len, boolean flag) {
|
||||||
|
int[] dest = new int[10];
|
||||||
|
int res = 0;
|
||||||
|
while (test_helper()) {
|
||||||
|
System.arraycopy(src, 0, dest, 0, len);
|
||||||
|
// predicate moved out of loop so control of following
|
||||||
|
// load is not the ArrayCopyNode. Otherwise, if the memory
|
||||||
|
// of the load is changed and the control is set to the
|
||||||
|
// ArrayCopyNode the graph is unschedulable and the test
|
||||||
|
// doesn't fail.
|
||||||
|
if (flag) {
|
||||||
|
}
|
||||||
|
// The memory of this load shouldn't bypass the arraycopy
|
||||||
|
res = dest[0];
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void main(String[] args) {
|
||||||
|
int[] src = new int[10];
|
||||||
|
src[0] = 0x42;
|
||||||
|
for (int i = 0; i < 20000; i++) {
|
||||||
|
int res = test(src, 10, false);
|
||||||
|
if (res != src[0]) {
|
||||||
|
throw new RuntimeException("test failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -71,7 +71,7 @@ public class SHAOptionsBase extends CommandLineOptionTest {
|
|||||||
* instructions required by the option are not supported.
|
* instructions required by the option are not supported.
|
||||||
*/
|
*/
|
||||||
protected static String getWarningForUnsupportedCPU(String optionName) {
|
protected static String getWarningForUnsupportedCPU(String optionName) {
|
||||||
if (Platform.isSparc()) {
|
if (Platform.isSparc() || Platform.isAArch64()) {
|
||||||
switch (optionName) {
|
switch (optionName) {
|
||||||
case SHAOptionsBase.USE_SHA_OPTION:
|
case SHAOptionsBase.USE_SHA_OPTION:
|
||||||
return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
|
return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
*/
|
*/
|
||||||
public class TestUseSHA1IntrinsicsOptionOnSupportedCPU {
|
public class TestUseSHA1IntrinsicsOptionOnSupportedCPU {
|
||||||
public static void main(String args[]) throws Throwable {
|
public static void main(String args[]) throws Throwable {
|
||||||
new SHAOptionsBase(new GenericTestCaseForSupportedSparcCPU(
|
new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
|
||||||
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,10 +40,12 @@ public class TestUseSHA1IntrinsicsOptionOnUnsupportedCPU {
|
|||||||
new SHAOptionsBase(
|
new SHAOptionsBase(
|
||||||
new GenericTestCaseForUnsupportedSparcCPU(
|
new GenericTestCaseForUnsupportedSparcCPU(
|
||||||
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
||||||
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
|
|
||||||
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
|
||||||
new GenericTestCaseForUnsupportedX86CPU(
|
new GenericTestCaseForUnsupportedX86CPU(
|
||||||
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
||||||
|
new GenericTestCaseForUnsupportedAArch64CPU(
|
||||||
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
||||||
|
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
|
||||||
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
||||||
new GenericTestCaseForOtherCPU(
|
new GenericTestCaseForOtherCPU(
|
||||||
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
public class TestUseSHA256IntrinsicsOptionOnSupportedCPU {
|
public class TestUseSHA256IntrinsicsOptionOnSupportedCPU {
|
||||||
public static void main(String args[]) throws Throwable {
|
public static void main(String args[]) throws Throwable {
|
||||||
new SHAOptionsBase(new GenericTestCaseForSupportedSparcCPU(
|
new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
|
||||||
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,10 +40,12 @@ public class TestUseSHA256IntrinsicsOptionOnUnsupportedCPU {
|
|||||||
new SHAOptionsBase(
|
new SHAOptionsBase(
|
||||||
new GenericTestCaseForUnsupportedSparcCPU(
|
new GenericTestCaseForUnsupportedSparcCPU(
|
||||||
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
||||||
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
|
|
||||||
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
|
||||||
new GenericTestCaseForUnsupportedX86CPU(
|
new GenericTestCaseForUnsupportedX86CPU(
|
||||||
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
||||||
|
new GenericTestCaseForUnsupportedAArch64CPU(
|
||||||
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
||||||
|
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
|
||||||
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
||||||
new GenericTestCaseForOtherCPU(
|
new GenericTestCaseForOtherCPU(
|
||||||
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
public class TestUseSHA512IntrinsicsOptionOnSupportedCPU {
|
public class TestUseSHA512IntrinsicsOptionOnSupportedCPU {
|
||||||
public static void main(String args[]) throws Throwable {
|
public static void main(String args[]) throws Throwable {
|
||||||
new SHAOptionsBase(new GenericTestCaseForSupportedSparcCPU(
|
new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
|
||||||
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,10 +40,12 @@ public class TestUseSHA512IntrinsicsOptionOnUnsupportedCPU {
|
|||||||
new SHAOptionsBase(
|
new SHAOptionsBase(
|
||||||
new GenericTestCaseForUnsupportedSparcCPU(
|
new GenericTestCaseForUnsupportedSparcCPU(
|
||||||
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
||||||
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
|
|
||||||
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
|
||||||
new GenericTestCaseForUnsupportedX86CPU(
|
new GenericTestCaseForUnsupportedX86CPU(
|
||||||
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
||||||
|
new GenericTestCaseForUnsupportedAArch64CPU(
|
||||||
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
||||||
|
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
|
||||||
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
||||||
new GenericTestCaseForOtherCPU(
|
new GenericTestCaseForOtherCPU(
|
||||||
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,9 @@
|
|||||||
public class TestUseSHAOptionOnSupportedCPU {
|
public class TestUseSHAOptionOnSupportedCPU {
|
||||||
public static void main(String args[]) throws Throwable {
|
public static void main(String args[]) throws Throwable {
|
||||||
new SHAOptionsBase(
|
new SHAOptionsBase(
|
||||||
new GenericTestCaseForSupportedSparcCPU(
|
new GenericTestCaseForSupportedCPU(
|
||||||
SHAOptionsBase.USE_SHA_OPTION),
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
new UseSHASpecificTestCaseForSupportedSparcCPU(
|
new UseSHASpecificTestCaseForSupportedCPU(
|
||||||
SHAOptionsBase.USE_SHA_OPTION)).test();
|
SHAOptionsBase.USE_SHA_OPTION)).test();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,10 +39,12 @@ public class TestUseSHAOptionOnUnsupportedCPU {
|
|||||||
new SHAOptionsBase(
|
new SHAOptionsBase(
|
||||||
new GenericTestCaseForUnsupportedSparcCPU(
|
new GenericTestCaseForUnsupportedSparcCPU(
|
||||||
SHAOptionsBase.USE_SHA_OPTION),
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
new UseSHASpecificTestCaseForUnsupportedSparcCPU(
|
|
||||||
SHAOptionsBase.USE_SHA_OPTION),
|
|
||||||
new GenericTestCaseForUnsupportedX86CPU(
|
new GenericTestCaseForUnsupportedX86CPU(
|
||||||
SHAOptionsBase.USE_SHA_OPTION),
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
|
new GenericTestCaseForUnsupportedAArch64CPU(
|
||||||
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
|
new UseSHASpecificTestCaseForUnsupportedCPU(
|
||||||
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
new GenericTestCaseForOtherCPU(
|
new GenericTestCaseForOtherCPU(
|
||||||
SHAOptionsBase.USE_SHA_OPTION)).test();
|
SHAOptionsBase.USE_SHA_OPTION)).test();
|
||||||
}
|
}
|
||||||
|
@ -35,16 +35,18 @@ public class GenericTestCaseForOtherCPU extends
|
|||||||
SHAOptionsBase.TestCase {
|
SHAOptionsBase.TestCase {
|
||||||
public GenericTestCaseForOtherCPU(String optionName) {
|
public GenericTestCaseForOtherCPU(String optionName) {
|
||||||
// Execute the test case on any CPU except SPARC and X86
|
// Execute the test case on any CPU except SPARC and X86
|
||||||
super(optionName, new NotPredicate(new OrPredicate(Platform::isSparc,
|
super(optionName, new NotPredicate(
|
||||||
new OrPredicate(Platform::isX64, Platform::isX86))));
|
new OrPredicate(
|
||||||
|
new OrPredicate(Platform::isSparc, Platform::isAArch64),
|
||||||
|
new OrPredicate(Platform::isX64, Platform::isX86))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void verifyWarnings() throws Throwable {
|
protected void verifyWarnings() throws Throwable {
|
||||||
String shouldPassMessage = String.format("JVM should start with "
|
String shouldPassMessage = String.format("JVM should start with "
|
||||||
+ "option '%s' without any warnings", optionName);
|
+ "option '%s' without any warnings", optionName);
|
||||||
// Verify that on non-x86 and non-SPARC CPU usage of SHA-related
|
// Verify that on non-x86, non-SPARC and non-AArch64 CPU usage of
|
||||||
// options will not cause any warnings.
|
// SHA-related options will not cause any warnings.
|
||||||
CommandLineOptionTest.verifySameJVMStartup(null,
|
CommandLineOptionTest.verifySameJVMStartup(null,
|
||||||
new String[] { ".*" + optionName + ".*" }, shouldPassMessage,
|
new String[] { ".*" + optionName + ".*" }, shouldPassMessage,
|
||||||
shouldPassMessage, ExitCode.OK,
|
shouldPassMessage, ExitCode.OK,
|
||||||
|
@ -25,16 +25,19 @@ import jdk.test.lib.ExitCode;
|
|||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||||
import jdk.test.lib.cli.predicate.AndPredicate;
|
import jdk.test.lib.cli.predicate.AndPredicate;
|
||||||
|
import jdk.test.lib.cli.predicate.OrPredicate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic test case for SHA-related options targeted to SPARC CPUs which
|
* Generic test case for SHA-related options targeted to CPUs which
|
||||||
* support instructions required by the tested option.
|
* support instructions required by the tested option.
|
||||||
*/
|
*/
|
||||||
public class GenericTestCaseForSupportedSparcCPU extends
|
public class GenericTestCaseForSupportedCPU extends
|
||||||
SHAOptionsBase.TestCase {
|
SHAOptionsBase.TestCase {
|
||||||
public GenericTestCaseForSupportedSparcCPU(String optionName) {
|
public GenericTestCaseForSupportedCPU(String optionName) {
|
||||||
super(optionName, new AndPredicate(Platform::isSparc,
|
super(optionName,
|
||||||
SHAOptionsBase.getPredicateForOption(optionName)));
|
new AndPredicate(
|
||||||
|
new OrPredicate(Platform::isSparc, Platform::isAArch64),
|
||||||
|
SHAOptionsBase.getPredicateForOption(optionName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import jdk.test.lib.ExitCode;
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
|
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||||
|
import jdk.test.lib.cli.predicate.AndPredicate;
|
||||||
|
import jdk.test.lib.cli.predicate.NotPredicate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic test case for SHA-related options targeted to AArch64 CPUs
|
||||||
|
* which don't support instruction required by the tested option.
|
||||||
|
*/
|
||||||
|
public class GenericTestCaseForUnsupportedAArch64CPU extends
|
||||||
|
SHAOptionsBase.TestCase {
|
||||||
|
public GenericTestCaseForUnsupportedAArch64CPU(String optionName) {
|
||||||
|
super(optionName, new AndPredicate(Platform::isAArch64,
|
||||||
|
new NotPredicate(SHAOptionsBase.getPredicateForOption(
|
||||||
|
optionName))));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void verifyWarnings() throws Throwable {
|
||||||
|
String shouldPassMessage = String.format("JVM startup should pass with"
|
||||||
|
+ "option '-XX:-%s' without any warnings", optionName);
|
||||||
|
//Verify that option could be disabled without any warnings.
|
||||||
|
CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
|
||||||
|
SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
|
||||||
|
}, shouldPassMessage, shouldPassMessage, ExitCode.OK,
|
||||||
|
CommandLineOptionTest.prepareBooleanFlag(optionName, false));
|
||||||
|
|
||||||
|
shouldPassMessage = String.format("JVM should start with '-XX:+"
|
||||||
|
+ "%s' flag, but output should contain warning.", optionName);
|
||||||
|
// Verify that when the tested option is explicitly enabled, then
|
||||||
|
// a warning will occur in VM output.
|
||||||
|
CommandLineOptionTest.verifySameJVMStartup(new String[] {
|
||||||
|
SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
|
||||||
|
}, null, shouldPassMessage, shouldPassMessage, ExitCode.OK,
|
||||||
|
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void verifyOptionValues() throws Throwable {
|
||||||
|
// Verify that option is disabled by default.
|
||||||
|
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
|
||||||
|
String.format("Option '%s' should be disabled by default",
|
||||||
|
optionName));
|
||||||
|
|
||||||
|
// Verify that option is disabled even if it was explicitly enabled
|
||||||
|
// using CLI options.
|
||||||
|
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
|
||||||
|
String.format("Option '%s' should be off on unsupported "
|
||||||
|
+ "AArch64CPU even if set to true directly", optionName),
|
||||||
|
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
|
||||||
|
|
||||||
|
// Verify that option is disabled when +UseSHA was passed to JVM.
|
||||||
|
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
|
||||||
|
String.format("Option '%s' should be off on unsupported "
|
||||||
|
+ "AArch64CPU even if %s flag set to JVM",
|
||||||
|
optionName, CommandLineOptionTest.prepareBooleanFlag(
|
||||||
|
SHAOptionsBase.USE_SHA_OPTION, true)),
|
||||||
|
CommandLineOptionTest.prepareBooleanFlag(
|
||||||
|
SHAOptionsBase.USE_SHA_OPTION, true));
|
||||||
|
}
|
||||||
|
}
|
@ -25,24 +25,26 @@ import jdk.test.lib.ExitCode;
|
|||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||||
import jdk.test.lib.cli.predicate.AndPredicate;
|
import jdk.test.lib.cli.predicate.AndPredicate;
|
||||||
|
import jdk.test.lib.cli.predicate.OrPredicate;
|
||||||
import jdk.test.lib.cli.predicate.NotPredicate;
|
import jdk.test.lib.cli.predicate.NotPredicate;
|
||||||
import sha.predicate.IntrinsicPredicates;
|
import sha.predicate.IntrinsicPredicates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test case specific to UseSHA*Intrinsics options targeted to SPARC CPUs which
|
* Test case specific to UseSHA*Intrinsics options targeted to SPARC and AArch64
|
||||||
* don't support required instruction, but support other SHA-related
|
* CPUs which don't support required instruction, but support other SHA-related
|
||||||
* instructions.
|
* instructions.
|
||||||
*
|
*
|
||||||
* For example, CPU support sha1 instruction, but don't support sha256 or
|
* For example, CPU support sha1 instruction, but don't support sha256 or
|
||||||
* sha512.
|
* sha512.
|
||||||
*/
|
*/
|
||||||
public class UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU
|
public class UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU
|
||||||
extends SHAOptionsBase.TestCase {
|
extends SHAOptionsBase.TestCase {
|
||||||
public UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
|
public UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
|
||||||
String optionName) {
|
String optionName) {
|
||||||
// execute test case on SPARC CPU that support any sha* instructions,
|
// execute test case on SPARC CPU that support any sha* instructions,
|
||||||
// but does not support sha* instruction required by the tested option.
|
// but does not support sha* instruction required by the tested option.
|
||||||
super(optionName, new AndPredicate(Platform::isSparc,
|
super(optionName, new AndPredicate(
|
||||||
|
new OrPredicate(Platform::isSparc, Platform::isAArch64),
|
||||||
new AndPredicate(
|
new AndPredicate(
|
||||||
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE,
|
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE,
|
||||||
new NotPredicate(SHAOptionsBase.getPredicateForOption(
|
new NotPredicate(SHAOptionsBase.getPredicateForOption(
|
@ -26,16 +26,18 @@ import jdk.test.lib.ExitCode;
|
|||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||||
import jdk.test.lib.cli.predicate.AndPredicate;
|
import jdk.test.lib.cli.predicate.AndPredicate;
|
||||||
|
import jdk.test.lib.cli.predicate.OrPredicate;
|
||||||
import sha.predicate.IntrinsicPredicates;
|
import sha.predicate.IntrinsicPredicates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UseSHA specific test case targeted to SPARC CPUs which support any sha*
|
* UseSHA specific test case targeted to SPARC and AArch64 CPUs which
|
||||||
* instruction.
|
* support any sha* instruction.
|
||||||
*/
|
*/
|
||||||
public class UseSHASpecificTestCaseForSupportedSparcCPU
|
public class UseSHASpecificTestCaseForSupportedCPU
|
||||||
extends SHAOptionsBase.TestCase {
|
extends SHAOptionsBase.TestCase {
|
||||||
public UseSHASpecificTestCaseForSupportedSparcCPU(String optionName) {
|
public UseSHASpecificTestCaseForSupportedCPU(String optionName) {
|
||||||
super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(Platform::isSparc,
|
super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(
|
||||||
|
new OrPredicate(Platform::isSparc, Platform::isAArch64),
|
||||||
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE));
|
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE));
|
||||||
|
|
||||||
Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION,
|
Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION,
|
@ -26,17 +26,19 @@ import jdk.test.lib.ExitCode;
|
|||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||||
import jdk.test.lib.cli.predicate.AndPredicate;
|
import jdk.test.lib.cli.predicate.AndPredicate;
|
||||||
|
import jdk.test.lib.cli.predicate.OrPredicate;
|
||||||
import jdk.test.lib.cli.predicate.NotPredicate;
|
import jdk.test.lib.cli.predicate.NotPredicate;
|
||||||
import sha.predicate.IntrinsicPredicates;
|
import sha.predicate.IntrinsicPredicates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UseSHA specific test case targeted to SPARC CPUs which don't support all sha*
|
* UseSHA specific test case targeted to SPARC and AArch64 CPUs which don't
|
||||||
* instructions.
|
* support all sha* instructions./
|
||||||
*/
|
*/
|
||||||
public class UseSHASpecificTestCaseForUnsupportedSparcCPU
|
public class UseSHASpecificTestCaseForUnsupportedCPU
|
||||||
extends SHAOptionsBase.TestCase {
|
extends SHAOptionsBase.TestCase {
|
||||||
public UseSHASpecificTestCaseForUnsupportedSparcCPU(String optionName) {
|
public UseSHASpecificTestCaseForUnsupportedCPU(String optionName) {
|
||||||
super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(Platform::isSparc,
|
super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(
|
||||||
|
new OrPredicate(Platform::isSparc, Platform::isAArch64),
|
||||||
new NotPredicate(
|
new NotPredicate(
|
||||||
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE)));
|
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE)));
|
||||||
|
|
||||||
@ -49,7 +51,7 @@ public class UseSHASpecificTestCaseForUnsupportedSparcCPU
|
|||||||
protected void verifyWarnings() throws Throwable {
|
protected void verifyWarnings() throws Throwable {
|
||||||
// Verify that attempt to use UseSHA option will cause a warning.
|
// Verify that attempt to use UseSHA option will cause a warning.
|
||||||
String shouldPassMessage = String.format("JVM startup should pass with"
|
String shouldPassMessage = String.format("JVM startup should pass with"
|
||||||
+ " '%s' option on unsupported SparcCPU, but there should be"
|
+ " '%s' option on unsupported CPU, but there should be"
|
||||||
+ "the message shown.", optionName);
|
+ "the message shown.", optionName);
|
||||||
CommandLineOptionTest.verifySameJVMStartup(new String[] {
|
CommandLineOptionTest.verifySameJVMStartup(new String[] {
|
||||||
SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
|
SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
|
||||||
@ -63,7 +65,7 @@ public class UseSHASpecificTestCaseForUnsupportedSparcCPU
|
|||||||
// UseSHA*Intrinsics were enabled.
|
// UseSHA*Intrinsics were enabled.
|
||||||
CommandLineOptionTest.verifyOptionValueForSameVM(
|
CommandLineOptionTest.verifyOptionValueForSameVM(
|
||||||
SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
|
SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
|
||||||
"%s option should be disabled on unsupported SparcCPU"
|
"%s option should be disabled on unsupported CPU"
|
||||||
+ " even if all UseSHA*Intrinsics options were enabled.",
|
+ " even if all UseSHA*Intrinsics options were enabled.",
|
||||||
SHAOptionsBase.USE_SHA_OPTION),
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
CommandLineOptionTest.prepareBooleanFlag(
|
CommandLineOptionTest.prepareBooleanFlag(
|
||||||
@ -77,7 +79,7 @@ public class UseSHASpecificTestCaseForUnsupportedSparcCPU
|
|||||||
// UseSHA*Intrinsics options were enabled and UseSHA was enabled as well.
|
// UseSHA*Intrinsics options were enabled and UseSHA was enabled as well.
|
||||||
CommandLineOptionTest.verifyOptionValueForSameVM(
|
CommandLineOptionTest.verifyOptionValueForSameVM(
|
||||||
SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
|
SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
|
||||||
"%s option should be disabled on unsupported SparcCPU"
|
"%s option should be disabled on unsupported CPU"
|
||||||
+ " even if all UseSHA*Intrinsics options were enabled"
|
+ " even if all UseSHA*Intrinsics options were enabled"
|
||||||
+ " and %s was enabled as well",
|
+ " and %s was enabled as well",
|
||||||
SHAOptionsBase.USE_SHA_OPTION,
|
SHAOptionsBase.USE_SHA_OPTION,
|
109
hotspot/test/compiler/jsr292/PollutedTrapCounts.java
Normal file
109
hotspot/test/compiler/jsr292/PollutedTrapCounts.java
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @bug 8074551
|
||||||
|
* @library /testlibrary
|
||||||
|
* @run main PollutedTrapCounts
|
||||||
|
*/
|
||||||
|
import java.lang.invoke.*;
|
||||||
|
import jdk.test.lib.*;
|
||||||
|
|
||||||
|
public class PollutedTrapCounts {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||||
|
"-XX:+IgnoreUnrecognizedVMOptions",
|
||||||
|
"-XX:-TieredCompilation", "-Xbatch",
|
||||||
|
"-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
|
||||||
|
"-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
|
||||||
|
"PollutedTrapCounts$Test");
|
||||||
|
|
||||||
|
OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
|
||||||
|
|
||||||
|
analyzer.shouldHaveExitValue(0);
|
||||||
|
|
||||||
|
analyzer.shouldNotContain("not compilable (disabled)");
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Test {
|
||||||
|
public static final MethodHandle test1;
|
||||||
|
public static final MethodHandle test2;
|
||||||
|
public static final MethodHandle empty;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
Class<?> THIS_CLASS = Test.class;
|
||||||
|
MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
|
||||||
|
test1 = LOOKUP.findStatic(THIS_CLASS, "test1", MethodType.methodType(boolean.class, boolean.class));
|
||||||
|
test2 = LOOKUP.findStatic(THIS_CLASS, "test2", MethodType.methodType(boolean.class, boolean.class));
|
||||||
|
empty = LOOKUP.findStatic(THIS_CLASS, "empty", MethodType.methodType(void.class, boolean.class));
|
||||||
|
} catch(Throwable e) {
|
||||||
|
throw new Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean test1(boolean b) {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
static boolean test2(boolean b) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
static void empty(boolean b) {}
|
||||||
|
|
||||||
|
static void test(boolean freqValue, boolean removeInlineBlocker) throws Throwable {
|
||||||
|
MethodHandle innerGWT = MethodHandles.guardWithTest(test1, empty, empty);
|
||||||
|
MethodHandle outerGWT = MethodHandles.guardWithTest(test2, innerGWT, innerGWT);
|
||||||
|
|
||||||
|
// Trigger compilation
|
||||||
|
for (int i = 0; i < 20_000; i++) {
|
||||||
|
outerGWT.invokeExact(freqValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trigger deopt & nmethod invalidation
|
||||||
|
outerGWT.invokeExact(!freqValue);
|
||||||
|
|
||||||
|
// Force inline blocker removal on rare-taken path
|
||||||
|
if (removeInlineBlocker) {
|
||||||
|
for (int i = 0; i < 100; i++) {
|
||||||
|
outerGWT.invokeExact(!freqValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trigger recompilation
|
||||||
|
for (int i = 0; i < 20_000; i++) {
|
||||||
|
outerGWT.invokeExact(freqValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
boolean freqValue = true;
|
||||||
|
boolean removeInlineBlocker = false;
|
||||||
|
for (int i = 0; i < 20; i++) {
|
||||||
|
test(freqValue, removeInlineBlocker);
|
||||||
|
freqValue = !freqValue;
|
||||||
|
removeInlineBlocker = !removeInlineBlocker;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -59,16 +59,19 @@ public class IntrinsicPredicates {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public static final BooleanSupplier SHA1_INSTRUCTION_AVAILABLE
|
public static final BooleanSupplier SHA1_INSTRUCTION_AVAILABLE
|
||||||
= new CPUSpecificPredicate("sparc.*", new String[] { "sha1" },
|
= new OrPredicate(
|
||||||
null);
|
new CPUSpecificPredicate("sparc.*", new String[] { "sha1" },null),
|
||||||
|
new CPUSpecificPredicate("aarch64.*", new String[] { "sha1" },null));
|
||||||
|
|
||||||
public static final BooleanSupplier SHA256_INSTRUCTION_AVAILABLE
|
public static final BooleanSupplier SHA256_INSTRUCTION_AVAILABLE
|
||||||
= new CPUSpecificPredicate("sparc.*", new String[] { "sha256" },
|
= new OrPredicate(
|
||||||
null);
|
new CPUSpecificPredicate("sparc.*", new String[] { "sha256" },null),
|
||||||
|
new CPUSpecificPredicate("aarch64.*", new String[] { "sha256" },null));
|
||||||
|
|
||||||
public static final BooleanSupplier SHA512_INSTRUCTION_AVAILABLE
|
public static final BooleanSupplier SHA512_INSTRUCTION_AVAILABLE
|
||||||
= new CPUSpecificPredicate("sparc.*", new String[] { "sha512" },
|
= new OrPredicate(
|
||||||
null);
|
new CPUSpecificPredicate("sparc.*", new String[] { "sha512" },null),
|
||||||
|
new CPUSpecificPredicate("aarch64.*", new String[] { "sha512" },null));
|
||||||
|
|
||||||
public static final BooleanSupplier ANY_SHA_INSTRUCTION_AVAILABLE
|
public static final BooleanSupplier ANY_SHA_INSTRUCTION_AVAILABLE
|
||||||
= new OrPredicate(IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE,
|
= new OrPredicate(IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE,
|
||||||
|
@ -32,11 +32,15 @@
|
|||||||
* @run driver RandomGeneratorTest DIFFERENT_SEED
|
* @run driver RandomGeneratorTest DIFFERENT_SEED
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import jdk.test.lib.ProcessTools;
|
import java.io.FileWriter;
|
||||||
import jdk.test.lib.Utils;
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import jdk.test.lib.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.ProcessTools;
|
||||||
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The test verifies correctness of work {@link jdk.test.lib.Utils#getRandomInstance()}.
|
* The test verifies correctness of work {@link jdk.test.lib.Utils#getRandomInstance()}.
|
||||||
@ -59,8 +63,13 @@ public class RandomGeneratorTest {
|
|||||||
jvmArgs.add(optStr);
|
jvmArgs.add(optStr);
|
||||||
}
|
}
|
||||||
jvmArgs.add(RandomRunner.class.getName());
|
jvmArgs.add(RandomRunner.class.getName());
|
||||||
|
String origFileName = seedOpt.name() + "_orig";
|
||||||
|
jvmArgs.add(origFileName);
|
||||||
|
int fileNameIndex = jvmArgs.size() - 1;
|
||||||
String[] cmdLineArgs = jvmArgs.toArray(new String[jvmArgs.size()]);
|
String[] cmdLineArgs = jvmArgs.toArray(new String[jvmArgs.size()]);
|
||||||
String etalon = ProcessTools.executeTestJvm(cmdLineArgs).getStdout().trim();
|
ProcessTools.executeTestJvm(cmdLineArgs).shouldHaveExitValue(0);
|
||||||
|
String etalon = Utils.fileAsString(origFileName).trim();
|
||||||
|
cmdLineArgs[fileNameIndex] = seedOpt.name();
|
||||||
seedOpt.verify(etalon, cmdLineArgs);
|
seedOpt.verify(etalon, cmdLineArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,26 +130,31 @@ public class RandomGeneratorTest {
|
|||||||
* @throws Throwable - Throws an exception in case test failure.
|
* @throws Throwable - Throws an exception in case test failure.
|
||||||
*/
|
*/
|
||||||
public void verify(String orig, String[] cmdLine) {
|
public void verify(String orig, String[] cmdLine) {
|
||||||
String lastLineOrig = getLastLine(orig);
|
String output;
|
||||||
String lastLine;
|
OutputAnalyzer oa;
|
||||||
try {
|
try {
|
||||||
lastLine = getLastLine(ProcessTools.executeTestJvm(cmdLine).getStdout().trim());
|
oa = ProcessTools.executeTestJvm(cmdLine);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
throw new Error("TESTBUG: Unexpedted exception during jvm execution.", t);
|
throw new Error("TESTBUG: Unexpedted exception during jvm execution.", t);
|
||||||
}
|
}
|
||||||
if (!isOutputExpected(lastLineOrig, lastLine)) {
|
oa.shouldHaveExitValue(0);
|
||||||
throw new AssertionError("Unexpected random number sequence for mode: " + this.name());
|
try {
|
||||||
|
output = Utils.fileAsString(name()).trim();
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
throw new Error("TESTBUG: Problem during IO operation with file: " + name(), ioe);
|
||||||
|
}
|
||||||
|
if (!isOutputExpected(orig, output)) {
|
||||||
|
System.err.println("Initial output: " + orig);
|
||||||
|
System.err.println("Second run output: " + output);
|
||||||
|
throw new AssertionError("Unexpected random number sequence for mode: " + this.name());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static String getLastLine(String output) {
|
|
||||||
return output.substring(output.lastIndexOf(Utils.NEW_LINE)).trim();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The helper class generates several random numbers
|
* The helper class generates several random numbers
|
||||||
* and prints them out.
|
* and put results to a file. The file name came as first
|
||||||
|
* command line argument.
|
||||||
*/
|
*/
|
||||||
public static class RandomRunner {
|
public static class RandomRunner {
|
||||||
private static final int COUNT = 10;
|
private static final int COUNT = 10;
|
||||||
@ -150,7 +164,11 @@ public class RandomGeneratorTest {
|
|||||||
for (int i = 0; i < COUNT; i++) {
|
for (int i = 0; i < COUNT; i++) {
|
||||||
sb.append(rng.nextLong()).append(' ');
|
sb.append(rng.nextLong()).append(' ');
|
||||||
}
|
}
|
||||||
System.out.println(sb.toString());
|
try (PrintWriter pw = new PrintWriter(new FileWriter(args[0]))) {
|
||||||
|
pw.write(sb.toString());
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
throw new Error("TESTBUG: Problem during IO operation with file: " + args[0], ioe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user