|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
@@ -582,62 +582,6 @@ void LateInlineVirtualCallGenerator::do_late_inline() {
|
582 | 582 | CallGenerator::do_late_inline_helper();
|
583 | 583 | }
|
584 | 584 |
|
585 |
| -static bool has_non_debug_usages(Node* n) { |
586 |
| - for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { |
587 |
| - Node* m = n->fast_out(i); |
588 |
| - if (!m->is_SafePoint() |
589 |
| - || (m->is_Call() && m->as_Call()->has_non_debug_use(n))) { |
590 |
| - return true; |
591 |
| - } |
592 |
| - } |
593 |
| - return false; |
594 |
| -} |
595 |
| - |
596 |
| -static bool is_box_cache_valid(CallNode* call) { |
597 |
| - ciInstanceKlass* klass = call->as_CallStaticJava()->method()->holder(); |
598 |
| - return klass->is_box_cache_valid(); |
599 |
| -} |
600 |
| - |
601 |
| -// delay box in runtime, treat box as a scalarized object |
602 |
| -static void scalarize_debug_usages(CallNode* call, Node* resproj) { |
603 |
| - GraphKit kit(call->jvms()); |
604 |
| - PhaseGVN& gvn = kit.gvn(); |
605 |
| - |
606 |
| - ProjNode* res = resproj->as_Proj(); |
607 |
| - ciInstanceKlass* klass = call->as_CallStaticJava()->method()->holder(); |
608 |
| - int n_fields = klass->nof_nonstatic_fields(); |
609 |
| - assert(n_fields == 1, "the klass must be an auto-boxing klass"); |
610 |
| - |
611 |
| - for (DUIterator_Last imin, i = res->last_outs(imin); i >= imin;) { |
612 |
| - SafePointNode* sfpt = res->last_out(i)->as_SafePoint(); |
613 |
| - uint first_ind = sfpt->req() - sfpt->jvms()->scloff(); |
614 |
| - Node* sobj = new SafePointScalarObjectNode(gvn.type(res)->isa_oopptr(), |
615 |
| -#ifdef ASSERT |
616 |
| - call, |
617 |
| -#endif // ASSERT |
618 |
| - first_ind, n_fields, true); |
619 |
| - sobj->init_req(0, kit.root()); |
620 |
| - sfpt->add_req(call->in(TypeFunc::Parms)); |
621 |
| - sobj = gvn.transform(sobj); |
622 |
| - JVMState* jvms = sfpt->jvms(); |
623 |
| - jvms->set_endoff(sfpt->req()); |
624 |
| - int start = jvms->debug_start(); |
625 |
| - int end = jvms->debug_end(); |
626 |
| - int num_edges = sfpt->replace_edges_in_range(res, sobj, start, end, &gvn); |
627 |
| - i -= num_edges; |
628 |
| - } |
629 |
| - |
630 |
| - assert(res->outcnt() == 0, "the box must have no use after replace"); |
631 |
| - |
632 |
| -#ifndef PRODUCT |
633 |
| - if (PrintEliminateAllocations) { |
634 |
| - tty->print("++++ Eliminated: %d ", call->_idx); |
635 |
| - call->as_CallStaticJava()->method()->print_short_name(tty); |
636 |
| - tty->cr(); |
637 |
| - } |
638 |
| -#endif |
639 |
| -} |
640 |
| - |
641 | 585 | void CallGenerator::do_late_inline_helper() {
|
642 | 586 | assert(is_late_inline(), "only late inline allowed");
|
643 | 587 |
|
@@ -687,24 +631,11 @@ void CallGenerator::do_late_inline_helper() {
|
687 | 631 | C->remove_macro_node(call);
|
688 | 632 | }
|
689 | 633 |
|
690 |
| - bool result_not_used = false; |
691 |
| - |
692 |
| - if (is_pure_call()) { |
693 |
| - // Disabled due to JDK-8276112 |
694 |
| - if (false && is_boxing_late_inline() && callprojs.resproj != nullptr) { |
695 |
| - // replace box node to scalar node only in case it is directly referenced by debug info |
696 |
| - assert(call->as_CallStaticJava()->is_boxing_method(), "sanity"); |
697 |
| - if (!has_non_debug_usages(callprojs.resproj) && is_box_cache_valid(call)) { |
698 |
| - scalarize_debug_usages(call, callprojs.resproj); |
699 |
| - } |
700 |
| - } |
| 634 | + // The call is marked as pure (no important side effects), but result isn't used. |
| 635 | + // It's safe to remove the call. |
| 636 | + bool result_not_used = (callprojs.resproj == NULL || callprojs.resproj->outcnt() == 0); |
701 | 637 |
|
702 |
| - // The call is marked as pure (no important side effects), but result isn't used. |
703 |
| - // It's safe to remove the call. |
704 |
| - result_not_used = (callprojs.resproj == NULL || callprojs.resproj->outcnt() == 0); |
705 |
| - } |
706 |
| - |
707 |
| - if (result_not_used) { |
| 638 | + if (is_pure_call() && result_not_used) { |
708 | 639 | GraphKit kit(call->jvms());
|
709 | 640 | kit.replace_call(call, C->top(), true);
|
710 | 641 | } else {
|
@@ -832,8 +763,6 @@ class LateInlineBoxingCallGenerator : public LateInlineCallGenerator {
|
832 | 763 | return new_jvms;
|
833 | 764 | }
|
834 | 765 |
|
835 |
| - virtual bool is_boxing_late_inline() const { return true; } |
836 |
| - |
837 | 766 | virtual CallGenerator* with_call_node(CallNode* call) {
|
838 | 767 | LateInlineBoxingCallGenerator* cg = new LateInlineBoxingCallGenerator(method(), _inline_cg);
|
839 | 768 | cg->set_call_node(call->as_CallStaticJava());
|
|
0 commit comments