17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
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
38 // Optimization - Graph Style
39
40 // Check whether val is not-null-decoded compressed oop,
41 // i.e. will grab into the base of the heap if it represents NULL.
42 static bool accesses_heap_base_zone(Node *val) {
43 if (Universe::narrow_oop_base() != NULL) { // Implies UseCompressedOops.
44 if (val && val->is_Mach()) {
45 if (val->as_Mach()->ideal_Opcode() == Op_DecodeN) {
46 // This assumes all Decodes with TypePtr::NotNull are matched to nodes that
47 // decode NULL to point to the heap base (Decode_NN).
48 if (val->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull) {
49 return true;
50 }
51 }
52 // Must recognize load operation with Decode matched in memory operand.
53 // We should not reach here exept for PPC/AIX, as os::zero_page_read_protected()
54 // returns true everywhere else. On PPC, no such memory operands
55 // exist, therefore we did not yet implement a check for such operands.
56 NOT_AIX(Unimplemented());
876 // When using CallRuntime mark SOE registers as killed by the call
877 // so values that could show up in the RegisterMap aren't live in a
878 // callee saved register since the register wouldn't know where to
879 // find them. CallLeaf and CallLeafNoFP are ok because they can't
880 // have debug info on them. Strictly speaking this only needs to be
881 // done for oops since idealreg2debugmask takes care of debug info
882 // references but there no way to handle oops differently than other
883 // pointers as far as the kill mask goes.
884 bool exclude_soe = op == Op_CallRuntime;
885
886 // If the call is a MethodHandle invoke, we need to exclude the
887 // register which is used to save the SP value over MH invokes from
888 // the mask. Otherwise this register could be used for
889 // deoptimization information.
890 if (op == Op_CallStaticJava) {
891 MachCallStaticJavaNode* mcallstaticjava = (MachCallStaticJavaNode*) mcall;
892 if (mcallstaticjava->_method_handle_invoke)
893 proj->_rout.OR(Matcher::method_handle_invoke_SP_save_mask());
894 }
895
896 if (UseShenandoahGC && mcall->entry_point() == StubRoutines::shenandoah_wb_C()) {
897 assert(op == Op_CallLeafNoFP, "shenandoah_wb_C should be called with Op_CallLeafNoFP");
898 add_call_kills(proj, regs, save_policy, exclude_soe, true);
899 } else {
900 add_call_kills(proj, regs, save_policy, exclude_soe, false);
901 }
902
903 return node_cnt;
904 }
905
906 void PhaseCFG::push_ready_nodes(Node* n, Node* m, Block* block, GrowableArray<int>& ready_cnt, Node_List& worklist, uint max_idx, int c) {
907 if (get_block_for_node(m) != block) {
908 return;
909 }
910 if (m->is_Phi()) {
911 return;
912 }
913 if (m->_idx >= max_idx) { // new node, skip it
914 assert(m->is_MachProj() && n->is_Mach() && n->as_Mach()->has_call(), "unexpected node types");
915 return;
916 }
917 int m_cnt = ready_cnt.at(m->_idx) - c;
918 ready_cnt.at_put(m->_idx, m_cnt);
919 if (m_cnt == 0) {
920 worklist.push(m);
921 }
922 }
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
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.
60 NOT_AIX(Unimplemented());
880 // When using CallRuntime mark SOE registers as killed by the call
881 // so values that could show up in the RegisterMap aren't live in a
882 // callee saved register since the register wouldn't know where to
883 // find them. CallLeaf and CallLeafNoFP are ok because they can't
884 // have debug info on them. Strictly speaking this only needs to be
885 // done for oops since idealreg2debugmask takes care of debug info
886 // references but there no way to handle oops differently than other
887 // pointers as far as the kill mask goes.
888 bool exclude_soe = op == Op_CallRuntime;
889
890 // If the call is a MethodHandle invoke, we need to exclude the
891 // register which is used to save the SP value over MH invokes from
892 // the mask. Otherwise this register could be used for
893 // deoptimization information.
894 if (op == Op_CallStaticJava) {
895 MachCallStaticJavaNode* mcallstaticjava = (MachCallStaticJavaNode*) mcall;
896 if (mcallstaticjava->_method_handle_invoke)
897 proj->_rout.OR(Matcher::method_handle_invoke_SP_save_mask());
898 }
899
900 #if INCLUDE_SHENANDOAHGC
901 if (UseShenandoahGC && (ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier) && mcall->entry_point() == ShenandoahBarrierSetAssembler::shenandoah_wb_C()) {
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;
922 }
923 int m_cnt = ready_cnt.at(m->_idx) - c;
924 ready_cnt.at_put(m->_idx, m_cnt);
925 if (m_cnt == 0) {
926 worklist.push(m);
927 }
928 }
|