287
288 public:
289 // This is the entry-point for the backend to perform accesses through the Access API.
290 virtual Node* store_at(C2Access& access, C2AccessValue& val) const;
291 virtual Node* load_at(C2Access& access, const Type* val_type) const;
292
293 virtual Node* atomic_cmpxchg_val_at(C2AtomicParseAccess& access, Node* expected_val,
294 Node* new_val, const Type* val_type) const;
295 virtual Node* atomic_cmpxchg_bool_at(C2AtomicParseAccess& access, Node* expected_val,
296 Node* new_val, const Type* val_type) const;
297 virtual Node* atomic_xchg_at(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const;
298 virtual Node* atomic_add_at(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const;
299
300 virtual void clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const;
301
302 virtual Node* obj_allocate(PhaseMacroExpand* macro, Node* mem, Node* toobig_false, Node* size_in_bytes,
303 Node*& i_o, Node*& needgc_ctrl,
304 Node*& fast_oop_ctrl, Node*& fast_oop_rawmem,
305 intx prefetch_lines) const;
306
307 virtual Node* ideal_node(PhaseGVN* phase, Node* n, bool can_reshape) const { return nullptr; }
308
309 // These are general helper methods used by C2
310 enum ArrayCopyPhase {
311 Parsing,
312 Optimization,
313 Expansion
314 };
315
316 virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, bool is_clone_instance, ArrayCopyPhase phase) const { return false; }
317 virtual void clone_at_expansion(PhaseMacroExpand* phase, ArrayCopyNode* ac) const;
318
319 // Support for GC barriers emitted during parsing
320 virtual bool has_load_barrier_nodes() const { return false; }
321 virtual bool is_gc_pre_barrier_node(Node* node) const { return false; }
322 virtual bool is_gc_barrier_node(Node* node) const { return false; }
323 virtual Node* step_over_gc_barrier(Node* c) const { return c; }
324
325 // Support for macro expanded GC barriers
326 virtual void register_potential_barrier_node(Node* node) const { }
327 virtual void unregister_potential_barrier_node(Node* node) const { }
328 virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const { }
329 virtual void eliminate_gc_barrier_data(Node* node) const { }
330 virtual void enqueue_useful_gc_barrier(PhaseIterGVN* igvn, Node* node) const {}
331 virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful, Compile* C) const {}
332
333 // Allow barrier sets to have shared state that is preserved across a compilation unit.
334 // This could for example comprise macro nodes to be expanded during macro expansion.
335 virtual void* create_barrier_state(Arena* comp_arena) const { return nullptr; }
336 // If the BarrierSetC2 state has barrier nodes in its compilation
337 // unit state to be expanded later, then now is the time to do so.
338 virtual bool expand_barriers(Compile* C, PhaseIterGVN& igvn) const { return false; }
339 virtual bool optimize_loops(PhaseIdealLoop* phase, LoopOptsMode mode, VectorSet& visited, Node_Stack& nstack, Node_List& worklist) const { return false; }
340 virtual bool strip_mined_loops_expanded(LoopOptsMode mode) const { return false; }
341 virtual bool is_gc_specific_loop_opts_pass(LoopOptsMode mode) const { return false; }
342 // Estimated size of the node barrier in number of C2 Ideal nodes.
343 // This is used to guide heuristics in C2, e.g. whether to unroll a loop.
344 virtual uint estimated_barrier_size(const Node* node) const { return 0; }
345 // Whether the given store can be used to initialize a newly allocated object.
346 virtual bool can_initialize_object(const StoreNode* store) const { return true; }
347
348 enum CompilePhase {
349 BeforeOptimize,
350 BeforeMacroExpand,
351 BeforeCodeGen
352 };
353
354 #ifdef ASSERT
355 virtual void verify_gc_barriers(Compile* compile, CompilePhase phase) const {}
356 #endif
357
358 virtual bool final_graph_reshaping(Compile* compile, Node* n, uint opcode, Unique_Node_List& dead_nodes) const { return false; }
359
360 virtual bool escape_add_to_con_graph(ConnectionGraph* conn_graph, PhaseGVN* gvn, Unique_Node_List* delayed_worklist, Node* n, uint opcode) const { return false; }
361 virtual bool escape_add_final_edges(ConnectionGraph* conn_graph, PhaseGVN* gvn, Node* n, uint opcode) const { return false; }
362 virtual bool escape_has_out_with_unsafe_object(Node* n) const { return false; }
363
364 virtual bool matcher_find_shared_post_visit(Matcher* matcher, Node* n, uint opcode) const { return false; };
365 virtual bool matcher_is_store_load_barrier(Node* x, uint xop) const { return false; }
366
367 // Whether the given phi node joins OOPs from fast and slow allocation paths.
368 static bool is_allocation(const Node* node);
369 // Elide GC barriers from a Mach node according to elide_dominated_barriers().
370 virtual void elide_dominated_barrier(MachNode* mach) const { }
371 // Elide GC barriers from instructions in 'accesses' if they are dominated by
372 // instructions in 'access_dominators' (according to elide_mach_barrier()) and
373 // there is no safepoint poll in between.
374 void elide_dominated_barriers(Node_List& accesses, Node_List& access_dominators) const;
375 virtual void late_barrier_analysis() const { }
376 virtual void compute_liveness_at_stubs() const;
377 virtual int estimate_stub_size() const { return 0; }
378 virtual void emit_stubs(CodeBuffer& cb) const { }
379
380 static int arraycopy_payload_base_offset(bool is_array);
381
382 #ifndef PRODUCT
383 virtual void dump_barrier_data(const MachNode* mach, outputStream* st) const {
384 st->print("%x", mach->barrier_data());
385 };
386 #endif
|
287
288 public:
289 // This is the entry-point for the backend to perform accesses through the Access API.
290 virtual Node* store_at(C2Access& access, C2AccessValue& val) const;
291 virtual Node* load_at(C2Access& access, const Type* val_type) const;
292
293 virtual Node* atomic_cmpxchg_val_at(C2AtomicParseAccess& access, Node* expected_val,
294 Node* new_val, const Type* val_type) const;
295 virtual Node* atomic_cmpxchg_bool_at(C2AtomicParseAccess& access, Node* expected_val,
296 Node* new_val, const Type* val_type) const;
297 virtual Node* atomic_xchg_at(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const;
298 virtual Node* atomic_add_at(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const;
299
300 virtual void clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const;
301
302 virtual Node* obj_allocate(PhaseMacroExpand* macro, Node* mem, Node* toobig_false, Node* size_in_bytes,
303 Node*& i_o, Node*& needgc_ctrl,
304 Node*& fast_oop_ctrl, Node*& fast_oop_rawmem,
305 intx prefetch_lines) const;
306
307 // These are general helper methods used by C2
308 enum ArrayCopyPhase {
309 Parsing,
310 Optimization,
311 Expansion
312 };
313
314 virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, bool is_clone_instance, ArrayCopyPhase phase) const { return false; }
315 virtual void clone_at_expansion(PhaseMacroExpand* phase, ArrayCopyNode* ac) const;
316
317 // Support for GC barriers emitted during parsing
318 virtual bool is_gc_barrier_node(Node* node) const { return false; }
319
320 // Support for macro expanded GC barriers
321 virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const { }
322 virtual void eliminate_gc_barrier_data(Node* node) const { }
323
324 // Allow barrier sets to have shared state that is preserved across a compilation unit.
325 // This could for example comprise macro nodes to be expanded during macro expansion.
326 virtual void* create_barrier_state(Arena* comp_arena) const { return nullptr; }
327 // If the BarrierSetC2 state has barrier nodes in its compilation
328 // unit state to be expanded later, then now is the time to do so.
329 virtual bool expand_barriers(Compile* C, PhaseIterGVN& igvn) const { return false; }
330 // Estimated size of the node barrier in number of C2 Ideal nodes.
331 // This is used to guide heuristics in C2, e.g. whether to unroll a loop.
332 virtual uint estimated_barrier_size(const Node* node) const { return 0; }
333 // Whether the given store can be used to initialize a newly allocated object.
334 virtual bool can_initialize_object(const StoreNode* store) const { return true; }
335
336 enum CompilePhase {
337 BeforeOptimize,
338 BeforeMacroExpand,
339 BeforeCodeGen
340 };
341
342 #ifdef ASSERT
343 virtual void verify_gc_barriers(Compile* compile, CompilePhase phase) const {}
344 #endif
345
346 // Whether the given phi node joins OOPs from fast and slow allocation paths.
347 static bool is_allocation(const Node* node);
348 // Elide GC barriers from a Mach node according to elide_dominated_barriers().
349 virtual void elide_dominated_barrier(MachNode* mach) const { }
350 // Elide GC barriers from instructions in 'accesses' if they are dominated by
351 // instructions in 'access_dominators' (according to elide_mach_barrier()) and
352 // there is no safepoint poll in between.
353 void elide_dominated_barriers(Node_List& accesses, Node_List& access_dominators) const;
354 virtual void late_barrier_analysis() const { }
355 virtual void compute_liveness_at_stubs() const;
356 virtual int estimate_stub_size() const { return 0; }
357 virtual void emit_stubs(CodeBuffer& cb) const { }
358
359 static int arraycopy_payload_base_offset(bool is_array);
360
361 #ifndef PRODUCT
362 virtual void dump_barrier_data(const MachNode* mach, outputStream* st) const {
363 st->print("%x", mach->barrier_data());
364 };
365 #endif
|