Closed Bug 1627248 Opened 5 years ago Closed 5 years ago

Use placement new to forward cells to work around undefined behaviour

Categories

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

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(3 files)

Use of RelocationOverlay::next_ to hold a linked list pointer is undefined behaviour because the underlying type of that location is something else. We can get around this by using placement new to start a new lifetime for the cell memory as a RelocationOverlay before using it as such. (I was surprised to discover that destruction of the original contents of the memory is not required first).

Depends on: 1625212

I wanted to assert that the most derived type of all GC things had standard layout type; sadly this was not true. The restrictions are quite strong, and I don't think this is realistic. However we can assert that the base GC thing type meets the restrictions with one minor change and I think that's most of the way there.

Depends on D69575

Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f6ca42417f92 Refactor cell methods that read cell header flags r=tcampbell https://hg.mozilla.org/integration/autoland/rev/cc6e408e477c Check GC thing classes are have standard layout type r=tcampbell https://hg.mozilla.org/integration/autoland/rev/f7bda197d6b9 Use placement new when forwarding cells r=tcampbell
Backout by malexandru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a5d3f290d892 Backed out 3 changesets for causing bustages in src/js/src/gc/GC.cpp
Attachment #9138562 - Attachment description: Bug 1627248 - Check GC thing classes are have standard layout type r?tcampbell → Bug 1627248 - Check GC thing classes have standard layout type r?tcampbell
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ae8829b46a23 Refactor cell methods that read cell header flags r=tcampbell https://hg.mozilla.org/integration/autoland/rev/6b6f3e10c9a4 Check GC thing classes have standard layout type r=tcampbell https://hg.mozilla.org/integration/autoland/rev/5bbd86857de9 Use placement new when forwarding cells r=tcampbell
Flags: needinfo?(jcoppeard)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: