# HG changeset patch # User Tom Rodriguez # Date 1422645960 28800 # Node ID 60ba8c3b4d93c030fa6b638bb9961aa9b95eefdd # Parent eb6af69e0195c35c9fa1cd6f7e6146ee0ffe1be4 Add substitution for CompilerToVMImpl.getJavaMirror diff -r eb6af69e0195 -r 60ba8c3b4d93 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java Fri Jan 30 11:24:27 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java Fri Jan 30 11:26:00 2015 -0800 @@ -105,7 +105,7 @@ if (superKlass.equal(0)) { return null; } else { - return piCastExactNonNull(superKlass.readObject(classMirrorOffset(), CLASS_MIRROR_LOCATION), Class.class); + return readJavaMirror(superKlass); } } } @@ -113,6 +113,10 @@ return null; } + public static Class readJavaMirror(Word klass) { + return piCastExactNonNull(klass.readObject(classMirrorOffset(), CLASS_MIRROR_LOCATION), Class.class); + } + @MacroSubstitution(macro = ClassGetComponentTypeNode.class, isStatic = false) @MethodSubstitution(isStatic = false) public static Class getComponentType(final Class thisObj) { diff -r eb6af69e0195 -r 60ba8c3b4d93 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompilerToVMImplSubstitutions.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompilerToVMImplSubstitutions.java Fri Jan 30 11:26:00 2015 -0800 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.hotspot.replacements; + +import com.oracle.graal.api.replacements.*; +import com.oracle.graal.hotspot.bridge.*; +import com.oracle.graal.word.*; + +/** + * Substitutions for {@link CompilerToVMImpl} methods. + */ +@ClassSubstitution(com.oracle.graal.hotspot.bridge.CompilerToVMImpl.class) +public class CompilerToVMImplSubstitutions { + + @MethodSubstitution(isStatic = false) + public static Class getJavaMirror(@SuppressWarnings("unused") CompilerToVMImpl impl, long metaspaceklass) { + return ClassSubstitutions.readJavaMirror(Word.unsigned(metaspaceklass)); + } +} diff -r eb6af69e0195 -r 60ba8c3b4d93 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java Fri Jan 30 11:24:27 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java Fri Jan 30 11:26:00 2015 -0800 @@ -33,6 +33,7 @@ import com.oracle.graal.api.replacements.*; import com.oracle.graal.api.runtime.*; import com.oracle.graal.graph.*; +import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.lir.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.replacements.*; @@ -65,6 +66,7 @@ replacements.registerSubstitutions(NodeClass.class, HotSpotNodeClassSubstitutions.class); replacements.registerSubstitutions(Node.class, HotSpotNodeSubstitutions.class); replacements.registerSubstitutions(CompositeValueClass.class, CompositeValueClassSubstitutions.class); + replacements.registerSubstitutions(CompilerToVMImpl.class, CompilerToVMImplSubstitutions.class); replacements.registerSubstitutions(new NamedType("com.sun.crypto.provider.AESCrypt"), AESCryptSubstitutions.class); replacements.registerSubstitutions(new NamedType("com.sun.crypto.provider.CipherBlockChaining"), CipherBlockChainingSubstitutions.class); }