43 // This denotes that a load has control dependency.
44 const DecoratorSet C2_CONTROL_DEPENDENT_LOAD = DECORATOR_LAST << 4;
45 // This denotes that a load that must be pinned.
46 const DecoratorSet C2_PINNED_LOAD = DECORATOR_LAST << 5;
47 // This denotes that the access is produced from the sun.misc.Unsafe intrinsics.
48 const DecoratorSet C2_UNSAFE_ACCESS = DECORATOR_LAST << 6;
49 // This denotes that the access mutates state.
50 const DecoratorSet C2_WRITE_ACCESS = DECORATOR_LAST << 7;
51 // This denotes that the access reads state.
52 const DecoratorSet C2_READ_ACCESS = DECORATOR_LAST << 8;
53 // A nearby allocation?
54 const DecoratorSet C2_TIGHLY_COUPLED_ALLOC = DECORATOR_LAST << 9;
55 // Loads and stores from an arraycopy being optimized
56 const DecoratorSet C2_ARRAY_COPY = DECORATOR_LAST << 10;
57
58 class Compile;
59 class ConnectionGraph;
60 class GraphKit;
61 class IdealKit;
62 class Node;
63 class PhaseGVN;
64 class PhaseMacroExpand;
65 class Type;
66 class TypePtr;
67 class Unique_Node_List;
68
69 // This class wraps a node and a type.
70 class C2AccessValue: public StackObj {
71 protected:
72 Node* _node;
73 const Type* _type;
74
75 public:
76 C2AccessValue(Node* node, const Type* type) :
77 _node(node),
78 _type(type) {}
79
80 Node* node() const { return _node; }
81 const Type* type() const { return _type; }
82
260 };
261 virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const { return false; }
262 virtual void clone_barrier_at_expansion(ArrayCopyNode* ac, Node* call, PhaseIterGVN& igvn) const;
263
264 // Support for GC barriers emitted during parsing
265 virtual bool has_load_barriers() const { return false; }
266 virtual bool is_gc_barrier_node(Node* node) const { return false; }
267 virtual Node* step_over_gc_barrier(Node* c) const { return c; }
268
269 // Support for macro expanded GC barriers
270 virtual void register_potential_barrier_node(Node* node) const { }
271 virtual void unregister_potential_barrier_node(Node* node) const { }
272 virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const { }
273 virtual void enqueue_useful_gc_barrier(PhaseIterGVN* igvn, Node* node) const {}
274 virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful, Compile* C) const {}
275 virtual void add_users_to_worklist(Unique_Node_List* worklist) const {}
276
277 // Allow barrier sets to have shared state that is preserved across a compilation unit.
278 // This could for example comprise macro nodes to be expanded during macro expansion.
279 virtual void* create_barrier_state(Arena* comp_arena) const { return NULL; }
280 // If the BarrierSetC2 state has kept macro nodes in its compilation unit state to be
281 // expanded later, then now is the time to do so.
282 virtual bool expand_macro_nodes(PhaseMacroExpand* macro) const { return false; }
283
284 virtual bool has_special_unique_user(const Node* node) const { return false; }
285
286 enum CompilePhase {
287 BeforeOptimize, /* post_parse = true */
288 BeforeExpand, /* post_parse = false */
289 BeforeCodeGen
290 };
291 virtual void verify_gc_barriers(Compile* compile, CompilePhase phase) const {}
292
293 virtual bool flatten_gc_alias_type(const TypePtr*& adr_type) const { return false; }
294 #ifdef ASSERT
295 virtual bool verify_gc_alias_type(const TypePtr* adr_type, int offset) const { return false; }
296 #endif
297
298 virtual bool final_graph_reshaping(Compile* compile, Node* n, uint opcode) const { return false; }
299
300 virtual bool escape_add_to_con_graph(ConnectionGraph* conn_graph, PhaseGVN* gvn, Unique_Node_List* delayed_worklist, Node* n, uint opcode) const { return false; }
301 virtual bool escape_add_final_edges(ConnectionGraph* conn_graph, PhaseGVN* gvn, Node* n, uint opcode) const { return false; }
302 virtual bool escape_has_out_with_unsafe_object(Node* n) const { return false; }
|
43 // This denotes that a load has control dependency.
44 const DecoratorSet C2_CONTROL_DEPENDENT_LOAD = DECORATOR_LAST << 4;
45 // This denotes that a load that must be pinned.
46 const DecoratorSet C2_PINNED_LOAD = DECORATOR_LAST << 5;
47 // This denotes that the access is produced from the sun.misc.Unsafe intrinsics.
48 const DecoratorSet C2_UNSAFE_ACCESS = DECORATOR_LAST << 6;
49 // This denotes that the access mutates state.
50 const DecoratorSet C2_WRITE_ACCESS = DECORATOR_LAST << 7;
51 // This denotes that the access reads state.
52 const DecoratorSet C2_READ_ACCESS = DECORATOR_LAST << 8;
53 // A nearby allocation?
54 const DecoratorSet C2_TIGHLY_COUPLED_ALLOC = DECORATOR_LAST << 9;
55 // Loads and stores from an arraycopy being optimized
56 const DecoratorSet C2_ARRAY_COPY = DECORATOR_LAST << 10;
57
58 class Compile;
59 class ConnectionGraph;
60 class GraphKit;
61 class IdealKit;
62 class Node;
63 class PhaseIdealLoop;
64 class PhaseGVN;
65 class PhaseMacroExpand;
66 class Type;
67 class TypePtr;
68 class Unique_Node_List;
69
70 // This class wraps a node and a type.
71 class C2AccessValue: public StackObj {
72 protected:
73 Node* _node;
74 const Type* _type;
75
76 public:
77 C2AccessValue(Node* node, const Type* type) :
78 _node(node),
79 _type(type) {}
80
81 Node* node() const { return _node; }
82 const Type* type() const { return _type; }
83
261 };
262 virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const { return false; }
263 virtual void clone_barrier_at_expansion(ArrayCopyNode* ac, Node* call, PhaseIterGVN& igvn) const;
264
265 // Support for GC barriers emitted during parsing
266 virtual bool has_load_barriers() const { return false; }
267 virtual bool is_gc_barrier_node(Node* node) const { return false; }
268 virtual Node* step_over_gc_barrier(Node* c) const { return c; }
269
270 // Support for macro expanded GC barriers
271 virtual void register_potential_barrier_node(Node* node) const { }
272 virtual void unregister_potential_barrier_node(Node* node) const { }
273 virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const { }
274 virtual void enqueue_useful_gc_barrier(PhaseIterGVN* igvn, Node* node) const {}
275 virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful, Compile* C) const {}
276 virtual void add_users_to_worklist(Unique_Node_List* worklist) const {}
277
278 // Allow barrier sets to have shared state that is preserved across a compilation unit.
279 // This could for example comprise macro nodes to be expanded during macro expansion.
280 virtual void* create_barrier_state(Arena* comp_arena) const { return NULL; }
281 // If the BarrierSetC2 state has barrier nodes in its compilation
282 // unit state to be expanded later, then now is the time to do so.
283 virtual bool expand_barriers(Compile* C, PhaseIterGVN& igvn) const { return false; }
284 virtual bool optimize_loops(PhaseIdealLoop* phase, LoopOptsMode mode, VectorSet& visited, Node_Stack& nstack, Node_List& worklist) const { return false; }
285 virtual bool strip_mined_loops_expanded(LoopOptsMode mode) const { return false; }
286 virtual bool is_gc_specific_loop_opts_pass(LoopOptsMode mode) const { return false; }
287
288 virtual bool has_special_unique_user(const Node* node) const { return false; }
289
290 enum CompilePhase {
291 BeforeOptimize, /* post_parse = true */
292 BeforeExpand, /* post_parse = false */
293 BeforeCodeGen
294 };
295 virtual void verify_gc_barriers(Compile* compile, CompilePhase phase) const {}
296
297 virtual bool flatten_gc_alias_type(const TypePtr*& adr_type) const { return false; }
298 #ifdef ASSERT
299 virtual bool verify_gc_alias_type(const TypePtr* adr_type, int offset) const { return false; }
300 #endif
301
302 virtual bool final_graph_reshaping(Compile* compile, Node* n, uint opcode) const { return false; }
303
304 virtual bool escape_add_to_con_graph(ConnectionGraph* conn_graph, PhaseGVN* gvn, Unique_Node_List* delayed_worklist, Node* n, uint opcode) const { return false; }
305 virtual bool escape_add_final_edges(ConnectionGraph* conn_graph, PhaseGVN* gvn, Node* n, uint opcode) const { return false; }
306 virtual bool escape_has_out_with_unsafe_object(Node* n) const { return false; }
|