vm: add assertions to tls_vm()

db4
Slava Pestov 2009-10-02 09:37:04 -05:00
parent 805fea33cb
commit 96df486753
3 changed files with 12 additions and 8 deletions

View File

@ -29,8 +29,8 @@ http://www.wodeveloper.com/omniLists/macosx-dev/2000/June/msg00137.html */
executing, the call frame of the current C primitive (if any) is rewound, and executing, the call frame of the current C primitive (if any) is rewound, and
the appropriate Factor error is thrown from the top-most Factor frame. */ the appropriate Factor error is thrown from the top-most Factor frame. */
void factor_vm::call_fault_handler( void factor_vm::call_fault_handler(
exception_type_t exception, exception_type_t exception,
exception_data_type_t code, exception_data_type_t code,
MACH_EXC_STATE_TYPE *exc_state, MACH_EXC_STATE_TYPE *exc_state,
MACH_THREAD_STATE_TYPE *thread_state, MACH_THREAD_STATE_TYPE *thread_state,
MACH_FLOAT_STATE_TYPE *float_state) MACH_FLOAT_STATE_TYPE *float_state)
@ -69,10 +69,10 @@ void factor_vm::call_fault_handler(
} }
static void call_fault_handler(exception_type_t exception, static void call_fault_handler(exception_type_t exception,
exception_data_type_t code, exception_data_type_t code,
MACH_EXC_STATE_TYPE *exc_state, MACH_EXC_STATE_TYPE *exc_state,
MACH_THREAD_STATE_TYPE *thread_state, MACH_THREAD_STATE_TYPE *thread_state,
MACH_FLOAT_STATE_TYPE *float_state) MACH_FLOAT_STATE_TYPE *float_state)
{ {
SIGNAL_VM_PTR()->call_fault_handler(exception,code,exc_state,thread_state,float_state); SIGNAL_VM_PTR()->call_fault_handler(exception,code,exc_state,thread_state,float_state);
} }

View File

@ -33,7 +33,9 @@ void register_vm_with_thread(factor_vm *vm)
factor_vm *tls_vm() factor_vm *tls_vm()
{ {
return (factor_vm*)pthread_getspecific(tlsKey); factor_vm *vm = (factor_vm*)pthread_getspecific(tlsKey);
assert(vm != NULL);
return vm;
} }
static void *null_dll; static void *null_dll;

View File

@ -23,7 +23,9 @@ void register_vm_with_thread(factor_vm *vm)
factor_vm *tls_vm() factor_vm *tls_vm()
{ {
return (factor_vm*)TlsGetValue(dwTlsIndex); factor_vm *vm = (factor_vm*)TlsGetValue(dwTlsIndex);
assert(vm != NULL);
return vm;
} }
s64 current_micros() s64 current_micros()