737 // Helper functions to build synchronizations
738 int next_monitor();
739 Node* insert_mem_bar(int opcode, Node* precedent = NULL);
740 Node* insert_mem_bar_volatile(int opcode, int alias_idx, Node* precedent = NULL);
741 // Optional 'precedent' is appended as an extra edge, to force ordering.
742 FastLockNode* shared_lock(Node* obj);
743 void shared_unlock(Node* box, Node* obj);
744
745 // helper functions for the fast path/slow path idioms
746 Node* fast_and_slow(Node* in, const Type *result_type, Node* null_result, IfNode* fast_test, Node* fast_result, address slow_call, const TypeFunc *slow_call_type, Node* slow_arg, Klass* ex_klass, Node* slow_result);
747
748 // Generate an instance-of idiom. Used by both the instance-of bytecode
749 // and the reflective instance-of call.
750 Node* gen_instanceof( Node *subobj, Node* superkls );
751
752 // Generate a check-cast idiom. Used by both the check-cast bytecode
753 // and the array-store bytecode
754 Node* gen_checkcast( Node *subobj, Node* superkls,
755 Node* *failure_control = NULL );
756
757 // Generate a subtyping check. Takes as input the subtype and supertype.
758 // Returns 2 values: sets the default control() to the true path and
759 // returns the false path. Only reads from constant memory taken from the
760 // default memory; does not write anything. It also doesn't take in an
761 // Object; if you wish to check an Object you need to load the Object's
762 // class prior to coming here.
763 Node* gen_subtype_check(Node* subklass, Node* superklass);
764
765 // Exact type check used for predicted calls and casts.
766 // Rewrites (*casted_receiver) to be casted to the stronger type.
767 // (Caller is responsible for doing replace_in_map.)
768 Node* type_check_receiver(Node* receiver, ciKlass* klass, float prob,
769 Node* *casted_receiver);
770
771 // implementation of object creation
772 Node* set_output_for_allocation(AllocateNode* alloc,
773 const TypeOopPtr* oop_type);
774 Node* get_layout_helper(Node* klass_node, jint& constant_value);
775 Node* new_instance(Node* klass_node,
776 Node* slow_test = NULL,
777 Node* *return_size_val = NULL);
778 Node* new_array(Node* klass_node, Node* count_val, int nargs,
779 Node* *return_size_val = NULL);
780
781 // java.lang.String helpers
782 Node* load_String_offset(Node* ctrl, Node* str);
783 Node* load_String_length(Node* ctrl, Node* str);
|
737 // Helper functions to build synchronizations
738 int next_monitor();
739 Node* insert_mem_bar(int opcode, Node* precedent = NULL);
740 Node* insert_mem_bar_volatile(int opcode, int alias_idx, Node* precedent = NULL);
741 // Optional 'precedent' is appended as an extra edge, to force ordering.
742 FastLockNode* shared_lock(Node* obj);
743 void shared_unlock(Node* box, Node* obj);
744
745 // helper functions for the fast path/slow path idioms
746 Node* fast_and_slow(Node* in, const Type *result_type, Node* null_result, IfNode* fast_test, Node* fast_result, address slow_call, const TypeFunc *slow_call_type, Node* slow_arg, Klass* ex_klass, Node* slow_result);
747
748 // Generate an instance-of idiom. Used by both the instance-of bytecode
749 // and the reflective instance-of call.
750 Node* gen_instanceof( Node *subobj, Node* superkls );
751
752 // Generate a check-cast idiom. Used by both the check-cast bytecode
753 // and the array-store bytecode
754 Node* gen_checkcast( Node *subobj, Node* superkls,
755 Node* *failure_control = NULL );
756
757 // helper functions that correctly interacts with the GVN depending
758 // on the current compiler phase
759 static Node *gvn_transform(Node *n, PhaseGVN* gvn) {
760 if (gvn->is_IterGVN() == NULL) {
761 return gvn->transform(n);
762 } else {
763 gvn->is_IterGVN()->register_new_node_with_optimizer(n);
764 return n;
765 }
766 return NULL;
767 }
768
769 static void gvn_transform_ctrl(Node *n, PhaseGVN* gvn) {
770 if (gvn->is_IterGVN() == NULL) {
771 gvn->C->record_for_igvn(n);
772 }
773 }
774
775 // Generate a subtyping check. Takes as input the subtype and supertype.
776 // Returns 2 values: sets the default control() to the true path and
777 // returns the false path. Only reads from constant memory taken from the
778 // default memory; does not write anything. It also doesn't take in an
779 // Object; if you wish to check an Object you need to load the Object's
780 // class prior to coming here.
781 static Node* gen_subtype_check_any_phase(Node* subklass, Node* superklass, Node** ctrl, MergeMemNode* mem, PhaseGVN* gvn);
782
783 Node* gen_subtype_check(Node* subklass, Node* superklass) {
784 MergeMemNode* mem = merged_memory();
785 Node* ctrl = control();
786 Node* n = gen_subtype_check_any_phase(subklass, superklass, &ctrl, mem, &_gvn);
787 set_control(ctrl);
788 return n;
789 }
790
791 // Exact type check used for predicted calls and casts.
792 // Rewrites (*casted_receiver) to be casted to the stronger type.
793 // (Caller is responsible for doing replace_in_map.)
794 Node* type_check_receiver(Node* receiver, ciKlass* klass, float prob,
795 Node* *casted_receiver);
796
797 // implementation of object creation
798 Node* set_output_for_allocation(AllocateNode* alloc,
799 const TypeOopPtr* oop_type);
800 Node* get_layout_helper(Node* klass_node, jint& constant_value);
801 Node* new_instance(Node* klass_node,
802 Node* slow_test = NULL,
803 Node* *return_size_val = NULL);
804 Node* new_array(Node* klass_node, Node* count_val, int nargs,
805 Node* *return_size_val = NULL);
806
807 // java.lang.String helpers
808 Node* load_String_offset(Node* ctrl, Node* str);
809 Node* load_String_length(Node* ctrl, Node* str);
|