Closed Bug 673341 Opened 13 years ago Closed 13 years ago

TI: Wrong liveness information for variables defined inside loops inside try blocks

Categories

(Core :: JavaScript Engine, defect)

All
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: shu, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

For the following code:

function g() {
  throw 0;
}

function f()
{
  try {
    for (var i = 0; i < 100; i++)
      var q = g();
  } catch(e) {
    print(q);
  }
}

|q| is marked as dead inside the loop at the RHS of the assignment. This is incorrect, as the RHS can almost always throw, and |q| is live at the catch block.
Attached patch fix v1 (obsolete) — Splinter Review
As per discussion with bhackett, fixes by extending the range all live variables that at exception entry points to the start of their respective try blocks.
Attachment #547625 - Flags: review?(bhackett1024)
Attached patch fix v1'Splinter Review
fix inconsistent unsigned type names
Attachment #547625 - Attachment is obsolete: true
Attachment #547625 - Flags: review?(bhackett1024)
Attachment #547627 - Flags: review?(bhackett1024)
Comment on attachment 547627 [details] [diff] [review]
fix v1'

Review of attachment 547627 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jsanalyze.h
@@ +561,5 @@
>      /* Jump preceding the basic block which killed this variable. */
>      uint32 savedEnd;
>  
> +    /* If the variable needs to be kept alive until lifetime->start. */
> +    bool ensured : 1;

Can you make savedEnd be 31 bits, to avoid using an extra word on 32 bit platforms?
Attachment #547627 - Flags: review?(bhackett1024) → review+
(In reply to comment #3)
> Comment on attachment 547627 [details] [diff] [review] [review]
> fix v1'
> 
> Review of attachment 547627 [details] [diff] [review] [review]:
> -----------------------------------------------------------------
> 
> ::: js/src/jsanalyze.h
> @@ +561,5 @@
> >      /* Jump preceding the basic block which killed this variable. */
> >      uint32 savedEnd;
> >  
> > +    /* If the variable needs to be kept alive until lifetime->start. */
> > +    bool ensured : 1;
> 
> Can you make savedEnd be 31 bits, to avoid using an extra word on 32 bit
> platforms?

Fixed and pushed: http://hg.mozilla.org/projects/jaegermonkey/rev/7e3ed488cd20
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: