changeset 12576:847819feb98e

moved registration of HotSpot method substitutions out of HotSpotLoweringProvider into separate HotSpotSubstitutions class
author Doug Simon <doug.simon@oracle.com>
date Thu, 24 Oct 2013 21:19:08 +0200
parents 3c6e94cbce25
children 32d08d88c881
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostLoweringProvider.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java
diffstat 2 files changed, 47 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostLoweringProvider.java	Thu Oct 24 21:17:58 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostLoweringProvider.java	Thu Oct 24 21:19:08 2013 +0200
@@ -79,18 +79,6 @@
     }
 
     public void initialize(HotSpotProviders providers, HotSpotVMConfig config) {
-        Replacements r = providers.getReplacements();
-
-        r.registerSubstitutions(ObjectSubstitutions.class);
-        r.registerSubstitutions(SystemSubstitutions.class);
-        r.registerSubstitutions(ThreadSubstitutions.class);
-        r.registerSubstitutions(UnsafeSubstitutions.class);
-        r.registerSubstitutions(ClassSubstitutions.class);
-        r.registerSubstitutions(AESCryptSubstitutions.class);
-        r.registerSubstitutions(CipherBlockChainingSubstitutions.class);
-        r.registerSubstitutions(CRC32Substitutions.class);
-        r.registerSubstitutions(ReflectionSubstitutions.class);
-
         TargetDescription target = providers.getCodeCache().getTarget();
         checkcastDynamicSnippets = new CheckCastDynamicSnippets.Templates(providers, target);
         instanceofSnippets = new InstanceOfSnippets.Templates(providers, target);
@@ -100,8 +88,7 @@
         boxingSnippets = new BoxingSnippets.Templates(providers, target);
         exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(providers, target);
         unsafeLoadSnippets = new UnsafeLoadSnippets.Templates(providers, target);
-
-        r.registerSnippetTemplateCache(new UnsafeArrayCopySnippets.Templates(providers, target));
+        providers.getReplacements().registerSnippetTemplateCache(new UnsafeArrayCopySnippets.Templates(providers, target));
     }
 
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java	Thu Oct 24 21:19:08 2013 +0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2013, 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.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.api.runtime.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.replacements.*;
+
+@ServiceProvider(ReplacementsProvider.class)
+public class HotSpotSubstitutions implements ReplacementsProvider {
+
+    @Override
+    public void registerReplacements(MetaAccessProvider metaAccess, LoweringProvider loweringProvider, Replacements replacements, TargetDescription target) {
+        replacements.registerSubstitutions(ObjectSubstitutions.class);
+        replacements.registerSubstitutions(SystemSubstitutions.class);
+        replacements.registerSubstitutions(ThreadSubstitutions.class);
+        replacements.registerSubstitutions(UnsafeSubstitutions.class);
+        replacements.registerSubstitutions(ClassSubstitutions.class);
+        replacements.registerSubstitutions(AESCryptSubstitutions.class);
+        replacements.registerSubstitutions(CipherBlockChainingSubstitutions.class);
+        replacements.registerSubstitutions(CRC32Substitutions.class);
+        replacements.registerSubstitutions(ReflectionSubstitutions.class);
+    }
+}