diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-07-02 15:48:27 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-07-02 15:58:52 +0100 |
commit | 3abd437507f8ba30a238a52c273c9944dcb9d5a1 (patch) | |
tree | 9e058e63cb1176446a2838436223d8b18119a2b0 /test | |
parent | 4990f5c14a04b9aad1be50d206b7c1f8989d8923 (diff) | |
download | art-3abd437507f8ba30a238a52c273c9944dcb9d5a1.zip art-3abd437507f8ba30a238a52c273c9944dcb9d5a1.tar.gz art-3abd437507f8ba30a238a52c273c9944dcb9d5a1.tar.bz2 |
Do not create a HBoundType when the instruction is non-null.
We don't need to refine the type after a null check, if the
instruction is known non null or null. As a side effect, this
avoids replacing HLoadClass instructions with HBoundType instructions.
bug:22116987
Change-Id: I565ae95db5a64faec30e026674636e398e0bf445
Diffstat (limited to 'test')
-rw-r--r-- | test/519-bound-load-class/src/Main.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/519-bound-load-class/src/Main.java b/test/519-bound-load-class/src/Main.java index 41bb951..cddeb09 100644 --- a/test/519-bound-load-class/src/Main.java +++ b/test/519-bound-load-class/src/Main.java @@ -16,9 +16,24 @@ public class Main { public static void main(String[] args) { + testInstanceOf(); + try { + testNull(); + throw new Error("Expected ClassClastException"); + } catch (ClassCastException e) { /* ignore */ } + } + + public static void testInstanceOf() { Object o = Main.class; if (o instanceof Main) { System.out.println((Main)o); } } + + public static void testNull() { + Object o = Main.class; + if (o != null) { + System.out.println((Main)o); + } + } } |