Closed Bug 1968356 Opened 3 months ago Closed 2 months ago

Could RootedField avoid aliasing clashes

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
141 Branch
Tracking Status
firefox141 --- fixed

People

(Reporter: mgaudet, Assigned: jonco)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I think it would be possible in a DEBUG build to add support to RootedField and Tuple for avoiding aliasing. In this model, you'd have a second tuple under the covers of the same dimension as the main tuple, but filled with bool. RootedField would set the bool for its field to true on construction, false on destruction, and assert if the bool is true on construction.

This would avoid accidental misuse via

RootedTuple<Value,Value> roots(cx); 
RootedField<Value, 0> v1(roots);
RootedField<Value, 1> v2(roots); // Aliasing

(if we had the ability to check I'd be more willing to use the same field on a tuple twice with non-overlapping ranges)

Blocks: sm-runtime
Severity: -- → N/A
Priority: -- → P3
Assignee: nobody → jcoppeard

C++ doesn't provide a tuple function to look up the index of a field by its
type so this has to be done with template metaprogramming.

Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 141 Branch
QA Whiteboard: [qa-triage-done-c142/b141]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: