microsoft / ChakraCore-wiki

A mirror of the ChakraCore wiki to enable pull requests on the Wiki.
https://github.com/Microsoft/ChakraCore/wiki
Other
22 stars 30 forks source link

Software Write Barrier should clarify need for software solution on non-Windows #58

Open rdoeffinger opened 5 years ago

rdoeffinger commented 5 years ago

The article simply claims that "hardware write barrier is not available", but does not explain why similar mechanisms are not used, e.g. if they are not usable, not fast enough, not convenient or the author simply was not aware of them. Linux for example has soft-dirty, see Documentation/vm/soft-dirty.txt It works pretty similar to the Windows feature I'd claim, HOWEVER resetting its state always operates on all of the process' memory space instead of just specific ranges, it likely is also slower due to being pagefault-based (but then, at least on ARM architecture even the Windows feature surely must be pagefault-based?). It is possible to map pages read-only and catch SIGSEGV, alternatively there is also MADV_USERFAULT (though I have not investigated how usable it is for catching only writes). All these in a library admittedly have the issue of potentially interfering with the host application if it also uses the feature, but the wiki at least mentioning those options and thoughts on their usefulness might be useful for anyone who'd like to try their hand at optimization of this feature for non-Windows.