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