Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use _Thread_local in run-test262.c #667

Merged
merged 2 commits into from
Nov 9, 2024

Conversation

bnoordhuis
Copy link
Contributor

Allows building with tcc and old gcc versions again.

Please heed the first commit where I unscrupulously add a backdoor so I can use JS_SetRuntimeOpaque in run-test262.c

JS_SetRuntimeOpaque() and JS_GetRuntimeOpaque() are intended for
embedders. Stop using them in quickjs-libc.c
Comment on lines +184 to +192
static JSThreadState *js_get_thread_state(JSRuntime *rt)
{
return (JSThreadState *)js_std_cmd(/*GetOpaque*/0, rt);
}

static void js_set_thread_state(JSRuntime *rt, JSThreadState *ts)
{
js_std_cmd(/*SetOpaque*/1, rt, ts);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other approach is a mutex-protected list or hash table but this seemed all around easier.

@bnoordhuis
Copy link
Contributor Author

gcc48 failure is ancient cmake 🤦

cmake --build build -j 4
Unknown argument -j
Unknown argument 4

Allows building with tcc and old gcc versions again.
Copy link
Contributor

@saghul saghul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I wonder if we could (ab)use this weird API: JS_EXTERN void JS_SetRuntimeInfo(JSRuntime *rt, const char *info);

No sweat though, there are a couple of APIs already that are exposed for libc really IIRC.

@bnoordhuis
Copy link
Contributor Author

Yeah, I've seen that one. run-test262 in fact uses it so that wouldn't have worked.

@bnoordhuis bnoordhuis merged commit b293326 into quickjs-ng:master Nov 9, 2024
47 checks passed
@bnoordhuis bnoordhuis deleted the no-thread-local branch November 9, 2024 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants