Add compile-time refcount bug hunt build mode#952
Merged
bnoordhuis merged 5 commits intoquickjs-ng:masterfrom Mar 8, 2025
Merged
Add compile-time refcount bug hunt build mode#952bnoordhuis merged 5 commits intoquickjs-ng:masterfrom
bnoordhuis merged 5 commits intoquickjs-ng:masterfrom
Conversation
Reintroduce JSValueConst and add a JS_CHECK_JSVALUE build mode that catches reference counting bugs by making JSValue and JSValueConst different types. The *vast* majority of this commit is rote work to make our own sources compile cleanly in said mode. Refs: quickjs-ng#944
Contributor
Author
msvc, man 🤦 |
saghul
approved these changes
Mar 7, 2025
Contributor
saghul
left a comment
There was a problem hiding this comment.
Damn! I hope you found a way not to type all that by hand...
bptato
reviewed
Mar 8, 2025
Contributor
bptato
left a comment
There was a problem hiding this comment.
Great work, thank you!
I've skimmed through the diff and then the public API, some suggestions (I have no idea how to do this through GH UI, sorry...):
- JS_MarkValue, JSClassFinalizer, JSClassGCMark, and JS_IsPromise take a JSValueConst for val
- JS_PromiseResult takes JSValueConst for promise
- JS_IsLiveObject, JS_GetOwnPropertyNames take JSValueConst for obj
- JS_IsEqual, JS_IsStrictEqual, JS_IsSameValue, JS_IsSameValueZero take JSValueConst for both params (they all dup the params first)
- JS_GetPrototypePrimitive returns a JSValueConst
Contributor
|
@bnoordhuis Do you want me to hold on the release until this lands? It does seem worthy. |
Contributor
Author
|
Yes, please. I'll incorporate @bptato's suggestions where possible. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #944.
Not fully done yet - still some 400 warnings left to fix 🤦 - but already uncovered a RC bug injs_date_setYear.Done. Caught a further two or three RC buglets.