Bug 150685 - B3::LowerToAir::imm() should work for both 32-bit and 64-bit immediates
Summary: B3::LowerToAir::imm() should work for both 32-bit and 64-bit immediates
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks: 150279
  Show dependency treegraph
 
Reported: 2015-10-29 12:44 PDT by Filip Pizlo
Modified: 2015-10-29 16:44 PDT (History)
10 users (show)

See Also:


Attachments
the patch (4.35 KB, patch)
2015-10-29 13:11 PDT, Filip Pizlo
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2015-10-29 12:44:16 PDT
In B3, a constant must match the type of its use. In Air, immediates don't have type, they only have representation. A 32-bit immediate (i.e. Arg::imm) can be used either for 32-bit operations or for 64-bit operations. The only difference from a Arg::imm64 is that it requires fewer bits.

In the B3->Air lowering, we have a lot of code that is effectively polymorphic over integer type.  That code should still be able to use Arg::imm, and it should work even for 64-bit immediates - so long as they are representable as 32-bit immediates.  Therefore, the imm() helper should happily accept either Const32Value or Const64Value.

We already sort of had this with immAnyType(), but it just turns out that anyone using immAnyType() should really be using imm().
Comment 1 Filip Pizlo 2015-10-29 13:11:01 PDT
Created attachment 264337 [details]
the patch
Comment 2 Geoffrey Garen 2015-10-29 14:22:32 PDT
Comment on attachment 264337 [details]
the patch

r=me
Comment 3 Filip Pizlo 2015-10-29 16:44:43 PDT
Landed in http://trac.webkit.org/changeset/191762