192 #endif // PRODUCT 193 194 #if INCLUDE_ALL_GCS 195 196 // G1 write-barrier pre: executed before a pointer store. 197 JRT_LEAF(void, SharedRuntime::g1_wb_pre(oopDesc* orig, JavaThread *thread)) 198 if (orig == NULL) { 199 assert(false, "should be optimized out"); 200 return; 201 } 202 assert(orig->is_oop(true /* ignore mark word */), "Error"); 203 // store the original value that was in the field reference 204 thread->satb_mark_queue().enqueue(orig); 205 JRT_END 206 207 // G1 write-barrier post: executed after a pointer store. 208 JRT_LEAF(void, SharedRuntime::g1_wb_post(void* card_addr, JavaThread* thread)) 209 thread->dirty_card_queue().enqueue(card_addr); 210 JRT_END 211 212 #endif // INCLUDE_ALL_GCS 213 214 215 JRT_LEAF(jlong, SharedRuntime::lmul(jlong y, jlong x)) 216 return x * y; 217 JRT_END 218 219 220 JRT_LEAF(jlong, SharedRuntime::ldiv(jlong y, jlong x)) 221 if (x == min_jlong && y == CONST64(-1)) { 222 return x; 223 } else { 224 return x / y; 225 } 226 JRT_END 227 228 229 JRT_LEAF(jlong, SharedRuntime::lrem(jlong y, jlong x)) 230 if (x == min_jlong && y == CONST64(-1)) { 231 return 0; 1778 const char* objName, const char* targetKlassName, const char* desc) { 1779 size_t msglen = strlen(objName) + strlen(desc) + strlen(targetKlassName) + 1; 1780 1781 char* message = NEW_RESOURCE_ARRAY(char, msglen); 1782 if (NULL == message) { 1783 // Shouldn't happen, but don't cause even more problems if it does 1784 message = const_cast<char*>(objName); 1785 } else { 1786 jio_snprintf(message, msglen, "%s%s%s", objName, desc, targetKlassName); 1787 } 1788 return message; 1789 } 1790 1791 JRT_LEAF(void, SharedRuntime::reguard_yellow_pages()) 1792 (void) JavaThread::current()->reguard_stack(); 1793 JRT_END 1794 1795 1796 // Handles the uncommon case in locking, i.e., contention or an inflated lock. 1797 JRT_BLOCK_ENTRY(void, SharedRuntime::complete_monitor_locking_C(oopDesc* _obj, BasicLock* lock, JavaThread* thread)) 1798 // Disable ObjectSynchronizer::quick_enter() in default config 1799 // until JDK-8077392 is resolved. 1800 if ((SyncFlags & 256) != 0 && !SafepointSynchronize::is_synchronizing()) { 1801 // Only try quick_enter() if we're not trying to reach a safepoint 1802 // so that the calling thread reaches the safepoint more quickly. 1803 if (ObjectSynchronizer::quick_enter(_obj, thread, lock)) return; 1804 } 1805 // NO_ASYNC required because an async exception on the state transition destructor 1806 // would leave you with the lock held and it would never be released. 1807 // The normal monitorenter NullPointerException is thrown without acquiring a lock 1808 // and the model is that an exception implies the method failed. 1809 JRT_BLOCK_NO_ASYNC 1810 oop obj(_obj); 1811 if (PrintBiasedLockingStatistics) { 1812 Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); 1813 } 1814 Handle h_obj(THREAD, obj); 1815 if (UseBiasedLocking) { 1816 // Retry fast entry if bias is revoked to avoid unnecessary inflation 1817 ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK); 1818 } else { 1819 ObjectSynchronizer::slow_enter(h_obj, lock, CHECK); 1820 } 1821 assert(!HAS_PENDING_EXCEPTION, "Should have no exception here"); 1822 JRT_BLOCK_END 1823 JRT_END 1824 1825 // Handles the uncommon cases of monitor unlocking in compiled code 1826 JRT_LEAF(void, SharedRuntime::complete_monitor_unlocking_C(oopDesc* _obj, BasicLock* lock, JavaThread * THREAD)) 1827 oop obj(_obj); 1828 assert(JavaThread::current() == THREAD, "invariant"); 1829 // I'm not convinced we need the code contained by MIGHT_HAVE_PENDING anymore 1830 // testing was unable to ever fire the assert that guarded it so I have removed it. 1831 assert(!HAS_PENDING_EXCEPTION, "Do we need code below anymore?"); 1832 #undef MIGHT_HAVE_PENDING 1833 #ifdef MIGHT_HAVE_PENDING 1834 // Save and restore any pending_exception around the exception mark. 1835 // While the slow_exit must not throw an exception, we could come into 1836 // this routine with one set. 1837 oop pending_excep = NULL; 1838 const char* pending_file; 1839 int pending_line; 1840 if (HAS_PENDING_EXCEPTION) { 1841 pending_excep = PENDING_EXCEPTION; 1842 pending_file = THREAD->exception_file(); 1843 pending_line = THREAD->exception_line(); 1844 CLEAR_PENDING_EXCEPTION; 1845 } 1846 #endif /* MIGHT_HAVE_PENDING */ | 192 #endif // PRODUCT 193 194 #if INCLUDE_ALL_GCS 195 196 // G1 write-barrier pre: executed before a pointer store. 197 JRT_LEAF(void, SharedRuntime::g1_wb_pre(oopDesc* orig, JavaThread *thread)) 198 if (orig == NULL) { 199 assert(false, "should be optimized out"); 200 return; 201 } 202 assert(orig->is_oop(true /* ignore mark word */), "Error"); 203 // store the original value that was in the field reference 204 thread->satb_mark_queue().enqueue(orig); 205 JRT_END 206 207 // G1 write-barrier post: executed after a pointer store. 208 JRT_LEAF(void, SharedRuntime::g1_wb_post(void* card_addr, JavaThread* thread)) 209 thread->dirty_card_queue().enqueue(card_addr); 210 JRT_END 211 212 // Shenandoah clone barrier: makes sure that references point to to-space 213 // in cloned objects. 214 JRT_LEAF(void, SharedRuntime::shenandoah_clone_barrier(oopDesc* obj)) 215 oopDesc::bs()->write_region(MemRegion((HeapWord*) obj, obj->size())); 216 JRT_END 217 218 #endif // INCLUDE_ALL_GCS 219 220 221 JRT_LEAF(jlong, SharedRuntime::lmul(jlong y, jlong x)) 222 return x * y; 223 JRT_END 224 225 226 JRT_LEAF(jlong, SharedRuntime::ldiv(jlong y, jlong x)) 227 if (x == min_jlong && y == CONST64(-1)) { 228 return x; 229 } else { 230 return x / y; 231 } 232 JRT_END 233 234 235 JRT_LEAF(jlong, SharedRuntime::lrem(jlong y, jlong x)) 236 if (x == min_jlong && y == CONST64(-1)) { 237 return 0; 1784 const char* objName, const char* targetKlassName, const char* desc) { 1785 size_t msglen = strlen(objName) + strlen(desc) + strlen(targetKlassName) + 1; 1786 1787 char* message = NEW_RESOURCE_ARRAY(char, msglen); 1788 if (NULL == message) { 1789 // Shouldn't happen, but don't cause even more problems if it does 1790 message = const_cast<char*>(objName); 1791 } else { 1792 jio_snprintf(message, msglen, "%s%s%s", objName, desc, targetKlassName); 1793 } 1794 return message; 1795 } 1796 1797 JRT_LEAF(void, SharedRuntime::reguard_yellow_pages()) 1798 (void) JavaThread::current()->reguard_stack(); 1799 JRT_END 1800 1801 1802 // Handles the uncommon case in locking, i.e., contention or an inflated lock. 1803 JRT_BLOCK_ENTRY(void, SharedRuntime::complete_monitor_locking_C(oopDesc* _obj, BasicLock* lock, JavaThread* thread)) 1804 _obj = oopDesc::bs()->write_barrier(_obj); 1805 // Disable ObjectSynchronizer::quick_enter() in default config 1806 // until JDK-8077392 is resolved. 1807 if ((SyncFlags & 256) != 0 && !SafepointSynchronize::is_synchronizing()) { 1808 // Only try quick_enter() if we're not trying to reach a safepoint 1809 // so that the calling thread reaches the safepoint more quickly. 1810 if (ObjectSynchronizer::quick_enter(_obj, thread, lock)) return; 1811 } 1812 // NO_ASYNC required because an async exception on the state transition destructor 1813 // would leave you with the lock held and it would never be released. 1814 // The normal monitorenter NullPointerException is thrown without acquiring a lock 1815 // and the model is that an exception implies the method failed. 1816 JRT_BLOCK_NO_ASYNC 1817 oop obj(_obj); 1818 if (PrintBiasedLockingStatistics) { 1819 Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); 1820 } 1821 Handle h_obj(THREAD, obj); 1822 if (UseBiasedLocking) { 1823 // Retry fast entry if bias is revoked to avoid unnecessary inflation 1824 ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK); 1825 } else { 1826 ObjectSynchronizer::slow_enter(h_obj, lock, CHECK); 1827 } 1828 assert(!HAS_PENDING_EXCEPTION, "Should have no exception here"); 1829 JRT_BLOCK_END 1830 JRT_END 1831 1832 // Handles the uncommon cases of monitor unlocking in compiled code 1833 JRT_LEAF(void, SharedRuntime::complete_monitor_unlocking_C(oopDesc* _obj, BasicLock* lock, JavaThread * THREAD)) 1834 _obj = oopDesc::bs()->write_barrier(_obj); 1835 oop obj(_obj); 1836 assert(JavaThread::current() == THREAD, "invariant"); 1837 // I'm not convinced we need the code contained by MIGHT_HAVE_PENDING anymore 1838 // testing was unable to ever fire the assert that guarded it so I have removed it. 1839 assert(!HAS_PENDING_EXCEPTION, "Do we need code below anymore?"); 1840 #undef MIGHT_HAVE_PENDING 1841 #ifdef MIGHT_HAVE_PENDING 1842 // Save and restore any pending_exception around the exception mark. 1843 // While the slow_exit must not throw an exception, we could come into 1844 // this routine with one set. 1845 oop pending_excep = NULL; 1846 const char* pending_file; 1847 int pending_line; 1848 if (HAS_PENDING_EXCEPTION) { 1849 pending_excep = PENDING_EXCEPTION; 1850 pending_file = THREAD->exception_file(); 1851 pending_line = THREAD->exception_line(); 1852 CLEAR_PENDING_EXCEPTION; 1853 } 1854 #endif /* MIGHT_HAVE_PENDING */ |