Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8250764: [lworld] Merge JDK-8247697 in from mainline #153

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions src/hotspot/share/opto/callGenerator.cpp
Original file line number Diff line number Diff line change
@@ -355,6 +355,10 @@ class LateInlineCallGenerator : public DirectCallGenerator {
virtual jlong unique_id() const {
return _unique_id;
}

virtual CallGenerator* inline_cg() {
return _inline_cg;
}
};

void LateInlineCallGenerator::do_late_inline() {
@@ -587,7 +591,14 @@ class LateInlineMHCallGenerator : public LateInlineCallGenerator {

bool LateInlineMHCallGenerator::do_late_inline_check(JVMState* jvms) {

CallGenerator* cg = for_method_handle_inline(jvms, _caller, method(), _input_not_const, AlwaysIncrementalInline);
CallGenerator* cg = for_method_handle_inline(jvms, _caller, method(), _input_not_const);

// AlwaysIncrementalInline causes for_method_handle_inline() to
// return a LateInlineCallGenerator. Extract the
// InlineCallGenerato from it.
if (AlwaysIncrementalInline && cg != NULL && cg->is_late_inline()) {
cg = cg->inline_cg();
}

Compile::current()->print_inlining_update_delayed(this);

@@ -929,13 +940,13 @@ JVMState* PredictedCallGenerator::generate(JVMState* jvms) {
}


CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool delayed_forbidden) {
CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* caller, ciMethod* callee) {
assert(callee->is_method_handle_intrinsic(), "for_method_handle_call mismatch");
bool input_not_const;
CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee, input_not_const, false);
CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee, input_not_const);
Compile* C = Compile::current();
if (cg != NULL) {
if (!delayed_forbidden && AlwaysIncrementalInline) {
if (AlwaysIncrementalInline) {
return CallGenerator::for_late_inline(callee, cg);
} else {
return cg;
@@ -971,7 +982,7 @@ static void cast_argument(int nargs, int arg_nb, ciType* t, GraphKit& kit) {
}
}

CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const, bool delayed_forbidden) {
CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const) {
GraphKit kit(jvms);
PhaseGVN& gvn = kit.gvn();
Compile* C = kit.C;
@@ -1000,8 +1011,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
true /* allow_inline */,
PROB_ALWAYS,
NULL,
true,
delayed_forbidden);
true);
return cg;
} else {
print_inlining_failure(C, callee, jvms->depth() - 1, jvms->bci(),
@@ -1075,8 +1085,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
!StressMethodHandleLinkerInlining /* allow_inline */,
PROB_ALWAYS,
speculative_receiver_type,
true,
delayed_forbidden);
true);
return cg;
} else {
print_inlining_failure(C, callee, jvms->depth() - 1, jvms->bci(),
6 changes: 4 additions & 2 deletions src/hotspot/share/opto/callGenerator.hpp
Original file line number Diff line number Diff line change
@@ -86,6 +86,8 @@ class CallGenerator : public ResourceObj {
virtual void set_unique_id(jlong id) { fatal("unique id only for late inlines"); };
virtual jlong unique_id() const { fatal("unique id only for late inlines"); return 0; };

virtual CallGenerator* inline_cg() { ShouldNotReachHere(); return NULL; }

// Note: It is possible for a CG to be both inline and virtual.
// (The hashCode intrinsic does a vtable check and an inlined fast path.)

@@ -124,8 +126,8 @@ class CallGenerator : public ResourceObj {
static CallGenerator* for_direct_call(ciMethod* m, bool separate_io_projs = false); // static, special
static CallGenerator* for_virtual_call(ciMethod* m, int vtable_index); // virtual, interface

static CallGenerator* for_method_handle_call( JVMState* jvms, ciMethod* caller, ciMethod* callee, bool delayed_forbidden);
static CallGenerator* for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const, bool delayed_forbidden);
static CallGenerator* for_method_handle_call( JVMState* jvms, ciMethod* caller, ciMethod* callee);
static CallGenerator* for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const);

// How to generate a replace a direct call with an inline version
static CallGenerator* for_late_inline(ciMethod* m, CallGenerator* inline_cg);
2 changes: 1 addition & 1 deletion src/hotspot/share/opto/compile.hpp
Original file line number Diff line number Diff line change
@@ -886,7 +886,7 @@ class Compile : public Phase {
// The profile factor is a discount to apply to this site's interp. profile.
CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_does_dispatch,
JVMState* jvms, bool allow_inline, float profile_factor, ciKlass* speculative_receiver_type = NULL,
bool allow_intrinsics = true, bool delayed_forbidden = false);
bool allow_intrinsics = true);
bool should_delay_inlining(ciMethod* call_method, JVMState* jvms) {
return should_delay_string_inlining(call_method, jvms) ||
should_delay_boxing_inlining(call_method, jvms);
9 changes: 3 additions & 6 deletions src/hotspot/share/opto/doCall.cpp
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMeth
CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool call_does_dispatch,
JVMState* jvms, bool allow_inline,
float prof_factor, ciKlass* speculative_receiver_type,
bool allow_intrinsics, bool delayed_forbidden) {
bool allow_intrinsics) {
ciMethod* caller = jvms->method();
int bci = jvms->bci();
Bytecodes::Code bytecode = caller->java_code_at_bci(bci);
@@ -146,8 +146,7 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool
// MethodHandle.invoke* are native methods which obviously don't
// have bytecodes and so normal inlining fails.
if (callee->is_method_handle_intrinsic()) {
CallGenerator* cg = CallGenerator::for_method_handle_call(jvms, caller, callee, delayed_forbidden);
assert(cg == NULL || !delayed_forbidden || !cg->is_late_inline() || cg->is_mh_late_inline(), "unexpected CallGenerator");
CallGenerator* cg = CallGenerator::for_method_handle_call(jvms, caller, callee);
return cg;
}

@@ -183,12 +182,10 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool
// opportunity to perform some high level optimizations
// first.
if (should_delay_string_inlining(callee, jvms)) {
assert(!delayed_forbidden, "strange");
return CallGenerator::for_string_late_inline(callee, cg);
} else if (should_delay_boxing_inlining(callee, jvms)) {
assert(!delayed_forbidden, "strange");
return CallGenerator::for_boxing_late_inline(callee, cg);
} else if ((should_delay || AlwaysIncrementalInline) && !delayed_forbidden) {
} else if (should_delay || AlwaysIncrementalInline) {
return CallGenerator::for_late_inline(callee, cg);
}
}