Closed Bug 1320353 Opened 8 years ago Closed 7 years ago

AnyRegister::Invalid is an orphan / AnyRegister() constructs garbage, not an invalid value

Categories

(Core :: JavaScript Engine: JIT, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: lth, Assigned: lth)

References

Details

Attachments

(1 file, 1 obsolete file)

AnyRegister::Invalid is not used anywhere, and indeed it cannot be used: there is no accessor for it, unlike in Register and Register64, and the obvious workaround AnyRegister::FromCode(AnyRegister::Invalid) asserts because the Invalid code is not a valid code for this function. Not sure what to do here. I actually found myself needing an invalid AnyRegister but I've not had time to test the consequences of implementing it. (Could one reliably use AnyRegister(Register::Invalid())?)
Priority: -- → P3
This bit me again. It is possible to construct an AnyRegister that contains garbage by AnyRegister() but it can't be tested for validity.
Summary: AnyRegister::Invalid is an orphan → AnyRegister::Invalid is an orphan / AnyRegister() constructs garbage, not an invalid value
... and that is because AnyRegister can be part of a union in TypedOrValueRegister and needs to have a default constructor that does nothing. Sigh.
What do you think of this? It's a halfway solution - code that needs to signal that the AnyRegister is invalid can do so, but there's still an option to construct an AnyRegister containing garbage, so as not to have to change the code where an AnyRegister is in a union. I have some cases in the ARM back-end where AnyRegister can be invalid and therefore wants to be created as one that is recognizably so (updates to that code are included in this patch); there's more code like that coming the ARM64 back-end.
Assignee: nobody → lhansen
Status: NEW → ASSIGNED
Attachment #8945803 - Flags: review?(nicolas.b.pierron)
Attachment #8945803 - Flags: review?(nicolas.b.pierron) → review+
(In reply to Lars T Hansen [:lth] from comment #2) > ... and that is because AnyRegister can be part of a union in > TypedOrValueRegister and needs to have a default constructor that does > nothing. Sigh. Can we store AnyRegister::Code in the union?
That's a good idea. I'll experiment. I don't know how many unions were affected, there could be more than the one.
Alternative solution, probably the superior approach. Only the one union needed to change.
Attachment #8946261 - Flags: review?(jdemooij)
Comment on attachment 8946261 [details] [diff] [review] bug1320353-no-garbage-anyregister.patch Review of attachment 8946261 [details] [diff] [review]: ----------------------------------------------------------------- Nice. Register has the same garbage-initialization I think; ideally we would use this pattern everywhere.
Attachment #8946261 - Flags: review?(jdemooij) → review+
(In reply to Jan de Mooij [:jandem] from comment #7) > Register has the same garbage-initialization I think; ideally we would > use this pattern everywhere. Filed as bug 1434539.
See Also: → 1434539
Attachment #8945803 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: