< prev index next >

src/share/vm/runtime/sharedRuntime.cpp

Print this page




  45 #include "runtime/arguments.hpp"
  46 #include "runtime/biasedLocking.hpp"
  47 #include "runtime/handles.inline.hpp"
  48 #include "runtime/init.hpp"
  49 #include "runtime/interfaceSupport.hpp"
  50 #include "runtime/javaCalls.hpp"
  51 #include "runtime/sharedRuntime.hpp"
  52 #include "runtime/stubRoutines.hpp"
  53 #include "runtime/vframe.hpp"
  54 #include "runtime/vframeArray.hpp"
  55 #include "utilities/copy.hpp"
  56 #include "utilities/dtrace.hpp"
  57 #include "utilities/events.hpp"
  58 #include "utilities/hashtable.inline.hpp"
  59 #include "utilities/macros.hpp"
  60 #include "utilities/xmlstream.hpp"
  61 #ifdef TARGET_ARCH_x86
  62 # include "nativeInst_x86.hpp"
  63 # include "vmreg_x86.inline.hpp"
  64 #endif




  65 #ifdef TARGET_ARCH_sparc
  66 # include "nativeInst_sparc.hpp"
  67 # include "vmreg_sparc.inline.hpp"
  68 #endif
  69 #ifdef TARGET_ARCH_zero
  70 # include "nativeInst_zero.hpp"
  71 # include "vmreg_zero.inline.hpp"
  72 #endif
  73 #ifdef TARGET_ARCH_arm
  74 # include "nativeInst_arm.hpp"
  75 # include "vmreg_arm.inline.hpp"
  76 #endif
  77 #ifdef TARGET_ARCH_ppc
  78 # include "nativeInst_ppc.hpp"
  79 # include "vmreg_ppc.inline.hpp"
  80 #endif
  81 #ifdef COMPILER1
  82 #include "c1/c1_Runtime1.hpp"
  83 #endif
  84 


1865   _monitor_enter_ctr++;             // monitor enter slow
1866 #endif
1867   if (PrintBiasedLockingStatistics) {
1868     Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
1869   }
1870   Handle h_obj(THREAD, obj);
1871   if (UseBiasedLocking) {
1872     // Retry fast entry if bias is revoked to avoid unnecessary inflation
1873     ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK);
1874   } else {
1875     ObjectSynchronizer::slow_enter(h_obj, lock, CHECK);
1876   }
1877   assert(!HAS_PENDING_EXCEPTION, "Should have no exception here");
1878 JRT_END
1879 
1880 #ifndef PRODUCT
1881 int SharedRuntime::_monitor_exit_ctr=0;
1882 #endif
1883 // Handles the uncommon cases of monitor unlocking in compiled code
1884 JRT_LEAF(void, SharedRuntime::complete_monitor_unlocking_C(oopDesc* _obj, BasicLock* lock))
1885    oop obj(_obj);
1886 #ifndef PRODUCT
1887   _monitor_exit_ctr++;              // monitor exit slow
1888 #endif
1889   Thread* THREAD = JavaThread::current();
1890   // I'm not convinced we need the code contained by MIGHT_HAVE_PENDING anymore
1891   // testing was unable to ever fire the assert that guarded it so I have removed it.
1892   assert(!HAS_PENDING_EXCEPTION, "Do we need code below anymore?");
1893 #undef MIGHT_HAVE_PENDING
1894 #ifdef MIGHT_HAVE_PENDING
1895   // Save and restore any pending_exception around the exception mark.
1896   // While the slow_exit must not throw an exception, we could come into
1897   // this routine with one set.
1898   oop pending_excep = NULL;
1899   const char* pending_file;
1900   int pending_line;
1901   if (HAS_PENDING_EXCEPTION) {
1902     pending_excep = PENDING_EXCEPTION;
1903     pending_file  = THREAD->exception_file();
1904     pending_line  = THREAD->exception_line();
1905     CLEAR_PENDING_EXCEPTION;


2802           new_in_regs[argcnt  ].set2(reg.first());
2803           new_in_regs[argcnt+1].set_bad();
2804           argcnt++;
2805           break;
2806         default:
2807           // No conversion needed.
2808           new_in_sig_bt[argcnt] = bt;
2809           new_in_regs[argcnt]   = reg;
2810           break;
2811       }
2812     }
2813     assert(argcnt == i2l_argcnt, "must match");
2814 
2815     in_regs = new_in_regs;
2816     in_sig_bt = new_in_sig_bt;
2817     in_args_count = i2l_argcnt;
2818   } else {
2819     assert(0, "This should not be needed on this platform");
2820   }
2821 }
















2822 
2823 // -------------------------------------------------------------------------
2824 // Java-Java calling convention
2825 // (what you use when Java calls Java)
2826 
2827 //------------------------------name_for_receiver----------------------------------
2828 // For a given signature, return the VMReg for parameter 0.
2829 VMReg SharedRuntime::name_for_receiver() {
2830   VMRegPair regs;
2831   BasicType sig_bt = T_OBJECT;
2832   (void) java_calling_convention(&sig_bt, &regs, 1, true);
2833   // Return argument 0 register.  In the LP64 build pointers
2834   // take 2 registers, but the VM wants only the 'main' name.
2835   return regs.first();
2836 }
2837 
2838 VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver, bool has_appendix, int* arg_size) {
2839   // This method is returning a data structure allocating as a
2840   // ResourceObject, so do not put any ResourceMarks in here.
2841   char *s = sig->as_C_string();




  45 #include "runtime/arguments.hpp"
  46 #include "runtime/biasedLocking.hpp"
  47 #include "runtime/handles.inline.hpp"
  48 #include "runtime/init.hpp"
  49 #include "runtime/interfaceSupport.hpp"
  50 #include "runtime/javaCalls.hpp"
  51 #include "runtime/sharedRuntime.hpp"
  52 #include "runtime/stubRoutines.hpp"
  53 #include "runtime/vframe.hpp"
  54 #include "runtime/vframeArray.hpp"
  55 #include "utilities/copy.hpp"
  56 #include "utilities/dtrace.hpp"
  57 #include "utilities/events.hpp"
  58 #include "utilities/hashtable.inline.hpp"
  59 #include "utilities/macros.hpp"
  60 #include "utilities/xmlstream.hpp"
  61 #ifdef TARGET_ARCH_x86
  62 # include "nativeInst_x86.hpp"
  63 # include "vmreg_x86.inline.hpp"
  64 #endif
  65 #ifdef TARGET_ARCH_aarch64
  66 # include "nativeInst_aarch64.hpp"
  67 # include "vmreg_aarch64.inline.hpp"
  68 #endif
  69 #ifdef TARGET_ARCH_sparc
  70 # include "nativeInst_sparc.hpp"
  71 # include "vmreg_sparc.inline.hpp"
  72 #endif
  73 #ifdef TARGET_ARCH_zero
  74 # include "nativeInst_zero.hpp"
  75 # include "vmreg_zero.inline.hpp"
  76 #endif
  77 #ifdef TARGET_ARCH_arm
  78 # include "nativeInst_arm.hpp"
  79 # include "vmreg_arm.inline.hpp"
  80 #endif
  81 #ifdef TARGET_ARCH_ppc
  82 # include "nativeInst_ppc.hpp"
  83 # include "vmreg_ppc.inline.hpp"
  84 #endif
  85 #ifdef COMPILER1
  86 #include "c1/c1_Runtime1.hpp"
  87 #endif
  88 


1869   _monitor_enter_ctr++;             // monitor enter slow
1870 #endif
1871   if (PrintBiasedLockingStatistics) {
1872     Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
1873   }
1874   Handle h_obj(THREAD, obj);
1875   if (UseBiasedLocking) {
1876     // Retry fast entry if bias is revoked to avoid unnecessary inflation
1877     ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK);
1878   } else {
1879     ObjectSynchronizer::slow_enter(h_obj, lock, CHECK);
1880   }
1881   assert(!HAS_PENDING_EXCEPTION, "Should have no exception here");
1882 JRT_END
1883 
1884 #ifndef PRODUCT
1885 int SharedRuntime::_monitor_exit_ctr=0;
1886 #endif
1887 // Handles the uncommon cases of monitor unlocking in compiled code
1888 JRT_LEAF(void, SharedRuntime::complete_monitor_unlocking_C(oopDesc* _obj, BasicLock* lock))
1889   oop obj(_obj);
1890 #ifndef PRODUCT
1891   _monitor_exit_ctr++;              // monitor exit slow
1892 #endif
1893   Thread* THREAD = JavaThread::current();
1894   // I'm not convinced we need the code contained by MIGHT_HAVE_PENDING anymore
1895   // testing was unable to ever fire the assert that guarded it so I have removed it.
1896   assert(!HAS_PENDING_EXCEPTION, "Do we need code below anymore?");
1897 #undef MIGHT_HAVE_PENDING
1898 #ifdef MIGHT_HAVE_PENDING
1899   // Save and restore any pending_exception around the exception mark.
1900   // While the slow_exit must not throw an exception, we could come into
1901   // this routine with one set.
1902   oop pending_excep = NULL;
1903   const char* pending_file;
1904   int pending_line;
1905   if (HAS_PENDING_EXCEPTION) {
1906     pending_excep = PENDING_EXCEPTION;
1907     pending_file  = THREAD->exception_file();
1908     pending_line  = THREAD->exception_line();
1909     CLEAR_PENDING_EXCEPTION;


2806           new_in_regs[argcnt  ].set2(reg.first());
2807           new_in_regs[argcnt+1].set_bad();
2808           argcnt++;
2809           break;
2810         default:
2811           // No conversion needed.
2812           new_in_sig_bt[argcnt] = bt;
2813           new_in_regs[argcnt]   = reg;
2814           break;
2815       }
2816     }
2817     assert(argcnt == i2l_argcnt, "must match");
2818 
2819     in_regs = new_in_regs;
2820     in_sig_bt = new_in_sig_bt;
2821     in_args_count = i2l_argcnt;
2822   } else {
2823     assert(0, "This should not be needed on this platform");
2824   }
2825 }
2826 
2827 JRT_LEAF(oopDesc*, SharedRuntime::pin_object(JavaThread* thread, oopDesc* obj))
2828   assert(Universe::heap()->supports_object_pinning(), "Why we here?");
2829   assert(obj != NULL, "Should not be null");
2830   oop o(obj);
2831   o = Universe::heap()->pin_object(thread, o);
2832   assert(o != NULL, "Should not be null");
2833   return o;
2834 JRT_END
2835 
2836 JRT_LEAF(void, SharedRuntime::unpin_object(JavaThread* thread, oopDesc* obj))
2837   assert(Universe::heap()->supports_object_pinning(), "Why we here?");
2838   assert(obj != NULL, "Should not be null");
2839   oop o(obj);
2840   Universe::heap()->unpin_object(thread, o);
2841 JRT_END
2842 
2843 // -------------------------------------------------------------------------
2844 // Java-Java calling convention
2845 // (what you use when Java calls Java)
2846 
2847 //------------------------------name_for_receiver----------------------------------
2848 // For a given signature, return the VMReg for parameter 0.
2849 VMReg SharedRuntime::name_for_receiver() {
2850   VMRegPair regs;
2851   BasicType sig_bt = T_OBJECT;
2852   (void) java_calling_convention(&sig_bt, &regs, 1, true);
2853   // Return argument 0 register.  In the LP64 build pointers
2854   // take 2 registers, but the VM wants only the 'main' name.
2855   return regs.first();
2856 }
2857 
2858 VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver, bool has_appendix, int* arg_size) {
2859   // This method is returning a data structure allocating as a
2860   // ResourceObject, so do not put any ResourceMarks in here.
2861   char *s = sig->as_C_string();


< prev index next >