1 /*
2 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
131 private:
132 // define stubs
133 static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char *name, int is_fancy_jump, bool pass_tls, bool save_arguments, bool return_pc);
134
135 // References to generated stubs
136 static address _new_instance_Java;
137 static address _new_array_Java;
138 static address _new_array_nozero_Java;
139 static address _multianewarray2_Java;
140 static address _multianewarray3_Java;
141 static address _multianewarray4_Java;
142 static address _multianewarray5_Java;
143 static address _multianewarrayN_Java;
144 static address _g1_wb_pre_Java;
145 static address _g1_wb_post_Java;
146 static address _vtable_must_compile_Java;
147 static address _complete_monitor_locking_Java;
148 static address _rethrow_Java;
149 static address _monitor_notify_Java;
150 static address _monitor_notifyAll_Java;
151
152 static address _slow_arraycopy_Java;
153 static address _register_finalizer_Java;
154
155 //
156 // Implementation of runtime methods
157 // =================================
158
159 // Allocate storage for a Java instance.
160 static void new_instance_C(Klass* instance_klass, JavaThread *thread);
161
162 // Allocate storage for a objArray or typeArray
163 static void new_array_C(Klass* array_klass, int len, JavaThread *thread);
164 static void new_array_nozero_C(Klass* array_klass, int len, JavaThread *thread);
165
166 // Post-slow-path-allocation, pre-initializing-stores step for
167 // implementing ReduceInitialCardMarks
168 static void new_store_pre_barrier(JavaThread* thread);
169
170 // Allocate storage for a multi-dimensional arrays
171 // Note: needs to be fixed for arbitrary number of dimensions
172 static void multianewarray2_C(Klass* klass, int len1, int len2, JavaThread *thread);
173 static void multianewarray3_C(Klass* klass, int len1, int len2, int len3, JavaThread *thread);
174 static void multianewarray4_C(Klass* klass, int len1, int len2, int len3, int len4, JavaThread *thread);
175 static void multianewarray5_C(Klass* klass, int len1, int len2, int len3, int len4, int len5, JavaThread *thread);
176 static void multianewarrayN_C(Klass* klass, arrayOopDesc* dims, JavaThread *thread);
177 static void g1_wb_pre_C(oopDesc* orig, JavaThread* thread);
178 static void g1_wb_post_C(void* card_addr, JavaThread* thread);
179
180 public:
181 // Slow-path Locking and Unlocking
182 static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
183 static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
184
185 static void monitor_notify_C(oopDesc* obj, JavaThread* thread);
186 static void monitor_notifyAll_C(oopDesc* obj, JavaThread* thread);
187
188 private:
189
190 // Implicit exception support
191 static void throw_null_exception_C(JavaThread* thread);
192
193 // Exception handling
194 static address handle_exception_C (JavaThread* thread);
195 static address handle_exception_C_helper(JavaThread* thread, nmethod*& nm);
196 static address rethrow_C (oopDesc* exception, JavaThread *thread, address return_pc );
197 static void deoptimize_caller_frame (JavaThread *thread);
198 static void deoptimize_caller_frame (JavaThread *thread, bool doit);
199 static bool is_deoptimized_caller_frame (JavaThread *thread);
216 static bool generate(ciEnv* env);
217
218 // Returns the name of a stub
219 static const char* stub_name(address entry);
220
221 // access to runtime stubs entry points for java code
222 static address new_instance_Java() { return _new_instance_Java; }
223 static address new_array_Java() { return _new_array_Java; }
224 static address new_array_nozero_Java() { return _new_array_nozero_Java; }
225 static address multianewarray2_Java() { return _multianewarray2_Java; }
226 static address multianewarray3_Java() { return _multianewarray3_Java; }
227 static address multianewarray4_Java() { return _multianewarray4_Java; }
228 static address multianewarray5_Java() { return _multianewarray5_Java; }
229 static address multianewarrayN_Java() { return _multianewarrayN_Java; }
230 static address g1_wb_pre_Java() { return _g1_wb_pre_Java; }
231 static address g1_wb_post_Java() { return _g1_wb_post_Java; }
232 static address vtable_must_compile_stub() { return _vtable_must_compile_Java; }
233 static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; }
234 static address monitor_notify_Java() { return _monitor_notify_Java; }
235 static address monitor_notifyAll_Java() { return _monitor_notifyAll_Java; }
236
237 static address slow_arraycopy_Java() { return _slow_arraycopy_Java; }
238 static address register_finalizer_Java() { return _register_finalizer_Java; }
239
240 static ExceptionBlob* exception_blob() { return _exception_blob; }
241
242 // Leaf routines helping with method data update
243 static void profile_receiver_type_C(DataLayout* data, oopDesc* receiver);
244
245 // Implicit exception support
246 static void throw_div0_exception_C (JavaThread* thread);
247 static void throw_stack_overflow_error_C(JavaThread* thread);
248
249 // Exception handling
250 static address rethrow_stub() { return _rethrow_Java; }
251
252
253 // Type functions
254 // ======================================================
255
257 static const TypeFunc* new_array_Type (); // [a]newarray (slow case)
258 static const TypeFunc* multianewarray_Type(int ndim); // multianewarray
259 static const TypeFunc* multianewarray2_Type(); // multianewarray
260 static const TypeFunc* multianewarray3_Type(); // multianewarray
261 static const TypeFunc* multianewarray4_Type(); // multianewarray
262 static const TypeFunc* multianewarray5_Type(); // multianewarray
263 static const TypeFunc* multianewarrayN_Type(); // multianewarray
264 static const TypeFunc* g1_wb_pre_Type();
265 static const TypeFunc* g1_wb_post_Type();
266 static const TypeFunc* complete_monitor_enter_Type();
267 static const TypeFunc* complete_monitor_exit_Type();
268 static const TypeFunc* monitor_notify_Type();
269 static const TypeFunc* uncommon_trap_Type();
270 static const TypeFunc* athrow_Type();
271 static const TypeFunc* rethrow_Type();
272 static const TypeFunc* Math_D_D_Type(); // sin,cos & friends
273 static const TypeFunc* Math_DD_D_Type(); // mod,pow & friends
274 static const TypeFunc* modf_Type();
275 static const TypeFunc* l2f_Type();
276 static const TypeFunc* void_long_Type();
277
278 static const TypeFunc* flush_windows_Type();
279
280 // arraycopy routine types
281 static const TypeFunc* fast_arraycopy_Type(); // bit-blasters
282 static const TypeFunc* checkcast_arraycopy_Type();
283 static const TypeFunc* generic_arraycopy_Type();
284 static const TypeFunc* slow_arraycopy_Type(); // the full routine
285
286 static const TypeFunc* array_fill_Type();
287
288 static const TypeFunc* aescrypt_block_Type();
289 static const TypeFunc* cipherBlockChaining_aescrypt_Type();
290 static const TypeFunc* counterMode_aescrypt_Type();
291
292 static const TypeFunc* sha_implCompress_Type();
293 static const TypeFunc* digestBase_implCompressMB_Type();
294
295 static const TypeFunc* multiplyToLen_Type();
296 static const TypeFunc* montgomeryMultiply_Type();
|
1 /*
2 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
131 private:
132 // define stubs
133 static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char *name, int is_fancy_jump, bool pass_tls, bool save_arguments, bool return_pc);
134
135 // References to generated stubs
136 static address _new_instance_Java;
137 static address _new_array_Java;
138 static address _new_array_nozero_Java;
139 static address _multianewarray2_Java;
140 static address _multianewarray3_Java;
141 static address _multianewarray4_Java;
142 static address _multianewarray5_Java;
143 static address _multianewarrayN_Java;
144 static address _g1_wb_pre_Java;
145 static address _g1_wb_post_Java;
146 static address _vtable_must_compile_Java;
147 static address _complete_monitor_locking_Java;
148 static address _rethrow_Java;
149 static address _monitor_notify_Java;
150 static address _monitor_notifyAll_Java;
151 static address _array_out_of_bounds_Java;
152
153 static address _slow_arraycopy_Java;
154 static address _register_finalizer_Java;
155
156 //
157 // Implementation of runtime methods
158 // =================================
159
160 // Allocate storage for a Java instance.
161 static void new_instance_C(Klass* instance_klass, JavaThread *thread);
162
163 // Allocate storage for a objArray or typeArray
164 static void new_array_C(Klass* array_klass, int len, JavaThread *thread);
165 static void new_array_nozero_C(Klass* array_klass, int len, JavaThread *thread);
166
167 // Post-slow-path-allocation, pre-initializing-stores step for
168 // implementing ReduceInitialCardMarks
169 static void new_store_pre_barrier(JavaThread* thread);
170
171 // Allocate storage for a multi-dimensional arrays
172 // Note: needs to be fixed for arbitrary number of dimensions
173 static void multianewarray2_C(Klass* klass, int len1, int len2, JavaThread *thread);
174 static void multianewarray3_C(Klass* klass, int len1, int len2, int len3, JavaThread *thread);
175 static void multianewarray4_C(Klass* klass, int len1, int len2, int len3, int len4, JavaThread *thread);
176 static void multianewarray5_C(Klass* klass, int len1, int len2, int len3, int len4, int len5, JavaThread *thread);
177 static void multianewarrayN_C(Klass* klass, arrayOopDesc* dims, JavaThread *thread);
178 static void g1_wb_pre_C(oopDesc* orig, JavaThread* thread);
179 static void g1_wb_post_C(void* card_addr, JavaThread* thread);
180
181 static void array_out_of_bounds(int index, int length, JavaThread *thread);
182
183 public:
184 // Slow-path Locking and Unlocking
185 static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
186 static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
187
188 static void monitor_notify_C(oopDesc* obj, JavaThread* thread);
189 static void monitor_notifyAll_C(oopDesc* obj, JavaThread* thread);
190
191 private:
192
193 // Implicit exception support
194 static void throw_null_exception_C(JavaThread* thread);
195
196 // Exception handling
197 static address handle_exception_C (JavaThread* thread);
198 static address handle_exception_C_helper(JavaThread* thread, nmethod*& nm);
199 static address rethrow_C (oopDesc* exception, JavaThread *thread, address return_pc );
200 static void deoptimize_caller_frame (JavaThread *thread);
201 static void deoptimize_caller_frame (JavaThread *thread, bool doit);
202 static bool is_deoptimized_caller_frame (JavaThread *thread);
219 static bool generate(ciEnv* env);
220
221 // Returns the name of a stub
222 static const char* stub_name(address entry);
223
224 // access to runtime stubs entry points for java code
225 static address new_instance_Java() { return _new_instance_Java; }
226 static address new_array_Java() { return _new_array_Java; }
227 static address new_array_nozero_Java() { return _new_array_nozero_Java; }
228 static address multianewarray2_Java() { return _multianewarray2_Java; }
229 static address multianewarray3_Java() { return _multianewarray3_Java; }
230 static address multianewarray4_Java() { return _multianewarray4_Java; }
231 static address multianewarray5_Java() { return _multianewarray5_Java; }
232 static address multianewarrayN_Java() { return _multianewarrayN_Java; }
233 static address g1_wb_pre_Java() { return _g1_wb_pre_Java; }
234 static address g1_wb_post_Java() { return _g1_wb_post_Java; }
235 static address vtable_must_compile_stub() { return _vtable_must_compile_Java; }
236 static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; }
237 static address monitor_notify_Java() { return _monitor_notify_Java; }
238 static address monitor_notifyAll_Java() { return _monitor_notifyAll_Java; }
239 static address array_out_of_bounds_Java() { return _array_out_of_bounds_Java; }
240
241 static address slow_arraycopy_Java() { return _slow_arraycopy_Java; }
242 static address register_finalizer_Java() { return _register_finalizer_Java; }
243
244 static ExceptionBlob* exception_blob() { return _exception_blob; }
245
246 // Leaf routines helping with method data update
247 static void profile_receiver_type_C(DataLayout* data, oopDesc* receiver);
248
249 // Implicit exception support
250 static void throw_div0_exception_C (JavaThread* thread);
251 static void throw_stack_overflow_error_C(JavaThread* thread);
252
253 // Exception handling
254 static address rethrow_stub() { return _rethrow_Java; }
255
256
257 // Type functions
258 // ======================================================
259
261 static const TypeFunc* new_array_Type (); // [a]newarray (slow case)
262 static const TypeFunc* multianewarray_Type(int ndim); // multianewarray
263 static const TypeFunc* multianewarray2_Type(); // multianewarray
264 static const TypeFunc* multianewarray3_Type(); // multianewarray
265 static const TypeFunc* multianewarray4_Type(); // multianewarray
266 static const TypeFunc* multianewarray5_Type(); // multianewarray
267 static const TypeFunc* multianewarrayN_Type(); // multianewarray
268 static const TypeFunc* g1_wb_pre_Type();
269 static const TypeFunc* g1_wb_post_Type();
270 static const TypeFunc* complete_monitor_enter_Type();
271 static const TypeFunc* complete_monitor_exit_Type();
272 static const TypeFunc* monitor_notify_Type();
273 static const TypeFunc* uncommon_trap_Type();
274 static const TypeFunc* athrow_Type();
275 static const TypeFunc* rethrow_Type();
276 static const TypeFunc* Math_D_D_Type(); // sin,cos & friends
277 static const TypeFunc* Math_DD_D_Type(); // mod,pow & friends
278 static const TypeFunc* modf_Type();
279 static const TypeFunc* l2f_Type();
280 static const TypeFunc* void_long_Type();
281 static const TypeFunc* array_out_of_bounds_Type();
282
283 static const TypeFunc* flush_windows_Type();
284
285 // arraycopy routine types
286 static const TypeFunc* fast_arraycopy_Type(); // bit-blasters
287 static const TypeFunc* checkcast_arraycopy_Type();
288 static const TypeFunc* generic_arraycopy_Type();
289 static const TypeFunc* slow_arraycopy_Type(); // the full routine
290
291 static const TypeFunc* array_fill_Type();
292
293 static const TypeFunc* aescrypt_block_Type();
294 static const TypeFunc* cipherBlockChaining_aescrypt_Type();
295 static const TypeFunc* counterMode_aescrypt_Type();
296
297 static const TypeFunc* sha_implCompress_Type();
298 static const TypeFunc* digestBase_implCompressMB_Type();
299
300 static const TypeFunc* multiplyToLen_Type();
301 static const TypeFunc* montgomeryMultiply_Type();
|