Initial OS X support
This commit is contained in:
parent
c86f9816d3
commit
1bf428f8da
@ -138,10 +138,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes -Wall")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast -funroll-loops -fvariable-expansion-in-unroller -fmerge-all-constants")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast -funroll-loops -fmerge-all-constants")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes -Wall -std=c++14 -fno-exceptions -fno-rtti")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -funroll-loops -fvariable-expansion-in-unroller -fmerge-all-constants")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -funroll-loops -fmerge-all-constants")
|
||||
|
||||
endif()
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <malloc.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -44,7 +44,11 @@ bool Mem::allocate(int algo, int threads, bool doubleHash)
|
||||
|
||||
m_flags |= HugepagesAvailable;
|
||||
|
||||
# if defined(__APPLE__)
|
||||
m_memory = static_cast<uint8_t*>(mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, VM_FLAGS_SUPERPAGE_SIZE_2MB, 0));
|
||||
# else
|
||||
m_memory = static_cast<uint8_t*>(mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE, 0, 0));
|
||||
# endif
|
||||
|
||||
if (m_memory == MAP_FAILED) {
|
||||
m_memory = static_cast<uint8_t*>(_mm_malloc(size, 16));
|
||||
|
@ -396,7 +396,9 @@ void Options::showVersion()
|
||||
{
|
||||
printf(APP_NAME " " APP_VERSION "\n built on " __DATE__
|
||||
|
||||
# if defined(__GNUC__)
|
||||
# if defined(__clang__)
|
||||
" with clang " __clang_version__);
|
||||
# elif defined(__GNUC__)
|
||||
" with GCC");
|
||||
printf(" %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
||||
# elif defined(_MSC_VER)
|
||||
|
@ -37,7 +37,9 @@ static void print_versions()
|
||||
{
|
||||
char buf[16];
|
||||
|
||||
# if defined(__GNUC__)
|
||||
# if defined(__clang__)
|
||||
snprintf(buf, 16, " clang/%d.%d.%d", __clang_major__, __clang_minor__, __clang_patchlevel__);
|
||||
# elif defined(__GNUC__)
|
||||
snprintf(buf, 16, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
||||
# elif defined(_MSC_VER)
|
||||
snprintf(buf, 16, " MSVC/%d", MSVC_VERSION);
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
protected:
|
||||
void onClose(Client *client, int failures) override;
|
||||
void onJobReceived(Client *client, const Job &job) override;
|
||||
void onJobResult(const JobResult &result);
|
||||
void onJobResult(const JobResult &result) override;
|
||||
void onLoginCredentialsRequired(Client *client) override;
|
||||
void onLoginSuccess(Client *client) override;
|
||||
|
||||
|
@ -54,7 +54,7 @@ Job Workers::job()
|
||||
Job job = m_job;
|
||||
uv_rwlock_rdunlock(&m_rwlock);
|
||||
|
||||
return std::move(job);
|
||||
return job;
|
||||
}
|
||||
|
||||
|
||||
@ -139,7 +139,9 @@ void Workers::onResult(uv_async_t *handle)
|
||||
void Workers::onTick(uv_timer_t *handle)
|
||||
{
|
||||
for (Handle *handle : m_workers) {
|
||||
m_telemetry->add(handle->threadId(), handle->worker()->hashCount(), handle->worker()->timestamp());
|
||||
if (handle->worker()) {
|
||||
m_telemetry->add(handle->threadId(), handle->worker()->hashCount(), handle->worker()->timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_ticks++ & 0xF) == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user