19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.inline.hpp"
27 #include "memory/allocation.inline.hpp"
28 #include "opto/ad.hpp"
29 #include "opto/block.hpp"
30 #include "opto/c2compiler.hpp"
31 #include "opto/callnode.hpp"
32 #include "opto/cfgnode.hpp"
33 #include "opto/machnode.hpp"
34 #include "opto/runtime.hpp"
35 #include "opto/chaitin.hpp"
36 #include "runtime/sharedRuntime.hpp"
37 #include "utilities/macros.hpp"
38 #if INCLUDE_SHENANDOAHGC
39 #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp"
40 #endif
41
42 // Optimization - Graph Style
43
44 // Check whether val is not-null-decoded compressed oop,
45 // i.e. will grab into the base of the heap if it represents NULL.
46 static bool accesses_heap_base_zone(Node *val) {
47 if (Universe::narrow_oop_base() != NULL) { // Implies UseCompressedOops.
48 if (val && val->is_Mach()) {
49 if (val->as_Mach()->ideal_Opcode() == Op_DecodeN) {
50 // This assumes all Decodes with TypePtr::NotNull are matched to nodes that
51 // decode NULL to point to the heap base (Decode_NN).
52 if (val->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull) {
53 return true;
54 }
55 }
56 // Must recognize load operation with Decode matched in memory operand.
57 // We should not reach here exept for PPC/AIX, as os::zero_page_read_protected()
58 // returns true everywhere else. On PPC, no such memory operands
59 // exist, therefore we did not yet implement a check for such operands.
881 // callee saved register since the register wouldn't know where to
882 // find them. CallLeaf and CallLeafNoFP are ok because they can't
883 // have debug info on them. Strictly speaking this only needs to be
884 // done for oops since idealreg2debugmask takes care of debug info
885 // references but there no way to handle oops differently than other
886 // pointers as far as the kill mask goes.
887 bool exclude_soe = op == Op_CallRuntime;
888
889 // If the call is a MethodHandle invoke, we need to exclude the
890 // register which is used to save the SP value over MH invokes from
891 // the mask. Otherwise this register could be used for
892 // deoptimization information.
893 if (op == Op_CallStaticJava) {
894 MachCallStaticJavaNode* mcallstaticjava = (MachCallStaticJavaNode*) mcall;
895 if (mcallstaticjava->_method_handle_invoke)
896 proj->_rout.OR(Matcher::method_handle_invoke_SP_save_mask());
897 }
898
899 #if INCLUDE_SHENANDOAHGC
900 if (UseShenandoahGC &&
901 ShenandoahBarrierSetAssembler::is_shenandoah_wb_C_call(mcall->entry_point())) {
902 assert(op == Op_CallLeafNoFP, "shenandoah_wb_C should be called with Op_CallLeafNoFP");
903 add_call_kills(proj, regs, save_policy, exclude_soe, true);
904 } else
905 #endif
906 {
907 add_call_kills(proj, regs, save_policy, exclude_soe, false);
908 }
909 return node_cnt;
910 }
911
912 void PhaseCFG::push_ready_nodes(Node* n, Node* m, Block* block, GrowableArray<int>& ready_cnt, Node_List& worklist, uint max_idx, int c) {
913 if (get_block_for_node(m) != block) {
914 return;
915 }
916 if (m->is_Phi()) {
917 return;
918 }
919 if (m->_idx >= max_idx) { // new node, skip it
920 assert(m->is_MachProj() && n->is_Mach() && n->as_Mach()->has_call(), "unexpected node types");
921 return;
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.inline.hpp"
27 #include "memory/allocation.inline.hpp"
28 #include "opto/ad.hpp"
29 #include "opto/block.hpp"
30 #include "opto/c2compiler.hpp"
31 #include "opto/callnode.hpp"
32 #include "opto/cfgnode.hpp"
33 #include "opto/machnode.hpp"
34 #include "opto/runtime.hpp"
35 #include "opto/chaitin.hpp"
36 #include "runtime/sharedRuntime.hpp"
37 #include "utilities/macros.hpp"
38 #if INCLUDE_SHENANDOAHGC
39 #include "gc/shenandoah/shenandoahBaseBarrierSetAssembler.hpp"
40 #endif
41
42 // Optimization - Graph Style
43
44 // Check whether val is not-null-decoded compressed oop,
45 // i.e. will grab into the base of the heap if it represents NULL.
46 static bool accesses_heap_base_zone(Node *val) {
47 if (Universe::narrow_oop_base() != NULL) { // Implies UseCompressedOops.
48 if (val && val->is_Mach()) {
49 if (val->as_Mach()->ideal_Opcode() == Op_DecodeN) {
50 // This assumes all Decodes with TypePtr::NotNull are matched to nodes that
51 // decode NULL to point to the heap base (Decode_NN).
52 if (val->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull) {
53 return true;
54 }
55 }
56 // Must recognize load operation with Decode matched in memory operand.
57 // We should not reach here exept for PPC/AIX, as os::zero_page_read_protected()
58 // returns true everywhere else. On PPC, no such memory operands
59 // exist, therefore we did not yet implement a check for such operands.
881 // callee saved register since the register wouldn't know where to
882 // find them. CallLeaf and CallLeafNoFP are ok because they can't
883 // have debug info on them. Strictly speaking this only needs to be
884 // done for oops since idealreg2debugmask takes care of debug info
885 // references but there no way to handle oops differently than other
886 // pointers as far as the kill mask goes.
887 bool exclude_soe = op == Op_CallRuntime;
888
889 // If the call is a MethodHandle invoke, we need to exclude the
890 // register which is used to save the SP value over MH invokes from
891 // the mask. Otherwise this register could be used for
892 // deoptimization information.
893 if (op == Op_CallStaticJava) {
894 MachCallStaticJavaNode* mcallstaticjava = (MachCallStaticJavaNode*) mcall;
895 if (mcallstaticjava->_method_handle_invoke)
896 proj->_rout.OR(Matcher::method_handle_invoke_SP_save_mask());
897 }
898
899 #if INCLUDE_SHENANDOAHGC
900 if (UseShenandoahGC &&
901 ShenandoahBaseBarrierSetAssembler::is_shenandoah_wb_C_call(mcall->entry_point())) {
902 assert(op == Op_CallLeafNoFP, "shenandoah_wb_C should be called with Op_CallLeafNoFP");
903 add_call_kills(proj, regs, save_policy, exclude_soe, true);
904 } else
905 #endif
906 {
907 add_call_kills(proj, regs, save_policy, exclude_soe, false);
908 }
909 return node_cnt;
910 }
911
912 void PhaseCFG::push_ready_nodes(Node* n, Node* m, Block* block, GrowableArray<int>& ready_cnt, Node_List& worklist, uint max_idx, int c) {
913 if (get_block_for_node(m) != block) {
914 return;
915 }
916 if (m->is_Phi()) {
917 return;
918 }
919 if (m->_idx >= max_idx) { // new node, skip it
920 assert(m->is_MachProj() && n->is_Mach() && n->as_Mach()->has_call(), "unexpected node types");
921 return;
|