MarkGCThing: stricter tail recursion

RESOLVED FIXED

Status

()

--
enhancement
RESOLVED FIXED
13 years ago
13 years ago

People

(Reporter: igor, Assigned: igor)

Tracking

Trunk
Points:
---
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

13 years ago
Currently MarkGCThing from jsgc.c contains the following code:

start:
...
    if (*flagp & GCF_MARK) {
        /*
         * This should happen only if recursive MARK_GC_THING marks flags
         * already stored in the caller's *next_flagp.
         */
        goto out;
    }


The situation described in the comments happens during marking of object's slots when recursive MARK_GC_THING invocation marks object referenced through next_thing. It is better to move the check there and add assert to require *flagp to be unmarked.
(Assignee)

Comment 1

13 years ago
Created attachment 213506 [details] [diff] [review]
Implementation and clenups

Besides moving the code to check for a marked thing to where it belongs the patch changes the return type for NarkGCThing to void and makes tail recusrion eleimination slightly more readable. See also bug 324278.
Assignee: general → igor.bukanov
Status: NEW → ASSIGNED
Attachment #213506 - Flags: review?(brendan)
(Assignee)

Updated

13 years ago
Blocks: 324278
Comment on attachment 213506 [details] [diff] [review]
Implementation and clenups

Cool -- only thoughts are these very minor comments:

1.  Save one goto by putting onTailRecursion: label and code in place of the patch's second goto onTailRecursion.

2.  SpiderMonkey has an esoteric style rule that prefers out_of_memory for long label names, not camelCaps.  You are now entering the ascended master SpiderMonkey level ;-).

/be
Attachment #213506 - Flags: review?(brendan) → review+
(Assignee)

Comment 3

13 years ago
Created attachment 214509 [details] [diff] [review]
Nits etc.

Besides addressing the nits the patch removes "out" label replacing all "goto out;" by "break;".
Attachment #213506 - Attachment is obsolete: true
Attachment #214509 - Flags: review?(brendan)
Comment on attachment 214509 [details] [diff] [review]
Nits etc.

Great!  Thanks,

/be
Attachment #214509 - Flags: review?(brendan) → review+
(Assignee)

Comment 5

13 years ago
Created attachment 214524 [details] [diff] [review]
Patch to commit with trailing blanks removed
(Assignee)

Comment 6

13 years ago
I committed the last patch:

Checking in jsgc.c;
/cvsroot/mozilla/js/src/jsgc.c,v  <--  jsgc.c
new revision: 3.119; previous revision: 3.118
done
Status: ASSIGNED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED

Updated

13 years ago
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.