Start marking functions that can transitively trigger a GC#33144
Start marking functions that can transitively trigger a GC#33144jdm merged 3 commits intoservo:mainfrom
Conversation
Signed-off-by: Josh Matthews <[email protected]>
Signed-off-by: Josh Matthews <[email protected]>
Signed-off-by: Josh Matthews <[email protected]>
|
This PR gets us to a point where I can file followups for less experienced contributors to help push it forward. There are many threads to pull! |
| obj: Box<T>, | ||
| global: &U, | ||
| proto: Option<HandleObject>, | ||
| can_gc: CanGc, |
There was a problem hiding this comment.
is there a future need to pass it here, as opposed to instantiate it inside the function and hide it from the caller?
There was a problem hiding this comment.
Yes. The purpose is to infect callers so it is clear whether any function can trigger a GC.
|
I'm trying to see if I can pull some of the threads further, and I'm wondering if there's an easier way to discover and poke at autogenerated code. In particular I'm wondering how to change this trait, used in 59:impl DOMParserMethods for DOMParser {
60- // https://w3c.github.io/DOM-Parsing/#the-domparser-interface
61- fn ParseFromString(
62- &self,
63- s: DOMString,
64- ty: DOMParserBinding::SupportedType,
65- can_gc: CanGc,
66- ) -> Fallible<DomRoot<Document>> {to accept a fourth I've found the autogenerated code in 276:pub trait DOMParserMethods {
277- fn ParseFromString(&self, str: DOMString, type_: SupportedType) -> Fallible<DomRoot<Document>>;
278-}And, through poking at 6362- self.cgRoot = CGWrapper(CGIndenter(CGList(methods, "")),
6363: pre=f"pub trait {descriptor.interface.identifier.name}Methods {{\n",
6364- post="}")and 222- else:
223: self.returnType = "DomRoot<%s>" % typeName
224- self.argumentType = "&%s" % typeNamemade sure that this is the code responsible for the |
|
@last-genius Good question! A useful model for adding arguments to the generated methods is the |
Per #33140, adding this zero-size argument to functions that can transitively GC makes it easier to recognize where hazards are present. This work can be done incrementally and iteratively as time allows.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors