Closed Bug 585986 Opened 14 years ago Closed 10 years ago

Start to use gcc 4.5's __builtin_unreachable

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: paul.biggar, Unassigned)

Details

Attachments

(1 file)

GCC 4.5 provides a __builtin_unreachable() builtin function, which tells the optimizers that a particular point in the program cannot be reached. If, in a non-release build, we changed JS_ASSERT to produce a __builtin_unreachable(), we might generate smaller or faster code.

I gave this a go, expecting no problems and some free performance. The attached patch shows how it would work. However, some problems:

 - this puts the `expr` (from JS_ASSERT(expr)) into non-DEBUG builds. However, many times those expressions aren't declared because they're #ifdef-ed out. I can't think of an elegant solution to this.

 - I tried it on just JS_NOT_REACHED. There were some ups and some downs, not enough to be sure either way. I tried it in valgrind to confirm, and it crashed on the executable.

 - gcc 4.5 seems to be 9ms (1.5%) slower than gcc 4.4. Taras says -Os no longer generates faster code than -O2 on gcc 4.5, so this is an obstacle to overcome.


All in all, more work than it's worth.
Assignee: general → nobody
I don't see this going anywhere. See also the work in bug 990764 and related bugs.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: