2708 if (!call->may_modify(toop, igvn)) {
2709 result = call->in(TypeFunc::Memory);
2710 }
2711 } else if (proj_in->is_Initialize()) {
2712 AllocateNode* alloc = proj_in->as_Initialize()->allocation();
2713 // Stop if this is the initialization for the object instance which
2714 // which contains this memory slice, otherwise skip over it.
2715 if (alloc == NULL || alloc->_idx != (uint)toop->instance_id()) {
2716 result = proj_in->in(TypeFunc::Memory);
2717 }
2718 } else if (proj_in->is_MemBar()) {
2719 if (proj_in->in(TypeFunc::Memory)->is_MergeMem() &&
2720 proj_in->in(TypeFunc::Memory)->as_MergeMem()->in(Compile::AliasIdxRaw)->is_Proj() &&
2721 proj_in->in(TypeFunc::Memory)->as_MergeMem()->in(Compile::AliasIdxRaw)->in(0)->is_ArrayCopy()) {
2722 // clone
2723 ArrayCopyNode* ac = proj_in->in(TypeFunc::Memory)->as_MergeMem()->in(Compile::AliasIdxRaw)->in(0)->as_ArrayCopy();
2724 if (ac->may_modify(toop, igvn)) {
2725 break;
2726 }
2727 }
2728 result = proj_in->in(TypeFunc::Memory);
2729 }
2730 } else if (result->is_MergeMem()) {
2731 MergeMemNode *mmem = result->as_MergeMem();
2732 result = step_through_mergemem(mmem, alias_idx, toop);
2733 if (result == mmem->base_memory()) {
2734 // Didn't find instance memory, search through general slice recursively.
2735 result = mmem->memory_at(C->get_general_index(alias_idx));
2736 result = find_inst_mem(result, alias_idx, orig_phis);
2737 if (C->failing()) {
2738 return NULL;
2739 }
2740 mmem->set_memory_at(alias_idx, result);
2741 }
2742 } else if (result->is_Phi() &&
2743 C->get_alias_index(result->as_Phi()->adr_type()) != alias_idx) {
2744 Node *un = result->as_Phi()->unique_input(igvn);
2745 if (un != NULL) {
2746 orig_phis.append_if_missing(result->as_Phi());
2747 result = un;
2748 } else {
2787 assert(false, "Object is not scalar replaceable if a StrInflatedCopy node accesses its field");
2788 break; // In product mode return SCMemProj node
2789 }
2790 }
2791 result = result->in(MemNode::Memory);
2792 }
2793 }
2794 if (result->is_Phi()) {
2795 PhiNode *mphi = result->as_Phi();
2796 assert(mphi->bottom_type() == Type::MEMORY, "memory phi required");
2797 const TypePtr *t = mphi->adr_type();
2798 if (!is_instance) {
2799 // Push all non-instance Phis on the orig_phis worklist to update inputs
2800 // during Phase 4 if needed.
2801 orig_phis.append_if_missing(mphi);
2802 } else if (C->get_alias_index(t) != alias_idx) {
2803 // Create a new Phi with the specified alias index type.
2804 result = split_memory_phi(mphi, alias_idx, orig_phis);
2805 }
2806 }
2807 // the result is either MemNode, PhiNode, InitializeNode.
2808 return result;
2809 }
2810
2811 //
2812 // Convert the types of unescaped object to instance types where possible,
2813 // propagate the new type information through the graph, and update memory
2814 // edges and MergeMem inputs to reflect the new type.
2815 //
2816 // We start with allocations (and calls which may be allocations) on alloc_worklist.
2817 // The processing is done in 4 phases:
2818 //
2819 // Phase 1: Process possible allocations from alloc_worklist. Create instance
2820 // types for the CheckCastPP for allocations where possible.
2821 // Propagate the new types through users as follows:
2822 // casts and Phi: push users on alloc_worklist
2823 // AddP: cast Base and Address inputs to the instance type
2824 // push any AddP users on alloc_worklist and push any memnode
2825 // users onto memnode_worklist.
2826 // Phase 2: Process MemNode's from memnode_worklist. compute new address type and
2827 // search the Memory chain for a store with the appropriate type
|
2708 if (!call->may_modify(toop, igvn)) {
2709 result = call->in(TypeFunc::Memory);
2710 }
2711 } else if (proj_in->is_Initialize()) {
2712 AllocateNode* alloc = proj_in->as_Initialize()->allocation();
2713 // Stop if this is the initialization for the object instance which
2714 // which contains this memory slice, otherwise skip over it.
2715 if (alloc == NULL || alloc->_idx != (uint)toop->instance_id()) {
2716 result = proj_in->in(TypeFunc::Memory);
2717 }
2718 } else if (proj_in->is_MemBar()) {
2719 if (proj_in->in(TypeFunc::Memory)->is_MergeMem() &&
2720 proj_in->in(TypeFunc::Memory)->as_MergeMem()->in(Compile::AliasIdxRaw)->is_Proj() &&
2721 proj_in->in(TypeFunc::Memory)->as_MergeMem()->in(Compile::AliasIdxRaw)->in(0)->is_ArrayCopy()) {
2722 // clone
2723 ArrayCopyNode* ac = proj_in->in(TypeFunc::Memory)->as_MergeMem()->in(Compile::AliasIdxRaw)->in(0)->as_ArrayCopy();
2724 if (ac->may_modify(toop, igvn)) {
2725 break;
2726 }
2727 }
2728 result = proj_in->in(TypeFunc::Memory); // FYI: bypasses a membar
2729 }
2730 } else if (result->is_MergeMem()) {
2731 MergeMemNode *mmem = result->as_MergeMem();
2732 result = step_through_mergemem(mmem, alias_idx, toop);
2733 if (result == mmem->base_memory()) {
2734 // Didn't find instance memory, search through general slice recursively.
2735 result = mmem->memory_at(C->get_general_index(alias_idx));
2736 result = find_inst_mem(result, alias_idx, orig_phis);
2737 if (C->failing()) {
2738 return NULL;
2739 }
2740 mmem->set_memory_at(alias_idx, result);
2741 }
2742 } else if (result->is_Phi() &&
2743 C->get_alias_index(result->as_Phi()->adr_type()) != alias_idx) {
2744 Node *un = result->as_Phi()->unique_input(igvn);
2745 if (un != NULL) {
2746 orig_phis.append_if_missing(result->as_Phi());
2747 result = un;
2748 } else {
2787 assert(false, "Object is not scalar replaceable if a StrInflatedCopy node accesses its field");
2788 break; // In product mode return SCMemProj node
2789 }
2790 }
2791 result = result->in(MemNode::Memory);
2792 }
2793 }
2794 if (result->is_Phi()) {
2795 PhiNode *mphi = result->as_Phi();
2796 assert(mphi->bottom_type() == Type::MEMORY, "memory phi required");
2797 const TypePtr *t = mphi->adr_type();
2798 if (!is_instance) {
2799 // Push all non-instance Phis on the orig_phis worklist to update inputs
2800 // during Phase 4 if needed.
2801 orig_phis.append_if_missing(mphi);
2802 } else if (C->get_alias_index(t) != alias_idx) {
2803 // Create a new Phi with the specified alias index type.
2804 result = split_memory_phi(mphi, alias_idx, orig_phis);
2805 }
2806 }
2807 return result;
2808 }
2809
2810 //
2811 // Convert the types of unescaped object to instance types where possible,
2812 // propagate the new type information through the graph, and update memory
2813 // edges and MergeMem inputs to reflect the new type.
2814 //
2815 // We start with allocations (and calls which may be allocations) on alloc_worklist.
2816 // The processing is done in 4 phases:
2817 //
2818 // Phase 1: Process possible allocations from alloc_worklist. Create instance
2819 // types for the CheckCastPP for allocations where possible.
2820 // Propagate the new types through users as follows:
2821 // casts and Phi: push users on alloc_worklist
2822 // AddP: cast Base and Address inputs to the instance type
2823 // push any AddP users on alloc_worklist and push any memnode
2824 // users onto memnode_worklist.
2825 // Phase 2: Process MemNode's from memnode_worklist. compute new address type and
2826 // search the Memory chain for a store with the appropriate type
|