提交 f4f207c1 编写于 作者: V vlivanov

Merge

...@@ -3767,11 +3767,14 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, Bytecode ...@@ -3767,11 +3767,14 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, Bytecode
} }
// now perform tests that are based on flag settings // now perform tests that are based on flag settings
if (callee->force_inline()) { if (callee->force_inline() || callee->should_inline()) {
if (inline_level() > MaxForceInlineLevel) INLINE_BAILOUT("MaxForceInlineLevel"); if (inline_level() > MaxForceInlineLevel ) INLINE_BAILOUT("MaxForceInlineLevel");
print_inlining(callee, "force inline by annotation"); if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("recursive inlining too deep");
} else if (callee->should_inline()) {
print_inlining(callee, "force inline by CompileOracle"); const char* msg = "";
if (callee->force_inline()) msg = "force inline by annotation";
if (callee->should_inline()) msg = "force inline by CompileOracle";
print_inlining(callee, msg);
} else { } else {
// use heuristic controls on inlining // use heuristic controls on inlining
if (inline_level() > MaxInlineLevel ) INLINE_BAILOUT("inlining too deep"); if (inline_level() > MaxInlineLevel ) INLINE_BAILOUT("inlining too deep");
......
...@@ -458,7 +458,7 @@ ...@@ -458,7 +458,7 @@
product(bool, EliminateAutoBox, false, \ product(bool, EliminateAutoBox, false, \
"Control optimizations for autobox elimination") \ "Control optimizations for autobox elimination") \
\ \
experimental(bool, UseImplicitStableValues, false, \ diagnostic(bool, UseImplicitStableValues, true, \
"Mark well-known stable fields as such (e.g. String.value)") \ "Mark well-known stable fields as such (e.g. String.value)") \
\ \
product(intx, AutoBoxCacheMax, 128, \ product(intx, AutoBoxCacheMax, 128, \
......
...@@ -1593,35 +1593,33 @@ LoadNode::load_array_final_field(const TypeKlassPtr *tkls, ...@@ -1593,35 +1593,33 @@ LoadNode::load_array_final_field(const TypeKlassPtr *tkls,
// Try to constant-fold a stable array element. // Try to constant-fold a stable array element.
static const Type* fold_stable_ary_elem(const TypeAryPtr* ary, int off, BasicType loadbt) { static const Type* fold_stable_ary_elem(const TypeAryPtr* ary, int off, BasicType loadbt) {
assert(ary->const_oop(), "array should be constant");
assert(ary->is_stable(), "array should be stable"); assert(ary->is_stable(), "array should be stable");
if (ary->const_oop() != NULL) { // Decode the results of GraphKit::array_element_address.
// Decode the results of GraphKit::array_element_address. ciArray* aobj = ary->const_oop()->as_array();
ciArray* aobj = ary->const_oop()->as_array(); ciConstant con = aobj->element_value_by_offset(off);
ciConstant con = aobj->element_value_by_offset(off);
if (con.basic_type() != T_ILLEGAL && !con.is_null_or_zero()) {
if (con.basic_type() != T_ILLEGAL && !con.is_null_or_zero()) { const Type* con_type = Type::make_from_constant(con);
const Type* con_type = Type::make_from_constant(con); if (con_type != NULL) {
if (con_type != NULL) { if (con_type->isa_aryptr()) {
if (con_type->isa_aryptr()) { // Join with the array element type, in case it is also stable.
// Join with the array element type, in case it is also stable. int dim = ary->stable_dimension();
int dim = ary->stable_dimension(); con_type = con_type->is_aryptr()->cast_to_stable(true, dim-1);
con_type = con_type->is_aryptr()->cast_to_stable(true, dim-1); }
} if (loadbt == T_NARROWOOP && con_type->isa_oopptr()) {
if (loadbt == T_NARROWOOP && con_type->isa_oopptr()) { con_type = con_type->make_narrowoop();
con_type = con_type->make_narrowoop(); }
}
#ifndef PRODUCT #ifndef PRODUCT
if (TraceIterativeGVN) { if (TraceIterativeGVN) {
tty->print("FoldStableValues: array element [off=%d]: con_type=", off); tty->print("FoldStableValues: array element [off=%d]: con_type=", off);
con_type->dump(); tty->cr(); con_type->dump(); tty->cr();
}
#endif //PRODUCT
return con_type;
} }
#endif //PRODUCT
return con_type;
} }
} }
return NULL; return NULL;
} }
...@@ -1641,7 +1639,7 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const { ...@@ -1641,7 +1639,7 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const {
// Try to guess loaded type from pointer type // Try to guess loaded type from pointer type
if (tp->isa_aryptr()) { if (tp->isa_aryptr()) {
const TypeAryPtr* ary = tp->is_aryptr(); const TypeAryPtr* ary = tp->is_aryptr();
const Type *t = ary->elem(); const Type* t = ary->elem();
// Determine whether the reference is beyond the header or not, by comparing // Determine whether the reference is beyond the header or not, by comparing
// the offset against the offset of the start of the array's data. // the offset against the offset of the start of the array's data.
...@@ -1653,10 +1651,9 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const { ...@@ -1653,10 +1651,9 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const {
const bool off_beyond_header = ((uint)off >= (uint)min_base_off); const bool off_beyond_header = ((uint)off >= (uint)min_base_off);
// Try to constant-fold a stable array element. // Try to constant-fold a stable array element.
if (FoldStableValues && ary->is_stable()) { if (FoldStableValues && ary->is_stable() && ary->const_oop() != NULL) {
// Make sure the reference is not into the header // Make sure the reference is not into the header and the offset is constant
if (off_beyond_header && off != Type::OffsetBot) { if (off_beyond_header && adr->is_AddP() && off != Type::OffsetBot) {
assert(adr->is_AddP() && adr->in(AddPNode::Offset)->is_Con(), "offset is a constant");
const Type* con_type = fold_stable_ary_elem(ary, off, memory_type()); const Type* con_type = fold_stable_ary_elem(ary, off, memory_type());
if (con_type != NULL) { if (con_type != NULL) {
return con_type; return con_type;
......
...@@ -2986,7 +2986,8 @@ class CommandLineFlags { ...@@ -2986,7 +2986,8 @@ class CommandLineFlags {
"maximum number of nested recursive calls that are inlined") \ "maximum number of nested recursive calls that are inlined") \
\ \
develop(intx, MaxForceInlineLevel, 100, \ develop(intx, MaxForceInlineLevel, 100, \
"maximum number of nested @ForceInline calls that are inlined") \ "maximum number of nested calls that are forced for inlining " \
"(using CompilerOracle or marked w/ @ForceInline)") \
\ \
product_pd(intx, InlineSmallCode, \ product_pd(intx, InlineSmallCode, \
"Only inline already compiled methods if their code size is " \ "Only inline already compiled methods if their code size is " \
...@@ -3797,8 +3798,8 @@ class CommandLineFlags { ...@@ -3797,8 +3798,8 @@ class CommandLineFlags {
experimental(bool, TrustFinalNonStaticFields, false, \ experimental(bool, TrustFinalNonStaticFields, false, \
"trust final non-static declarations for constant folding") \ "trust final non-static declarations for constant folding") \
\ \
experimental(bool, FoldStableValues, false, \ diagnostic(bool, FoldStableValues, true, \
"Private flag to control optimizations for stable variables") \ "Optimize loads from stable fields (marked w/ @Stable)") \
\ \
develop(bool, TraceInvokeDynamic, false, \ develop(bool, TraceInvokeDynamic, false, \
"trace internal invoke dynamic operations") \ "trace internal invoke dynamic operations") \
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册