20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_OPTO_GRAPHKIT_HPP
26 #define SHARE_OPTO_GRAPHKIT_HPP
27
28 #include "ci/ciEnv.hpp"
29 #include "ci/ciMethodData.hpp"
30 #include "gc/shared/c2/barrierSetC2.hpp"
31 #include "opto/addnode.hpp"
32 #include "opto/callnode.hpp"
33 #include "opto/cfgnode.hpp"
34 #include "opto/compile.hpp"
35 #include "opto/divnode.hpp"
36 #include "opto/mulnode.hpp"
37 #include "opto/phaseX.hpp"
38 #include "opto/subnode.hpp"
39 #include "opto/type.hpp"
40 #include "runtime/deoptimization.hpp"
41
42 class BarrierSetC2;
43 class FastLockNode;
44 class FastUnlockNode;
45 class IdealKit;
46 class LibraryCallKit;
47 class Parse;
48 class RootNode;
49
50 //-----------------------------------------------------------------------------
51 //----------------------------GraphKit-----------------------------------------
52 // Toolkit for building the common sorts of subgraphs.
53 // Does not know about bytecode parsing or type-flow results.
54 // It is able to create graphs implementing the semantics of most
55 // or all bytecodes, so that it can expand intrinsics and calls.
56 // It may depend on JVMState structure, but it must not depend
57 // on specific bytecode streams.
58 class GraphKit : public Phase {
59 friend class PreserveJVMState;
661 void make_dtrace_method_entry_exit(ciMethod* method, bool is_entry);
662 void make_dtrace_method_entry(ciMethod* method) {
663 make_dtrace_method_entry_exit(method, true);
664 }
665 void make_dtrace_method_exit(ciMethod* method) {
666 make_dtrace_method_entry_exit(method, false);
667 }
668
669 //--------------- stub generation -------------------
670 public:
671 void gen_stub(address C_function,
672 const char *name,
673 int is_fancy_jump,
674 bool pass_tls,
675 bool return_pc);
676
677 //---------- help for generating calls --------------
678
679 // Do a null check on the receiver as it would happen before the call to
680 // callee (with all arguments still on the stack).
681 Node* null_check_receiver_before_call(ciMethod* callee) {
682 assert(!callee->is_static(), "must be a virtual method");
683 if (argument(0)->is_ValueType()) {
684 return argument(0);
685 }
686 // Callsite signature can be different from actual method being called (i.e _linkTo* sites).
687 // Use callsite signature always.
688 ciMethod* declared_method = method()->get_method_at_bci(bci());
689 const int nargs = declared_method->arg_size();
690 inc_sp(nargs);
691 Node* n = null_check_receiver();
692 dec_sp(nargs);
693 return n;
694 }
695
696 // Fill in argument edges for the call from argument(0), argument(1), ...
697 // (The next step is to call set_edges_for_java_call.)
698 void set_arguments_for_java_call(CallJavaNode* call, bool incremental_inlining = false);
699
700 // Fill in non-argument edges for the call.
701 // Transform the call, and update the basics: control, i_o, memory.
702 // (The next step is usually to call set_results_for_java_call.)
703 void set_edges_for_java_call(CallJavaNode* call,
704 bool must_throw = false, bool separate_io_proj = false);
705
706 // Finish up a java call that was started by set_edges_for_java_call.
707 // Call add_exception on any throw arising from the call.
708 // Return the call result (transformed).
709 Node* set_results_for_java_call(CallJavaNode* call, bool separate_io_proj = false, bool deoptimize = false);
710
711 // Similar to set_edges_for_java_call, but simplified for runtime calls.
712 void set_predefined_output_for_runtime_call(Node* call) {
|
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_OPTO_GRAPHKIT_HPP
26 #define SHARE_OPTO_GRAPHKIT_HPP
27
28 #include "ci/ciEnv.hpp"
29 #include "ci/ciMethodData.hpp"
30 #include "gc/shared/c2/barrierSetC2.hpp"
31 #include "opto/addnode.hpp"
32 #include "opto/callnode.hpp"
33 #include "opto/cfgnode.hpp"
34 #include "opto/compile.hpp"
35 #include "opto/divnode.hpp"
36 #include "opto/mulnode.hpp"
37 #include "opto/phaseX.hpp"
38 #include "opto/subnode.hpp"
39 #include "opto/type.hpp"
40 #include "opto/valuetypenode.hpp"
41 #include "runtime/deoptimization.hpp"
42
43 class BarrierSetC2;
44 class FastLockNode;
45 class FastUnlockNode;
46 class IdealKit;
47 class LibraryCallKit;
48 class Parse;
49 class RootNode;
50
51 //-----------------------------------------------------------------------------
52 //----------------------------GraphKit-----------------------------------------
53 // Toolkit for building the common sorts of subgraphs.
54 // Does not know about bytecode parsing or type-flow results.
55 // It is able to create graphs implementing the semantics of most
56 // or all bytecodes, so that it can expand intrinsics and calls.
57 // It may depend on JVMState structure, but it must not depend
58 // on specific bytecode streams.
59 class GraphKit : public Phase {
60 friend class PreserveJVMState;
662 void make_dtrace_method_entry_exit(ciMethod* method, bool is_entry);
663 void make_dtrace_method_entry(ciMethod* method) {
664 make_dtrace_method_entry_exit(method, true);
665 }
666 void make_dtrace_method_exit(ciMethod* method) {
667 make_dtrace_method_entry_exit(method, false);
668 }
669
670 //--------------- stub generation -------------------
671 public:
672 void gen_stub(address C_function,
673 const char *name,
674 int is_fancy_jump,
675 bool pass_tls,
676 bool return_pc);
677
678 //---------- help for generating calls --------------
679
680 // Do a null check on the receiver as it would happen before the call to
681 // callee (with all arguments still on the stack).
682 Node* null_check_receiver_before_call(ciMethod* callee, bool replace_value = true) {
683 assert(!callee->is_static(), "must be a virtual method");
684 if (argument(0)->is_ValueType()) {
685 return argument(0);
686 }
687 // Callsite signature can be different from actual method being called (i.e _linkTo* sites).
688 // Use callsite signature always.
689 ciMethod* declared_method = method()->get_method_at_bci(bci());
690 const int nargs = declared_method->arg_size();
691 inc_sp(nargs);
692 Node* n = null_check_receiver();
693 dec_sp(nargs);
694 // Scalarize value type receiver
695 const Type* recv_type = gvn().type(n);
696 if (recv_type->is_valuetypeptr() && recv_type->value_klass()->is_scalarizable()) {
697 assert(!recv_type->maybe_null(), "should never be null");
698 ValueTypeNode* vt = ValueTypeNode::make_from_oop(this, n, recv_type->value_klass());
699 if (replace_value) {
700 replace_in_map(n, vt);
701 }
702 n = vt;
703 }
704 return n;
705 }
706
707 // Fill in argument edges for the call from argument(0), argument(1), ...
708 // (The next step is to call set_edges_for_java_call.)
709 void set_arguments_for_java_call(CallJavaNode* call, bool incremental_inlining = false);
710
711 // Fill in non-argument edges for the call.
712 // Transform the call, and update the basics: control, i_o, memory.
713 // (The next step is usually to call set_results_for_java_call.)
714 void set_edges_for_java_call(CallJavaNode* call,
715 bool must_throw = false, bool separate_io_proj = false);
716
717 // Finish up a java call that was started by set_edges_for_java_call.
718 // Call add_exception on any throw arising from the call.
719 // Return the call result (transformed).
720 Node* set_results_for_java_call(CallJavaNode* call, bool separate_io_proj = false, bool deoptimize = false);
721
722 // Similar to set_edges_for_java_call, but simplified for runtime calls.
723 void set_predefined_output_for_runtime_call(Node* call) {
|