MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / cpu_thread_run_jit

Function cpu_thread_run_jit

src/newcpu.cpp:5791–5860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5789
5790#ifdef WITH_THREADED_CPU
5791static int cpu_thread_run_jit(void *v)
5792{
5793 cpu_thread_tid = uae_thread_get_id(nullptr);
5794 __atomic_store_n(&cpu_thread_indirect_mode, 0xff, __ATOMIC_RELEASE);
5795 __atomic_store_n(&cpu_thread_reset, 0, __ATOMIC_RELEASE);
5796 cpu_thread_active = 1;
5797#ifdef USE_STRUCTURED_EXCEPTION_HANDLING
5798 __try
5799#endif
5800 {
5801 for (;;) {
5802 check_debugger();
5803#if defined(JIT_HAS_BUS_ERROR_RECOVERY)
5804 {
5805 int bus_error_exc = setjmp(jit_bus_error_jmpbuf);
5806 if (bus_error_exc != 0) {
5807 jit_in_compiled_code = false;
5808 Exception(bus_error_exc);
5809 continue;
5810 }
5811 }
5812 jit_in_compiled_code = true;
5813#endif
5814 ((compiled_handler*)(pushall_call_handler))();
5815 /* Check for pending exception from SIGSEGV handler (x86-64) */
5816#if defined(CPU_x86_64) || defined(_M_AMD64)
5817 if (jit_exception_pending) {
5818 int exc = jit_exception_pending;
5819 jit_exception_pending = 0;
5820 write_log(_T("JIT: Processing pending bus error in cpu_thread (exception %d, PC=%08x)\n"),
5821 exc, (unsigned int)M68K_GETPC);
5822#if defined(JIT_HAS_BUS_ERROR_RECOVERY)
5823 jit_in_compiled_code = false;
5824#endif
5825 Exception(exc);
5826#if defined(JIT_HAS_BUS_ERROR_RECOVERY)
5827 jit_in_compiled_code = true;
5828#endif
5829 }
5830#endif
5831 /* Whenever we return from that, we should check spcflags */
5832 if (regs.spcflags || cpu_thread_ilvl > 0) {
5833#if defined(JIT_HAS_BUS_ERROR_RECOVERY)
5834 jit_in_compiled_code = false;
5835#endif
5836 if (do_specialties_thread()) {
5837 break;
5838 }
5839#if defined(JIT_HAS_BUS_ERROR_RECOVERY)
5840 jit_in_compiled_code = true;
5841#endif
5842 }
5843 if (regs.stopped) {
5844 uae_sem_wait(&cpu_wakeup_sema);
5845 }
5846 }
5847 }
5848#ifdef USE_STRUCTURED_EXCEPTION_HANDLING

Callers

nothing calls this directly

Calls 6

uae_thread_get_idFunction · 0.85
check_debuggerFunction · 0.85
do_specialties_threadFunction · 0.85
EvalExceptionFunction · 0.85
ExceptionFunction · 0.70
write_logFunction · 0.70

Tested by

no test coverage detected