47 #define C1_STUB_ID_ENUM_DECLARE(name) STUB_ID_NAME(name),
48 enum class C1StubId :int {
49 NO_STUBID = -1,
50 C1_STUBS_DO(C1_STUB_ID_ENUM_DECLARE)
51 NUM_STUBIDS
52 };
53 #undef C1_STUB_ID_ENUM_DECLARE
54
55 class Runtime1: public AllStatic {
56 friend class ArrayCopyStub;
57
58 public:
59 // statistics
60 #ifndef PRODUCT
61 static uint _generic_arraycopystub_cnt;
62 static uint _arraycopy_slowcase_cnt;
63 static uint _arraycopy_checkcast_cnt;
64 static uint _arraycopy_checkcast_attempt_cnt;
65 static uint _new_type_array_slowcase_cnt;
66 static uint _new_object_array_slowcase_cnt;
67 static uint _new_instance_slowcase_cnt;
68 static uint _new_multi_array_slowcase_cnt;
69 static uint _monitorenter_slowcase_cnt;
70 static uint _monitorexit_slowcase_cnt;
71 static uint _patch_code_slowcase_cnt;
72 static uint _throw_range_check_exception_count;
73 static uint _throw_index_exception_count;
74 static uint _throw_div0_exception_count;
75 static uint _throw_null_pointer_exception_count;
76 static uint _throw_class_cast_exception_count;
77 static uint _throw_incompatible_class_change_error_count;
78 static uint _throw_count;
79 #endif
80
81 private:
82 static CodeBlob* _blobs[(int)C1StubId::NUM_STUBIDS];
83 static const char* _blob_names[];
84
85 // stub generation
86 public:
87 static CodeBlob* generate_blob(BufferBlob* buffer_blob, C1StubId id, const char* name, bool expect_oop_map, StubAssemblerCodeGenClosure *cl);
88 static bool generate_blob_for(BufferBlob* blob, C1StubId id);
89 static OopMapSet* generate_code_for(C1StubId id, StubAssembler* sasm);
90 private:
91 static OopMapSet* generate_exception_throw(StubAssembler* sasm, address target, bool has_argument);
92 static OopMapSet* generate_handle_exception(C1StubId id, StubAssembler* sasm);
93 static void generate_unwind_exception(StubAssembler *sasm);
94 static OopMapSet* generate_patching(StubAssembler* sasm, address target);
95
96 static OopMapSet* generate_stub_call(StubAssembler* sasm, Register result, address entry,
97 Register arg1 = noreg, Register arg2 = noreg, Register arg3 = noreg);
98
99 // runtime entry points
100 static void new_instance (JavaThread* current, Klass* klass);
101 static void new_type_array (JavaThread* current, Klass* klass, jint length);
102 static void new_object_array(JavaThread* current, Klass* klass, jint length);
103 static void new_multi_array (JavaThread* current, Klass* klass, int rank, jint* dims);
104
105 static address counter_overflow(JavaThread* current, int bci, Method* method);
106
107 static void unimplemented_entry(JavaThread* current, C1StubId id);
108
109 static address exception_handler_for_pc(JavaThread* current);
110
111 static void throw_range_check_exception(JavaThread* current, int index, arrayOopDesc* a);
112 static void throw_index_exception(JavaThread* current, int index);
113 static void throw_div0_exception(JavaThread* current);
114 static void throw_null_pointer_exception(JavaThread* current);
115 static void throw_class_cast_exception(JavaThread* current, oopDesc* object);
116 static void throw_incompatible_class_change_error(JavaThread* current);
117 static void throw_array_store_exception(JavaThread* current, oopDesc* object);
118
119 static void monitorenter(JavaThread* current, oopDesc* obj, BasicObjectLock* lock);
120 static void monitorexit (JavaThread* current, BasicObjectLock* lock);
121
122 static void deoptimize(JavaThread* current, jint trap_request);
123
124 static int access_field_patching(JavaThread* current);
125 static int move_klass_patching(JavaThread* current);
126 static int move_mirror_patching(JavaThread* current);
127 static int move_appendix_patching(JavaThread* current);
128
129 static void patch_code(JavaThread* current, C1StubId stub_id);
130
131 public:
132 // initialization
133 static bool initialize(BufferBlob* blob);
134 static void initialize_pd();
135
136 // return offset in words
|
47 #define C1_STUB_ID_ENUM_DECLARE(name) STUB_ID_NAME(name),
48 enum class C1StubId :int {
49 NO_STUBID = -1,
50 C1_STUBS_DO(C1_STUB_ID_ENUM_DECLARE)
51 NUM_STUBIDS
52 };
53 #undef C1_STUB_ID_ENUM_DECLARE
54
55 class Runtime1: public AllStatic {
56 friend class ArrayCopyStub;
57
58 public:
59 // statistics
60 #ifndef PRODUCT
61 static uint _generic_arraycopystub_cnt;
62 static uint _arraycopy_slowcase_cnt;
63 static uint _arraycopy_checkcast_cnt;
64 static uint _arraycopy_checkcast_attempt_cnt;
65 static uint _new_type_array_slowcase_cnt;
66 static uint _new_object_array_slowcase_cnt;
67 static uint _new_null_free_array_slowcase_cnt;
68 static uint _new_instance_slowcase_cnt;
69 static uint _new_multi_array_slowcase_cnt;
70 static uint _load_flat_array_slowcase_cnt;
71 static uint _store_flat_array_slowcase_cnt;
72 static uint _substitutability_check_slowcase_cnt;
73 static uint _buffer_inline_args_slowcase_cnt;
74 static uint _buffer_inline_args_no_receiver_slowcase_cnt;
75 static uint _monitorenter_slowcase_cnt;
76 static uint _monitorexit_slowcase_cnt;
77 static uint _patch_code_slowcase_cnt;
78 static uint _throw_range_check_exception_count;
79 static uint _throw_index_exception_count;
80 static uint _throw_div0_exception_count;
81 static uint _throw_null_pointer_exception_count;
82 static uint _throw_class_cast_exception_count;
83 static uint _throw_incompatible_class_change_error_count;
84 static uint _throw_illegal_monitor_state_exception_count;
85 static uint _throw_identity_exception_count;
86 static uint _throw_count;
87 #endif
88
89 private:
90 static CodeBlob* _blobs[(int)C1StubId::NUM_STUBIDS];
91 static const char* _blob_names[];
92 static void buffer_inline_args_impl(JavaThread* current, Method* m, bool allocate_receiver);
93
94 // stub generation
95 public:
96 static CodeBlob* generate_blob(BufferBlob* buffer_blob, C1StubId id, const char* name, bool expect_oop_map, StubAssemblerCodeGenClosure *cl);
97 static bool generate_blob_for(BufferBlob* blob, C1StubId id);
98 static OopMapSet* generate_code_for(C1StubId id, StubAssembler* sasm);
99 private:
100 static OopMapSet* generate_exception_throw(StubAssembler* sasm, address target, bool has_argument);
101 static OopMapSet* generate_handle_exception(C1StubId id, StubAssembler* sasm);
102 static void generate_unwind_exception(StubAssembler *sasm);
103 static OopMapSet* generate_patching(StubAssembler* sasm, address target);
104
105 static OopMapSet* generate_stub_call(StubAssembler* sasm, Register result, address entry,
106 Register arg1 = noreg, Register arg2 = noreg, Register arg3 = noreg);
107
108 // runtime entry points
109 static void new_instance (JavaThread* current, Klass* klass);
110 static void new_instance_no_inline(JavaThread* current, Klass* klass);
111 static void new_type_array (JavaThread* current, Klass* klass, jint length);
112 static void new_object_array(JavaThread* current, Klass* klass, jint length);
113 static void new_null_free_array(JavaThread* current, Klass* klass, jint length);
114 static void new_multi_array (JavaThread* current, Klass* klass, int rank, jint* dims);
115 static void load_flat_array(JavaThread* current, flatArrayOopDesc* array, int index);
116 static void store_flat_array(JavaThread* current, flatArrayOopDesc* array, int index, oopDesc* value);
117 static int substitutability_check(JavaThread* current, oopDesc* left, oopDesc* right);
118 static void buffer_inline_args(JavaThread* current, Method* method);
119 static void buffer_inline_args_no_receiver(JavaThread* current, Method* method);
120
121 static address counter_overflow(JavaThread* current, int bci, Method* method);
122
123 static void unimplemented_entry(JavaThread* current, C1StubId id);
124
125 static address exception_handler_for_pc(JavaThread* current);
126
127 static void throw_range_check_exception(JavaThread* current, int index, arrayOopDesc* a);
128 static void throw_index_exception(JavaThread* current, int index);
129 static void throw_div0_exception(JavaThread* current);
130 static void throw_null_pointer_exception(JavaThread* current);
131 static void throw_class_cast_exception(JavaThread* current, oopDesc* object);
132 static void throw_incompatible_class_change_error(JavaThread* current);
133 static void throw_illegal_monitor_state_exception(JavaThread* current);
134 static void throw_identity_exception(JavaThread* current, oopDesc* object);
135 static void throw_array_store_exception(JavaThread* current, oopDesc* object);
136
137 static void monitorenter(JavaThread* current, oopDesc* obj, BasicObjectLock* lock);
138 static void monitorexit (JavaThread* current, BasicObjectLock* lock);
139
140 static void deoptimize(JavaThread* current, jint trap_request);
141
142 static int access_field_patching(JavaThread* current);
143 static int move_klass_patching(JavaThread* current);
144 static int move_mirror_patching(JavaThread* current);
145 static int move_appendix_patching(JavaThread* current);
146
147 static void patch_code(JavaThread* current, C1StubId stub_id);
148
149 public:
150 // initialization
151 static bool initialize(BufferBlob* blob);
152 static void initialize_pd();
153
154 // return offset in words
|