-
Notifications
You must be signed in to change notification settings - Fork 37
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
Migration from ESR 115 to 128 #85
base: next
Are you sure you want to change the base?
Conversation
Also, note that `JS::GCPolicy<JS::Heap<T>>` does not implement | ||
`needsSweep()`. | ||
If you were storing a `JS::Heap` inside `JS::WeakCache<T>`, you will | ||
need to use a different data structure. | ||
An easy drop-in replacement for `JS::Heap` suitable for this purpose | ||
would be something like this: | ||
|
||
```c++ | ||
template <typename T> | ||
class WeakPtr : public JS::Heap<T> { | ||
public: | ||
using JS::Heap<T>::Heap; | ||
using JS::Heap<T>::operator=; | ||
}; | ||
|
||
namespace JS { | ||
|
||
template <typename T> | ||
struct GCPolicy<WeakPtr<T>> { | ||
static void trace(JSTracer* trc, WeakPtr<T>* thingp, const char* name) { | ||
return JS::TraceEdge(trc, thingp, name); | ||
} | ||
|
||
static bool traceWeak(JSTracer* trc, WeakPtr<T>* thingp) { | ||
return js::gc::TraceWeakEdge(trc, thingp); | ||
} | ||
|
||
static bool needsSweep(JSTracer* trc, const WeakPtr<T>* thingp) { | ||
WeakPtr<T> thing{*thingp}; | ||
return !js::gc::TraceWeakEdge(trc, &thing); | ||
} | ||
}; | ||
|
||
} // namespace JS | ||
``` |
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.
I was also wondering if this omission was unintentional and we should have JS::Heap
's GCPolicy be sweepable after all.
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.
Thank you for covering the changes around column number and function name.
@arai-a Thanks for the review. I've pushed another revision. Any thoughts on whether we should add |
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.
Thank you for updating!
The parts other than JS::GCPolicy
looks good.
Let's wait for GC devs for the JS::GCPolicy
part.
Includes updated build instructions and a migration guide. One of the examples needs to be updated, with the new column number API; and the WeakRefs example needs its job queue and realm creation options adjusted. Everything else builds as is.
Includes updated build instructions and a migration guide. Only one of the examples needs to be updated, with the new column number API; everything else builds as is.