-
Notifications
You must be signed in to change notification settings - Fork 141
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
Add compile-time refcount bug hunt build mode #952
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
msvc, man 🤦 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn! I hope you found a way not to type all that by hand...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@bnoordhuis Do you want me to hold on the release until this lands? It does seem worthy. |
Yes, please. I'll incorporate @bptato's suggestions where possible. |
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.