Open Bug 1733681 Opened 3 years ago Updated 3 years ago

Add an in-code mechanism for annotating that a function cannot GC

Categories

(Core :: JavaScript: GC, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: sfink, Unassigned)

References

(Blocks 1 open bug)

Details

Currently, you can use AutoSuppressGCAnalysis in a function to declare that nothing will GC in an RAII scope. But this is inadequate for some cases:

  • it might be third-party code that should not be modified
  • it's in a part of the tree (eg mozglue) that doesn't have access to annotations
  • the analysis can't resolve all possible virtual overrides
  • the GC might happen after any RAII scope ends if it's triggered by the destruction of a member variable

annotations.js has a mechanism to handle this, where you can list out functions that you assert cannot GC. That's fine for most things, but for the last item in the above list, it would be preferable in most cases to have an annotation in the body of the function itself (since the actual code may contain measures for making the assertion true).

So this bug proposes something like JS_HAZ_THIS_FUNCTION_CANNOT_GC.

Severity: -- → N/A
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.