diff --git a/vm/os-windows.cpp b/vm/os-windows.cpp index 937a2f7c40..389732ed9c 100755 --- a/vm/os-windows.cpp +++ b/vm/os-windows.cpp @@ -347,7 +347,7 @@ void factor_vm::end_sampling_profiler_timer() DWORD wait_result = WaitForSingleObject(sampler_thread, 3000/FACTOR_PROFILE_SAMPLES_PER_SECOND); if (wait_result != WAIT_OBJECT_0) - TerminateThread(sampler_thread); + TerminateThread(sampler_thread, 0); sampler_thread = NULL; } diff --git a/vm/sampling_profiler.cpp b/vm/sampling_profiler.cpp index c7865b0a46..cacc9ab6f9 100644 --- a/vm/sampling_profiler.cpp +++ b/vm/sampling_profiler.cpp @@ -4,10 +4,10 @@ namespace factor { profiling_sample::profiling_sample(factor_vm *vm, - cell sample_count, - cell gc_sample_count, - cell foreign_sample_count, - cell foreign_thread_sample_count, + fixnum sample_count, + fixnum gc_sample_count, + fixnum foreign_sample_count, + fixnum foreign_thread_sample_count, context *ctx) : sample_count(sample_count), @@ -21,10 +21,10 @@ profiling_sample::profiling_sample(factor_vm *vm, void factor_vm::record_sample() { - cell recorded_sample_count; - cell recorded_gc_sample_count; - cell recorded_foreign_sample_count; - cell recorded_foreign_thread_sample_count; + fixnum recorded_sample_count; + fixnum recorded_gc_sample_count; + fixnum recorded_foreign_sample_count; + fixnum recorded_foreign_thread_sample_count; FACTOR_MEMORY_BARRIER(); recorded_sample_count = safepoint_sample_count; diff --git a/vm/sampling_profiler.hpp b/vm/sampling_profiler.hpp index 939f74b186..861eb9c089 100644 --- a/vm/sampling_profiler.hpp +++ b/vm/sampling_profiler.hpp @@ -6,13 +6,13 @@ namespace factor struct profiling_sample { // Number of samples taken before the safepoint that recorded the sample - cell sample_count; + fixnum sample_count; // Number of samples taken during GC - cell gc_sample_count; + fixnum gc_sample_count; // Number of samples taken during foreign code execution - cell foreign_sample_count; + fixnum foreign_sample_count; // Number of samples taken during code execution in non-Factor threads - cell foreign_thread_sample_count; + fixnum foreign_thread_sample_count; // Active context during sample context *ctx; /* The callstack at safepoint time. Indexes to the beginning and ending @@ -20,10 +20,10 @@ struct profiling_sample cell callstack_begin, callstack_end; profiling_sample(factor_vm *vm, - cell sample_count, - cell gc_sample_count, - cell foreign_sample_count, - cell foreign_thread_sample_count, + fixnum sample_count, + fixnum gc_sample_count, + fixnum foreign_sample_count, + fixnum foreign_thread_sample_count, context *ctx); }; diff --git a/vm/utilities.hpp b/vm/utilities.hpp index aa67a646e6..67692d442b 100755 --- a/vm/utilities.hpp +++ b/vm/utilities.hpp @@ -58,24 +58,26 @@ VM_C_API void *factor_memcpy(void *dst, void *src, size_t len); #if defined(FACTOR_64) #define FACTOR_ATOMIC_CAS(ptr, old_val, new_val) \ - (InterlockedCompareExchange64(ptr, new_val, old_val) == old_val) + (InterlockedCompareExchange64( \ + reinterpret_cast(ptr), new_val, old_val) == old_val) #define FACTOR_ATOMIC_ADD(ptr, val) \ - InterlockedAdd64(ptr, val) + InterlockedAdd64(reinterpret_cast(ptr), val) #define FACTOR_ATOMIC_SUB(ptr, val) \ - InterlockedSub64(ptr, val) + InterlockedAdd64(reinterpret_cast(ptr), -val) #else #define FACTOR_ATOMIC_CAS(ptr, old_val, new_val) \ - (InterlockedCompareExchange(ptr, new_val, old_val) == old_val) + (InterlockedCompareExchange( \ + reinterpret_cast(ptr), new_val, old_val) == old_val) #define FACTOR_ATOMIC_ADD(ptr, val) \ - InterlockedAdd(ptr, val) + InterlockedAdd(reinterpret_cast(ptr), val) #define FACTOR_ATOMIC_SUB(ptr, val) \ - InterlockedSub(ptr, val) + InterlockedAdd(reinterpret_cast(ptr), -val) #endif diff --git a/vm/vm.hpp b/vm/vm.hpp index 9f07596da0..68bbeefa10 100755 --- a/vm/vm.hpp +++ b/vm/vm.hpp @@ -75,10 +75,10 @@ struct factor_vm /* State kept by the sampling profiler */ std::vector samples; std::vector sample_callstacks; - volatile cell safepoint_sample_count; - volatile cell safepoint_gc_sample_count; - volatile cell safepoint_foreign_sample_count; - volatile cell safepoint_foreign_thread_sample_count; + volatile fixnum safepoint_sample_count; + volatile fixnum safepoint_gc_sample_count; + volatile fixnum safepoint_foreign_sample_count; + volatile fixnum safepoint_foreign_thread_sample_count; /* GC is off during heap walking */ bool gc_off;