diff a/src/hotspot/share/opto/macro.hpp b/src/hotspot/share/opto/macro.hpp --- a/src/hotspot/share/opto/macro.hpp +++ b/src/hotspot/share/opto/macro.hpp @@ -102,16 +102,33 @@ address slow_call_address); void yank_initalize_node(InitializeNode* node); void yank_alloc_node(AllocateNode* alloc); Node *value_from_mem(Node *mem, Node *ctl, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc); Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc, Node_Stack *value_phis, int level); + const Type* field_type_from_element(ciField* field, ciType* elem_type, BasicType& basic_elem_type); + void adjust_safepoint_jvms(SafePointNode* sfpt, Node* res, SafePointScalarObjectNode* sobj); + void retrieve_type_and_size_info(AllocateNode *alloc, Node *res, const TypeOopPtr** res_type, ciKlass** klass, ciInstanceKlass** iklass, int* nfields); + void retrieve_array_type_and_size_info(ciKlass* klass, ciType** elem_type, BasicType* basic_elem_type, int* element_size, int* array_base); bool eliminate_boxing_node(CallStaticJavaNode *boxing); bool eliminate_allocate_node(AllocateNode *alloc); bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray & safepoints); bool scalar_replacement(AllocateNode *alloc, GrowableArray & safepoints_done); void process_users_of_allocation(CallNode *alloc); + bool stack_allocation(AllocateNode *alloc); + void eliminate_unused_allocation_edges(CallNode* alloc); + void handle_safepoint_for_stack_allocation(Dict* safepoint_map, AllocateNode* alloc, Node* oop_node, Node* parent, SafePointNode* sfpt); + bool process_write_barriers_on_stack_allocated_objects(AllocateNode* alloc); + bool register_stack_allocated_object_with_safepoints(AllocateNode* alloc, Node* stack_oop); + void stack_allocation_init_array_length_on_entry(AllocateNode *alloc, Node *length, Node *stack_oop); +#ifndef PRODUCT + void stack_allocation_clear_object_data(AllocateNode *alloc, Node *stack_oop); +#endif + void estimate_stack_allocation_size(AllocateNode* alloc); + bool can_stack_allocate(AllocateNode* alloc, Node *res, intptr_t size_of_object); + bool stack_allocation_location_representable(int n); + int next_stack_allocated_object(int num_slots); void eliminate_gc_barrier(Node *p2x); void mark_eliminated_box(Node* box, Node* obj); void mark_eliminated_locking_nodes(AbstractLockNode *alock); bool eliminate_locking_node(AbstractLockNode *alock); @@ -201,10 +218,23 @@ Node* klass_node, Node* length, Node* size_in_bytes); Node* make_arraycopy_load(ArrayCopyNode* ac, intptr_t offset, Node* ctl, Node* mem, BasicType ft, const Type *ftype, AllocateNode *alloc); + bool should_stack_allocate() { + return C->do_stack_allocation(); + } + +#ifndef PRODUCT + bool print_eliminate_allocations() { + return PrintEliminateAllocations || C->directive()->PrintEliminateAllocationsOption; + } + bool print_stack_allocation() { + return PrintStackAllocation || C->directive()->PrintStackAllocationOption; + } +#endif + public: PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn), _has_locks(false) { _igvn.set_delay_transform(true); } void eliminate_macro_nodes();