< prev index next >
src/hotspot/share/opto/callGenerator.cpp
Print this page
*** 294,313 ****
}
// Allow inlining decisions to be delayed
class LateInlineCallGenerator : public DirectCallGenerator {
private:
! // unique id for log compilation
! jlong _unique_id;
protected:
CallGenerator* _inline_cg;
virtual bool do_late_inline_check(JVMState* jvms) { return true; }
public:
! LateInlineCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
! DirectCallGenerator(method, true), _unique_id(0), _inline_cg(inline_cg) {}
virtual bool is_late_inline() const { return true; }
// Convert the CallStaticJava into an inline
virtual void do_late_inline();
--- 294,313 ----
}
// Allow inlining decisions to be delayed
class LateInlineCallGenerator : public DirectCallGenerator {
private:
! jlong _unique_id; // unique id for log compilation
! bool _is_pure_call; // a hint that the call doesn't have important side effects to care about
protected:
CallGenerator* _inline_cg;
virtual bool do_late_inline_check(JVMState* jvms) { return true; }
public:
! LateInlineCallGenerator(ciMethod* method, CallGenerator* inline_cg, bool is_pure_call = false) :
! DirectCallGenerator(method, true), _unique_id(0), _is_pure_call(is_pure_call), _inline_cg(inline_cg) {}
virtual bool is_late_inline() const { return true; }
// Convert the CallStaticJava into an inline
virtual void do_late_inline();
*** 387,396 ****
--- 387,403 ----
// Remove inlined methods from Compiler's lists.
if (call->is_macro()) {
C->remove_macro_node(call);
}
+ bool result_not_used = (callprojs.resproj == NULL || callprojs.resproj->outcnt() == 0);
+ if (_is_pure_call && result_not_used) {
+ // The call is marked as pure (no important side effects), but result isn't used.
+ // It's safe to remove the call.
+ GraphKit kit(call->jvms());
+ kit.replace_call(call, C->top(), true);
+ } else {
// Make a clone of the JVMState that appropriate to use for driving a parse
JVMState* old_jvms = call->jvms();
JVMState* jvms = old_jvms->clone_shallow(C);
uint size = call->req();
SafePointNode* map = new SafePointNode(size, jvms);
*** 459,468 ****
--- 466,476 ----
C->set_has_loops(C->has_loops() || _inline_cg->method()->has_loops());
C->env()->notice_inlined_method(_inline_cg->method());
C->set_inlining_progress(true);
C->set_do_cleanup(kit.stopped()); // path is dead; needs cleanup
kit.replace_call(call, result, true);
+ }
}
CallGenerator* CallGenerator::for_late_inline(ciMethod* method, CallGenerator* inline_cg) {
return new LateInlineCallGenerator(method, inline_cg);
*** 549,559 ****
class LateInlineBoxingCallGenerator : public LateInlineCallGenerator {
public:
LateInlineBoxingCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
! LateInlineCallGenerator(method, inline_cg) {}
virtual JVMState* generate(JVMState* jvms) {
Compile *C = Compile::current();
C->log_inline_id(this);
--- 557,567 ----
class LateInlineBoxingCallGenerator : public LateInlineCallGenerator {
public:
LateInlineBoxingCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
! LateInlineCallGenerator(method, inline_cg, /*is_pure=*/true) {}
virtual JVMState* generate(JVMState* jvms) {
Compile *C = Compile::current();
C->log_inline_id(this);
< prev index next >