Skip to content

Commit

Permalink
use MVM_platform_cpu_count to implement cpucores op, but use uv impl
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlemmen committed May 28, 2017
1 parent d7d48d6 commit 40bb532
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 91 deletions.
7 changes: 3 additions & 4 deletions build/Makefile.in
Expand Up @@ -52,12 +52,10 @@ ARFLAGS = @arflags@

PLATFORM_WIN32 = src/platform/win32/mmap@obj@ \
src/platform/win32/time@obj@ \
src/platform/win32/io@obj@ \
src/platform/win32/sys@obj@
src/platform/win32/io@obj@

PLATFORM_POSIX = src/platform/posix/mmap@obj@ \
src/platform/posix/time@obj@ \
src/platform/posix/sys@obj@
src/platform/posix/time@obj@

DASM_FLAGS_WIN32 = -D WIN32=1
DASM_FLAGS_POSIX = -D POSIX=1
Expand Down Expand Up @@ -209,6 +207,7 @@ OBJECTS = src/core/callsite@obj@ \
src/profiler/telemeh@obj@ \
src/instrument/crossthreadwrite@obj@ \
src/instrument/line_coverage@obj@ \
src/platform/sys@obj@ \
src/moar@obj@ \
@platform@ \
@jit@
Expand Down
3 changes: 2 additions & 1 deletion src/core/interp.c
@@ -1,6 +1,7 @@
#include "moar.h"
#include <math.h>
#include "platform/time.h"
#include "platform/sys.h"
#include "strings/unicode_ops.h"

/* Macros for getting things from the bytecode stream. */
Expand Down Expand Up @@ -5633,7 +5634,7 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
goto NEXT;
}
OP(cpucores): {
GET_REG(cur_op, 0).i64 = MVM_cpucores();
GET_REG(cur_op, 0).i32 = MVM_platform_cpu_count();
cur_op += 2;
goto NEXT;
}
Expand Down
9 changes: 0 additions & 9 deletions src/core/threads.c
Expand Up @@ -264,12 +264,3 @@ void MVM_thread_join_foreground(MVMThreadContext *tc) {
}
}

MVMint64 MVM_cpucores() {
int count;
uv_cpu_info_t *info;

uv_cpu_info(&info, &count);
uv_free_cpu_info(info, count);

return count;
}
1 change: 0 additions & 1 deletion src/core/threads.h
Expand Up @@ -8,4 +8,3 @@ void MVM_thread_yield(MVMThreadContext *tc);
MVMObject * MVM_thread_current(MVMThreadContext *tc);
void MVM_thread_cleanup_threads_list(MVMThreadContext *tc, MVMThread **head);
void MVM_thread_join_foreground(MVMThreadContext *tc);
MVMint64 MVM_cpucores();
62 changes: 0 additions & 62 deletions src/platform/posix/sys.c

This file was deleted.

12 changes: 12 additions & 0 deletions src/platform/sys.c
@@ -0,0 +1,12 @@
#include "moar.h"
#include "platform/sys.h"

MVMuint32 MVM_platform_cpu_count(void) {
int count;
uv_cpu_info_t *info;

uv_cpu_info(&info, &count);
uv_free_cpu_info(info, count);

return count;
}
14 changes: 0 additions & 14 deletions src/platform/win32/sys.c

This file was deleted.

0 comments on commit 40bb532

Please sign in to comment.