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)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
mozilla60
Tracking | Status | |
---|---|---|
firefox60 | --- | fixed |
People
(Reporter: lth, Assigned: lth)
References
Details
Attachments
(1 file, 1 obsolete file)
2.35 KB,
patch
|
jandem
:
review+
|
Details | Diff | Splinter Review |
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())?)
Updated•8 years ago
|
Priority: -- → P3
Assignee | ||
Comment 1•7 years ago
|
||
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
Assignee | ||
Comment 2•7 years ago
|
||
... and that is because AnyRegister can be part of a union in TypedOrValueRegister and needs to have a default constructor that does nothing. Sigh.
Assignee | ||
Comment 3•7 years ago
|
||
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)
Updated•7 years ago
|
Attachment #8945803 -
Flags: review?(nicolas.b.pierron) → review+
Comment 4•7 years ago
|
||
(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?
Assignee | ||
Comment 5•7 years ago
|
||
That's a good idea. I'll experiment. I don't know how many unions were affected, there could be more than the one.
Assignee | ||
Comment 6•7 years ago
|
||
Alternative solution, probably the superior approach. Only the one union needed to change.
Attachment #8946261 -
Flags: review?(jdemooij)
Comment 7•7 years ago
|
||
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+
Assignee | ||
Comment 8•7 years ago
|
||
(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.
Assignee | ||
Updated•7 years ago
|
Attachment #8945803 -
Attachment is obsolete: true
Pushed by lhansen@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/593bad5d26d6
Avoid garbage AnyRegister. r=jandem
Comment 10•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox60:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in
before you can comment on or make changes to this bug.
Description
•