mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
Merge
This commit is contained in:
commit
7d92dc4d79
32 changed files with 1002 additions and 606 deletions
|
@ -3369,8 +3369,8 @@ operand immI16() %{
|
||||||
interface(CONST_INTER);
|
interface(CONST_INTER);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// Unsigned (positive) Integer Immediate: 13-bit
|
// Unsigned Integer Immediate: 12-bit (non-negative that fits in simm13)
|
||||||
operand immU13() %{
|
operand immU12() %{
|
||||||
predicate((0 <= n->get_int()) && Assembler::is_simm13(n->get_int()));
|
predicate((0 <= n->get_int()) && Assembler::is_simm13(n->get_int()));
|
||||||
match(ConI);
|
match(ConI);
|
||||||
op_cost(0);
|
op_cost(0);
|
||||||
|
@ -3406,6 +3406,17 @@ operand immI5() %{
|
||||||
interface(CONST_INTER);
|
interface(CONST_INTER);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
// Int Immediate non-negative
|
||||||
|
operand immU31()
|
||||||
|
%{
|
||||||
|
predicate(n->get_int() >= 0);
|
||||||
|
match(ConI);
|
||||||
|
|
||||||
|
op_cost(0);
|
||||||
|
format %{ %}
|
||||||
|
interface(CONST_INTER);
|
||||||
|
%}
|
||||||
|
|
||||||
// Integer Immediate: 0-bit
|
// Integer Immediate: 0-bit
|
||||||
operand immI0() %{
|
operand immI0() %{
|
||||||
predicate(n->get_int() == 0);
|
predicate(n->get_int() == 0);
|
||||||
|
@ -5734,7 +5745,6 @@ instruct loadUS2L_immI16(iRegL dst, memory mem, immI16 mask, iRegL tmp) %{
|
||||||
effect(TEMP dst, TEMP tmp);
|
effect(TEMP dst, TEMP tmp);
|
||||||
ins_cost(MEMORY_REF_COST + 2*DEFAULT_COST);
|
ins_cost(MEMORY_REF_COST + 2*DEFAULT_COST);
|
||||||
|
|
||||||
size((3+1)*4); // set may use two instructions.
|
|
||||||
format %{ "LDUH $mem,$dst\t! ushort/char & 16-bit mask -> long\n\t"
|
format %{ "LDUH $mem,$dst\t! ushort/char & 16-bit mask -> long\n\t"
|
||||||
"SET $mask,$tmp\n\t"
|
"SET $mask,$tmp\n\t"
|
||||||
"AND $dst,$tmp,$dst" %}
|
"AND $dst,$tmp,$dst" %}
|
||||||
|
@ -5856,13 +5866,13 @@ instruct loadI2L_immI_65535(iRegL dst, indOffset13m7 mem, immI_65535 mask) %{
|
||||||
ins_pipe(iload_mem);
|
ins_pipe(iload_mem);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// Load Integer with a 13-bit mask into a Long Register
|
// Load Integer with a 12-bit mask into a Long Register
|
||||||
instruct loadI2L_immI13(iRegL dst, memory mem, immI13 mask) %{
|
instruct loadI2L_immU12(iRegL dst, memory mem, immU12 mask) %{
|
||||||
match(Set dst (ConvI2L (AndI (LoadI mem) mask)));
|
match(Set dst (ConvI2L (AndI (LoadI mem) mask)));
|
||||||
ins_cost(MEMORY_REF_COST + DEFAULT_COST);
|
ins_cost(MEMORY_REF_COST + DEFAULT_COST);
|
||||||
|
|
||||||
size(2*4);
|
size(2*4);
|
||||||
format %{ "LDUW $mem,$dst\t! int & 13-bit mask -> long\n\t"
|
format %{ "LDUW $mem,$dst\t! int & 12-bit mask -> long\n\t"
|
||||||
"AND $dst,$mask,$dst" %}
|
"AND $dst,$mask,$dst" %}
|
||||||
ins_encode %{
|
ins_encode %{
|
||||||
Register Rdst = $dst$$Register;
|
Register Rdst = $dst$$Register;
|
||||||
|
@ -5872,14 +5882,13 @@ instruct loadI2L_immI13(iRegL dst, memory mem, immI13 mask) %{
|
||||||
ins_pipe(iload_mem);
|
ins_pipe(iload_mem);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// Load Integer with a 32-bit mask into a Long Register
|
// Load Integer with a 31-bit mask into a Long Register
|
||||||
instruct loadI2L_immI(iRegL dst, memory mem, immI mask, iRegL tmp) %{
|
instruct loadI2L_immU31(iRegL dst, memory mem, immU31 mask, iRegL tmp) %{
|
||||||
match(Set dst (ConvI2L (AndI (LoadI mem) mask)));
|
match(Set dst (ConvI2L (AndI (LoadI mem) mask)));
|
||||||
effect(TEMP dst, TEMP tmp);
|
effect(TEMP dst, TEMP tmp);
|
||||||
ins_cost(MEMORY_REF_COST + 2*DEFAULT_COST);
|
ins_cost(MEMORY_REF_COST + 2*DEFAULT_COST);
|
||||||
|
|
||||||
size((3+1)*4); // set may use two instructions.
|
format %{ "LDUW $mem,$dst\t! int & 31-bit mask -> long\n\t"
|
||||||
format %{ "LDUW $mem,$dst\t! int & 32-bit mask -> long\n\t"
|
|
||||||
"SET $mask,$tmp\n\t"
|
"SET $mask,$tmp\n\t"
|
||||||
"AND $dst,$tmp,$dst" %}
|
"AND $dst,$tmp,$dst" %}
|
||||||
ins_encode %{
|
ins_encode %{
|
||||||
|
@ -8976,7 +8985,7 @@ instruct testL_reg_con(flagsRegL xcc, iRegL op1, immL13 con, immL0 zero) %{
|
||||||
ins_pipe(ialu_cconly_reg_reg);
|
ins_pipe(ialu_cconly_reg_reg);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
instruct compU_iReg_imm13(flagsRegU icc, iRegI op1, immU13 op2 ) %{
|
instruct compU_iReg_imm13(flagsRegU icc, iRegI op1, immU12 op2 ) %{
|
||||||
match(Set icc (CmpU op1 op2));
|
match(Set icc (CmpU op1 op2));
|
||||||
|
|
||||||
size(4);
|
size(4);
|
||||||
|
|
|
@ -3897,6 +3897,17 @@ operand immI16() %{
|
||||||
interface(CONST_INTER);
|
interface(CONST_INTER);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
// Int Immediate non-negative
|
||||||
|
operand immU31()
|
||||||
|
%{
|
||||||
|
predicate(n->get_int() >= 0);
|
||||||
|
match(ConI);
|
||||||
|
|
||||||
|
op_cost(0);
|
||||||
|
format %{ %}
|
||||||
|
interface(CONST_INTER);
|
||||||
|
%}
|
||||||
|
|
||||||
// Constant for long shifts
|
// Constant for long shifts
|
||||||
operand immI_32() %{
|
operand immI_32() %{
|
||||||
predicate( n->get_int() == 32 );
|
predicate( n->get_int() == 32 );
|
||||||
|
@ -6127,12 +6138,12 @@ instruct loadI2L_immI_65535(eRegL dst, memory mem, immI_65535 mask, eFlagsReg cr
|
||||||
ins_pipe(ialu_reg_mem);
|
ins_pipe(ialu_reg_mem);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// Load Integer with 32-bit mask into Long Register
|
// Load Integer with 31-bit mask into Long Register
|
||||||
instruct loadI2L_immI(eRegL dst, memory mem, immI mask, eFlagsReg cr) %{
|
instruct loadI2L_immU31(eRegL dst, memory mem, immU31 mask, eFlagsReg cr) %{
|
||||||
match(Set dst (ConvI2L (AndI (LoadI mem) mask)));
|
match(Set dst (ConvI2L (AndI (LoadI mem) mask)));
|
||||||
effect(KILL cr);
|
effect(KILL cr);
|
||||||
|
|
||||||
format %{ "MOV $dst.lo,$mem\t# int & 32-bit mask -> long\n\t"
|
format %{ "MOV $dst.lo,$mem\t# int & 31-bit mask -> long\n\t"
|
||||||
"XOR $dst.hi,$dst.hi\n\t"
|
"XOR $dst.hi,$dst.hi\n\t"
|
||||||
"AND $dst.lo,$mask" %}
|
"AND $dst.lo,$mask" %}
|
||||||
ins_encode %{
|
ins_encode %{
|
||||||
|
|
|
@ -3094,6 +3094,17 @@ operand immI16()
|
||||||
interface(CONST_INTER);
|
interface(CONST_INTER);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
// Int Immediate non-negative
|
||||||
|
operand immU31()
|
||||||
|
%{
|
||||||
|
predicate(n->get_int() >= 0);
|
||||||
|
match(ConI);
|
||||||
|
|
||||||
|
op_cost(0);
|
||||||
|
format %{ %}
|
||||||
|
interface(CONST_INTER);
|
||||||
|
%}
|
||||||
|
|
||||||
// Constant for long shifts
|
// Constant for long shifts
|
||||||
operand immI_32()
|
operand immI_32()
|
||||||
%{
|
%{
|
||||||
|
@ -5050,12 +5061,12 @@ instruct loadI2L_immI_65535(rRegL dst, memory mem, immI_65535 mask) %{
|
||||||
ins_pipe(ialu_reg_mem);
|
ins_pipe(ialu_reg_mem);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// Load Integer with a 32-bit mask into Long Register
|
// Load Integer with a 31-bit mask into Long Register
|
||||||
instruct loadI2L_immI(rRegL dst, memory mem, immI mask, rFlagsReg cr) %{
|
instruct loadI2L_immU31(rRegL dst, memory mem, immU31 mask, rFlagsReg cr) %{
|
||||||
match(Set dst (ConvI2L (AndI (LoadI mem) mask)));
|
match(Set dst (ConvI2L (AndI (LoadI mem) mask)));
|
||||||
effect(KILL cr);
|
effect(KILL cr);
|
||||||
|
|
||||||
format %{ "movl $dst, $mem\t# int & 32-bit mask -> long\n\t"
|
format %{ "movl $dst, $mem\t# int & 31-bit mask -> long\n\t"
|
||||||
"andl $dst, $mask" %}
|
"andl $dst, $mask" %}
|
||||||
ins_encode %{
|
ins_encode %{
|
||||||
Register Rdst = $dst$$Register;
|
Register Rdst = $dst$$Register;
|
||||||
|
|
|
@ -1221,11 +1221,9 @@ bool Dependencies::is_concrete_method(Method* m) {
|
||||||
|
|
||||||
// We could also return false if m does not yet appear to be
|
// We could also return false if m does not yet appear to be
|
||||||
// executed, if the VM version supports this distinction also.
|
// executed, if the VM version supports this distinction also.
|
||||||
|
// Default methods are considered "concrete" as well.
|
||||||
return !m->is_abstract() &&
|
return !m->is_abstract() &&
|
||||||
!InstanceKlass::cast(m->method_holder())->is_interface();
|
!m->is_overpass(); // error functions aren't concrete
|
||||||
// TODO: investigate whether default methods should be
|
|
||||||
// considered as "concrete" in this situation. For now they
|
|
||||||
// are not.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,6 @@ InlineTree::InlineTree(Compile* c,
|
||||||
assert(_caller_jvms->same_calls_as(caller_jvms), "consistent JVMS");
|
assert(_caller_jvms->same_calls_as(caller_jvms), "consistent JVMS");
|
||||||
assert((caller_tree == NULL ? 0 : caller_tree->stack_depth() + 1) == stack_depth(), "correct (redundant) depth parameter");
|
assert((caller_tree == NULL ? 0 : caller_tree->stack_depth() + 1) == stack_depth(), "correct (redundant) depth parameter");
|
||||||
assert(caller_bci == this->caller_bci(), "correct (redundant) bci parameter");
|
assert(caller_bci == this->caller_bci(), "correct (redundant) bci parameter");
|
||||||
if (UseOldInlining) {
|
|
||||||
// Update hierarchical counts, count_inline_bcs() and count_inlines()
|
// Update hierarchical counts, count_inline_bcs() and count_inlines()
|
||||||
InlineTree *caller = (InlineTree *)caller_tree;
|
InlineTree *caller = (InlineTree *)caller_tree;
|
||||||
for( ; caller != NULL; caller = ((InlineTree *)(caller->caller_tree())) ) {
|
for( ; caller != NULL; caller = ((InlineTree *)(caller->caller_tree())) ) {
|
||||||
|
@ -71,25 +70,6 @@ InlineTree::InlineTree(Compile* c,
|
||||||
NOT_PRODUCT(caller->_count_inlines++;)
|
NOT_PRODUCT(caller->_count_inlines++;)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
InlineTree::InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvms,
|
|
||||||
float site_invoke_ratio, int max_inline_level) :
|
|
||||||
C(c),
|
|
||||||
_caller_jvms(caller_jvms),
|
|
||||||
_caller_tree(NULL),
|
|
||||||
_method(callee_method),
|
|
||||||
_site_invoke_ratio(site_invoke_ratio),
|
|
||||||
_max_inline_level(max_inline_level),
|
|
||||||
_count_inline_bcs(method()->code_size()),
|
|
||||||
_msg(NULL)
|
|
||||||
{
|
|
||||||
#ifndef PRODUCT
|
|
||||||
_count_inlines = 0;
|
|
||||||
_forced_inline = false;
|
|
||||||
#endif
|
|
||||||
assert(!UseOldInlining, "do not use for old stuff");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true when EA is ON and a java constructor is called or
|
* Return true when EA is ON and a java constructor is called or
|
||||||
|
@ -161,11 +141,6 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UseOldInlining) {
|
|
||||||
set_msg("!UseOldInlining");
|
|
||||||
return true; // size and frequency are represented in a new way
|
|
||||||
}
|
|
||||||
|
|
||||||
int default_max_inline_size = C->max_inline_size();
|
int default_max_inline_size = C->max_inline_size();
|
||||||
int inline_small_code_size = InlineSmallCode / 4;
|
int inline_small_code_size = InlineSmallCode / 4;
|
||||||
int max_inline_size = default_max_inline_size;
|
int max_inline_size = default_max_inline_size;
|
||||||
|
@ -229,35 +204,6 @@ bool InlineTree::should_not_inline(ciMethod *callee_method,
|
||||||
fail_msg = "don't inline by annotation";
|
fail_msg = "don't inline by annotation";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UseOldInlining) {
|
|
||||||
if (fail_msg != NULL) {
|
|
||||||
*wci_result = *(WarmCallInfo::always_cold());
|
|
||||||
set_msg(fail_msg);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (callee_method->has_unloaded_classes_in_signature()) {
|
|
||||||
wci_result->set_profit(wci_result->profit() * 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't inline exception code unless the top method belongs to an
|
|
||||||
// exception class
|
|
||||||
if (callee_method->holder()->is_subclass_of(C->env()->Throwable_klass())) {
|
|
||||||
ciMethod* top_method = jvms->caller() != NULL ? jvms->caller()->of_depth(1)->method() : method();
|
|
||||||
if (!top_method->holder()->is_subclass_of(C->env()->Throwable_klass())) {
|
|
||||||
wci_result->set_profit(wci_result->profit() * 0.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (callee_method->has_compiled_code() &&
|
|
||||||
callee_method->instructions_size() > InlineSmallCode) {
|
|
||||||
wci_result->set_profit(wci_result->profit() * 0.1);
|
|
||||||
// %%% adjust wci_result->size()?
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// one more inlining restriction
|
// one more inlining restriction
|
||||||
if (fail_msg == NULL && callee_method->has_unloaded_classes_in_signature()) {
|
if (fail_msg == NULL && callee_method->has_unloaded_classes_in_signature()) {
|
||||||
fail_msg = "unloaded signature classes";
|
fail_msg = "unloaded signature classes";
|
||||||
|
@ -360,9 +306,7 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method,
|
||||||
int caller_bci, JVMState* jvms, ciCallProfile& profile,
|
int caller_bci, JVMState* jvms, ciCallProfile& profile,
|
||||||
WarmCallInfo* wci_result, bool& should_delay) {
|
WarmCallInfo* wci_result, bool& should_delay) {
|
||||||
|
|
||||||
// Old algorithm had funny accumulating BC-size counters
|
if (ClipInlining && (int)count_inline_bcs() >= DesiredMethodLimit) {
|
||||||
if (UseOldInlining && ClipInlining
|
|
||||||
&& (int)count_inline_bcs() >= DesiredMethodLimit) {
|
|
||||||
if (!callee_method->force_inline() || !IncrementalInline) {
|
if (!callee_method->force_inline() || !IncrementalInline) {
|
||||||
set_msg("size > DesiredMethodLimit");
|
set_msg("size > DesiredMethodLimit");
|
||||||
return false;
|
return false;
|
||||||
|
@ -465,8 +409,7 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method,
|
||||||
|
|
||||||
int size = callee_method->code_size_for_inlining();
|
int size = callee_method->code_size_for_inlining();
|
||||||
|
|
||||||
if (UseOldInlining && ClipInlining
|
if (ClipInlining && (int)count_inline_bcs() + size >= DesiredMethodLimit) {
|
||||||
&& (int)count_inline_bcs() + size >= DesiredMethodLimit) {
|
|
||||||
if (!callee_method->force_inline() || !IncrementalInline) {
|
if (!callee_method->force_inline() || !IncrementalInline) {
|
||||||
set_msg("size > DesiredMethodLimit");
|
set_msg("size > DesiredMethodLimit");
|
||||||
return false;
|
return false;
|
||||||
|
@ -584,8 +527,7 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms,
|
||||||
jvms, profile, &wci, should_delay);
|
jvms, profile, &wci, should_delay);
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (UseOldInlining && InlineWarmCalls
|
if (InlineWarmCalls && (PrintOpto || C->print_inlining())) {
|
||||||
&& (PrintOpto || C->print_inlining())) {
|
|
||||||
bool cold = wci.is_cold();
|
bool cold = wci.is_cold();
|
||||||
bool hot = !cold && wci.is_hot();
|
bool hot = !cold && wci.is_hot();
|
||||||
bool old_cold = !success;
|
bool old_cold = !success;
|
||||||
|
@ -599,13 +541,12 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (UseOldInlining) {
|
|
||||||
if (success) {
|
if (success) {
|
||||||
wci = *(WarmCallInfo::always_hot());
|
wci = *(WarmCallInfo::always_hot());
|
||||||
} else {
|
} else {
|
||||||
wci = *(WarmCallInfo::always_cold());
|
wci = *(WarmCallInfo::always_cold());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!InlineWarmCalls) {
|
if (!InlineWarmCalls) {
|
||||||
if (!wci.is_cold() && !wci.is_hot()) {
|
if (!wci.is_cold() && !wci.is_hot()) {
|
||||||
// Do not inline the warm calls.
|
// Do not inline the warm calls.
|
||||||
|
@ -619,7 +560,6 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms,
|
||||||
set_msg("inline (hot)");
|
set_msg("inline (hot)");
|
||||||
}
|
}
|
||||||
print_inlining(callee_method, caller_bci, true /* success */);
|
print_inlining(callee_method, caller_bci, true /* success */);
|
||||||
if (UseOldInlining)
|
|
||||||
build_inline_tree_for_callee(callee_method, jvms, caller_bci);
|
build_inline_tree_for_callee(callee_method, jvms, caller_bci);
|
||||||
if (InlineWarmCalls && !wci.is_hot())
|
if (InlineWarmCalls && !wci.is_hot())
|
||||||
return new (C) WarmCallInfo(wci); // copy to heap
|
return new (C) WarmCallInfo(wci); // copy to heap
|
||||||
|
|
|
@ -357,9 +357,6 @@
|
||||||
"File to dump ideal graph to. If set overrides the " \
|
"File to dump ideal graph to. If set overrides the " \
|
||||||
"use of the network") \
|
"use of the network") \
|
||||||
\
|
\
|
||||||
product(bool, UseOldInlining, true, \
|
|
||||||
"Enable the 1.3 inlining strategy") \
|
|
||||||
\
|
|
||||||
product(bool, UseBimorphicInlining, true, \
|
product(bool, UseBimorphicInlining, true, \
|
||||||
"Profiling based inlining for two receivers") \
|
"Profiling based inlining for two receivers") \
|
||||||
\
|
\
|
||||||
|
|
|
@ -722,7 +722,7 @@ JVMState* PredictedCallGenerator::generate(JVMState* jvms, Parse* parent_parser)
|
||||||
Node* m = kit.map()->in(i);
|
Node* m = kit.map()->in(i);
|
||||||
Node* n = slow_map->in(i);
|
Node* n = slow_map->in(i);
|
||||||
if (m != n) {
|
if (m != n) {
|
||||||
const Type* t = gvn.type(m)->meet(gvn.type(n));
|
const Type* t = gvn.type(m)->meet_speculative(gvn.type(n));
|
||||||
Node* phi = PhiNode::make(region, m, t);
|
Node* phi = PhiNode::make(region, m, t);
|
||||||
phi->set_req(2, n);
|
phi->set_req(2, n);
|
||||||
kit.map()->set_req(i, gvn.transform(phi));
|
kit.map()->set_req(i, gvn.transform(phi));
|
||||||
|
@ -975,7 +975,7 @@ JVMState* PredictedIntrinsicGenerator::generate(JVMState* jvms, Parse* parent_pa
|
||||||
Node* m = kit.map()->in(i);
|
Node* m = kit.map()->in(i);
|
||||||
Node* n = slow_map->in(i);
|
Node* n = slow_map->in(i);
|
||||||
if (m != n) {
|
if (m != n) {
|
||||||
const Type* t = gvn.type(m)->meet(gvn.type(n));
|
const Type* t = gvn.type(m)->meet_speculative(gvn.type(n));
|
||||||
Node* phi = PhiNode::make(region, m, t);
|
Node* phi = PhiNode::make(region, m, t);
|
||||||
phi->set_req(2, n);
|
phi->set_req(2, n);
|
||||||
kit.map()->set_req(i, gvn.transform(phi));
|
kit.map()->set_req(i, gvn.transform(phi));
|
||||||
|
|
|
@ -951,7 +951,7 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const {
|
||||||
if (is_intf != ti_is_intf)
|
if (is_intf != ti_is_intf)
|
||||||
{ t = _type; break; }
|
{ t = _type; break; }
|
||||||
}
|
}
|
||||||
t = t->meet(ti);
|
t = t->meet_speculative(ti);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -968,11 +968,11 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const {
|
||||||
//
|
//
|
||||||
// It is not possible to see Type::BOTTOM values as phi inputs,
|
// It is not possible to see Type::BOTTOM values as phi inputs,
|
||||||
// because the ciTypeFlow pre-pass produces verifier-quality types.
|
// because the ciTypeFlow pre-pass produces verifier-quality types.
|
||||||
const Type* ft = t->filter(_type); // Worst case type
|
const Type* ft = t->filter_speculative(_type); // Worst case type
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
// The following logic has been moved into TypeOopPtr::filter.
|
// The following logic has been moved into TypeOopPtr::filter.
|
||||||
const Type* jt = t->join(_type);
|
const Type* jt = t->join_speculative(_type);
|
||||||
if( jt->empty() ) { // Emptied out???
|
if( jt->empty() ) { // Emptied out???
|
||||||
|
|
||||||
// Check for evil case of 't' being a class and '_type' expecting an
|
// Check for evil case of 't' being a class and '_type' expecting an
|
||||||
|
@ -1757,7 +1757,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Accumulate type for resulting Phi
|
// Accumulate type for resulting Phi
|
||||||
type = type->meet(in(i)->in(AddPNode::Base)->bottom_type());
|
type = type->meet_speculative(in(i)->in(AddPNode::Base)->bottom_type());
|
||||||
}
|
}
|
||||||
Node* base = NULL;
|
Node* base = NULL;
|
||||||
if (doit) {
|
if (doit) {
|
||||||
|
|
|
@ -98,6 +98,12 @@ public:
|
||||||
}
|
}
|
||||||
// Compute the degree between 2 live ranges
|
// Compute the degree between 2 live ranges
|
||||||
int compute_degree( LRG &l ) const;
|
int compute_degree( LRG &l ) const;
|
||||||
|
bool mask_is_nonempty_and_up() const {
|
||||||
|
return mask().is_UP() && mask_size();
|
||||||
|
}
|
||||||
|
bool is_float_or_vector() const {
|
||||||
|
return _is_float || _is_vector;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RegMask _mask; // Allowed registers for this LRG
|
RegMask _mask; // Allowed registers for this LRG
|
||||||
|
@ -129,6 +135,7 @@ public:
|
||||||
void SUBTRACT( const RegMask &rm ) { _mask.SUBTRACT(rm); debug_only(_msize_valid=0;)}
|
void SUBTRACT( const RegMask &rm ) { _mask.SUBTRACT(rm); debug_only(_msize_valid=0;)}
|
||||||
void Clear() { _mask.Clear() ; debug_only(_msize_valid=1); _mask_size = 0; }
|
void Clear() { _mask.Clear() ; debug_only(_msize_valid=1); _mask_size = 0; }
|
||||||
void Set_All() { _mask.Set_All(); debug_only(_msize_valid=1); _mask_size = RegMask::CHUNK_SIZE; }
|
void Set_All() { _mask.Set_All(); debug_only(_msize_valid=1); _mask_size = RegMask::CHUNK_SIZE; }
|
||||||
|
|
||||||
void Insert( OptoReg::Name reg ) { _mask.Insert(reg); debug_only(_msize_valid=0;) }
|
void Insert( OptoReg::Name reg ) { _mask.Insert(reg); debug_only(_msize_valid=0;) }
|
||||||
void Remove( OptoReg::Name reg ) { _mask.Remove(reg); debug_only(_msize_valid=0;) }
|
void Remove( OptoReg::Name reg ) { _mask.Remove(reg); debug_only(_msize_valid=0;) }
|
||||||
void clear_to_pairs() { _mask.clear_to_pairs(); debug_only(_msize_valid=0;) }
|
void clear_to_pairs() { _mask.clear_to_pairs(); debug_only(_msize_valid=0;) }
|
||||||
|
@ -483,15 +490,75 @@ private:
|
||||||
// Same as _ifg->add_vector(reg,live) EXCEPT use the RegMask
|
// Same as _ifg->add_vector(reg,live) EXCEPT use the RegMask
|
||||||
// information to trim the set of interferences. Return the
|
// information to trim the set of interferences. Return the
|
||||||
// count of edges added.
|
// count of edges added.
|
||||||
void interfere_with_live( uint reg, IndexSet *live );
|
void interfere_with_live(uint lid, IndexSet* liveout);
|
||||||
|
#ifdef ASSERT
|
||||||
// Count register pressure for asserts
|
// Count register pressure for asserts
|
||||||
uint count_int_pressure(IndexSet* liveout);
|
uint count_int_pressure(IndexSet* liveout);
|
||||||
uint count_float_pressure(IndexSet* liveout);
|
uint count_float_pressure(IndexSet* liveout);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Build the interference graph using virtual registers only.
|
// Build the interference graph using virtual registers only.
|
||||||
// Used for aggressive coalescing.
|
// Used for aggressive coalescing.
|
||||||
void build_ifg_virtual( );
|
void build_ifg_virtual( );
|
||||||
|
|
||||||
|
class Pressure {
|
||||||
|
public:
|
||||||
|
// keeps track of the register pressure at the current
|
||||||
|
// instruction (used when stepping backwards in the block)
|
||||||
|
uint _current_pressure;
|
||||||
|
|
||||||
|
// keeps track of the instruction index of the first low to high register pressure
|
||||||
|
// transition (starting from the top) in the block
|
||||||
|
// if high_pressure_index == 0 then the whole block is high pressure
|
||||||
|
// if high_pressure_index = b.end_idx() + 1 then the whole block is low pressure
|
||||||
|
uint _high_pressure_index;
|
||||||
|
|
||||||
|
// stores the highest pressure we find
|
||||||
|
uint _final_pressure;
|
||||||
|
|
||||||
|
// number of live ranges that constitute high register pressure
|
||||||
|
const uint _high_pressure_limit;
|
||||||
|
|
||||||
|
// lower the register pressure and look for a low to high pressure
|
||||||
|
// transition
|
||||||
|
void lower(LRG& lrg, uint& location) {
|
||||||
|
_current_pressure -= lrg.reg_pressure();
|
||||||
|
if (_current_pressure == _high_pressure_limit) {
|
||||||
|
_high_pressure_index = location;
|
||||||
|
if (_current_pressure > _final_pressure) {
|
||||||
|
_final_pressure = _current_pressure + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// raise the pressure and store the pressure if it's the biggest
|
||||||
|
// pressure so far
|
||||||
|
void raise(LRG &lrg) {
|
||||||
|
_current_pressure += lrg.reg_pressure();
|
||||||
|
if (_current_pressure > _final_pressure) {
|
||||||
|
_final_pressure = _current_pressure;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Pressure(uint high_pressure_index, uint high_pressure_limit)
|
||||||
|
: _current_pressure(0)
|
||||||
|
, _high_pressure_index(high_pressure_index)
|
||||||
|
, _high_pressure_limit(high_pressure_limit)
|
||||||
|
, _final_pressure(0) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
void lower_pressure(Block* b, uint location, LRG& lrg, IndexSet* liveout, Pressure& int_pressure, Pressure& float_pressure);
|
||||||
|
void raise_pressure(Block* b, LRG& lrg, Pressure& int_pressure, Pressure& float_pressure);
|
||||||
|
void check_for_high_pressure_transition_at_fatproj(uint& block_reg_pressure, uint location, LRG& lrg, Pressure& pressure, const int op_regtype);
|
||||||
|
void add_input_to_liveout(Block* b, Node* n, IndexSet* liveout, double cost, Pressure& int_pressure, Pressure& float_pressure);
|
||||||
|
void compute_initial_block_pressure(Block* b, IndexSet* liveout, Pressure& int_pressure, Pressure& float_pressure, double cost);
|
||||||
|
bool remove_node_if_not_used(Block* b, uint location, Node* n, uint lid, IndexSet* liveout);
|
||||||
|
void assign_high_score_to_immediate_copies(Block* b, Node* n, LRG& lrg, uint next_inst, uint last_inst);
|
||||||
|
void remove_interference_from_copy(Block* b, uint location, uint lid_copy, IndexSet* liveout, double cost, Pressure& int_pressure, Pressure& float_pressure);
|
||||||
|
void remove_bound_register_from_interfering_live_ranges(LRG& lrg, IndexSet* liveout, uint& must_spill);
|
||||||
|
void check_for_high_pressure_block(Pressure& pressure);
|
||||||
|
void adjust_high_pressure_index(Block* b, uint& hrp_index, Pressure& pressure);
|
||||||
|
|
||||||
// Build the interference graph using physical registers when available.
|
// Build the interference graph using physical registers when available.
|
||||||
// That is, if 2 live ranges are simultaneously alive but in their
|
// That is, if 2 live ranges are simultaneously alive but in their
|
||||||
// acceptable register sets do not overlap, then they do not interfere.
|
// acceptable register sets do not overlap, then they do not interfere.
|
||||||
|
|
|
@ -705,10 +705,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
|
||||||
|
|
||||||
print_compile_messages();
|
print_compile_messages();
|
||||||
|
|
||||||
if (UseOldInlining || PrintCompilation NOT_PRODUCT( || PrintOpto) )
|
|
||||||
_ilt = InlineTree::build_inline_tree_root();
|
_ilt = InlineTree::build_inline_tree_root();
|
||||||
else
|
|
||||||
_ilt = NULL;
|
|
||||||
|
|
||||||
// Even if NO memory addresses are used, MergeMem nodes must have at least 1 slice
|
// Even if NO memory addresses are used, MergeMem nodes must have at least 1 slice
|
||||||
assert(num_alias_types() >= AliasIdxRaw, "");
|
assert(num_alias_types() >= AliasIdxRaw, "");
|
||||||
|
@ -3948,17 +3945,19 @@ void Compile::remove_speculative_types(PhaseIterGVN &igvn) {
|
||||||
// which may optimize it out.
|
// which may optimize it out.
|
||||||
for (uint next = 0; next < worklist.size(); ++next) {
|
for (uint next = 0; next < worklist.size(); ++next) {
|
||||||
Node *n = worklist.at(next);
|
Node *n = worklist.at(next);
|
||||||
if (n->is_Type() && n->as_Type()->type()->isa_oopptr() != NULL &&
|
if (n->is_Type()) {
|
||||||
n->as_Type()->type()->is_oopptr()->speculative() != NULL) {
|
|
||||||
TypeNode* tn = n->as_Type();
|
TypeNode* tn = n->as_Type();
|
||||||
const TypeOopPtr* t = tn->type()->is_oopptr();
|
const Type* t = tn->type();
|
||||||
|
const Type* t_no_spec = t->remove_speculative();
|
||||||
|
if (t_no_spec != t) {
|
||||||
bool in_hash = igvn.hash_delete(n);
|
bool in_hash = igvn.hash_delete(n);
|
||||||
assert(in_hash, "node should be in igvn hash table");
|
assert(in_hash, "node should be in igvn hash table");
|
||||||
tn->set_type(t->remove_speculative());
|
tn->set_type(t_no_spec);
|
||||||
igvn.hash_insert(n);
|
igvn.hash_insert(n);
|
||||||
igvn._worklist.push(n); // give it a chance to go away
|
igvn._worklist.push(n); // give it a chance to go away
|
||||||
modified++;
|
modified++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
uint max = n->len();
|
uint max = n->len();
|
||||||
for( uint i = 0; i < max; ++i ) {
|
for( uint i = 0; i < max; ++i ) {
|
||||||
Node *m = n->in(i);
|
Node *m = n->in(i);
|
||||||
|
@ -3971,6 +3970,27 @@ void Compile::remove_speculative_types(PhaseIterGVN &igvn) {
|
||||||
if (modified > 0) {
|
if (modified > 0) {
|
||||||
igvn.optimize();
|
igvn.optimize();
|
||||||
}
|
}
|
||||||
|
#ifdef ASSERT
|
||||||
|
// Verify that after the IGVN is over no speculative type has resurfaced
|
||||||
|
worklist.clear();
|
||||||
|
worklist.push(root());
|
||||||
|
for (uint next = 0; next < worklist.size(); ++next) {
|
||||||
|
Node *n = worklist.at(next);
|
||||||
|
const Type* t = igvn.type(n);
|
||||||
|
assert(t == t->remove_speculative(), "no more speculative types");
|
||||||
|
if (n->is_Type()) {
|
||||||
|
t = n->as_Type()->type();
|
||||||
|
assert(t == t->remove_speculative(), "no more speculative types");
|
||||||
|
}
|
||||||
|
uint max = n->len();
|
||||||
|
for( uint i = 0; i < max; ++i ) {
|
||||||
|
Node *m = n->in(i);
|
||||||
|
if (not_a_node(m)) continue;
|
||||||
|
worklist.push(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
igvn.check_no_speculative_types();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ Node *CMoveNode::Identity( PhaseTransform *phase ) {
|
||||||
const Type *CMoveNode::Value( PhaseTransform *phase ) const {
|
const Type *CMoveNode::Value( PhaseTransform *phase ) const {
|
||||||
if( phase->type(in(Condition)) == Type::TOP )
|
if( phase->type(in(Condition)) == Type::TOP )
|
||||||
return Type::TOP;
|
return Type::TOP;
|
||||||
return phase->type(in(IfFalse))->meet(phase->type(in(IfTrue)));
|
return phase->type(in(IfFalse))->meet_speculative(phase->type(in(IfTrue)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------make-------------------------------------------
|
//------------------------------make-------------------------------------------
|
||||||
|
@ -392,14 +392,14 @@ Node *CMoveDNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// If input is already higher or equal to cast type, then this is an identity.
|
// If input is already higher or equal to cast type, then this is an identity.
|
||||||
Node *ConstraintCastNode::Identity( PhaseTransform *phase ) {
|
Node *ConstraintCastNode::Identity( PhaseTransform *phase ) {
|
||||||
return phase->type(in(1))->higher_equal(_type) ? in(1) : this;
|
return phase->type(in(1))->higher_equal_speculative(_type) ? in(1) : this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------Value------------------------------------------
|
//------------------------------Value------------------------------------------
|
||||||
// Take 'join' of input and cast-up type
|
// Take 'join' of input and cast-up type
|
||||||
const Type *ConstraintCastNode::Value( PhaseTransform *phase ) const {
|
const Type *ConstraintCastNode::Value( PhaseTransform *phase ) const {
|
||||||
if( in(0) && phase->type(in(0)) == Type::TOP ) return Type::TOP;
|
if( in(0) && phase->type(in(0)) == Type::TOP ) return Type::TOP;
|
||||||
const Type* ft = phase->type(in(1))->filter(_type);
|
const Type* ft = phase->type(in(1))->filter_speculative(_type);
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
// Previous versions of this function had some special case logic,
|
// Previous versions of this function had some special case logic,
|
||||||
|
@ -409,7 +409,7 @@ const Type *ConstraintCastNode::Value( PhaseTransform *phase ) const {
|
||||||
{
|
{
|
||||||
const Type* t1 = phase->type(in(1));
|
const Type* t1 = phase->type(in(1));
|
||||||
if( t1 == Type::TOP ) assert(ft == Type::TOP, "special case #1");
|
if( t1 == Type::TOP ) assert(ft == Type::TOP, "special case #1");
|
||||||
const Type* rt = t1->join(_type);
|
const Type* rt = t1->join_speculative(_type);
|
||||||
if (rt->empty()) assert(ft == Type::TOP, "special case #2");
|
if (rt->empty()) assert(ft == Type::TOP, "special case #2");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class MachNode;
|
||||||
// Simple constants
|
// Simple constants
|
||||||
class ConNode : public TypeNode {
|
class ConNode : public TypeNode {
|
||||||
public:
|
public:
|
||||||
ConNode( const Type *t ) : TypeNode(t,1) {
|
ConNode( const Type *t ) : TypeNode(t->remove_speculative(),1) {
|
||||||
init_req(0, (Node*)Compile::current()->root());
|
init_req(0, (Node*)Compile::current()->root());
|
||||||
init_flags(Flag_is_Con);
|
init_flags(Flag_is_Con);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,19 +161,8 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool
|
||||||
|
|
||||||
// Try inlining a bytecoded method:
|
// Try inlining a bytecoded method:
|
||||||
if (!call_does_dispatch) {
|
if (!call_does_dispatch) {
|
||||||
InlineTree* ilt;
|
InlineTree* ilt = InlineTree::find_subtree_from_root(this->ilt(), jvms->caller(), jvms->method());
|
||||||
if (UseOldInlining) {
|
|
||||||
ilt = InlineTree::find_subtree_from_root(this->ilt(), jvms->caller(), jvms->method());
|
|
||||||
} else {
|
|
||||||
// Make a disembodied, stateless ILT.
|
|
||||||
// TO DO: When UseOldInlining is removed, copy the ILT code elsewhere.
|
|
||||||
float site_invoke_ratio = prof_factor;
|
|
||||||
// Note: ilt is for the root of this parse, not the present call site.
|
|
||||||
ilt = new InlineTree(this, jvms->method(), jvms->caller(), site_invoke_ratio, MaxInlineLevel);
|
|
||||||
}
|
|
||||||
WarmCallInfo scratch_ci;
|
WarmCallInfo scratch_ci;
|
||||||
if (!UseOldInlining)
|
|
||||||
scratch_ci.init(jvms, callee, profile, prof_factor);
|
|
||||||
bool should_delay = false;
|
bool should_delay = false;
|
||||||
WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci, should_delay);
|
WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci, should_delay);
|
||||||
assert(ci != &scratch_ci, "do not let this pointer escape");
|
assert(ci != &scratch_ci, "do not let this pointer escape");
|
||||||
|
|
|
@ -420,7 +420,7 @@ void GraphKit::combine_exception_states(SafePointNode* ex_map, SafePointNode* ph
|
||||||
}
|
}
|
||||||
const Type* srctype = _gvn.type(src);
|
const Type* srctype = _gvn.type(src);
|
||||||
if (phi->type() != srctype) {
|
if (phi->type() != srctype) {
|
||||||
const Type* dsttype = phi->type()->meet(srctype);
|
const Type* dsttype = phi->type()->meet_speculative(srctype);
|
||||||
if (phi->type() != dsttype) {
|
if (phi->type() != dsttype) {
|
||||||
phi->set_type(dsttype);
|
phi->set_type(dsttype);
|
||||||
_gvn.set_type(phi, dsttype);
|
_gvn.set_type(phi, dsttype);
|
||||||
|
@ -1224,7 +1224,7 @@ Node* GraphKit::null_check_common(Node* value, BasicType type,
|
||||||
// See if mixing in the NULL pointer changes type.
|
// See if mixing in the NULL pointer changes type.
|
||||||
// If so, then the NULL pointer was not allowed in the original
|
// If so, then the NULL pointer was not allowed in the original
|
||||||
// type. In other words, "value" was not-null.
|
// type. In other words, "value" was not-null.
|
||||||
if (t->meet(TypePtr::NULL_PTR) != t) {
|
if (t->meet(TypePtr::NULL_PTR) != t->remove_speculative()) {
|
||||||
// same as: if (!TypePtr::NULL_PTR->higher_equal(t)) ...
|
// same as: if (!TypePtr::NULL_PTR->higher_equal(t)) ...
|
||||||
explicit_null_checks_elided++;
|
explicit_null_checks_elided++;
|
||||||
return value; // Elided null check quickly!
|
return value; // Elided null check quickly!
|
||||||
|
@ -1357,7 +1357,7 @@ Node* GraphKit::null_check_common(Node* value, BasicType type,
|
||||||
// Cast obj to not-null on this path
|
// Cast obj to not-null on this path
|
||||||
Node* GraphKit::cast_not_null(Node* obj, bool do_replace_in_map) {
|
Node* GraphKit::cast_not_null(Node* obj, bool do_replace_in_map) {
|
||||||
const Type *t = _gvn.type(obj);
|
const Type *t = _gvn.type(obj);
|
||||||
const Type *t_not_null = t->join(TypePtr::NOTNULL);
|
const Type *t_not_null = t->join_speculative(TypePtr::NOTNULL);
|
||||||
// Object is already not-null?
|
// Object is already not-null?
|
||||||
if( t == t_not_null ) return obj;
|
if( t == t_not_null ) return obj;
|
||||||
|
|
||||||
|
@ -3014,7 +3014,7 @@ Node* GraphKit::gen_checkcast(Node *obj, Node* superklass,
|
||||||
if (failure_control != NULL) // failure is now impossible
|
if (failure_control != NULL) // failure is now impossible
|
||||||
(*failure_control) = top();
|
(*failure_control) = top();
|
||||||
// adjust the type of the phi to the exact klass:
|
// adjust the type of the phi to the exact klass:
|
||||||
phi->raise_bottom_type(_gvn.type(cast_obj)->meet(TypePtr::NULL_PTR));
|
phi->raise_bottom_type(_gvn.type(cast_obj)->meet_speculative(TypePtr::NULL_PTR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,20 +281,23 @@ void PhaseIFG::verify( const PhaseChaitin *pc ) const {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Interfere this register with everything currently live. Use the RegMasks
|
/*
|
||||||
// to trim the set of possible interferences. Return a count of register-only
|
* Interfere this register with everything currently live.
|
||||||
// interferences as an estimate of register pressure.
|
* Check for interference by checking overlap of regmasks.
|
||||||
void PhaseChaitin::interfere_with_live( uint r, IndexSet *liveout ) {
|
* Only interfere if acceptable register masks overlap.
|
||||||
uint retval = 0;
|
*/
|
||||||
// Interfere with everything live.
|
void PhaseChaitin::interfere_with_live(uint lid, IndexSet* liveout) {
|
||||||
const RegMask &rm = lrgs(r).mask();
|
LRG& lrg = lrgs(lid);
|
||||||
// Check for interference by checking overlap of regmasks.
|
const RegMask& rm = lrg.mask();
|
||||||
// Only interfere if acceptable register masks overlap.
|
|
||||||
IndexSetIterator elements(liveout);
|
IndexSetIterator elements(liveout);
|
||||||
uint l;
|
uint interfering_lid = elements.next();
|
||||||
while( (l = elements.next()) != 0 )
|
while (interfering_lid != 0) {
|
||||||
if( rm.overlap( lrgs(l).mask() ) )
|
LRG& interfering_lrg = lrgs(interfering_lid);
|
||||||
_ifg->add_edge( r, l );
|
if (rm.overlap(interfering_lrg.mask())) {
|
||||||
|
_ifg->add_edge(lid, interfering_lid);
|
||||||
|
}
|
||||||
|
interfering_lid = elements.next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actually build the interference graph. Uses virtual registers only, no
|
// Actually build the interference graph. Uses virtual registers only, no
|
||||||
|
@ -333,7 +336,7 @@ void PhaseChaitin::build_ifg_virtual( ) {
|
||||||
// Copies do not define a new value and so do not interfere.
|
// Copies do not define a new value and so do not interfere.
|
||||||
// Remove the copies source from the liveout set before interfering.
|
// Remove the copies source from the liveout set before interfering.
|
||||||
uint idx = n->is_Copy();
|
uint idx = n->is_Copy();
|
||||||
if (idx) {
|
if (idx != 0) {
|
||||||
liveout->remove(_lrg_map.live_range_id(n->in(idx)));
|
liveout->remove(_lrg_map.live_range_id(n->in(idx)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,418 +392,465 @@ void PhaseChaitin::build_ifg_virtual( ) {
|
||||||
} // End of forall blocks
|
} // End of forall blocks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ASSERT
|
||||||
uint PhaseChaitin::count_int_pressure(IndexSet* liveout) {
|
uint PhaseChaitin::count_int_pressure(IndexSet* liveout) {
|
||||||
IndexSetIterator elements(liveout);
|
IndexSetIterator elements(liveout);
|
||||||
uint lidx;
|
uint lidx = elements.next();
|
||||||
uint cnt = 0;
|
uint cnt = 0;
|
||||||
while ((lidx = elements.next()) != 0) {
|
while (lidx != 0) {
|
||||||
if( lrgs(lidx).mask().is_UP() &&
|
LRG& lrg = lrgs(lidx);
|
||||||
lrgs(lidx).mask_size() &&
|
if (lrg.mask_is_nonempty_and_up() &&
|
||||||
!lrgs(lidx)._is_float &&
|
!lrg.is_float_or_vector() &&
|
||||||
!lrgs(lidx)._is_vector &&
|
lrg.mask().overlap(*Matcher::idealreg2regmask[Op_RegI])) {
|
||||||
lrgs(lidx).mask().overlap(*Matcher::idealreg2regmask[Op_RegI]) )
|
cnt += lrg.reg_pressure();
|
||||||
cnt += lrgs(lidx).reg_pressure();
|
}
|
||||||
|
lidx = elements.next();
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint PhaseChaitin::count_float_pressure(IndexSet* liveout) {
|
uint PhaseChaitin::count_float_pressure(IndexSet* liveout) {
|
||||||
IndexSetIterator elements(liveout);
|
IndexSetIterator elements(liveout);
|
||||||
uint lidx;
|
uint lidx = elements.next();
|
||||||
uint cnt = 0;
|
uint cnt = 0;
|
||||||
while ((lidx = elements.next()) != 0) {
|
while (lidx != 0) {
|
||||||
if( lrgs(lidx).mask().is_UP() &&
|
LRG& lrg = lrgs(lidx);
|
||||||
lrgs(lidx).mask_size() &&
|
if (lrg.mask_is_nonempty_and_up() && lrg.is_float_or_vector()) {
|
||||||
(lrgs(lidx)._is_float || lrgs(lidx)._is_vector))
|
cnt += lrg.reg_pressure();
|
||||||
cnt += lrgs(lidx).reg_pressure();
|
}
|
||||||
|
lidx = elements.next();
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Adjust register pressure down by 1. Capture last hi-to-low transition,
|
/*
|
||||||
static void lower_pressure( LRG *lrg, uint where, Block *b, uint *pressure, uint *hrp_index ) {
|
* Adjust register pressure down by 1. Capture last hi-to-low transition,
|
||||||
if (lrg->mask().is_UP() && lrg->mask_size()) {
|
*/
|
||||||
if (lrg->_is_float || lrg->_is_vector) {
|
void PhaseChaitin::lower_pressure(Block* b, uint location, LRG& lrg, IndexSet* liveout, Pressure& int_pressure, Pressure& float_pressure) {
|
||||||
pressure[1] -= lrg->reg_pressure();
|
if (lrg.mask_is_nonempty_and_up()) {
|
||||||
if( pressure[1] == (uint)FLOATPRESSURE ) {
|
if (lrg.is_float_or_vector()) {
|
||||||
hrp_index[1] = where;
|
float_pressure.lower(lrg, location);
|
||||||
if( pressure[1] > b->_freg_pressure )
|
} else {
|
||||||
b->_freg_pressure = pressure[1]+1;
|
// Do not count the SP and flag registers
|
||||||
}
|
const RegMask& r = lrg.mask();
|
||||||
} else if( lrg->mask().overlap(*Matcher::idealreg2regmask[Op_RegI]) ) {
|
if (r.overlap(*Matcher::idealreg2regmask[Op_RegI])) {
|
||||||
pressure[0] -= lrg->reg_pressure();
|
int_pressure.lower(lrg, location);
|
||||||
if( pressure[0] == (uint)INTPRESSURE ) {
|
|
||||||
hrp_index[0] = where;
|
|
||||||
if( pressure[0] > b->_reg_pressure )
|
|
||||||
b->_reg_pressure = pressure[0]+1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert(int_pressure._current_pressure == count_int_pressure(liveout), "the int pressure is incorrect");
|
||||||
|
assert(float_pressure._current_pressure == count_float_pressure(liveout), "the float pressure is incorrect");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the interference graph using physical registers when available.
|
/* Go to the first non-phi index in a block */
|
||||||
// That is, if 2 live ranges are simultaneously alive but in their acceptable
|
static uint first_nonphi_index(Block* b) {
|
||||||
// register sets do not overlap, then they do not interfere.
|
uint i;
|
||||||
uint PhaseChaitin::build_ifg_physical( ResourceArea *a ) {
|
uint end_idx = b->end_idx();
|
||||||
NOT_PRODUCT( Compile::TracePhase t3("buildIFG", &_t_buildIFGphysical, TimeCompiler); )
|
for (i = 1; i < end_idx; i++) {
|
||||||
|
Node* n = b->get_node(i);
|
||||||
uint must_spill = 0;
|
if (!n->is_Phi()) {
|
||||||
|
|
||||||
// For all blocks (in any order) do...
|
|
||||||
for (uint i = 0; i < _cfg.number_of_blocks(); i++) {
|
|
||||||
Block* block = _cfg.get_block(i);
|
|
||||||
// Clone (rather than smash in place) the liveout info, so it is alive
|
|
||||||
// for the "collect_gc_info" phase later.
|
|
||||||
IndexSet liveout(_live->live(block));
|
|
||||||
uint last_inst = block->end_idx();
|
|
||||||
// Compute first nonphi node index
|
|
||||||
uint first_inst;
|
|
||||||
for (first_inst = 1; first_inst < last_inst; first_inst++) {
|
|
||||||
if (!block->get_node(first_inst)->is_Phi()) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
// Spills could be inserted before CreateEx node which should be
|
/*
|
||||||
// first instruction in block after Phis. Move CreateEx up.
|
* Spills could be inserted before a CreateEx node which should be the first
|
||||||
for (uint insidx = first_inst; insidx < last_inst; insidx++) {
|
* instruction in a block after Phi nodes. If so, move the CreateEx node up.
|
||||||
Node *ex = block->get_node(insidx);
|
*/
|
||||||
|
static void move_exception_node_up(Block* b, uint first_inst, uint last_inst) {
|
||||||
|
for (uint i = first_inst; i < last_inst; i++) {
|
||||||
|
Node* ex = b->get_node(i);
|
||||||
if (ex->is_SpillCopy()) {
|
if (ex->is_SpillCopy()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (insidx > first_inst && ex->is_Mach() && ex->as_Mach()->ideal_Opcode() == Op_CreateEx) {
|
|
||||||
// If the CreateEx isn't above all the MachSpillCopies
|
if (i > first_inst &&
|
||||||
// then move it to the top.
|
ex->is_Mach() && ex->as_Mach()->ideal_Opcode() == Op_CreateEx) {
|
||||||
block->remove_node(insidx);
|
b->remove_node(i);
|
||||||
block->insert_node(ex, first_inst);
|
b->insert_node(ex, first_inst);
|
||||||
}
|
}
|
||||||
// Stop once a CreateEx or any other node is found
|
// Stop once a CreateEx or any other node is found
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Reset block's register pressure values for each ifg construction
|
/*
|
||||||
uint pressure[2], hrp_index[2];
|
* When new live ranges are live, we raise the register pressure
|
||||||
pressure[0] = pressure[1] = 0;
|
*/
|
||||||
hrp_index[0] = hrp_index[1] = last_inst+1;
|
void PhaseChaitin::raise_pressure(Block* b, LRG& lrg, Pressure& int_pressure, Pressure& float_pressure) {
|
||||||
block->_reg_pressure = block->_freg_pressure = 0;
|
if (lrg.mask_is_nonempty_and_up()) {
|
||||||
// Liveout things are presumed live for the whole block. We accumulate
|
if (lrg.is_float_or_vector()) {
|
||||||
// 'area' accordingly. If they get killed in the block, we'll subtract
|
float_pressure.raise(lrg);
|
||||||
// the unused part of the block from the area.
|
} else {
|
||||||
int inst_count = last_inst - first_inst;
|
// Do not count the SP and flag registers
|
||||||
double cost = (inst_count <= 0) ? 0.0 : block->_freq * double(inst_count);
|
const RegMask& rm = lrg.mask();
|
||||||
assert(!(cost < 0.0), "negative spill cost" );
|
if (rm.overlap(*Matcher::idealreg2regmask[Op_RegI])) {
|
||||||
IndexSetIterator elements(&liveout);
|
int_pressure.raise(lrg);
|
||||||
uint lidx;
|
}
|
||||||
while ((lidx = elements.next()) != 0) {
|
}
|
||||||
LRG &lrg = lrgs(lidx);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Computes the initial register pressure of a block, looking at all live
|
||||||
|
* ranges in the liveout. The register pressure is computed for both float
|
||||||
|
* and int/pointer registers.
|
||||||
|
* Live ranges in the liveout are presumed live for the whole block.
|
||||||
|
* We add the cost for the whole block to the area of the live ranges initially.
|
||||||
|
* If a live range gets killed in the block, we'll subtract the unused part of
|
||||||
|
* the block from the area.
|
||||||
|
*/
|
||||||
|
void PhaseChaitin::compute_initial_block_pressure(Block* b, IndexSet* liveout, Pressure& int_pressure, Pressure& float_pressure, double cost) {
|
||||||
|
IndexSetIterator elements(liveout);
|
||||||
|
uint lid = elements.next();
|
||||||
|
while (lid != 0) {
|
||||||
|
LRG& lrg = lrgs(lid);
|
||||||
lrg._area += cost;
|
lrg._area += cost;
|
||||||
// Compute initial register pressure
|
raise_pressure(b, lrg, int_pressure, float_pressure);
|
||||||
if (lrg.mask().is_UP() && lrg.mask_size()) {
|
lid = elements.next();
|
||||||
if (lrg._is_float || lrg._is_vector) { // Count float pressure
|
|
||||||
pressure[1] += lrg.reg_pressure();
|
|
||||||
if (pressure[1] > block->_freg_pressure) {
|
|
||||||
block->_freg_pressure = pressure[1];
|
|
||||||
}
|
}
|
||||||
// Count int pressure, but do not count the SP, flags
|
assert(int_pressure._current_pressure == count_int_pressure(liveout), "the int pressure is incorrect");
|
||||||
} else if(lrgs(lidx).mask().overlap(*Matcher::idealreg2regmask[Op_RegI])) {
|
assert(float_pressure._current_pressure == count_float_pressure(liveout), "the float pressure is incorrect");
|
||||||
pressure[0] += lrg.reg_pressure();
|
|
||||||
if (pressure[0] > block->_reg_pressure) {
|
|
||||||
block->_reg_pressure = pressure[0];
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert( pressure[0] == count_int_pressure (&liveout), "" );
|
|
||||||
assert( pressure[1] == count_float_pressure(&liveout), "" );
|
|
||||||
|
|
||||||
// The IFG is built by a single reverse pass over each basic block.
|
/*
|
||||||
// Starting with the known live-out set, we remove things that get
|
* Remove dead node if it's not used.
|
||||||
// defined and add things that become live (essentially executing one
|
* We only remove projection nodes if the node "defining" the projection is
|
||||||
// pass of a standard LIVE analysis). Just before a Node defines a value
|
* dead, for example on x86, if we have a dead Add node we remove its
|
||||||
// (and removes it from the live-ness set) that value is certainly live.
|
* RFLAGS node.
|
||||||
// The defined value interferes with everything currently live. The
|
*/
|
||||||
// value is then removed from the live-ness set and it's inputs are added
|
bool PhaseChaitin::remove_node_if_not_used(Block* b, uint location, Node* n, uint lid, IndexSet* liveout) {
|
||||||
// to the live-ness set.
|
|
||||||
uint j;
|
|
||||||
for (j = last_inst + 1; j > 1; j--) {
|
|
||||||
Node* n = block->get_node(j - 1);
|
|
||||||
|
|
||||||
// Get value being defined
|
|
||||||
uint r = _lrg_map.live_range_id(n);
|
|
||||||
|
|
||||||
// Some special values do not allocate
|
|
||||||
if(r) {
|
|
||||||
// A DEF normally costs block frequency; rematerialized values are
|
|
||||||
// removed from the DEF sight, so LOWER costs here.
|
|
||||||
lrgs(r)._cost += n->rematerialize() ? 0 : block->_freq;
|
|
||||||
|
|
||||||
// If it is not live, then this instruction is dead. Probably caused
|
|
||||||
// by spilling and rematerialization. Who cares why, yank this baby.
|
|
||||||
if( !liveout.member(r) && n->Opcode() != Op_SafePoint ) {
|
|
||||||
Node* def = n->in(0);
|
Node* def = n->in(0);
|
||||||
if (!n->is_Proj() ||
|
if (!n->is_Proj() ||
|
||||||
// Could also be a flags-projection of a dead ADD or such.
|
(_lrg_map.live_range_id(def) && !liveout->member(_lrg_map.live_range_id(def)))) {
|
||||||
(_lrg_map.live_range_id(def) && !liveout.member(_lrg_map.live_range_id(def)))) {
|
b->remove_node(location);
|
||||||
block->remove_node(j - 1);
|
LRG& lrg = lrgs(lid);
|
||||||
if (lrgs(r)._def == n) {
|
if (lrg._def == n) {
|
||||||
lrgs(r)._def = 0;
|
lrg._def = 0;
|
||||||
}
|
}
|
||||||
n->disconnect_inputs(NULL, C);
|
n->disconnect_inputs(NULL, C);
|
||||||
_cfg.unmap_node_from_block(n);
|
_cfg.unmap_node_from_block(n);
|
||||||
n->replace_by(C->top());
|
n->replace_by(C->top());
|
||||||
// Since yanking a Node from block, high pressure moves up one
|
return true;
|
||||||
hrp_index[0]--;
|
}
|
||||||
hrp_index[1]--;
|
return false;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fat-projections kill many registers which cannot be used to
|
/*
|
||||||
// hold live ranges.
|
* When encountering a fat projection, we might go from a low to high to low
|
||||||
if (lrgs(r)._fat_proj) {
|
* (since the fat proj only lives at this instruction) going backwards in the
|
||||||
// Count the int-only registers
|
* block. If we find a low to high transition, we record it.
|
||||||
RegMask itmp = lrgs(r).mask();
|
*/
|
||||||
itmp.AND(*Matcher::idealreg2regmask[Op_RegI]);
|
void PhaseChaitin::check_for_high_pressure_transition_at_fatproj(uint& block_reg_pressure, uint location, LRG& lrg, Pressure& pressure, const int op_regtype) {
|
||||||
int iregs = itmp.Size();
|
RegMask mask_tmp = lrg.mask();
|
||||||
if (pressure[0]+iregs > block->_reg_pressure) {
|
mask_tmp.AND(*Matcher::idealreg2regmask[op_regtype]);
|
||||||
block->_reg_pressure = pressure[0] + iregs;
|
// this pressure is only valid at this instruction, i.e. we don't need to lower
|
||||||
|
// the register pressure since the fat proj was never live before (going backwards)
|
||||||
|
uint new_pressure = pressure._current_pressure + mask_tmp.Size();
|
||||||
|
if (new_pressure > pressure._final_pressure) {
|
||||||
|
pressure._final_pressure = new_pressure;
|
||||||
}
|
}
|
||||||
if (pressure[0] <= (uint)INTPRESSURE && pressure[0] + iregs > (uint)INTPRESSURE) {
|
// if we were at a low pressure and now at the fat proj is at high pressure, record the fat proj location
|
||||||
hrp_index[0] = j - 1;
|
// as coming from a low to high (to low again)
|
||||||
}
|
if (pressure._current_pressure <= pressure._high_pressure_limit && new_pressure > pressure._high_pressure_limit) {
|
||||||
// Count the float-only registers
|
pressure._high_pressure_index = location;
|
||||||
RegMask ftmp = lrgs(r).mask();
|
|
||||||
ftmp.AND(*Matcher::idealreg2regmask[Op_RegD]);
|
|
||||||
int fregs = ftmp.Size();
|
|
||||||
if (pressure[1] + fregs > block->_freg_pressure) {
|
|
||||||
block->_freg_pressure = pressure[1] + fregs;
|
|
||||||
}
|
|
||||||
if(pressure[1] <= (uint)FLOATPRESSURE && pressure[1]+fregs > (uint)FLOATPRESSURE) {
|
|
||||||
hrp_index[1] = j - 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // Else it is live
|
/*
|
||||||
// A DEF also ends 'area' partway through the block.
|
* Insure high score for immediate-use spill copies so they get a color.
|
||||||
lrgs(r)._area -= cost;
|
* All single-use MachSpillCopy(s) that immediately precede their
|
||||||
assert(!(lrgs(r)._area < 0.0), "negative spill area" );
|
* use must color early. If a longer live range steals their
|
||||||
|
* color, the spill copy will split and may push another spill copy
|
||||||
// Insure high score for immediate-use spill copies so they get a color
|
* further away resulting in an infinite spill-split-retry cycle.
|
||||||
if( n->is_SpillCopy()
|
* Assigning a zero area results in a high score() and a good
|
||||||
&& lrgs(r).is_singledef() // MultiDef live range can still split
|
* location in the simplify list.
|
||||||
&& n->outcnt() == 1 // and use must be in this block
|
*/
|
||||||
&& _cfg.get_block_for_node(n->unique_out()) == block) {
|
void PhaseChaitin::assign_high_score_to_immediate_copies(Block* b, Node* n, LRG& lrg, uint next_inst, uint last_inst) {
|
||||||
// All single-use MachSpillCopy(s) that immediately precede their
|
if (n->is_SpillCopy() &&
|
||||||
// use must color early. If a longer live range steals their
|
lrg.is_singledef() && // A multi defined live range can still split
|
||||||
// color, the spill copy will split and may push another spill copy
|
n->outcnt() == 1 && // and use must be in this block
|
||||||
// further away resulting in an infinite spill-split-retry cycle.
|
_cfg.get_block_for_node(n->unique_out()) == b) {
|
||||||
// Assigning a zero area results in a high score() and a good
|
|
||||||
// location in the simplify list.
|
|
||||||
//
|
|
||||||
|
|
||||||
Node* single_use = n->unique_out();
|
Node* single_use = n->unique_out();
|
||||||
assert(block->find_node(single_use) >= j, "Use must be later in block");
|
assert(b->find_node(single_use) >= next_inst, "Use must be later in block");
|
||||||
// Use can be earlier in block if it is a Phi, but then I should be a MultiDef
|
// Use can be earlier in block if it is a Phi, but then I should be a MultiDef
|
||||||
|
|
||||||
// Find first non SpillCopy 'm' that follows the current instruction
|
// Find first non SpillCopy 'm' that follows the current instruction
|
||||||
// (j - 1) is index for current instruction 'n'
|
// (current_inst - 1) is index for current instruction 'n'
|
||||||
Node* m = n;
|
Node* m = n;
|
||||||
for (uint i = j; i <= last_inst && m->is_SpillCopy(); ++i) {
|
for (uint i = next_inst; i <= last_inst && m->is_SpillCopy(); ++i) {
|
||||||
m = block->get_node(i);
|
m = b->get_node(i);
|
||||||
}
|
}
|
||||||
if (m == single_use) {
|
if (m == single_use) {
|
||||||
lrgs(r)._area = 0.0;
|
lrg._area = 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove from live-out set
|
/*
|
||||||
if( liveout.remove(r) ) {
|
* Copies do not define a new value and so do not interfere.
|
||||||
// Adjust register pressure.
|
* Remove the copies source from the liveout set before interfering.
|
||||||
// Capture last hi-to-lo pressure transition
|
*/
|
||||||
lower_pressure(&lrgs(r), j - 1, block, pressure, hrp_index);
|
void PhaseChaitin::remove_interference_from_copy(Block* b, uint location, uint lid_copy, IndexSet* liveout, double cost, Pressure& int_pressure, Pressure& float_pressure) {
|
||||||
assert( pressure[0] == count_int_pressure (&liveout), "" );
|
if (liveout->remove(lid_copy)) {
|
||||||
assert( pressure[1] == count_float_pressure(&liveout), "" );
|
LRG& lrg_copy = lrgs(lid_copy);
|
||||||
}
|
lrg_copy._area -= cost;
|
||||||
|
|
||||||
// Copies do not define a new value and so do not interfere.
|
// Lower register pressure since copy and definition can share the same register
|
||||||
// Remove the copies source from the liveout set before interfering.
|
lower_pressure(b, location, lrg_copy, liveout, int_pressure, float_pressure);
|
||||||
uint idx = n->is_Copy();
|
|
||||||
if (idx) {
|
|
||||||
uint x = _lrg_map.live_range_id(n->in(idx));
|
|
||||||
if (liveout.remove(x)) {
|
|
||||||
lrgs(x)._area -= cost;
|
|
||||||
// Adjust register pressure.
|
|
||||||
lower_pressure(&lrgs(x), j - 1, block, pressure, hrp_index);
|
|
||||||
assert( pressure[0] == count_int_pressure (&liveout), "" );
|
|
||||||
assert( pressure[1] == count_float_pressure(&liveout), "" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // End of if live or not
|
|
||||||
|
|
||||||
// Interfere with everything live. If the defined value must
|
/*
|
||||||
// go in a particular register, just remove that register from
|
* The defined value must go in a particular register. Remove that register from
|
||||||
// all conflicting parties and avoid the interference.
|
* all conflicting parties and avoid the interference.
|
||||||
|
*/
|
||||||
// Make exclusions for rematerializable defs. Since rematerializable
|
void PhaseChaitin::remove_bound_register_from_interfering_live_ranges(LRG& lrg, IndexSet* liveout, uint& must_spill) {
|
||||||
// DEFs are not bound but the live range is, some uses must be bound.
|
|
||||||
// If we spill live range 'r', it can rematerialize at each use site
|
|
||||||
// according to its bindings.
|
|
||||||
const RegMask &rmask = lrgs(r).mask();
|
|
||||||
if( lrgs(r).is_bound() && !(n->rematerialize()) && rmask.is_NotEmpty() ) {
|
|
||||||
// Check for common case
|
// Check for common case
|
||||||
int r_size = lrgs(r).num_regs();
|
const RegMask& rm = lrg.mask();
|
||||||
OptoReg::Name r_reg = (r_size == 1) ? rmask.find_first_elem() : OptoReg::Physical;
|
int r_size = lrg.num_regs();
|
||||||
// Smear odd bits
|
// Smear odd bits
|
||||||
IndexSetIterator elements(&liveout);
|
IndexSetIterator elements(liveout);
|
||||||
uint l;
|
uint l = elements.next();
|
||||||
while ((l = elements.next()) != 0) {
|
while (l != 0) {
|
||||||
LRG &lrg = lrgs(l);
|
LRG& interfering_lrg = lrgs(l);
|
||||||
// If 'l' must spill already, do not further hack his bits.
|
// If 'l' must spill already, do not further hack his bits.
|
||||||
// He'll get some interferences and be forced to spill later.
|
// He'll get some interferences and be forced to spill later.
|
||||||
if( lrg._must_spill ) continue;
|
if (interfering_lrg._must_spill) {
|
||||||
|
l = elements.next();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove bound register(s) from 'l's choices
|
// Remove bound register(s) from 'l's choices
|
||||||
RegMask old = lrg.mask();
|
RegMask old = interfering_lrg.mask();
|
||||||
uint old_size = lrg.mask_size();
|
uint old_size = interfering_lrg.mask_size();
|
||||||
// Remove the bits from LRG 'r' from LRG 'l' so 'l' no
|
|
||||||
// longer interferes with 'r'. If 'l' requires aligned
|
// Remove the bits from LRG 'rm' from LRG 'l' so 'l' no
|
||||||
|
// longer interferes with 'rm'. If 'l' requires aligned
|
||||||
// adjacent pairs, subtract out bit pairs.
|
// adjacent pairs, subtract out bit pairs.
|
||||||
assert(!lrg._is_vector || !lrg._fat_proj, "sanity");
|
assert(!interfering_lrg._is_vector || !interfering_lrg._fat_proj, "sanity");
|
||||||
if (lrg.num_regs() > 1 && !lrg._fat_proj) {
|
|
||||||
RegMask r2mask = rmask;
|
if (interfering_lrg.num_regs() > 1 && !interfering_lrg._fat_proj) {
|
||||||
|
RegMask r2mask = rm;
|
||||||
// Leave only aligned set of bits.
|
// Leave only aligned set of bits.
|
||||||
r2mask.smear_to_sets(lrg.num_regs());
|
r2mask.smear_to_sets(interfering_lrg.num_regs());
|
||||||
// It includes vector case.
|
// It includes vector case.
|
||||||
lrg.SUBTRACT( r2mask );
|
interfering_lrg.SUBTRACT(r2mask);
|
||||||
lrg.compute_set_mask_size();
|
interfering_lrg.compute_set_mask_size();
|
||||||
} else if( r_size != 1 ) { // fat proj
|
} else if (r_size != 1) {
|
||||||
lrg.SUBTRACT( rmask );
|
// fat proj
|
||||||
lrg.compute_set_mask_size();
|
interfering_lrg.SUBTRACT(rm);
|
||||||
} else { // Common case: size 1 bound removal
|
interfering_lrg.compute_set_mask_size();
|
||||||
if( lrg.mask().Member(r_reg) ) {
|
} else {
|
||||||
lrg.Remove(r_reg);
|
// Common case: size 1 bound removal
|
||||||
lrg.set_mask_size(lrg.mask().is_AllStack() ? LRG::AllStack_size : old_size - 1);
|
OptoReg::Name r_reg = rm.find_first_elem();
|
||||||
|
if (interfering_lrg.mask().Member(r_reg)) {
|
||||||
|
interfering_lrg.Remove(r_reg);
|
||||||
|
interfering_lrg.set_mask_size(interfering_lrg.mask().is_AllStack() ? LRG::AllStack_size : old_size - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If 'l' goes completely dry, it must spill.
|
// If 'l' goes completely dry, it must spill.
|
||||||
if( lrg.not_free() ) {
|
if (interfering_lrg.not_free()) {
|
||||||
// Give 'l' some kind of reasonable mask, so he picks up
|
// Give 'l' some kind of reasonable mask, so it picks up
|
||||||
// interferences (and will spill later).
|
// interferences (and will spill later).
|
||||||
lrg.set_mask( old );
|
interfering_lrg.set_mask(old);
|
||||||
lrg.set_mask_size(old_size);
|
interfering_lrg.set_mask_size(old_size);
|
||||||
must_spill++;
|
must_spill++;
|
||||||
lrg._must_spill = 1;
|
interfering_lrg._must_spill = 1;
|
||||||
lrg.set_reg(OptoReg::Name(LRG::SPILL_REG));
|
interfering_lrg.set_reg(OptoReg::Name(LRG::SPILL_REG));
|
||||||
|
}
|
||||||
|
l = elements.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // End of if bound
|
|
||||||
|
|
||||||
// Now interference with everything that is live and has
|
/*
|
||||||
// compatible register sets.
|
* Start loop at 1 (skip control edge) for most Nodes. SCMemProj's might be the
|
||||||
interfere_with_live(r,&liveout);
|
* sole use of a StoreLConditional. While StoreLConditionals set memory (the
|
||||||
|
* SCMemProj use) they also def flags; if that flag def is unused the allocator
|
||||||
|
* sees a flag-setting instruction with no use of the flags and assumes it's
|
||||||
|
* dead. This keeps the (useless) flag-setting behavior alive while also
|
||||||
|
* keeping the (useful) memory update effect.
|
||||||
|
*/
|
||||||
|
void PhaseChaitin::add_input_to_liveout(Block* b, Node* n, IndexSet* liveout, double cost, Pressure& int_pressure, Pressure& float_pressure) {
|
||||||
|
JVMState* jvms = n->jvms();
|
||||||
|
uint debug_start = jvms ? jvms->debug_start() : 999999;
|
||||||
|
|
||||||
} // End of if normal register-allocated value
|
for (uint k = ((n->Opcode() == Op_SCMemProj) ? 0:1); k < n->req(); k++) {
|
||||||
|
Node* def = n->in(k);
|
||||||
|
uint lid = _lrg_map.live_range_id(def);
|
||||||
|
if (!lid) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
LRG& lrg = lrgs(lid);
|
||||||
|
|
||||||
|
// No use-side cost for spilling debug info
|
||||||
|
if (k < debug_start) {
|
||||||
|
// A USE costs twice block frequency (once for the Load, once
|
||||||
|
// for a Load-delay). Rematerialized uses only cost once.
|
||||||
|
lrg._cost += (def->rematerialize() ? b->_freq : (b->_freq * 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (liveout->insert(lid)) {
|
||||||
|
// Newly live things assumed live from here to top of block
|
||||||
|
lrg._area += cost;
|
||||||
|
raise_pressure(b, lrg, int_pressure, float_pressure);
|
||||||
|
assert(int_pressure._current_pressure == count_int_pressure(liveout), "the int pressure is incorrect");
|
||||||
|
assert(float_pressure._current_pressure == count_float_pressure(liveout), "the float pressure is incorrect");
|
||||||
|
}
|
||||||
|
assert(!(lrg._area < 0.0), "negative spill area" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we run off the top of the block with high pressure just record that the
|
||||||
|
* whole block is high pressure. (Even though we might have a transition
|
||||||
|
* lower down in the block)
|
||||||
|
*/
|
||||||
|
void PhaseChaitin::check_for_high_pressure_block(Pressure& pressure) {
|
||||||
|
// current pressure now means the pressure before the first instruction in the block
|
||||||
|
// (since we have stepped through all instructions backwards)
|
||||||
|
if (pressure._current_pressure > pressure._high_pressure_limit) {
|
||||||
|
pressure._high_pressure_index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compute high pressure indice; avoid landing in the middle of projnodes
|
||||||
|
* and set the high pressure index for the block
|
||||||
|
*/
|
||||||
|
void PhaseChaitin::adjust_high_pressure_index(Block* b, uint& block_hrp_index, Pressure& pressure) {
|
||||||
|
uint i = pressure._high_pressure_index;
|
||||||
|
if (i < b->number_of_nodes() && i < b->end_idx() + 1) {
|
||||||
|
Node* cur = b->get_node(i);
|
||||||
|
while (cur->is_Proj() || (cur->is_MachNullCheck()) || cur->is_Catch()) {
|
||||||
|
cur = b->get_node(--i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
block_hrp_index = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Build an interference graph:
|
||||||
|
* That is, if 2 live ranges are simultaneously alive but in their acceptable
|
||||||
|
* register sets do not overlap, then they do not interfere. The IFG is built
|
||||||
|
* by a single reverse pass over each basic block. Starting with the known
|
||||||
|
* live-out set, we remove things that get defined and add things that become
|
||||||
|
* live (essentially executing one pass of a standard LIVE analysis). Just
|
||||||
|
* before a Node defines a value (and removes it from the live-ness set) that
|
||||||
|
* value is certainly live. The defined value interferes with everything
|
||||||
|
* currently live. The value is then removed from the live-ness set and it's
|
||||||
|
* inputs are added to the live-ness set.
|
||||||
|
* Compute register pressure for each block:
|
||||||
|
* We store the biggest register pressure for each block and also the first
|
||||||
|
* low to high register pressure transition within the block (if any).
|
||||||
|
*/
|
||||||
|
uint PhaseChaitin::build_ifg_physical( ResourceArea *a ) {
|
||||||
|
NOT_PRODUCT(Compile::TracePhase t3("buildIFG", &_t_buildIFGphysical, TimeCompiler);)
|
||||||
|
|
||||||
|
uint must_spill = 0;
|
||||||
|
for (uint i = 0; i < _cfg.number_of_blocks(); i++) {
|
||||||
|
Block* block = _cfg.get_block(i);
|
||||||
|
|
||||||
|
// Clone (rather than smash in place) the liveout info, so it is alive
|
||||||
|
// for the "collect_gc_info" phase later.
|
||||||
|
IndexSet liveout(_live->live(block));
|
||||||
|
|
||||||
|
uint first_inst = first_nonphi_index(block);
|
||||||
|
uint last_inst = block->end_idx();
|
||||||
|
|
||||||
|
move_exception_node_up(block, first_inst, last_inst);
|
||||||
|
|
||||||
|
Pressure int_pressure(last_inst + 1, INTPRESSURE);
|
||||||
|
Pressure float_pressure(last_inst + 1, FLOATPRESSURE);
|
||||||
|
block->_reg_pressure = 0;
|
||||||
|
block->_freg_pressure = 0;
|
||||||
|
|
||||||
|
int inst_count = last_inst - first_inst;
|
||||||
|
double cost = (inst_count <= 0) ? 0.0 : block->_freq * double(inst_count);
|
||||||
|
assert(!(cost < 0.0), "negative spill cost" );
|
||||||
|
|
||||||
|
compute_initial_block_pressure(block, &liveout, int_pressure, float_pressure, cost);
|
||||||
|
|
||||||
|
for (uint location = last_inst; location > 0; location--) {
|
||||||
|
Node* n = block->get_node(location);
|
||||||
|
uint lid = _lrg_map.live_range_id(n);
|
||||||
|
|
||||||
|
if(lid) {
|
||||||
|
LRG& lrg = lrgs(lid);
|
||||||
|
|
||||||
|
// A DEF normally costs block frequency; rematerialized values are
|
||||||
|
// removed from the DEF sight, so LOWER costs here.
|
||||||
|
lrg._cost += n->rematerialize() ? 0 : block->_freq;
|
||||||
|
|
||||||
|
if (!liveout.member(lid) && n->Opcode() != Op_SafePoint) {
|
||||||
|
if (remove_node_if_not_used(block, location, n, lid, &liveout)) {
|
||||||
|
float_pressure._high_pressure_index--;
|
||||||
|
int_pressure._high_pressure_index--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (lrg._fat_proj) {
|
||||||
|
check_for_high_pressure_transition_at_fatproj(block->_reg_pressure, location, lrg, int_pressure, Op_RegI);
|
||||||
|
check_for_high_pressure_transition_at_fatproj(block->_freg_pressure, location, lrg, float_pressure, Op_RegD);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// A live range ends at its definition, remove the remaining area.
|
||||||
|
lrg._area -= cost;
|
||||||
|
assert(lrg._area >= 0.0, "negative spill area" );
|
||||||
|
|
||||||
|
assign_high_score_to_immediate_copies(block, n, lrg, location + 1, last_inst);
|
||||||
|
|
||||||
|
if (liveout.remove(lid)) {
|
||||||
|
lower_pressure(block, location, lrg, &liveout, int_pressure, float_pressure);
|
||||||
|
}
|
||||||
|
uint copy_idx = n->is_Copy();
|
||||||
|
if (copy_idx) {
|
||||||
|
uint lid_copy = _lrg_map.live_range_id(n->in(copy_idx));
|
||||||
|
remove_interference_from_copy(block, location, lid_copy, &liveout, cost, int_pressure, float_pressure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since rematerializable DEFs are not bound but the live range is,
|
||||||
|
// some uses must be bound. If we spill live range 'r', it can
|
||||||
|
// rematerialize at each use site according to its bindings.
|
||||||
|
if (lrg.is_bound() && !n->rematerialize() && lrg.mask().is_NotEmpty()) {
|
||||||
|
remove_bound_register_from_interfering_live_ranges(lrg, &liveout, must_spill);
|
||||||
|
}
|
||||||
|
interfere_with_live(lid, &liveout);
|
||||||
|
}
|
||||||
|
|
||||||
// Area remaining in the block
|
// Area remaining in the block
|
||||||
inst_count--;
|
inst_count--;
|
||||||
cost = (inst_count <= 0) ? 0.0 : block->_freq * double(inst_count);
|
cost = (inst_count <= 0) ? 0.0 : block->_freq * double(inst_count);
|
||||||
|
|
||||||
// Make all inputs live
|
if (!n->is_Phi()) {
|
||||||
if( !n->is_Phi() ) { // Phi function uses come from prior block
|
add_input_to_liveout(block, n, &liveout, cost, int_pressure, float_pressure);
|
||||||
JVMState* jvms = n->jvms();
|
|
||||||
uint debug_start = jvms ? jvms->debug_start() : 999999;
|
|
||||||
// Start loop at 1 (skip control edge) for most Nodes.
|
|
||||||
// SCMemProj's might be the sole use of a StoreLConditional.
|
|
||||||
// While StoreLConditionals set memory (the SCMemProj use)
|
|
||||||
// they also def flags; if that flag def is unused the
|
|
||||||
// allocator sees a flag-setting instruction with no use of
|
|
||||||
// the flags and assumes it's dead. This keeps the (useless)
|
|
||||||
// flag-setting behavior alive while also keeping the (useful)
|
|
||||||
// memory update effect.
|
|
||||||
for (uint k = ((n->Opcode() == Op_SCMemProj) ? 0:1); k < n->req(); k++) {
|
|
||||||
Node *def = n->in(k);
|
|
||||||
uint x = _lrg_map.live_range_id(def);
|
|
||||||
if (!x) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
LRG &lrg = lrgs(x);
|
|
||||||
// No use-side cost for spilling debug info
|
|
||||||
if (k < debug_start) {
|
|
||||||
// A USE costs twice block frequency (once for the Load, once
|
|
||||||
// for a Load-delay). Rematerialized uses only cost once.
|
|
||||||
lrg._cost += (def->rematerialize() ? block->_freq : (block->_freq + block->_freq));
|
|
||||||
}
|
|
||||||
// It is live now
|
|
||||||
if (liveout.insert(x)) {
|
|
||||||
// Newly live things assumed live from here to top of block
|
|
||||||
lrg._area += cost;
|
|
||||||
// Adjust register pressure
|
|
||||||
if (lrg.mask().is_UP() && lrg.mask_size()) {
|
|
||||||
if (lrg._is_float || lrg._is_vector) {
|
|
||||||
pressure[1] += lrg.reg_pressure();
|
|
||||||
if (pressure[1] > block->_freg_pressure) {
|
|
||||||
block->_freg_pressure = pressure[1];
|
|
||||||
}
|
|
||||||
} else if( lrg.mask().overlap(*Matcher::idealreg2regmask[Op_RegI]) ) {
|
|
||||||
pressure[0] += lrg.reg_pressure();
|
|
||||||
if (pressure[0] > block->_reg_pressure) {
|
|
||||||
block->_reg_pressure = pressure[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert( pressure[0] == count_int_pressure (&liveout), "" );
|
|
||||||
assert( pressure[1] == count_float_pressure(&liveout), "" );
|
|
||||||
}
|
|
||||||
assert(!(lrg._area < 0.0), "negative spill area" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // End of reverse pass over all instructions in block
|
|
||||||
|
|
||||||
// If we run off the top of the block with high pressure and
|
|
||||||
// never see a hi-to-low pressure transition, just record that
|
|
||||||
// the whole block is high pressure.
|
|
||||||
if (pressure[0] > (uint)INTPRESSURE) {
|
|
||||||
hrp_index[0] = 0;
|
|
||||||
if (pressure[0] > block->_reg_pressure) {
|
|
||||||
block->_reg_pressure = pressure[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pressure[1] > (uint)FLOATPRESSURE) {
|
|
||||||
hrp_index[1] = 0;
|
|
||||||
if (pressure[1] > block->_freg_pressure) {
|
|
||||||
block->_freg_pressure = pressure[1];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute high pressure indice; avoid landing in the middle of projnodes
|
check_for_high_pressure_block(int_pressure);
|
||||||
j = hrp_index[0];
|
check_for_high_pressure_block(float_pressure);
|
||||||
if (j < block->number_of_nodes() && j < block->end_idx() + 1) {
|
adjust_high_pressure_index(block, block->_ihrp_index, int_pressure);
|
||||||
Node* cur = block->get_node(j);
|
adjust_high_pressure_index(block, block->_fhrp_index, float_pressure);
|
||||||
while (cur->is_Proj() || (cur->is_MachNullCheck()) || cur->is_Catch()) {
|
// set the final_pressure as the register pressure for the block
|
||||||
j--;
|
block->_reg_pressure = int_pressure._final_pressure;
|
||||||
cur = block->get_node(j);
|
block->_freg_pressure = float_pressure._final_pressure;
|
||||||
}
|
|
||||||
}
|
|
||||||
block->_ihrp_index = j;
|
|
||||||
j = hrp_index[1];
|
|
||||||
if (j < block->number_of_nodes() && j < block->end_idx() + 1) {
|
|
||||||
Node* cur = block->get_node(j);
|
|
||||||
while (cur->is_Proj() || (cur->is_MachNullCheck()) || cur->is_Catch()) {
|
|
||||||
j--;
|
|
||||||
cur = block->get_node(j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
block->_fhrp_index = j;
|
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
// Gather Register Pressure Statistics
|
// Gather Register Pressure Statistics
|
||||||
if (PrintOptoStatistics) {
|
if (PrintOptoStatistics) {
|
||||||
if (block->_reg_pressure > (uint)INTPRESSURE || block->_freg_pressure > (uint)FLOATPRESSURE) {
|
if (block->_reg_pressure > int_pressure._high_pressure_limit || block->_freg_pressure > float_pressure._high_pressure_limit) {
|
||||||
_high_pressure++;
|
_high_pressure++;
|
||||||
} else {
|
} else {
|
||||||
_low_pressure++;
|
_low_pressure++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} // End of for all blocks
|
}
|
||||||
|
|
||||||
return must_spill;
|
return must_spill;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1115,8 +1115,8 @@ BoolNode *PhaseIdealLoop::clone_iff( PhiNode *phi, IdealLoopTree *loop ) {
|
||||||
Node *n2 = phi->in(i)->in(1)->in(2);
|
Node *n2 = phi->in(i)->in(1)->in(2);
|
||||||
phi1->set_req( i, n1 );
|
phi1->set_req( i, n1 );
|
||||||
phi2->set_req( i, n2 );
|
phi2->set_req( i, n2 );
|
||||||
phi1->set_type( phi1->type()->meet(n1->bottom_type()) );
|
phi1->set_type( phi1->type()->meet_speculative(n1->bottom_type()));
|
||||||
phi2->set_type( phi2->type()->meet(n2->bottom_type()) );
|
phi2->set_type( phi2->type()->meet_speculative(n2->bottom_type()));
|
||||||
}
|
}
|
||||||
// See if these Phis have been made before.
|
// See if these Phis have been made before.
|
||||||
// Register with optimizer
|
// Register with optimizer
|
||||||
|
@ -1189,8 +1189,8 @@ CmpNode *PhaseIdealLoop::clone_bool( PhiNode *phi, IdealLoopTree *loop ) {
|
||||||
}
|
}
|
||||||
phi1->set_req( j, n1 );
|
phi1->set_req( j, n1 );
|
||||||
phi2->set_req( j, n2 );
|
phi2->set_req( j, n2 );
|
||||||
phi1->set_type( phi1->type()->meet(n1->bottom_type()) );
|
phi1->set_type(phi1->type()->meet_speculative(n1->bottom_type()));
|
||||||
phi2->set_type( phi2->type()->meet(n2->bottom_type()) );
|
phi2->set_type(phi2->type()->meet_speculative(n2->bottom_type()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if these Phis have been made before.
|
// See if these Phis have been made before.
|
||||||
|
|
|
@ -657,7 +657,7 @@ const TypePtr* MemNode::calculate_adr_type(const Type* t, const TypePtr* cross_c
|
||||||
// disregarding "null"-ness.
|
// disregarding "null"-ness.
|
||||||
// (We make an exception for TypeRawPtr::BOTTOM, which is a bit bucket.)
|
// (We make an exception for TypeRawPtr::BOTTOM, which is a bit bucket.)
|
||||||
const TypePtr* tp_notnull = tp->join(TypePtr::NOTNULL)->is_ptr();
|
const TypePtr* tp_notnull = tp->join(TypePtr::NOTNULL)->is_ptr();
|
||||||
assert(cross_check->meet(tp_notnull) == cross_check,
|
assert(cross_check->meet(tp_notnull) == cross_check->remove_speculative(),
|
||||||
"real address must not escape from expected memory type");
|
"real address must not escape from expected memory type");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1685,7 +1685,7 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const {
|
||||||
// t might actually be lower than _type, if _type is a unique
|
// t might actually be lower than _type, if _type is a unique
|
||||||
// concrete subclass of abstract class t.
|
// concrete subclass of abstract class t.
|
||||||
if (off_beyond_header) { // is the offset beyond the header?
|
if (off_beyond_header) { // is the offset beyond the header?
|
||||||
const Type* jt = t->join(_type);
|
const Type* jt = t->join_speculative(_type);
|
||||||
// In any case, do not allow the join, per se, to empty out the type.
|
// In any case, do not allow the join, per se, to empty out the type.
|
||||||
if (jt->empty() && !t->empty()) {
|
if (jt->empty() && !t->empty()) {
|
||||||
// This can happen if a interface-typed array narrows to a class type.
|
// This can happen if a interface-typed array narrows to a class type.
|
||||||
|
|
|
@ -94,7 +94,7 @@ const Type* ProjNode::proj_type(const Type* t) const {
|
||||||
if ((_con == TypeFunc::Parms) &&
|
if ((_con == TypeFunc::Parms) &&
|
||||||
n->is_CallStaticJava() && n->as_CallStaticJava()->is_boxing_method()) {
|
n->is_CallStaticJava() && n->as_CallStaticJava()->is_boxing_method()) {
|
||||||
// The result of autoboxing is always non-null on normal path.
|
// The result of autoboxing is always non-null on normal path.
|
||||||
t = t->join(TypePtr::NOTNULL);
|
t = t->join_speculative(TypePtr::NOTNULL);
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
|
@ -995,13 +995,13 @@ void Node::raise_bottom_type(const Type* new_type) {
|
||||||
if (is_Type()) {
|
if (is_Type()) {
|
||||||
TypeNode *n = this->as_Type();
|
TypeNode *n = this->as_Type();
|
||||||
if (VerifyAliases) {
|
if (VerifyAliases) {
|
||||||
assert(new_type->higher_equal(n->type()), "new type must refine old type");
|
assert(new_type->higher_equal_speculative(n->type()), "new type must refine old type");
|
||||||
}
|
}
|
||||||
n->set_type(new_type);
|
n->set_type(new_type);
|
||||||
} else if (is_Load()) {
|
} else if (is_Load()) {
|
||||||
LoadNode *n = this->as_Load();
|
LoadNode *n = this->as_Load();
|
||||||
if (VerifyAliases) {
|
if (VerifyAliases) {
|
||||||
assert(new_type->higher_equal(n->type()), "new type must refine old type");
|
assert(new_type->higher_equal_speculative(n->type()), "new type must refine old type");
|
||||||
}
|
}
|
||||||
n->set_type(new_type);
|
n->set_type(new_type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1656,7 +1656,7 @@ void Parse::merge_common(Parse::Block* target, int pnum) {
|
||||||
assert(bt1 != Type::BOTTOM, "should not be building conflict phis");
|
assert(bt1 != Type::BOTTOM, "should not be building conflict phis");
|
||||||
map()->set_req(j, _gvn.transform_no_reclaim(phi));
|
map()->set_req(j, _gvn.transform_no_reclaim(phi));
|
||||||
debug_only(const Type* bt2 = phi->bottom_type());
|
debug_only(const Type* bt2 = phi->bottom_type());
|
||||||
assert(bt2->higher_equal(bt1), "must be consistent with type-flow");
|
assert(bt2->higher_equal_speculative(bt1), "must be consistent with type-flow");
|
||||||
record_for_igvn(phi);
|
record_for_igvn(phi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2029,7 +2029,7 @@ void Parse::return_current(Node* value) {
|
||||||
!tp->klass()->is_interface()) {
|
!tp->klass()->is_interface()) {
|
||||||
// sharpen the type eagerly; this eases certain assert checking
|
// sharpen the type eagerly; this eases certain assert checking
|
||||||
if (tp->higher_equal(TypeInstPtr::NOTNULL))
|
if (tp->higher_equal(TypeInstPtr::NOTNULL))
|
||||||
tr = tr->join(TypeInstPtr::NOTNULL)->is_instptr();
|
tr = tr->join_speculative(TypeInstPtr::NOTNULL)->is_instptr();
|
||||||
value = _gvn.transform(new (C) CheckCastPPNode(0,value,tr));
|
value = _gvn.transform(new (C) CheckCastPPNode(0,value,tr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ Node* Parse::array_addressing(BasicType type, int vals, const Type* *result2) {
|
||||||
if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) {
|
if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) {
|
||||||
// If we load from "AbstractClass[]" we must see "ConcreteSubClass".
|
// If we load from "AbstractClass[]" we must see "ConcreteSubClass".
|
||||||
const Type* subklass = Type::get_const_type(toop->klass());
|
const Type* subklass = Type::get_const_type(toop->klass());
|
||||||
elemtype = subklass->join(el);
|
elemtype = subklass->join_speculative(el);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1278,7 +1278,7 @@ void Parse::sharpen_type_after_if(BoolTest::mask btest,
|
||||||
// Bool(CmpP(LoadKlass(obj._klass), ConP(Foo.klass)), [eq])
|
// Bool(CmpP(LoadKlass(obj._klass), ConP(Foo.klass)), [eq])
|
||||||
// or the narrowOop equivalent.
|
// or the narrowOop equivalent.
|
||||||
const Type* obj_type = _gvn.type(obj);
|
const Type* obj_type = _gvn.type(obj);
|
||||||
const TypeOopPtr* tboth = obj_type->join(con_type)->isa_oopptr();
|
const TypeOopPtr* tboth = obj_type->join_speculative(con_type)->isa_oopptr();
|
||||||
if (tboth != NULL && tboth->klass_is_exact() && tboth != obj_type &&
|
if (tboth != NULL && tboth->klass_is_exact() && tboth != obj_type &&
|
||||||
tboth->higher_equal(obj_type)) {
|
tboth->higher_equal(obj_type)) {
|
||||||
// obj has to be of the exact type Foo if the CmpP succeeds.
|
// obj has to be of the exact type Foo if the CmpP succeeds.
|
||||||
|
@ -1288,7 +1288,7 @@ void Parse::sharpen_type_after_if(BoolTest::mask btest,
|
||||||
(jvms->is_loc(obj_in_map) || jvms->is_stk(obj_in_map))) {
|
(jvms->is_loc(obj_in_map) || jvms->is_stk(obj_in_map))) {
|
||||||
TypeNode* ccast = new (C) CheckCastPPNode(control(), obj, tboth);
|
TypeNode* ccast = new (C) CheckCastPPNode(control(), obj, tboth);
|
||||||
const Type* tcc = ccast->as_Type()->type();
|
const Type* tcc = ccast->as_Type()->type();
|
||||||
assert(tcc != obj_type && tcc->higher_equal(obj_type), "must improve");
|
assert(tcc != obj_type && tcc->higher_equal_speculative(obj_type), "must improve");
|
||||||
// Delay transform() call to allow recovery of pre-cast value
|
// Delay transform() call to allow recovery of pre-cast value
|
||||||
// at the control merge.
|
// at the control merge.
|
||||||
_gvn.set_type_bottom(ccast);
|
_gvn.set_type_bottom(ccast);
|
||||||
|
@ -1318,7 +1318,7 @@ void Parse::sharpen_type_after_if(BoolTest::mask btest,
|
||||||
switch (btest) {
|
switch (btest) {
|
||||||
case BoolTest::eq: // Constant test?
|
case BoolTest::eq: // Constant test?
|
||||||
{
|
{
|
||||||
const Type* tboth = tcon->join(tval);
|
const Type* tboth = tcon->join_speculative(tval);
|
||||||
if (tboth == tval) break; // Nothing to gain.
|
if (tboth == tval) break; // Nothing to gain.
|
||||||
if (tcon->isa_int()) {
|
if (tcon->isa_int()) {
|
||||||
ccast = new (C) CastIINode(val, tboth);
|
ccast = new (C) CastIINode(val, tboth);
|
||||||
|
@ -1352,7 +1352,7 @@ void Parse::sharpen_type_after_if(BoolTest::mask btest,
|
||||||
|
|
||||||
if (ccast != NULL) {
|
if (ccast != NULL) {
|
||||||
const Type* tcc = ccast->as_Type()->type();
|
const Type* tcc = ccast->as_Type()->type();
|
||||||
assert(tcc != tval && tcc->higher_equal(tval), "must improve");
|
assert(tcc != tval && tcc->higher_equal_speculative(tval), "must improve");
|
||||||
// Delay transform() call to allow recovery of pre-cast value
|
// Delay transform() call to allow recovery of pre-cast value
|
||||||
// at the control merge.
|
// at the control merge.
|
||||||
ccast->set_req(0, control());
|
ccast->set_req(0, control());
|
||||||
|
|
|
@ -361,7 +361,7 @@ bool Parse::push_constant(ciConstant constant, bool require_constant, bool is_au
|
||||||
// should_be_constant = (oop not scavengable || ScavengeRootsInCode >= 2)
|
// should_be_constant = (oop not scavengable || ScavengeRootsInCode >= 2)
|
||||||
// An oop is not scavengable if it is in the perm gen.
|
// An oop is not scavengable if it is in the perm gen.
|
||||||
if (stable_type != NULL && con_type != NULL && con_type->isa_oopptr())
|
if (stable_type != NULL && con_type != NULL && con_type->isa_oopptr())
|
||||||
con_type = con_type->join(stable_type);
|
con_type = con_type->join_speculative(stable_type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_ILLEGAL:
|
case T_ILLEGAL:
|
||||||
|
|
|
@ -323,6 +323,23 @@ void NodeHash::remove_useless_nodes(VectorSet &useful) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void NodeHash::check_no_speculative_types() {
|
||||||
|
#ifdef ASSERT
|
||||||
|
uint max = size();
|
||||||
|
Node *sentinel_node = sentinel();
|
||||||
|
for (uint i = 0; i < max; ++i) {
|
||||||
|
Node *n = at(i);
|
||||||
|
if(n != NULL && n != sentinel_node && n->is_Type()) {
|
||||||
|
TypeNode* tn = n->as_Type();
|
||||||
|
const Type* t = tn->type();
|
||||||
|
const Type* t_no_spec = t->remove_speculative();
|
||||||
|
assert(t == t_no_spec, "dead node in hash table or missed node during speculative cleanup");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
//------------------------------dump-------------------------------------------
|
//------------------------------dump-------------------------------------------
|
||||||
// Dump statistics for the hash table
|
// Dump statistics for the hash table
|
||||||
|
@ -1392,11 +1409,11 @@ void PhaseIterGVN::remove_speculative_types() {
|
||||||
assert(UseTypeSpeculation, "speculation is off");
|
assert(UseTypeSpeculation, "speculation is off");
|
||||||
for (uint i = 0; i < _types.Size(); i++) {
|
for (uint i = 0; i < _types.Size(); i++) {
|
||||||
const Type* t = _types.fast_lookup(i);
|
const Type* t = _types.fast_lookup(i);
|
||||||
if (t != NULL && t->isa_oopptr()) {
|
if (t != NULL) {
|
||||||
const TypeOopPtr* to = t->is_oopptr();
|
_types.map(i, t->remove_speculative());
|
||||||
_types.map(i, to->remove_speculative());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_table.check_no_speculative_types();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
|
@ -93,6 +93,7 @@ public:
|
||||||
|
|
||||||
void remove_useless_nodes(VectorSet &useful); // replace with sentinel
|
void remove_useless_nodes(VectorSet &useful); // replace with sentinel
|
||||||
void replace_with(NodeHash* nh);
|
void replace_with(NodeHash* nh);
|
||||||
|
void check_no_speculative_types(); // Check no speculative part for type nodes in table
|
||||||
|
|
||||||
Node *sentinel() { return _sentinel; }
|
Node *sentinel() { return _sentinel; }
|
||||||
|
|
||||||
|
@ -501,6 +502,9 @@ public:
|
||||||
Deoptimization::DeoptReason reason);
|
Deoptimization::DeoptReason reason);
|
||||||
|
|
||||||
void remove_speculative_types();
|
void remove_speculative_types();
|
||||||
|
void check_no_speculative_types() {
|
||||||
|
_table.check_no_speculative_types();
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -241,6 +241,13 @@ int Type::cmp( const Type *const t1, const Type *const t2 ) {
|
||||||
return !t1->eq(t2); // Return ZERO if equal
|
return !t1->eq(t2); // Return ZERO if equal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Type* Type::maybe_remove_speculative(bool include_speculative) const {
|
||||||
|
if (!include_speculative) {
|
||||||
|
return remove_speculative();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------hash-------------------------------------------
|
//------------------------------hash-------------------------------------------
|
||||||
int Type::uhash( const Type *const t ) {
|
int Type::uhash( const Type *const t ) {
|
||||||
return t->hash();
|
return t->hash();
|
||||||
|
@ -633,37 +640,40 @@ bool Type::interface_vs_oop(const Type *t) const {
|
||||||
//------------------------------meet-------------------------------------------
|
//------------------------------meet-------------------------------------------
|
||||||
// Compute the MEET of two types. NOT virtual. It enforces that meet is
|
// Compute the MEET of two types. NOT virtual. It enforces that meet is
|
||||||
// commutative and the lattice is symmetric.
|
// commutative and the lattice is symmetric.
|
||||||
const Type *Type::meet( const Type *t ) const {
|
const Type *Type::meet_helper(const Type *t, bool include_speculative) const {
|
||||||
if (isa_narrowoop() && t->isa_narrowoop()) {
|
if (isa_narrowoop() && t->isa_narrowoop()) {
|
||||||
const Type* result = make_ptr()->meet(t->make_ptr());
|
const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative);
|
||||||
return result->make_narrowoop();
|
return result->make_narrowoop();
|
||||||
}
|
}
|
||||||
if (isa_narrowklass() && t->isa_narrowklass()) {
|
if (isa_narrowklass() && t->isa_narrowklass()) {
|
||||||
const Type* result = make_ptr()->meet(t->make_ptr());
|
const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative);
|
||||||
return result->make_narrowklass();
|
return result->make_narrowklass();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Type *mt = xmeet(t);
|
const Type *this_t = maybe_remove_speculative(include_speculative);
|
||||||
|
t = t->maybe_remove_speculative(include_speculative);
|
||||||
|
|
||||||
|
const Type *mt = this_t->xmeet(t);
|
||||||
if (isa_narrowoop() || t->isa_narrowoop()) return mt;
|
if (isa_narrowoop() || t->isa_narrowoop()) return mt;
|
||||||
if (isa_narrowklass() || t->isa_narrowklass()) return mt;
|
if (isa_narrowklass() || t->isa_narrowklass()) return mt;
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
assert( mt == t->xmeet(this), "meet not commutative" );
|
assert(mt == t->xmeet(this_t), "meet not commutative");
|
||||||
const Type* dual_join = mt->_dual;
|
const Type* dual_join = mt->_dual;
|
||||||
const Type *t2t = dual_join->xmeet(t->_dual);
|
const Type *t2t = dual_join->xmeet(t->_dual);
|
||||||
const Type *t2this = dual_join->xmeet( _dual);
|
const Type *t2this = dual_join->xmeet(this_t->_dual);
|
||||||
|
|
||||||
// Interface meet Oop is Not Symmetric:
|
// Interface meet Oop is Not Symmetric:
|
||||||
// Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull
|
// Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull
|
||||||
// Interface:NotNull meet Oop:NotNull == java/lang/Object:NotNull
|
// Interface:NotNull meet Oop:NotNull == java/lang/Object:NotNull
|
||||||
|
|
||||||
if( !interface_vs_oop(t) && (t2t != t->_dual || t2this != _dual) ) {
|
if( !interface_vs_oop(t) && (t2t != t->_dual || t2this != this_t->_dual) ) {
|
||||||
tty->print_cr("=== Meet Not Symmetric ===");
|
tty->print_cr("=== Meet Not Symmetric ===");
|
||||||
tty->print("t = "); t->dump(); tty->cr();
|
tty->print("t = "); t->dump(); tty->cr();
|
||||||
tty->print("this= "); dump(); tty->cr();
|
tty->print("this= "); this_t->dump(); tty->cr();
|
||||||
tty->print("mt=(t meet this)= "); mt->dump(); tty->cr();
|
tty->print("mt=(t meet this)= "); mt->dump(); tty->cr();
|
||||||
|
|
||||||
tty->print("t_dual= "); t->_dual->dump(); tty->cr();
|
tty->print("t_dual= "); t->_dual->dump(); tty->cr();
|
||||||
tty->print("this_dual= "); _dual->dump(); tty->cr();
|
tty->print("this_dual= "); this_t->_dual->dump(); tty->cr();
|
||||||
tty->print("mt_dual= "); mt->_dual->dump(); tty->cr();
|
tty->print("mt_dual= "); mt->_dual->dump(); tty->cr();
|
||||||
|
|
||||||
tty->print("mt_dual meet t_dual= "); t2t ->dump(); tty->cr();
|
tty->print("mt_dual meet t_dual= "); t2t ->dump(); tty->cr();
|
||||||
|
@ -759,8 +769,8 @@ const Type *Type::xmeet( const Type *t ) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------filter------------------------------------------
|
//-----------------------------filter------------------------------------------
|
||||||
const Type *Type::filter( const Type *kills ) const {
|
const Type *Type::filter_helper(const Type *kills, bool include_speculative) const {
|
||||||
const Type* ft = join(kills);
|
const Type* ft = join_helper(kills, include_speculative);
|
||||||
if (ft->empty())
|
if (ft->empty())
|
||||||
return Type::TOP; // Canonical empty value
|
return Type::TOP; // Canonical empty value
|
||||||
return ft;
|
return ft;
|
||||||
|
@ -1314,8 +1324,8 @@ const Type *TypeInt::narrow( const Type *old ) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------filter------------------------------------------
|
//-----------------------------filter------------------------------------------
|
||||||
const Type *TypeInt::filter( const Type *kills ) const {
|
const Type *TypeInt::filter_helper(const Type *kills, bool include_speculative) const {
|
||||||
const TypeInt* ft = join(kills)->isa_int();
|
const TypeInt* ft = join_helper(kills, include_speculative)->isa_int();
|
||||||
if (ft == NULL || ft->empty())
|
if (ft == NULL || ft->empty())
|
||||||
return Type::TOP; // Canonical empty value
|
return Type::TOP; // Canonical empty value
|
||||||
if (ft->_widen < this->_widen) {
|
if (ft->_widen < this->_widen) {
|
||||||
|
@ -1575,8 +1585,8 @@ const Type *TypeLong::narrow( const Type *old ) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------filter------------------------------------------
|
//-----------------------------filter------------------------------------------
|
||||||
const Type *TypeLong::filter( const Type *kills ) const {
|
const Type *TypeLong::filter_helper(const Type *kills, bool include_speculative) const {
|
||||||
const TypeLong* ft = join(kills)->isa_long();
|
const TypeLong* ft = join_helper(kills, include_speculative)->isa_long();
|
||||||
if (ft == NULL || ft->empty())
|
if (ft == NULL || ft->empty())
|
||||||
return Type::TOP; // Canonical empty value
|
return Type::TOP; // Canonical empty value
|
||||||
if (ft->_widen < this->_widen) {
|
if (ft->_widen < this->_widen) {
|
||||||
|
@ -1731,7 +1741,7 @@ const TypeTuple *TypeTuple::make_domain(ciInstanceKlass* recv, ciSignature* sig)
|
||||||
total_fields++;
|
total_fields++;
|
||||||
field_array = fields(total_fields);
|
field_array = fields(total_fields);
|
||||||
// Use get_const_type here because it respects UseUniqueSubclasses:
|
// Use get_const_type here because it respects UseUniqueSubclasses:
|
||||||
field_array[pos++] = get_const_type(recv)->join(TypePtr::NOTNULL);
|
field_array[pos++] = get_const_type(recv)->join_speculative(TypePtr::NOTNULL);
|
||||||
} else {
|
} else {
|
||||||
field_array = fields(total_fields);
|
field_array = fields(total_fields);
|
||||||
}
|
}
|
||||||
|
@ -1921,7 +1931,7 @@ const Type *TypeAry::xmeet( const Type *t ) const {
|
||||||
|
|
||||||
case Array: { // Meeting 2 arrays?
|
case Array: { // Meeting 2 arrays?
|
||||||
const TypeAry *a = t->is_ary();
|
const TypeAry *a = t->is_ary();
|
||||||
return TypeAry::make(_elem->meet(a->_elem),
|
return TypeAry::make(_elem->meet_speculative(a->_elem),
|
||||||
_size->xmeet(a->_size)->is_int(),
|
_size->xmeet(a->_size)->is_int(),
|
||||||
_stable & a->_stable);
|
_stable & a->_stable);
|
||||||
}
|
}
|
||||||
|
@ -1954,6 +1964,13 @@ int TypeAry::hash(void) const {
|
||||||
return (intptr_t)_elem + (intptr_t)_size + (_stable ? 43 : 0);
|
return (intptr_t)_elem + (intptr_t)_size + (_stable ? 43 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return same type without a speculative part in the element
|
||||||
|
*/
|
||||||
|
const Type* TypeAry::remove_speculative() const {
|
||||||
|
return make(_elem->remove_speculative(), _size, _stable);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------interface_vs_oop---------------------------------------
|
//----------------------interface_vs_oop---------------------------------------
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
bool TypeAry::interface_vs_oop(const Type *t) const {
|
bool TypeAry::interface_vs_oop(const Type *t) const {
|
||||||
|
@ -2566,14 +2583,14 @@ const Type *TypeOopPtr::xmeet(const Type *t) const {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res->isa_oopptr() != NULL) {
|
const TypeOopPtr* res_oopptr = res->is_oopptr();
|
||||||
|
if (res_oopptr->speculative() != NULL) {
|
||||||
// type->speculative() == NULL means that speculation is no better
|
// type->speculative() == NULL means that speculation is no better
|
||||||
// than type, i.e. type->speculative() == type. So there are 2
|
// than type, i.e. type->speculative() == type. So there are 2
|
||||||
// ways to represent the fact that we have no useful speculative
|
// ways to represent the fact that we have no useful speculative
|
||||||
// data and we should use a single one to be able to test for
|
// data and we should use a single one to be able to test for
|
||||||
// equality between types. Check whether type->speculative() ==
|
// equality between types. Check whether type->speculative() ==
|
||||||
// type and set speculative to NULL if it is the case.
|
// type and set speculative to NULL if it is the case.
|
||||||
const TypeOopPtr* res_oopptr = res->is_oopptr();
|
|
||||||
if (res_oopptr->remove_speculative() == res_oopptr->speculative()) {
|
if (res_oopptr->remove_speculative() == res_oopptr->speculative()) {
|
||||||
return res_oopptr->remove_speculative();
|
return res_oopptr->remove_speculative();
|
||||||
}
|
}
|
||||||
|
@ -2639,7 +2656,7 @@ const Type *TypeOopPtr::xmeet_helper(const Type *t) const {
|
||||||
case OopPtr: { // Meeting to other OopPtrs
|
case OopPtr: { // Meeting to other OopPtrs
|
||||||
const TypeOopPtr *tp = t->is_oopptr();
|
const TypeOopPtr *tp = t->is_oopptr();
|
||||||
int instance_id = meet_instance_id(tp->instance_id());
|
int instance_id = meet_instance_id(tp->instance_id());
|
||||||
const TypeOopPtr* speculative = meet_speculative(tp);
|
const TypeOopPtr* speculative = xmeet_speculative(tp);
|
||||||
return make(meet_ptr(tp->ptr()), meet_offset(tp->offset()), instance_id, speculative);
|
return make(meet_ptr(tp->ptr()), meet_offset(tp->offset()), instance_id, speculative);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2793,9 +2810,9 @@ intptr_t TypeOopPtr::get_con() const {
|
||||||
|
|
||||||
//-----------------------------filter------------------------------------------
|
//-----------------------------filter------------------------------------------
|
||||||
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
||||||
const Type *TypeOopPtr::filter(const Type *kills) const {
|
const Type *TypeOopPtr::filter_helper(const Type *kills, bool include_speculative) const {
|
||||||
|
|
||||||
const Type* ft = join(kills);
|
const Type* ft = join_helper(kills, include_speculative);
|
||||||
const TypeInstPtr* ftip = ft->isa_instptr();
|
const TypeInstPtr* ftip = ft->isa_instptr();
|
||||||
const TypeInstPtr* ktip = kills->isa_instptr();
|
const TypeInstPtr* ktip = kills->isa_instptr();
|
||||||
|
|
||||||
|
@ -2907,7 +2924,10 @@ const TypePtr *TypeOopPtr::add_offset(intptr_t offset) const {
|
||||||
/**
|
/**
|
||||||
* Return same type without a speculative part
|
* Return same type without a speculative part
|
||||||
*/
|
*/
|
||||||
const TypeOopPtr* TypeOopPtr::remove_speculative() const {
|
const Type* TypeOopPtr::remove_speculative() const {
|
||||||
|
if (_speculative == NULL) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
return make(_ptr, _offset, _instance_id, NULL);
|
return make(_ptr, _offset, _instance_id, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2933,7 +2953,7 @@ int TypeOopPtr::dual_instance_id( ) const {
|
||||||
*
|
*
|
||||||
* @param other type to meet with
|
* @param other type to meet with
|
||||||
*/
|
*/
|
||||||
const TypeOopPtr* TypeOopPtr::meet_speculative(const TypeOopPtr* other) const {
|
const TypeOopPtr* TypeOopPtr::xmeet_speculative(const TypeOopPtr* other) const {
|
||||||
bool this_has_spec = (_speculative != NULL);
|
bool this_has_spec = (_speculative != NULL);
|
||||||
bool other_has_spec = (other->speculative() != NULL);
|
bool other_has_spec = (other->speculative() != NULL);
|
||||||
|
|
||||||
|
@ -2958,7 +2978,7 @@ const TypeOopPtr* TypeOopPtr::meet_speculative(const TypeOopPtr* other) const {
|
||||||
other_spec = other;
|
other_spec = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this_spec->meet(other_spec)->is_oopptr();
|
return this_spec->meet_speculative(other_spec)->is_oopptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3117,7 +3137,7 @@ const TypeInstPtr *TypeInstPtr::xmeet_unloaded(const TypeInstPtr *tinst) const {
|
||||||
int off = meet_offset(tinst->offset());
|
int off = meet_offset(tinst->offset());
|
||||||
PTR ptr = meet_ptr(tinst->ptr());
|
PTR ptr = meet_ptr(tinst->ptr());
|
||||||
int instance_id = meet_instance_id(tinst->instance_id());
|
int instance_id = meet_instance_id(tinst->instance_id());
|
||||||
const TypeOopPtr* speculative = meet_speculative(tinst);
|
const TypeOopPtr* speculative = xmeet_speculative(tinst);
|
||||||
|
|
||||||
const TypeInstPtr *loaded = is_loaded() ? this : tinst;
|
const TypeInstPtr *loaded = is_loaded() ? this : tinst;
|
||||||
const TypeInstPtr *unloaded = is_loaded() ? tinst : this;
|
const TypeInstPtr *unloaded = is_loaded() ? tinst : this;
|
||||||
|
@ -3194,7 +3214,7 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {
|
||||||
int offset = meet_offset(tp->offset());
|
int offset = meet_offset(tp->offset());
|
||||||
PTR ptr = meet_ptr(tp->ptr());
|
PTR ptr = meet_ptr(tp->ptr());
|
||||||
int instance_id = meet_instance_id(tp->instance_id());
|
int instance_id = meet_instance_id(tp->instance_id());
|
||||||
const TypeOopPtr* speculative = meet_speculative(tp);
|
const TypeOopPtr* speculative = xmeet_speculative(tp);
|
||||||
switch (ptr) {
|
switch (ptr) {
|
||||||
case TopPTR:
|
case TopPTR:
|
||||||
case AnyNull: // Fall 'down' to dual of object klass
|
case AnyNull: // Fall 'down' to dual of object klass
|
||||||
|
@ -3244,14 +3264,14 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {
|
||||||
case TopPTR:
|
case TopPTR:
|
||||||
case AnyNull: {
|
case AnyNull: {
|
||||||
int instance_id = meet_instance_id(InstanceTop);
|
int instance_id = meet_instance_id(InstanceTop);
|
||||||
const TypeOopPtr* speculative = meet_speculative(tp);
|
const TypeOopPtr* speculative = xmeet_speculative(tp);
|
||||||
return make(ptr, klass(), klass_is_exact(),
|
return make(ptr, klass(), klass_is_exact(),
|
||||||
(ptr == Constant ? const_oop() : NULL), offset, instance_id, speculative);
|
(ptr == Constant ? const_oop() : NULL), offset, instance_id, speculative);
|
||||||
}
|
}
|
||||||
case NotNull:
|
case NotNull:
|
||||||
case BotPTR: {
|
case BotPTR: {
|
||||||
int instance_id = meet_instance_id(tp->instance_id());
|
int instance_id = meet_instance_id(tp->instance_id());
|
||||||
const TypeOopPtr* speculative = meet_speculative(tp);
|
const TypeOopPtr* speculative = xmeet_speculative(tp);
|
||||||
return TypeOopPtr::make(ptr, offset, instance_id, speculative);
|
return TypeOopPtr::make(ptr, offset, instance_id, speculative);
|
||||||
}
|
}
|
||||||
default: typerr(t);
|
default: typerr(t);
|
||||||
|
@ -3303,7 +3323,7 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {
|
||||||
int off = meet_offset( tinst->offset() );
|
int off = meet_offset( tinst->offset() );
|
||||||
PTR ptr = meet_ptr( tinst->ptr() );
|
PTR ptr = meet_ptr( tinst->ptr() );
|
||||||
int instance_id = meet_instance_id(tinst->instance_id());
|
int instance_id = meet_instance_id(tinst->instance_id());
|
||||||
const TypeOopPtr* speculative = meet_speculative(tinst);
|
const TypeOopPtr* speculative = xmeet_speculative(tinst);
|
||||||
|
|
||||||
// Check for easy case; klasses are equal (and perhaps not loaded!)
|
// Check for easy case; klasses are equal (and perhaps not loaded!)
|
||||||
// If we have constants, then we created oops so classes are loaded
|
// If we have constants, then we created oops so classes are loaded
|
||||||
|
@ -3552,7 +3572,10 @@ const TypePtr *TypeInstPtr::add_offset(intptr_t offset) const {
|
||||||
return make(_ptr, klass(), klass_is_exact(), const_oop(), xadd_offset(offset), _instance_id, add_offset_speculative(offset));
|
return make(_ptr, klass(), klass_is_exact(), const_oop(), xadd_offset(offset), _instance_id, add_offset_speculative(offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
const TypeOopPtr *TypeInstPtr::remove_speculative() const {
|
const Type *TypeInstPtr::remove_speculative() const {
|
||||||
|
if (_speculative == NULL) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
return make(_ptr, klass(), klass_is_exact(), const_oop(), _offset, _instance_id, NULL);
|
return make(_ptr, klass(), klass_is_exact(), const_oop(), _offset, _instance_id, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3754,14 +3777,14 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
|
||||||
case TopPTR:
|
case TopPTR:
|
||||||
case AnyNull: {
|
case AnyNull: {
|
||||||
int instance_id = meet_instance_id(InstanceTop);
|
int instance_id = meet_instance_id(InstanceTop);
|
||||||
const TypeOopPtr* speculative = meet_speculative(tp);
|
const TypeOopPtr* speculative = xmeet_speculative(tp);
|
||||||
return make(ptr, (ptr == Constant ? const_oop() : NULL),
|
return make(ptr, (ptr == Constant ? const_oop() : NULL),
|
||||||
_ary, _klass, _klass_is_exact, offset, instance_id, speculative);
|
_ary, _klass, _klass_is_exact, offset, instance_id, speculative);
|
||||||
}
|
}
|
||||||
case BotPTR:
|
case BotPTR:
|
||||||
case NotNull: {
|
case NotNull: {
|
||||||
int instance_id = meet_instance_id(tp->instance_id());
|
int instance_id = meet_instance_id(tp->instance_id());
|
||||||
const TypeOopPtr* speculative = meet_speculative(tp);
|
const TypeOopPtr* speculative = xmeet_speculative(tp);
|
||||||
return TypeOopPtr::make(ptr, offset, instance_id, speculative);
|
return TypeOopPtr::make(ptr, offset, instance_id, speculative);
|
||||||
}
|
}
|
||||||
default: ShouldNotReachHere();
|
default: ShouldNotReachHere();
|
||||||
|
@ -3799,10 +3822,10 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
|
||||||
case AryPtr: { // Meeting 2 references?
|
case AryPtr: { // Meeting 2 references?
|
||||||
const TypeAryPtr *tap = t->is_aryptr();
|
const TypeAryPtr *tap = t->is_aryptr();
|
||||||
int off = meet_offset(tap->offset());
|
int off = meet_offset(tap->offset());
|
||||||
const TypeAry *tary = _ary->meet(tap->_ary)->is_ary();
|
const TypeAry *tary = _ary->meet_speculative(tap->_ary)->is_ary();
|
||||||
PTR ptr = meet_ptr(tap->ptr());
|
PTR ptr = meet_ptr(tap->ptr());
|
||||||
int instance_id = meet_instance_id(tap->instance_id());
|
int instance_id = meet_instance_id(tap->instance_id());
|
||||||
const TypeOopPtr* speculative = meet_speculative(tap);
|
const TypeOopPtr* speculative = xmeet_speculative(tap);
|
||||||
ciKlass* lazy_klass = NULL;
|
ciKlass* lazy_klass = NULL;
|
||||||
if (tary->_elem->isa_int()) {
|
if (tary->_elem->isa_int()) {
|
||||||
// Integral array element types have irrelevant lattice relations.
|
// Integral array element types have irrelevant lattice relations.
|
||||||
|
@ -3882,7 +3905,7 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
|
||||||
int offset = meet_offset(tp->offset());
|
int offset = meet_offset(tp->offset());
|
||||||
PTR ptr = meet_ptr(tp->ptr());
|
PTR ptr = meet_ptr(tp->ptr());
|
||||||
int instance_id = meet_instance_id(tp->instance_id());
|
int instance_id = meet_instance_id(tp->instance_id());
|
||||||
const TypeOopPtr* speculative = meet_speculative(tp);
|
const TypeOopPtr* speculative = xmeet_speculative(tp);
|
||||||
switch (ptr) {
|
switch (ptr) {
|
||||||
case TopPTR:
|
case TopPTR:
|
||||||
case AnyNull: // Fall 'down' to dual of object klass
|
case AnyNull: // Fall 'down' to dual of object klass
|
||||||
|
@ -3996,8 +4019,8 @@ const TypePtr *TypeAryPtr::add_offset(intptr_t offset) const {
|
||||||
return make(_ptr, _const_oop, _ary, _klass, _klass_is_exact, xadd_offset(offset), _instance_id, add_offset_speculative(offset));
|
return make(_ptr, _const_oop, _ary, _klass, _klass_is_exact, xadd_offset(offset), _instance_id, add_offset_speculative(offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
const TypeOopPtr *TypeAryPtr::remove_speculative() const {
|
const Type *TypeAryPtr::remove_speculative() const {
|
||||||
return make(_ptr, _const_oop, _ary, _klass, _klass_is_exact, _offset, _instance_id, NULL);
|
return make(_ptr, _const_oop, _ary->remove_speculative()->is_ary(), _klass, _klass_is_exact, _offset, _instance_id, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -4037,9 +4060,9 @@ const Type *TypeNarrowPtr::xdual() const { // Compute dual right now.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Type *TypeNarrowPtr::filter( const Type *kills ) const {
|
const Type *TypeNarrowPtr::filter_helper(const Type *kills, bool include_speculative) const {
|
||||||
if (isa_same_narrowptr(kills)) {
|
if (isa_same_narrowptr(kills)) {
|
||||||
const Type* ft =_ptrtype->filter(is_same_narrowptr(kills)->_ptrtype);
|
const Type* ft =_ptrtype->filter_helper(is_same_narrowptr(kills)->_ptrtype, include_speculative);
|
||||||
if (ft->empty())
|
if (ft->empty())
|
||||||
return Type::TOP; // Canonical empty value
|
return Type::TOP; // Canonical empty value
|
||||||
if (ft->isa_ptr()) {
|
if (ft->isa_ptr()) {
|
||||||
|
@ -4047,7 +4070,7 @@ const Type *TypeNarrowPtr::filter( const Type *kills ) const {
|
||||||
}
|
}
|
||||||
return ft;
|
return ft;
|
||||||
} else if (kills->isa_ptr()) {
|
} else if (kills->isa_ptr()) {
|
||||||
const Type* ft = _ptrtype->join(kills);
|
const Type* ft = _ptrtype->join_helper(kills, include_speculative);
|
||||||
if (ft->empty())
|
if (ft->empty())
|
||||||
return Type::TOP; // Canonical empty value
|
return Type::TOP; // Canonical empty value
|
||||||
return ft;
|
return ft;
|
||||||
|
@ -4177,8 +4200,8 @@ const TypePtr *TypeMetadataPtr::add_offset( intptr_t offset ) const {
|
||||||
|
|
||||||
//-----------------------------filter------------------------------------------
|
//-----------------------------filter------------------------------------------
|
||||||
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
||||||
const Type *TypeMetadataPtr::filter( const Type *kills ) const {
|
const Type *TypeMetadataPtr::filter_helper(const Type *kills, bool include_speculative) const {
|
||||||
const TypeMetadataPtr* ft = join(kills)->isa_metadataptr();
|
const TypeMetadataPtr* ft = join_helper(kills, include_speculative)->isa_metadataptr();
|
||||||
if (ft == NULL || ft->empty())
|
if (ft == NULL || ft->empty())
|
||||||
return Type::TOP; // Canonical empty value
|
return Type::TOP; // Canonical empty value
|
||||||
return ft;
|
return ft;
|
||||||
|
@ -4380,10 +4403,10 @@ bool TypeKlassPtr::singleton(void) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
||||||
const Type *TypeKlassPtr::filter(const Type *kills) const {
|
const Type *TypeKlassPtr::filter_helper(const Type *kills, bool include_speculative) const {
|
||||||
// logic here mirrors the one from TypeOopPtr::filter. See comments
|
// logic here mirrors the one from TypeOopPtr::filter. See comments
|
||||||
// there.
|
// there.
|
||||||
const Type* ft = join(kills);
|
const Type* ft = join_helper(kills, include_speculative);
|
||||||
const TypeKlassPtr* ftkp = ft->isa_klassptr();
|
const TypeKlassPtr* ftkp = ft->isa_klassptr();
|
||||||
const TypeKlassPtr* ktkp = kills->isa_klassptr();
|
const TypeKlassPtr* ktkp = kills->isa_klassptr();
|
||||||
|
|
||||||
|
|
|
@ -164,6 +164,8 @@ private:
|
||||||
virtual bool interface_vs_oop_helper(const Type *t) const;
|
virtual bool interface_vs_oop_helper(const Type *t) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const Type *meet_helper(const Type *t, bool include_speculative) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Each class of type is also identified by its base.
|
// Each class of type is also identified by its base.
|
||||||
const TYPES _base; // Enum of Types type
|
const TYPES _base; // Enum of Types type
|
||||||
|
@ -171,6 +173,10 @@ protected:
|
||||||
Type( TYPES t ) : _dual(NULL), _base(t) {} // Simple types
|
Type( TYPES t ) : _dual(NULL), _base(t) {} // Simple types
|
||||||
// ~Type(); // Use fast deallocation
|
// ~Type(); // Use fast deallocation
|
||||||
const Type *hashcons(); // Hash-cons the type
|
const Type *hashcons(); // Hash-cons the type
|
||||||
|
virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
|
||||||
|
const Type *join_helper(const Type *t, bool include_speculative) const {
|
||||||
|
return dual()->meet_helper(t->dual(), include_speculative)->dual();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -202,10 +208,24 @@ public:
|
||||||
// Test for equivalence of types
|
// Test for equivalence of types
|
||||||
static int cmp( const Type *const t1, const Type *const t2 );
|
static int cmp( const Type *const t1, const Type *const t2 );
|
||||||
// Test for higher or equal in lattice
|
// Test for higher or equal in lattice
|
||||||
int higher_equal( const Type *t ) const { return !cmp(meet(t),t); }
|
// Variant that drops the speculative part of the types
|
||||||
|
int higher_equal(const Type *t) const {
|
||||||
|
return !cmp(meet(t),t->remove_speculative());
|
||||||
|
}
|
||||||
|
// Variant that keeps the speculative part of the types
|
||||||
|
int higher_equal_speculative(const Type *t) const {
|
||||||
|
return !cmp(meet_speculative(t),t);
|
||||||
|
}
|
||||||
|
|
||||||
// MEET operation; lower in lattice.
|
// MEET operation; lower in lattice.
|
||||||
const Type *meet( const Type *t ) const;
|
// Variant that drops the speculative part of the types
|
||||||
|
const Type *meet(const Type *t) const {
|
||||||
|
return meet_helper(t, false);
|
||||||
|
}
|
||||||
|
// Variant that keeps the speculative part of the types
|
||||||
|
const Type *meet_speculative(const Type *t) const {
|
||||||
|
return meet_helper(t, true);
|
||||||
|
}
|
||||||
// WIDEN: 'widens' for Ints and other range types
|
// WIDEN: 'widens' for Ints and other range types
|
||||||
virtual const Type *widen( const Type *old, const Type* limit ) const { return this; }
|
virtual const Type *widen( const Type *old, const Type* limit ) const { return this; }
|
||||||
// NARROW: complement for widen, used by pessimistic phases
|
// NARROW: complement for widen, used by pessimistic phases
|
||||||
|
@ -221,13 +241,26 @@ public:
|
||||||
|
|
||||||
// JOIN operation; higher in lattice. Done by finding the dual of the
|
// JOIN operation; higher in lattice. Done by finding the dual of the
|
||||||
// meet of the dual of the 2 inputs.
|
// meet of the dual of the 2 inputs.
|
||||||
|
// Variant that drops the speculative part of the types
|
||||||
const Type *join(const Type *t) const {
|
const Type *join(const Type *t) const {
|
||||||
return dual()->meet(t->dual())->dual(); }
|
return join_helper(t, false);
|
||||||
|
}
|
||||||
|
// Variant that keeps the speculative part of the types
|
||||||
|
const Type *join_speculative(const Type *t) const {
|
||||||
|
return join_helper(t, true);
|
||||||
|
}
|
||||||
|
|
||||||
// Modified version of JOIN adapted to the needs Node::Value.
|
// Modified version of JOIN adapted to the needs Node::Value.
|
||||||
// Normalizes all empty values to TOP. Does not kill _widen bits.
|
// Normalizes all empty values to TOP. Does not kill _widen bits.
|
||||||
// Currently, it also works around limitations involving interface types.
|
// Currently, it also works around limitations involving interface types.
|
||||||
virtual const Type *filter( const Type *kills ) const;
|
// Variant that drops the speculative part of the types
|
||||||
|
const Type *filter(const Type *kills) const {
|
||||||
|
return filter_helper(kills, false);
|
||||||
|
}
|
||||||
|
// Variant that keeps the speculative part of the types
|
||||||
|
const Type *filter_speculative(const Type *kills) const {
|
||||||
|
return filter_helper(kills, true);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
// One type is interface, the other is oop
|
// One type is interface, the other is oop
|
||||||
|
@ -383,6 +416,8 @@ public:
|
||||||
|
|
||||||
// Speculative type. See TypeInstPtr
|
// Speculative type. See TypeInstPtr
|
||||||
virtual ciKlass* speculative_type() const { return NULL; }
|
virtual ciKlass* speculative_type() const { return NULL; }
|
||||||
|
const Type* maybe_remove_speculative(bool include_speculative) const;
|
||||||
|
virtual const Type* remove_speculative() const { return this; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// support arrays
|
// support arrays
|
||||||
|
@ -450,12 +485,14 @@ public:
|
||||||
// upper bound, inclusive.
|
// upper bound, inclusive.
|
||||||
class TypeInt : public Type {
|
class TypeInt : public Type {
|
||||||
TypeInt( jint lo, jint hi, int w );
|
TypeInt( jint lo, jint hi, int w );
|
||||||
|
protected:
|
||||||
|
virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool eq( const Type *t ) const;
|
virtual bool eq( const Type *t ) const;
|
||||||
virtual int hash() const; // Type specific hashing
|
virtual int hash() const; // Type specific hashing
|
||||||
virtual bool singleton(void) const; // TRUE if type is a singleton
|
virtual bool singleton(void) const; // TRUE if type is a singleton
|
||||||
virtual bool empty(void) const; // TRUE if type is vacuous
|
virtual bool empty(void) const; // TRUE if type is vacuous
|
||||||
public:
|
|
||||||
const jint _lo, _hi; // Lower bound, upper bound
|
const jint _lo, _hi; // Lower bound, upper bound
|
||||||
const short _widen; // Limit on times we widen this sucker
|
const short _widen; // Limit on times we widen this sucker
|
||||||
|
|
||||||
|
@ -475,7 +512,6 @@ public:
|
||||||
virtual const Type *widen( const Type *t, const Type* limit_type ) const;
|
virtual const Type *widen( const Type *t, const Type* limit_type ) const;
|
||||||
virtual const Type *narrow( const Type *t ) const;
|
virtual const Type *narrow( const Type *t ) const;
|
||||||
// Do not kill _widen bits.
|
// Do not kill _widen bits.
|
||||||
virtual const Type *filter( const Type *kills ) const;
|
|
||||||
// Convenience common pre-built types.
|
// Convenience common pre-built types.
|
||||||
static const TypeInt *MINUS_1;
|
static const TypeInt *MINUS_1;
|
||||||
static const TypeInt *ZERO;
|
static const TypeInt *ZERO;
|
||||||
|
@ -506,6 +542,9 @@ public:
|
||||||
// an upper bound, inclusive.
|
// an upper bound, inclusive.
|
||||||
class TypeLong : public Type {
|
class TypeLong : public Type {
|
||||||
TypeLong( jlong lo, jlong hi, int w );
|
TypeLong( jlong lo, jlong hi, int w );
|
||||||
|
protected:
|
||||||
|
// Do not kill _widen bits.
|
||||||
|
virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
|
||||||
public:
|
public:
|
||||||
virtual bool eq( const Type *t ) const;
|
virtual bool eq( const Type *t ) const;
|
||||||
virtual int hash() const; // Type specific hashing
|
virtual int hash() const; // Type specific hashing
|
||||||
|
@ -533,8 +572,6 @@ public:
|
||||||
virtual const Type *xdual() const; // Compute dual right now.
|
virtual const Type *xdual() const; // Compute dual right now.
|
||||||
virtual const Type *widen( const Type *t, const Type* limit_type ) const;
|
virtual const Type *widen( const Type *t, const Type* limit_type ) const;
|
||||||
virtual const Type *narrow( const Type *t ) const;
|
virtual const Type *narrow( const Type *t ) const;
|
||||||
// Do not kill _widen bits.
|
|
||||||
virtual const Type *filter( const Type *kills ) const;
|
|
||||||
// Convenience common pre-built types.
|
// Convenience common pre-built types.
|
||||||
static const TypeLong *MINUS_1;
|
static const TypeLong *MINUS_1;
|
||||||
static const TypeLong *ZERO;
|
static const TypeLong *ZERO;
|
||||||
|
@ -625,6 +662,7 @@ public:
|
||||||
virtual const Type *xmeet( const Type *t ) const;
|
virtual const Type *xmeet( const Type *t ) const;
|
||||||
virtual const Type *xdual() const; // Compute dual right now.
|
virtual const Type *xdual() const; // Compute dual right now.
|
||||||
bool ary_must_be_exact() const; // true if arrays of such are never generic
|
bool ary_must_be_exact() const; // true if arrays of such are never generic
|
||||||
|
virtual const Type* remove_speculative() const;
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
// One type is interface, the other is oop
|
// One type is interface, the other is oop
|
||||||
virtual bool interface_vs_oop(const Type *t) const;
|
virtual bool interface_vs_oop(const Type *t) const;
|
||||||
|
@ -835,7 +873,7 @@ protected:
|
||||||
|
|
||||||
// utility methods to work on the speculative part of the type
|
// utility methods to work on the speculative part of the type
|
||||||
const TypeOopPtr* dual_speculative() const;
|
const TypeOopPtr* dual_speculative() const;
|
||||||
const TypeOopPtr* meet_speculative(const TypeOopPtr* other) const;
|
const TypeOopPtr* xmeet_speculative(const TypeOopPtr* other) const;
|
||||||
bool eq_speculative(const TypeOopPtr* other) const;
|
bool eq_speculative(const TypeOopPtr* other) const;
|
||||||
int hash_speculative() const;
|
int hash_speculative() const;
|
||||||
const TypeOopPtr* add_offset_speculative(intptr_t offset) const;
|
const TypeOopPtr* add_offset_speculative(intptr_t offset) const;
|
||||||
|
@ -843,6 +881,9 @@ protected:
|
||||||
void dump_speculative(outputStream *st) const;
|
void dump_speculative(outputStream *st) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
||||||
|
virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Creates a type given a klass. Correctly handles multi-dimensional arrays
|
// Creates a type given a klass. Correctly handles multi-dimensional arrays
|
||||||
// Respects UseUniqueSubclasses.
|
// Respects UseUniqueSubclasses.
|
||||||
|
@ -898,16 +939,13 @@ public:
|
||||||
|
|
||||||
virtual const TypePtr *add_offset( intptr_t offset ) const;
|
virtual const TypePtr *add_offset( intptr_t offset ) const;
|
||||||
// Return same type without a speculative part
|
// Return same type without a speculative part
|
||||||
virtual const TypeOopPtr* remove_speculative() const;
|
virtual const Type* remove_speculative() const;
|
||||||
|
|
||||||
virtual const Type *xmeet(const Type *t) const;
|
virtual const Type *xmeet(const Type *t) const;
|
||||||
virtual const Type *xdual() const; // Compute dual right now.
|
virtual const Type *xdual() const; // Compute dual right now.
|
||||||
// the core of the computation of the meet for TypeOopPtr and for its subclasses
|
// the core of the computation of the meet for TypeOopPtr and for its subclasses
|
||||||
virtual const Type *xmeet_helper(const Type *t) const;
|
virtual const Type *xmeet_helper(const Type *t) const;
|
||||||
|
|
||||||
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
|
||||||
virtual const Type *filter( const Type *kills ) const;
|
|
||||||
|
|
||||||
// Convenience common pre-built type.
|
// Convenience common pre-built type.
|
||||||
static const TypeOopPtr *BOTTOM;
|
static const TypeOopPtr *BOTTOM;
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
|
@ -984,7 +1022,7 @@ class TypeInstPtr : public TypeOopPtr {
|
||||||
|
|
||||||
virtual const TypePtr *add_offset( intptr_t offset ) const;
|
virtual const TypePtr *add_offset( intptr_t offset ) const;
|
||||||
// Return same type without a speculative part
|
// Return same type without a speculative part
|
||||||
virtual const TypeOopPtr* remove_speculative() const;
|
virtual const Type* remove_speculative() const;
|
||||||
|
|
||||||
// the core of the computation of the meet of 2 types
|
// the core of the computation of the meet of 2 types
|
||||||
virtual const Type *xmeet_helper(const Type *t) const;
|
virtual const Type *xmeet_helper(const Type *t) const;
|
||||||
|
@ -1062,7 +1100,7 @@ public:
|
||||||
virtual bool empty(void) const; // TRUE if type is vacuous
|
virtual bool empty(void) const; // TRUE if type is vacuous
|
||||||
virtual const TypePtr *add_offset( intptr_t offset ) const;
|
virtual const TypePtr *add_offset( intptr_t offset ) const;
|
||||||
// Return same type without a speculative part
|
// Return same type without a speculative part
|
||||||
virtual const TypeOopPtr* remove_speculative() const;
|
virtual const Type* remove_speculative() const;
|
||||||
|
|
||||||
// the core of the computation of the meet of 2 types
|
// the core of the computation of the meet of 2 types
|
||||||
virtual const Type *xmeet_helper(const Type *t) const;
|
virtual const Type *xmeet_helper(const Type *t) const;
|
||||||
|
@ -1103,6 +1141,8 @@ public:
|
||||||
class TypeMetadataPtr : public TypePtr {
|
class TypeMetadataPtr : public TypePtr {
|
||||||
protected:
|
protected:
|
||||||
TypeMetadataPtr(PTR ptr, ciMetadata* metadata, int offset);
|
TypeMetadataPtr(PTR ptr, ciMetadata* metadata, int offset);
|
||||||
|
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
||||||
|
virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
|
||||||
public:
|
public:
|
||||||
virtual bool eq( const Type *t ) const;
|
virtual bool eq( const Type *t ) const;
|
||||||
virtual int hash() const; // Type specific hashing
|
virtual int hash() const; // Type specific hashing
|
||||||
|
@ -1128,9 +1168,6 @@ public:
|
||||||
|
|
||||||
virtual intptr_t get_con() const;
|
virtual intptr_t get_con() const;
|
||||||
|
|
||||||
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
|
||||||
virtual const Type *filter( const Type *kills ) const;
|
|
||||||
|
|
||||||
// Convenience common pre-built types.
|
// Convenience common pre-built types.
|
||||||
static const TypeMetadataPtr *BOTTOM;
|
static const TypeMetadataPtr *BOTTOM;
|
||||||
|
|
||||||
|
@ -1144,6 +1181,8 @@ public:
|
||||||
class TypeKlassPtr : public TypePtr {
|
class TypeKlassPtr : public TypePtr {
|
||||||
TypeKlassPtr( PTR ptr, ciKlass* klass, int offset );
|
TypeKlassPtr( PTR ptr, ciKlass* klass, int offset );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
|
||||||
public:
|
public:
|
||||||
virtual bool eq( const Type *t ) const;
|
virtual bool eq( const Type *t ) const;
|
||||||
virtual int hash() const; // Type specific hashing
|
virtual int hash() const; // Type specific hashing
|
||||||
|
@ -1205,9 +1244,6 @@ public:
|
||||||
|
|
||||||
virtual intptr_t get_con() const;
|
virtual intptr_t get_con() const;
|
||||||
|
|
||||||
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
|
||||||
virtual const Type *filter( const Type *kills ) const;
|
|
||||||
|
|
||||||
// Convenience common pre-built types.
|
// Convenience common pre-built types.
|
||||||
static const TypeKlassPtr* OBJECT; // Not-null object klass or below
|
static const TypeKlassPtr* OBJECT; // Not-null object klass or below
|
||||||
static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
|
static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
|
||||||
|
@ -1231,6 +1267,8 @@ protected:
|
||||||
virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const = 0;
|
virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const = 0;
|
||||||
virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const = 0;
|
virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const = 0;
|
||||||
virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const = 0;
|
virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const = 0;
|
||||||
|
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
||||||
|
virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
|
||||||
public:
|
public:
|
||||||
virtual bool eq( const Type *t ) const;
|
virtual bool eq( const Type *t ) const;
|
||||||
virtual int hash() const; // Type specific hashing
|
virtual int hash() const; // Type specific hashing
|
||||||
|
@ -1241,9 +1279,6 @@ public:
|
||||||
|
|
||||||
virtual intptr_t get_con() const;
|
virtual intptr_t get_con() const;
|
||||||
|
|
||||||
// Do not allow interface-vs.-noninterface joins to collapse to top.
|
|
||||||
virtual const Type *filter( const Type *kills ) const;
|
|
||||||
|
|
||||||
virtual bool empty(void) const; // TRUE if type is vacuous
|
virtual bool empty(void) const; // TRUE if type is vacuous
|
||||||
|
|
||||||
// returns the equivalent ptr type for this compressed pointer
|
// returns the equivalent ptr type for this compressed pointer
|
||||||
|
@ -1294,6 +1329,10 @@ public:
|
||||||
static const TypeNarrowOop *BOTTOM;
|
static const TypeNarrowOop *BOTTOM;
|
||||||
static const TypeNarrowOop *NULL_PTR;
|
static const TypeNarrowOop *NULL_PTR;
|
||||||
|
|
||||||
|
virtual const Type* remove_speculative() const {
|
||||||
|
return make(_ptrtype->remove_speculative()->is_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
|
virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -293,6 +293,7 @@ static ObsoleteFlag obsolete_jvm_flags[] = {
|
||||||
{ "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
{ "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||||
{ "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
{ "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||||
{ "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
{ "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||||
|
{ "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
#ifdef PRODUCT
|
#ifdef PRODUCT
|
||||||
{ "DesiredMethodLimit",
|
{ "DesiredMethodLimit",
|
||||||
JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
|
JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* @bug 6826736
|
* @bug 6826736
|
||||||
* @summary CMS: core dump with -XX:+UseCompressedOops
|
* @summary CMS: core dump with -XX:+UseCompressedOops
|
||||||
*
|
*
|
||||||
* @run main/othervm/timeout=600 -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+ScavengeALot -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g -XX:CompileThreshold=100 -XX:CompileOnly=Test.test -XX:-BlockLayoutRotateLoops -XX:LoopUnrollLimit=0 Test
|
* @run main/othervm/timeout=600 -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+ScavengeALot -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g -XX:CompileThreshold=100 -XX:CompileOnly=Test.test -XX:-BlockLayoutRotateLoops -XX:LoopUnrollLimit=0 -Xmx256m -XX:ParallelGCThreads=4 Test
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Test {
|
public class Test {
|
||||||
|
|
44
hotspot/test/compiler/codegen/LoadWithMask.java
Normal file
44
hotspot/test/compiler/codegen/LoadWithMask.java
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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 8032207
|
||||||
|
* @summary Invalid node sizing for loadUS2L_immI16 and loadI2L_immI
|
||||||
|
* @run main/othervm -server -Xbatch -XX:-TieredCompilation -XX:CompileCommand=compileonly,LoadWithMask.foo LoadWithMask
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class LoadWithMask {
|
||||||
|
static int x[] = new int[1];
|
||||||
|
static long foo() {
|
||||||
|
return x[0] & 0xfff0ffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
x[0] = -1;
|
||||||
|
long l = 0;
|
||||||
|
for (int i = 0; i < 100000; ++i) {
|
||||||
|
l = foo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
55
hotspot/test/compiler/codegen/LoadWithMask2.java
Normal file
55
hotspot/test/compiler/codegen/LoadWithMask2.java
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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 8031743
|
||||||
|
* @summary loadI2L_immI broken for negative memory values
|
||||||
|
* @run main/othervm -server -Xbatch -XX:-TieredCompilation -XX:CompileCommand=compileonly,*.foo* LoadWithMask2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class LoadWithMask2 {
|
||||||
|
static int x;
|
||||||
|
static long foo1() {
|
||||||
|
return x & 0xfffffffe;
|
||||||
|
}
|
||||||
|
static long foo2() {
|
||||||
|
return x & 0xff000000;
|
||||||
|
}
|
||||||
|
static long foo3() {
|
||||||
|
return x & 0x8abcdef1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
x = -1;
|
||||||
|
long l = 0;
|
||||||
|
for (int i = 0; i < 100000; ++i) {
|
||||||
|
l = foo1() & foo2() & foo3();
|
||||||
|
}
|
||||||
|
if (l > 0) {
|
||||||
|
System.out.println("FAILED");
|
||||||
|
System.exit(97);
|
||||||
|
}
|
||||||
|
System.out.println("PASSED");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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 8031695
|
||||||
|
* @summary CHA ignores default methods during analysis leading to incorrect code generation
|
||||||
|
*
|
||||||
|
* @run main/othervm -Xbatch DefaultAndConcreteMethodsCHA
|
||||||
|
*/
|
||||||
|
interface I {
|
||||||
|
default int m() { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
class A implements I {}
|
||||||
|
|
||||||
|
class C extends A { }
|
||||||
|
class D extends A { public int m() { return 1; } }
|
||||||
|
|
||||||
|
public class DefaultAndConcreteMethodsCHA {
|
||||||
|
public static int test(A obj) {
|
||||||
|
return obj.m();
|
||||||
|
}
|
||||||
|
public static void main(String[] args) {
|
||||||
|
for (int i = 0; i < 10000; i++) {
|
||||||
|
int idC = test(new C());
|
||||||
|
if (idC != 0) {
|
||||||
|
throw new Error("C.m didn't invoke I.m: id "+idC);
|
||||||
|
}
|
||||||
|
|
||||||
|
int idD = test(new D());
|
||||||
|
if (idD != 1) {
|
||||||
|
throw new Error("D.m didn't invoke D.m: id "+idD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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 8027422
|
||||||
|
* @summary type methods shouldn't always operate on speculative part
|
||||||
|
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TypeProfileLevel=222 -XX:+UnlockExperimentalVMOptions -XX:+UseTypeSpeculation -XX:-BackgroundCompilation TestSpeculationFailedHigherEqual
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TestSpeculationFailedHigherEqual {
|
||||||
|
|
||||||
|
static class A {
|
||||||
|
void m() {}
|
||||||
|
int i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static class C extends A {
|
||||||
|
}
|
||||||
|
|
||||||
|
static C c;
|
||||||
|
|
||||||
|
static A m1(A a, boolean cond) {
|
||||||
|
// speculative type for a is C not null
|
||||||
|
if (cond ) {
|
||||||
|
a = c;
|
||||||
|
}
|
||||||
|
// speculative type for a is C (may be null)
|
||||||
|
int i = a.i;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void main(String[] args) {
|
||||||
|
C c = new C();
|
||||||
|
TestSpeculationFailedHigherEqual.c = c;
|
||||||
|
for (int i = 0; i < 20000; i++) {
|
||||||
|
m1(c, i%2 == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("TEST PASSED");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue