Bug 262059
Summary: | Provide public C API for getting and setting JavaScriptCore options | ||
---|---|---|---|
Product: | WebKit | Reporter: | Kasper Isager Dalsgarð <kasperisager> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | mark.lam, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari 17 | ||
Hardware: | Mac (Apple Silicon) | ||
OS: | macOS 13 |
Kasper Isager Dalsgarð
The public JavaScriptCore C API is currently missing functions for getting and settings options as defined by https://github.com/WebKit/WebKit/blob/main/Source/JavaScriptCore/runtime/OptionsList.h. This necessitates relying on environment variables instead, such as by using `setenv()`, though one can only set options this way and not get their current value.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Mark Lam
Why do you need to set these options? The options are designed for platform implementers to tune their system. These are low level options, and it takes intimate knowledge about how the system works in order to set them correctly.
They are not intended for app developers to modify. In fact, many of the options are not safe for app developers to modify, and if set incorrectly, may result in performance / correctness / security issues.
Can you explain why you are attempting to set these options (via environment variables) or otherwise?
Kasper Isager Dalsgarð
I'm working on a JavaScript runtime that binds to several JavaScript engines, JavaScriptCore being one and V8 being another. Mostly for debugging purposes, the C API of the runtime exposes options for disabling or tracing JIT, enabling sampling profiling if available, and more.
Through an API independent of the underlying engine, embedders can specify platform options, such as `trace_garbage_collection`, which are then translated to engine specific options behind the scenes, such as `--trace-gc` in V8 or `JSC_logGC=true` in JavaScriptCore. That particular option also happened to be one of the options you asked me to enable in https://bugs.webkit.org/show_bug.cgi?id=251261, and it has proven helpful in other cases as well.
To some extent, it might also be true that I shouldn't be using the system JavaScriptCore framework for this; I could just embed it directly and rely on its internal APIs. Using the system JavaScriptCore framework is highly desirable, however, as it allows me to ship a mostly complete runtime, with things like CommonJS and C addon support, to Apple devices in only a few hundred KiB. The other bugs I've filed over the past year asking for additional public API to be exposed relates to the bits I'm missing for it to be fully complete.
Radar WebKit Bug Importer
<rdar://problem/116355721>