Closed
Bug 910715
Opened 11 years ago
Closed 5 years ago
Odinmonkey: extend annotations to included bitwise subsets of the signed type.
Categories
(Core :: JavaScript: WebAssembly, defect)
Core
JavaScript: WebAssembly
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: dougc, Unassigned)
Details
The asm.js spec. currently supports a few function parameter and return type annotations including '|0' for the 'signed' type. For optimization of heap access using index masking it would be common to apply a bitwise-and operation to the parameters passed and received by functions, and to results returned by and received from functions. If the annotations were extended to support '&n', where 'n' is a literal constant mask, then it might be possible to eliminate one side of the masking or the other by enforcing the matching of the types. E.g. function intPointerPlus (p1, p2) { p1 = p1 & 0xfffc; // Word aligned pointer argument p2 = p2 & 0xfffc; return (p1 + p2) & 0xfffc; } // If the matching of argument and result types were enforced then // it would be possible to optimize away the bitwise-and operations in // the following while still being able to depend on the callee masking // the arguments and depend on the result being a word aligned number // in the range 0 to 0xfffc which could help optimize heap access. ... intPointerPlus(pa & 0xfffc, pb & 0xfffc) & 0xfffc Being able to declare results type in this manner could also be expected to help other compiler optimizations by improving type information in range analysis. There might also be a similar issue with variables. For example a global variable holding a stack pointer, might be declared to be a word aligned signed within the range of the heap, and then it might only be necessary to mask stores rather than also loads while still being able to depend on a loaded stack pointer being masked when optimizing heap access. Rather then enforcing just equality of masks, it would be possible to accept an input with a more restrictive mask than that declared. There might also be a gain in the code density if '(... |0)&n' patterns could be replaced by just '&n'.
Comment 1•11 years ago
|
||
I guess I see 2 separate goals: decreasing code size and adding a new type to asm.js that exposed a new optimization. For the former, it'd be interesting to measure, but I wouldn't expect a huge difference (esp. after gzip). The latter is pretty intriguing; I'd be curious to see the proposed addition to the type system.
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Comment 2•6 years ago
|
||
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
Updated•6 years ago
|
Status: RESOLVED → REOPENED
Resolution: INACTIVE → ---
Updated•5 years ago
|
Component: JavaScript Engine → Javascript: WebAssembly
Comment 3•5 years ago
|
||
Asm.js enhancement proposal, which we won't extend in the future. Closing.
Status: REOPENED → RESOLVED
Closed: 6 years ago → 5 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•