< prev index next >

src/hotspot/share/runtime/sharedRuntime.hpp

Print this page

261   static void throw_and_post_jvmti_exception(JavaThread *thread, Handle h_exception);
262   static void throw_and_post_jvmti_exception(JavaThread *thread, Symbol* name, const char *message = NULL);
263 
264   // RedefineClasses() tracing support for obsolete method entry
265   static int rc_trace_method_entry(JavaThread* thread, Method* m);
266 
267   // To be used as the entry point for unresolved native methods.
268   static address native_method_throw_unsatisfied_link_error_entry();
269   static address native_method_throw_unsupported_operation_exception_entry();
270 
271   static oop retrieve_receiver(Symbol* sig, frame caller);
272 
273   static void register_finalizer(JavaThread* thread, oopDesc* obj);
274 
275   // dtrace notifications
276   static int dtrace_object_alloc(oopDesc* o, int size);
277   static int dtrace_object_alloc_base(Thread* thread, oopDesc* o, int size);
278   static int dtrace_method_entry(JavaThread* thread, Method* m);
279   static int dtrace_method_exit(JavaThread* thread, Method* m);
280 













































































281   // Utility method for retrieving the Java thread id, returns 0 if the
282   // thread is not a well formed Java thread.
283   static jlong get_java_tid(Thread* thread);
284 
285 
286   // used by native wrappers to reenable yellow if overflow happened in native code
287   static void reguard_yellow_pages();
288 
289   // Fill in the "X cannot be cast to a Y" message for ClassCastException
290   //
291   // @param thr the current thread
292   // @param caster_klass the class of the object we are casting
293   // @return the dynamically allocated exception message (must be freed
294   // by the caller using a resource mark)
295   //
296   // BCP must refer to the current 'checkcast' opcode for the frame
297   // on top of the stack.
298   // The caller (or one of its callers) must use a ResourceMark
299   // in order to correctly free the result.
300   //

261   static void throw_and_post_jvmti_exception(JavaThread *thread, Handle h_exception);
262   static void throw_and_post_jvmti_exception(JavaThread *thread, Symbol* name, const char *message = NULL);
263 
264   // RedefineClasses() tracing support for obsolete method entry
265   static int rc_trace_method_entry(JavaThread* thread, Method* m);
266 
267   // To be used as the entry point for unresolved native methods.
268   static address native_method_throw_unsatisfied_link_error_entry();
269   static address native_method_throw_unsupported_operation_exception_entry();
270 
271   static oop retrieve_receiver(Symbol* sig, frame caller);
272 
273   static void register_finalizer(JavaThread* thread, oopDesc* obj);
274 
275   // dtrace notifications
276   static int dtrace_object_alloc(oopDesc* o, int size);
277   static int dtrace_object_alloc_base(Thread* thread, oopDesc* o, int size);
278   static int dtrace_method_entry(JavaThread* thread, Method* m);
279   static int dtrace_method_exit(JavaThread* thread, Method* m);
280 
281 #if INCLUDE_TSAN
282   // TSAN instrumentation
283 
284   // TSAN uses a 64-bit value to identify code location.
285   // TSAN uses the uppermost 3 bits (63:61) for the internal purposes.
286   // If bit 60 is set, TSAN recognizes that the code location belongs to the
287   // JVM, and will call __tsan_symbolize_external_ex() for symbolization rather
288   // than TSAN's own symbolizer. See __sanitizer::kExternalPCBit and
289   // __tsan::__tsan_symbolize_external_ex() in TSAN for more details.
290   // The lower 60 bits may contain either a packed bytecode location, or an
291   // instruction address inside the code generated by JIT compiler.
292   // A packed code location has the method ID in bits 59:16 and the bytecode
293   //offset within method in bits 15:0. 44 bits (59:16) are enough to encode any
294   // 47-bit 8-byte-aligned address, which is the maximum address space TSAN
295   // allows. The next 16 bits are used for storing the bci.
296   // | Tsan: 3 | TsanJava: 1 | jmethodID: 44 | BCI: 16 |
297   static const int tsan_method_id_alignment_bits = 3;
298   static const int tsan_bci_bits = 16;
299   static const u8 tsan_bci_mask = right_n_bits(tsan_bci_bits);
300   static const int tsan_method_id_shift = tsan_bci_bits -
301       tsan_method_id_alignment_bits;
302   static const u8 tsan_fake_pc_bit = 1L << 60;
303   static void * tsan_code_location(jmethodID jmethod_id_ptr, u2 bci) {
304     return (void *)(tsan_fake_pc_bit |
305       (((u8)(jmethod_id_ptr)) << tsan_method_id_shift) | bci);
306   }
307   static jmethodID tsan_method_id_from_code_location(u8 loc) {
308     return (jmethodID)(
309         (loc & ~(tsan_fake_pc_bit | tsan_bci_mask)) >> tsan_method_id_shift);
310   }
311   static u2 tsan_bci_from_code_location(u8 loc) {
312     return (u2)(loc & tsan_bci_mask);
313   }
314 
315   // These functions are wrappers around TSAN callbacks,
316   // which are listed in tsanExternalDecls.hpp. The VM uses only these
317   // functions to push events to ThreadSanitizer.
318 
319   // Verify that an oop is valid and that the index is within the object size.
320   static void verify_oop_index(oopDesc* obj, int index);
321 
322   // Java method entry/exit from code run by template interpreter
323   static void tsan_interp_method_entry(JavaThread *thread);
324   static void tsan_interp_method_exit();
325 
326   // Monitor acquire/release in VM code
327   // (e.g., generated native method wrapper, JNI heavyweight locks)
328   static void tsan_oop_lock(Thread* thread, oop obj);
329   static void tsan_oop_unlock(Thread* thread, oop obj);
330   // Monitor acquire/release in VM code; recursive lock variant (e.g., wait())
331   static void tsan_oop_rec_lock(Thread* thread, oop obj, int rec);
332   static int tsan_oop_rec_unlock(Thread* thread, oop obj);
333 
334   // Monitor acquire/release from code run by template interpreter
335   static void tsan_interp_lock(JavaThread* thread, BasicObjectLock* elem);
336   static void tsan_interp_unlock(JavaThread* thread, BasicObjectLock* elem);
337 
338   // Address must point to an object in the Java heap.
339   static void tsan_acquire(void* address);
340   static void tsan_release(void* address);
341 
342   // Called whenever an obj is created.
343   static void tsan_track_obj_with_size(oopDesc* obj, int size);
344   static void tsan_track_obj(oopDesc* obj);
345 
346   // Memory reads/writes from code run by template interpreter
347   static void tsan_read1(void* addr, Method* method, address bcp);
348   static void tsan_read2(void* addr, Method* method, address bcp);
349   static void tsan_read4(void* addr, Method* method, address bcp);
350   static void tsan_read8(void* addr, Method* method, address bcp);
351   static void tsan_write1(void* addr, Method* method, address bcp);
352   static void tsan_write2(void* addr, Method* method, address bcp);
353   static void tsan_write4(void* addr, Method* method, address bcp);
354   static void tsan_write8(void* addr, Method* method, address bcp);
355 
356 #endif // INCLUDE_TSAN
357 
358   // Utility method for retrieving the Java thread id, returns 0 if the
359   // thread is not a well formed Java thread.
360   static jlong get_java_tid(Thread* thread);
361 
362 
363   // used by native wrappers to reenable yellow if overflow happened in native code
364   static void reguard_yellow_pages();
365 
366   // Fill in the "X cannot be cast to a Y" message for ClassCastException
367   //
368   // @param thr the current thread
369   // @param caster_klass the class of the object we are casting
370   // @return the dynamically allocated exception message (must be freed
371   // by the caller using a resource mark)
372   //
373   // BCP must refer to the current 'checkcast' opcode for the frame
374   // on top of the stack.
375   // The caller (or one of its callers) must use a ResourceMark
376   // in order to correctly free the result.
377   //
< prev index next >