Mercurial > hg > graal-compiler
changeset 8479:a6ba61be2b5f
made method substitutions for Object be interpretable
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 26 Mar 2013 12:56:27 +0100 |
parents | e9dad49ce336 |
children | 7abc6865bdc6 |
files | graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/HotSpotMethodSubstitutionTest.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSnippetUtils.java |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/HotSpotMethodSubstitutionTest.java Tue Mar 26 12:53:02 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/HotSpotMethodSubstitutionTest.java Tue Mar 26 12:56:27 2013 +0100 @@ -37,6 +37,11 @@ public void testObjectSubstitutions() { test("getClass_"); test("objectHashCode"); + + Object obj = new Object(); + + assertEquals("a string".getClass(), ObjectSubstitutions.getClass("a string")); + assertEquals(obj.hashCode(), ObjectSubstitutions.hashCode(obj)); } @SuppressWarnings("all")
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSnippetUtils.java Tue Mar 26 12:53:02 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSnippetUtils.java Tue Mar 26 12:56:27 2013 +0100 @@ -363,8 +363,11 @@ return Word.box(unsafeReadWord(object, offset + displacement)); } + @SuppressWarnings("unused") @NodeIntrinsic(value = LoadHubNode.class, setStampFromReturnType = true) - static native Word loadHubIntrinsic(Object object, @ConstantNodeParameter Kind word); + static Word loadHubIntrinsic(Object object, @ConstantNodeParameter Kind word) { + return Word.box(unsafeReadWord(object, hubOffset())); + } @Fold public static int log2WordSize() {