Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
build: fix build on macos and fix crash on exit
Browse files Browse the repository at this point in the history
PrivateHeap is causing crash on exit due to node picking up chakracore's
overridden new and delete operators.  For now fix by disabling
PrivateHeap.
  • Loading branch information
Ian Halliday committed Nov 24, 2016
1 parent 5c0da90 commit 4c73217
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
8 changes: 8 additions & 0 deletions deps/chakrashim/chakrashim.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
[ 'OS in "linux"', {
'cflags_cc': [ '-fexceptions' ],
}],
[ 'OS in "mac"', {
'cflags_cc': [ '-fexceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'OTHER_CFLAGS': [ '-fexceptions' ],
},
}],
],
'msvs_use_library_dependency_inputs': 1,

Expand Down
2 changes: 1 addition & 1 deletion deps/chakrashim/core/lib/Common/ConfigFlagsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ PHASE(All)
#define DEFAULT_CONFIG_EnumerationCompat (false)
#define DEFAULT_CONFIG_ConcurrentRuntime (false)
#define DEFAULT_CONFIG_PrimeRecycler (false)
#define DEFAULT_CONFIG_PrivateHeap (true)
#define DEFAULT_CONFIG_PrivateHeap (false)
#define DEFAULT_CONFIG_DisableRentalThreading (false)
#define DEFAULT_CONFIG_DisableDebugObject (false)
#define DEFAULT_CONFIG_DumpHeap (false)
Expand Down
8 changes: 4 additions & 4 deletions deps/chakrashim/src/jsrtisolateshim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ bool CALLBACK TTReadBytesFromStreamCallback(JsTTDStreamHandle handle,
return false;
}

bool ok = FALSE;
bool ok = false;
*readCount = TTDHostRead(buff, size, (FILE*)handle);
ok = (*readCount != 0);

Expand All @@ -411,7 +411,7 @@ bool CALLBACK TTWriteBytesToStreamCallback(JsTTDStreamHandle handle,
return false;
}

bool ok = FALSE;
bool ok = false;
*writtenCount = TTDHostWrite(buff, size, (FILE*)handle);
ok = (*writtenCount == size);

Expand Down Expand Up @@ -905,8 +905,8 @@ bool IsolateShim::RunSingleStepOfReverseMoveLoop(v8::Isolate* isolate,
*moveMode = (uint64_t)_moveMode;
if (*nextEventTime == -1) {
printf("\nReached end of Execution -- Exiting.\n");
return FALSE;
return false;
}
return TRUE;
return true;
}
} // namespace jsrt
6 changes: 2 additions & 4 deletions deps/chakrashim/src/jsrtisolateshim.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@
#include "uv.h"
#include <vector>

// CHAKRA-TODO : now that node is using libc++ for C++11 support can we remove
// all OSX_SDK_TR1 specialization?
#if !defined(OSX_SDK_TR1) && defined(__APPLE__)
#include <AvailabilityMacros.h>
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < MAC_OS_X_VERSION_10_9
#define OSX_SDK_TR1
#endif
#endif

#ifdef OSX_SDK_TR1
#include <tr1/unordered_map>
#else
#include <unordered_map>
#endif

namespace v8 {

Expand Down
1 change: 1 addition & 0 deletions deps/chakrashim/src/jsrtproxyutils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "jsrtutils.h"
#include <string>
#include <cstdlib>
#include <assert.h>

namespace jsrt {
Expand Down
1 change: 1 addition & 0 deletions deps/chakrashim/src/jsrtutils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <stdarg.h>
#include "jsrtutils.h"
#include <string>

namespace jsrt {

Expand Down
2 changes: 0 additions & 2 deletions deps/chakrashim/src/jsrtutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ inline size_t _countof(T (&)[N]) {
#ifndef _WIN32
#define strnicmp strncasecmp
#define __debugbreak __builtin_trap
using std::min;
using std::max;
#endif

#ifndef __APPLE__
Expand Down
22 changes: 8 additions & 14 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4656,20 +4656,14 @@ static void StartNodeInstance_TTDReplay(void* arg) {
////
JsTTDStart();

try {
int64_t nextEventTime = -2;
bool continueReplayActions = TRUE;

while (continueReplayActions) {
continueReplayActions =
v8::Isolate::RunSingleStepOfReverseMoveLoop(isolate,
&s_ttdStartupMode,
&nextEventTime);
}
}
catch (...) {
printf("Terminal exception in Replay -- exiting.");
exit(1);
int64_t nextEventTime = -2;
bool continueReplayActions = true;

while (continueReplayActions) {
continueReplayActions =
v8::Isolate::RunSingleStepOfReverseMoveLoop(isolate,
&s_ttdStartupMode,
&nextEventTime);
}
////

Expand Down

0 comments on commit 4c73217

Please sign in to comment.