diff --git a/API/hermes/hermes.cpp b/API/hermes/hermes.cpp index 2b19ab1af1c..a7ebfe754a7 100644 --- a/API/hermes/hermes.cpp +++ b/API/hermes/hermes.cpp @@ -110,15 +110,6 @@ void hermesFatalErrorHandler( namespace { -// Max size of the runtime's register stack. -// The runtime register stack needs to be small enough to be allocated on the -// native thread stack in Android (1MiB) and on MacOS's thread stack (512 KiB) -// Calculated by: (thread stack size - size of runtime - -// 8 memory pages for other stuff in the thread) -static constexpr unsigned kMaxNumRegisters = - (512 * 1024 - sizeof(::hermes::vm::Runtime) - 4096 * 8) / - sizeof(::hermes::vm::PinnedHermesValue); - void raw_ostream_append(llvh::raw_ostream &os) {} template @@ -170,11 +161,7 @@ class HermesRuntimeImpl final : public HermesRuntime, HermesRuntimeImpl(const vm::RuntimeConfig &runtimeConfig) : hermesValues_(runtimeConfig.getGCConfig().getOccupancyTarget()), weakHermesValues_(runtimeConfig.getGCConfig().getOccupancyTarget()), - rt_(::hermes::vm::Runtime::create( - runtimeConfig.rebuild() - .withRegisterStack(nullptr) - .withMaxNumRegisters(kMaxNumRegisters) - .build())), + rt_(::hermes::vm::Runtime::create(runtimeConfig)), runtime_(*rt_), vmExperimentFlags_(runtimeConfig.getVMExperimentFlags()) { #ifdef HERMES_ENABLE_DEBUGGER diff --git a/public/hermes/Public/RuntimeConfig.h b/public/hermes/Public/RuntimeConfig.h index d7e8434329a..a61a37d7f12 100644 --- a/public/hermes/Public/RuntimeConfig.h +++ b/public/hermes/Public/RuntimeConfig.h @@ -35,7 +35,7 @@ class PinnedHermesValue; F(constexpr, PinnedHermesValue *, RegisterStack, nullptr) \ \ /* Register Stack Size */ \ - F(constexpr, unsigned, MaxNumRegisters, 1024 * 1024) \ + F(constexpr, unsigned, MaxNumRegisters, 64 * 1024) \ \ /* Whether to allow eval and Function ctor */ \ F(constexpr, bool, EnableEval, true) \ diff --git a/tools/hermes/hermes.cpp b/tools/hermes/hermes.cpp index b1db21990eb..b483e5148d0 100644 --- a/tools/hermes/hermes.cpp +++ b/tools/hermes/hermes.cpp @@ -112,6 +112,7 @@ static int executeHBCBytecodeFromCL( .withEnableHermesInternal(cl::EnableHermesInternal) .withEnableHermesInternalTestMethods( cl::EnableHermesInternalTestMethods) + .withMaxNumRegisters(1024 * 1024) .build(); options.basicBlockProfiling = cl::BasicBlockProfiling; diff --git a/tools/hvm/hvm.cpp b/tools/hvm/hvm.cpp index dcea74bf2f3..654a8a98067 100644 --- a/tools/hvm/hvm.cpp +++ b/tools/hvm/hvm.cpp @@ -126,6 +126,7 @@ int main(int argc, char **argv) { .withEnableHermesInternal(cl::EnableHermesInternal) .withEnableHermesInternalTestMethods( cl::EnableHermesInternalTestMethods) + .withMaxNumRegisters(1024 * 1024) .build(); options.stabilizeInstructionCount = cl::StableInstructionCount;