27
28 #include "compiler/compileBroker.hpp"
29 #include "opto/callnode.hpp"
30 #include "opto/compile.hpp"
31 #include "opto/type.hpp"
32 #include "runtime/deoptimization.hpp"
33
34 //---------------------------CallGenerator-------------------------------------
35 // The subclasses of this class handle generation of ideal nodes for
36 // call sites and method entry points.
37
38 class CallGenerator : public ArenaObj {
39 private:
40 ciMethod* _method; // The method being called.
41
42 protected:
43 CallGenerator(ciMethod* method) : _method(method) {}
44
45 void do_late_inline_helper();
46
47 virtual bool do_late_inline_check(Compile* C, JVMState* jvms) { ShouldNotReachHere(); return false; }
48 virtual CallGenerator* inline_cg() const { ShouldNotReachHere(); return nullptr;}
49 virtual bool is_pure_call() const { ShouldNotReachHere(); return false; }
50
51 public:
52 // Accessors
53 ciMethod* method() const { return _method; }
54
55 // is_inline: At least some code implementing the method is copied here.
56 virtual bool is_inline() const { return false; }
57 // is_intrinsic: There's a method-specific way of generating the inline code.
58 virtual bool is_intrinsic() const { return false; }
59 // is_parse: Bytecodes implementing the specific method are copied here.
60 virtual bool is_parse() const { return false; }
61 // is_virtual: The call uses the receiver type to select or check the method.
62 virtual bool is_virtual() const { return false; }
63 // is_deferred: The decision whether to inline or not is deferred.
64 virtual bool is_deferred() const { return false; }
65 // is_predicated: Uses an explicit check (predicate).
66 virtual bool is_predicated() const { return false; }
67 virtual int predicates_count() const { return 0; }
68 // is_trap: Does not return to the caller. (E.g., uncommon trap.)
69 virtual bool is_trap() const { return false; }
70 // does_virtual_dispatch: Should try inlining as normal method first.
71 virtual bool does_virtual_dispatch() const { return false; }
72
73 // is_late_inline: supports conversion of call into an inline
74 virtual bool is_late_inline() const { return false; }
75 // same but for method handle calls
76 virtual bool is_mh_late_inline() const { return false; }
77 virtual bool is_string_late_inline() const { return false; }
78 virtual bool is_virtual_late_inline() const { return false; }
79
80 // Replace the call with an inline version of the code
81 virtual void do_late_inline() { ShouldNotReachHere(); }
82
83 virtual CallNode* call_node() const { return nullptr; }
84 virtual CallGenerator* with_call_node(CallNode* call) { return this; }
85
86 virtual void set_unique_id(jlong id) { fatal("unique id only for late inlines"); };
87 virtual jlong unique_id() const { fatal("unique id only for late inlines"); return 0; };
88
89 virtual void set_callee_method(ciMethod* callee) { ShouldNotReachHere(); }
90
91 // Note: It is possible for a CG to be both inline and virtual.
92 // (The hashCode intrinsic does a vtable check and an inlined fast path.)
93
94 // Allocate CallGenerators only in Compile arena since some of them are referenced from CallNodes.
95 void* operator new(size_t size) throw() {
96 Compile* C = Compile::current();
97 return ArenaObj::operator new(size, C->comp_arena());
98 }
99
100 // Utilities:
101 const TypeFunc* tf() const;
102
103 // The given jvms has state and arguments for a call to my method.
104 // Edges after jvms->argoff() carry all (pre-popped) argument values.
105 //
106 // Update the map with state and return values (if any) and return it.
107 // The return values (0, 1, or 2) must be pushed on the map's stack,
108 // and the sp of the jvms incremented accordingly.
|
27
28 #include "compiler/compileBroker.hpp"
29 #include "opto/callnode.hpp"
30 #include "opto/compile.hpp"
31 #include "opto/type.hpp"
32 #include "runtime/deoptimization.hpp"
33
34 //---------------------------CallGenerator-------------------------------------
35 // The subclasses of this class handle generation of ideal nodes for
36 // call sites and method entry points.
37
38 class CallGenerator : public ArenaObj {
39 private:
40 ciMethod* _method; // The method being called.
41
42 protected:
43 CallGenerator(ciMethod* method) : _method(method) {}
44
45 void do_late_inline_helper();
46
47 virtual bool do_late_inline_check(Compile* C, JVMState* jvms) { ShouldNotReachHere(); return false; }
48 virtual bool is_pure_call() const { ShouldNotReachHere(); return false; }
49
50 public:
51 // Accessors
52 ciMethod* method() const { return _method; }
53
54 // is_inline: At least some code implementing the method is copied here.
55 virtual bool is_inline() const { return false; }
56 // is_intrinsic: There's a method-specific way of generating the inline code.
57 virtual bool is_intrinsic() const { return false; }
58 // is_parse: Bytecodes implementing the specific method are copied here.
59 virtual bool is_parse() const { return false; }
60 // is_virtual: The call uses the receiver type to select or check the method.
61 virtual bool is_virtual() const { return false; }
62 // is_deferred: The decision whether to inline or not is deferred.
63 virtual bool is_deferred() const { return false; }
64 // is_predicated: Uses an explicit check (predicate).
65 virtual bool is_predicated() const { return false; }
66 virtual int predicates_count() const { return 0; }
67 // is_trap: Does not return to the caller. (E.g., uncommon trap.)
68 virtual bool is_trap() const { return false; }
69 // does_virtual_dispatch: Should try inlining as normal method first.
70 virtual bool does_virtual_dispatch() const { return false; }
71
72 // is_late_inline: supports conversion of call into an inline
73 virtual bool is_late_inline() const { return false; }
74 // same but for method handle calls
75 virtual bool is_mh_late_inline() const { return false; }
76 virtual bool is_string_late_inline() const { return false; }
77 virtual bool is_virtual_late_inline() const { return false; }
78
79 // Replace the call with an inline version of the code
80 virtual void do_late_inline() { ShouldNotReachHere(); }
81
82 virtual CallNode* call_node() const { return nullptr; }
83 virtual CallGenerator* with_call_node(CallNode* call) { return this; }
84
85 virtual void set_unique_id(jlong id) { fatal("unique id only for late inlines"); };
86 virtual jlong unique_id() const { fatal("unique id only for late inlines"); return 0; };
87
88 virtual CallGenerator* inline_cg() const { ShouldNotReachHere(); return nullptr; }
89
90 virtual void set_callee_method(ciMethod* callee) { ShouldNotReachHere(); }
91
92 // Note: It is possible for a CG to be both inline and virtual.
93 // (The hashCode intrinsic does a vtable check and an inlined fast path.)
94
95 // Allocate CallGenerators only in Compile arena since some of them are referenced from CallNodes.
96 void* operator new(size_t size) throw() {
97 Compile* C = Compile::current();
98 return ArenaObj::operator new(size, C->comp_arena());
99 }
100
101 // Utilities:
102 const TypeFunc* tf() const;
103
104 // The given jvms has state and arguments for a call to my method.
105 // Edges after jvms->argoff() carry all (pre-popped) argument values.
106 //
107 // Update the map with state and return values (if any) and return it.
108 // The return values (0, 1, or 2) must be pushed on the map's stack,
109 // and the sp of the jvms incremented accordingly.
|