chakra-core / ChakraCore

ChakraCore is an open source Javascript engine with a C API.
MIT License
9.06k stars 1.19k forks source link

Fix JsDisableRuntimeExecution on AppleSilicon #6995

Open rhuanjl opened 3 weeks ago

rhuanjl commented 3 weeks ago

JsDisableRuntimeExecution currently does not function on AppleSilicon.

This is because of an incorrect ifdef, JsDisableRuntimeExecution works by overriding CC's stack size tracking so that CC mistakenly thinks there is no stack space left and hence stops executing JS; in order to do this StackLimitForScriptInterrupt needs to be an appropriately large number for the architecture, currently it's being set to the same size on AppleSilicon that was used for x86 which is obviously not high enough, change the ifdef so all 64bit architectures (i.e. x64 and AppleSilicon) get the larger figure.

Bug reported by @fatcerberus fix also tested offline by @fatcerberus

Currently most of our native API tests only run on windows hence do not detect this; we should look at enabling them on macOS/Linux as a future todo.

ppenzin commented 1 day ago

I need to check my email a bit more often, sorry. It is failing in debug mode on Windows, but Azure already helpfully deleted the build, I am trying to re-run it.