Mercurial > hg > graal-compiler
diff src/share/vm/c1/c1_GraphBuilder.cpp @ 18041:52b4284cb496
Merge with jdk8u20-b26
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 15 Oct 2014 16:02:50 +0200 |
parents | 4ca6dc0799b6 ee1c924763d2 |
children | 7848fc12602b |
line wrap: on
line diff
--- a/src/share/vm/c1/c1_GraphBuilder.cpp Thu Oct 16 10:21:29 2014 +0200 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp Wed Oct 15 16:02:50 2014 +0200 @@ -1569,6 +1569,7 @@ default: constant = new Constant(as_ValueType(field_val)); } + // Stable static fields are checked for non-default values in ciField::initialize_from(). } if (constant != NULL) { push(type, append(constant)); @@ -1610,6 +1611,10 @@ default: constant = new Constant(as_ValueType(field_val)); } + if (FoldStableValues && field->is_stable() && field_val.is_null_or_zero()) { + // Stable field with default value can't be constant. + constant = NULL; + } } else { // For CallSite objects treat the target field as a compile time constant. if (const_oop->is_call_site()) { @@ -1697,6 +1702,15 @@ return NULL; } +void GraphBuilder::check_args_for_profiling(Values* obj_args, int expected) { +#ifdef ASSERT + bool ignored_will_link; + ciSignature* declared_signature = NULL; + ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature); + assert(expected == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?"); +#endif +} + // Collect arguments that we want to profile in a list Values* GraphBuilder::collect_args_for_profiling(Values* args, ciMethod* target, bool may_have_receiver) { int start = 0; @@ -1705,13 +1719,14 @@ return NULL; } int s = obj_args->size(); - for (int i = start, j = 0; j < s; i++) { + // if called through method handle invoke, some arguments may have been popped + for (int i = start, j = 0; j < s && i < args->length(); i++) { if (args->at(i)->type()->is_object_kind()) { obj_args->push(args->at(i)); j++; } } - assert(s == obj_args->length(), "missed on arg?"); + check_args_for_profiling(obj_args, s); return obj_args; } @@ -1983,7 +1998,13 @@ if (!UseInlineCaches && is_loaded && code == Bytecodes::_invokevirtual && !target->can_be_statically_bound()) { // Find a vtable index if one is available - vtable_index = target->resolve_vtable_index(calling_klass, callee_holder); + // For arrays, callee_holder is Object. Resolving the call with + // Object would allow an illegal call to finalize() on an + // array. We use holder instead: illegal calls to finalize() won't + // be compiled as vtable calls (IC call resolution will catch the + // illegal call) and the few legal calls on array types won't be + // either. + vtable_index = target->resolve_vtable_index(calling_klass, holder); } #endif @@ -3769,11 +3790,14 @@ } // now perform tests that are based on flag settings - if (callee->force_inline()) { - if (inline_level() > MaxForceInlineLevel) INLINE_BAILOUT("MaxForceInlineLevel"); - print_inlining(callee, "force inline by annotation"); - } else if (callee->should_inline()) { - print_inlining(callee, "force inline by CompileOracle"); + if (callee->force_inline() || callee->should_inline()) { + if (inline_level() > MaxForceInlineLevel ) INLINE_BAILOUT("MaxForceInlineLevel"); + if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("recursive inlining too deep"); + + 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 { // use heuristic controls on inlining if (inline_level() > MaxInlineLevel ) INLINE_BAILOUT("inlining too deep"); @@ -3842,14 +3866,7 @@ j++; } } -#ifdef ASSERT - { - bool ignored_will_link; - ciSignature* declared_signature = NULL; - ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature); - assert(s == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?"); - } -#endif + check_args_for_profiling(obj_args, s); } profile_call(callee, recv, holder_known ? callee->holder() : NULL, obj_args, true); }