hotspot/src/share/vm/prims/jni.cpp
changeset 34285 0b07014c15e9
parent 33813 4f376e851453
child 34298 f3c9dcc5af96
equal deleted inserted replaced
34277:d457b9400c99 34285:0b07014c15e9
   259 
   259 
   260 #ifdef ASSERT
   260 #ifdef ASSERT
   261   Histogram* JNIHistogram;
   261   Histogram* JNIHistogram;
   262   static volatile jint JNIHistogram_lock = 0;
   262   static volatile jint JNIHistogram_lock = 0;
   263 
   263 
   264   class JNITraceWrapper : public StackObj {
       
   265    public:
       
   266     JNITraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
       
   267       if (TraceJNICalls) {
       
   268         va_list ap;
       
   269         va_start(ap, format);
       
   270         tty->print("JNI ");
       
   271         tty->vprint_cr(format, ap);
       
   272         va_end(ap);
       
   273       }
       
   274     }
       
   275   };
       
   276 
       
   277   class JNIHistogramElement : public HistogramElement {
   264   class JNIHistogramElement : public HistogramElement {
   278     public:
   265     public:
   279      JNIHistogramElement(const char* name);
   266      JNIHistogramElement(const char* name);
   280   };
   267   };
   281 
   268 
   303 
   290 
   304   #define JNICountWrapper(arg)                                     \
   291   #define JNICountWrapper(arg)                                     \
   305      static JNIHistogramElement* e = new JNIHistogramElement(arg); \
   292      static JNIHistogramElement* e = new JNIHistogramElement(arg); \
   306       /* There is a MT-race condition in VC++. So we need to make sure that that e has been initialized */ \
   293       /* There is a MT-race condition in VC++. So we need to make sure that that e has been initialized */ \
   307      if (e != NULL) e->increment_count()
   294      if (e != NULL) e->increment_count()
   308   #define JNIWrapper(arg) JNICountWrapper(arg); JNITraceWrapper(arg)
   295   #define JNIWrapper(arg) JNICountWrapper(arg);
   309 #else
   296 #else
   310   #define JNIWrapper(arg)
   297   #define JNIWrapper(arg)
   311 #endif
   298 #endif
   312 
   299 
   313 
   300 
  3757 }
  3744 }
  3758 
  3745 
  3759 void quicken_jni_functions() {
  3746 void quicken_jni_functions() {
  3760   // Replace Get<Primitive>Field with fast versions
  3747   // Replace Get<Primitive>Field with fast versions
  3761   if (UseFastJNIAccessors && !JvmtiExport::can_post_field_access()
  3748   if (UseFastJNIAccessors && !JvmtiExport::can_post_field_access()
  3762       && !VerifyJNIFields && !TraceJNICalls && !CountJNICalls && !CheckJNICalls
  3749       && !VerifyJNIFields && !CountJNICalls && !CheckJNICalls
  3763 #if defined(_WINDOWS) && defined(IA32) && defined(COMPILER2)
  3750 #if defined(_WINDOWS) && defined(IA32) && defined(COMPILER2)
  3764       // windows x86 currently needs SEH wrapper and the gain of the fast
  3751       // windows x86 currently needs SEH wrapper and the gain of the fast
  3765       // versions currently isn't certain for server vm on uniprocessor.
  3752       // versions currently isn't certain for server vm on uniprocessor.
  3766       && os::is_MP()
  3753       && os::is_MP()
  3767 #endif
  3754 #endif