Mercurial > hg > graal-compiler
changeset 8420:5d3fa6f949fb
created com.oracle.graal.api.replacements project and moved ClassSubstitution and MethodSubstitution there
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.api.replacements/src/com/oracle/graal/api/replacements/ClassSubstitution.java Thu Mar 21 12:14:09 2013 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2011, 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.api.replacements; + +import java.lang.annotation.*; + +/** + * Denotes a class that substitutes methods of another specified class. The substitute methods are + * exactly those annotated by {@link MethodSubstitution}. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface ClassSubstitution { + + /** + * Specifies the original class. + * <p> + * If the default value is specified for this element, then a non-default value must be given + * for the {@link #className()} element. + */ + Class<?> value() default ClassSubstitution.class; + + /** + * Specifies the original class. + * <p> + * This method is provided for cases where the original class is not accessible (according to + * Java language access control rules). + * <p> + * If the default value is specified for this element, then a non-default value must be given + * for the {@link #value()} element. + */ + String className() default ""; + + /** + * Determines if the substitutions are for classes that may not be part of the runtime. + * Substitutions for such classes are omitted if the original classes cannot be found. + */ + boolean optional() default false; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.api.replacements/src/com/oracle/graal/api/replacements/MethodSubstitution.java Thu Mar 21 12:14:09 2013 +0100 @@ -0,0 +1,57 @@ +/* + * 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.api.replacements; + +import java.lang.annotation.*; + +import com.oracle.graal.api.meta.*; + +/** + * Denotes a substitute method. A substitute method can call the original/substituted method by + * making a recursive call to itself. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface MethodSubstitution { + + /** + * Gets the name of the original method. + * <p> + * If the default value is specified for this element, then the name of the original method is + * same as the substitute method. + */ + String value() default ""; + + /** + * Determines if the original method is static. + */ + boolean isStatic() default true; + + /** + * Gets the {@linkplain MetaUtil#signatureToMethodDescriptor signature} of the original method. + * <p> + * If the default value is specified for this element, then the signature of the original method + * is the same as the substitute method. + */ + String signature() default ""; +}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AESCryptSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AESCryptSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -28,13 +28,13 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.compiler.gen.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.nodes.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.type.*; -import com.oracle.graal.replacements.*; import com.oracle.graal.word.*; /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CipherBlockChainingSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CipherBlockChainingSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -28,14 +28,14 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.compiler.gen.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.nodes.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.type.*; -import com.oracle.graal.replacements.*; -import com.oracle.graal.replacements.Snippet.*; +import com.oracle.graal.replacements.Snippet.Fold; import com.oracle.graal.word.*; /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -27,8 +27,8 @@ import java.lang.reflect.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.calc.*; -import com.oracle.graal.replacements.*; import com.oracle.graal.word.*; /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -25,6 +25,7 @@ import static com.oracle.graal.hotspot.replacements.HotSpotSnippetUtils.*; import static com.oracle.graal.nodes.extended.UnsafeCastNode.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.replacements.*; import com.oracle.graal.word.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -26,6 +26,7 @@ import static com.oracle.graal.replacements.nodes.BranchProbabilityNode.*; import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.graph.Node.ConstantNodeParameter; import com.oracle.graal.graph.Node.NodeIntrinsic; import com.oracle.graal.nodes.extended.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -24,8 +24,8 @@ import static com.oracle.graal.hotspot.replacements.HotSpotSnippetUtils.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.hotspot.nodes.*; -import com.oracle.graal.replacements.*; import com.oracle.graal.word.*; /**
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/MethodSubstitutionTest.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/MethodSubstitutionTest.java Thu Mar 21 12:14:09 2013 +0100 @@ -31,6 +31,7 @@ import sun.misc.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ClassSubstitution.java Thu Mar 21 11:59:40 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2011, 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.replacements; - -import java.lang.annotation.*; - -/** - * Denotes a class that substitutes methods of another specified class. The substitute methods are - * exactly those annotated by {@link MethodSubstitution}. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface ClassSubstitution { - - /** - * Specifies the original class. - * <p> - * If the default value is specified for this element, then a non-default value must be given - * for the {@link #className()} element. - */ - Class<?> value() default ClassSubstitution.class; - - /** - * Specifies the original class. - * <p> - * This method is provided for cases where the original class is not accessible (according to - * Java language access control rules). - * <p> - * If the default value is specified for this element, then a non-default value must be given - * for the {@link #value()} element. - */ - String className() default ""; - - /** - * Determines if the substitutions are for classes that may not be part of the runtime. - * Substitutions for such classes are omitted if the original classes cannot be found. - */ - boolean optional() default false; -}
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DoubleSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DoubleSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.replacements; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.calc.*; /**
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/FloatSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/FloatSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.replacements; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.calc.*; /**
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntegerSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntegerSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.replacements; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.replacements.nodes.*; @ClassSubstitution(Integer.class)
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/LongSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/LongSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.replacements; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.replacements.nodes.*; @ClassSubstitution(Long.class)
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MathSubstitutionsX86.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MathSubstitutionsX86.java Thu Mar 21 12:14:09 2013 +0100 @@ -23,6 +23,7 @@ package com.oracle.graal.replacements; import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.graph.Node.ConstantNodeParameter; import com.oracle.graal.graph.Node.NodeIntrinsic; import com.oracle.graal.nodes.extended.*;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MethodSubstitution.java Thu Mar 21 11:59:40 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * 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.replacements; - -import java.lang.annotation.*; - -import com.oracle.graal.api.meta.*; - -/** - * Denotes a substitute method. A substitute method can call the original/substituted method by - * making a recursive call to itself. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface MethodSubstitution { - - /** - * Gets the name of the original method. - * <p> - * If the default value is specified for this element, then the name of the original method is - * same as the substitute method. - */ - String value() default ""; - - /** - * Determines if the original method is static. - */ - boolean isStatic() default true; - - /** - * Gets the {@linkplain MetaUtil#signatureToMethodDescriptor signature} of the original method. - * <p> - * If the default value is specified for this element, then the signature of the original method - * is the same as the substitute method. - */ - String signature() default ""; -}
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeClassSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeClassSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -23,6 +23,7 @@ package com.oracle.graal.replacements; import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.extended.*;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsInstaller.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsInstaller.java Thu Mar 21 12:14:09 2013 +0100 @@ -32,6 +32,7 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.java.*;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/UnsafeSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/UnsafeSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -24,6 +24,7 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.replacements.nodes.*;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/UnsignedMathSubstitutions.java Thu Mar 21 11:59:40 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/UnsignedMathSubstitutions.java Thu Mar 21 12:14:09 2013 +0100 @@ -27,6 +27,7 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.calc.*; /**
--- a/make/build-graal.xml Thu Mar 21 11:59:40 2013 +0100 +++ b/make/build-graal.xml Thu Mar 21 12:14:09 2013 +0100 @@ -48,6 +48,7 @@ <src path="${src.dir}/com.oracle.graal.bytecode"/> <src path="${src.dir}/com.oracle.graal.java"/> <src path="${src.dir}/com.oracle.graal.word"/> + <src path="${src.dir}/com.oracle.graal.api.replacements"/> <src path="${src.dir}/com.oracle.graal.replacements"/> <src path="${src.dir}/com.oracle.graal.api.runtime"/> <src path="${src.dir}/com.oracle.graal.printer"/>
--- a/mx/projects Thu Mar 21 11:59:40 2013 +0100 +++ b/mx/projects Thu Mar 21 12:14:09 2013 +0100 @@ -58,6 +58,13 @@ project@com.oracle.graal.api.code@checkstyle=com.oracle.graal.graph project@com.oracle.graal.api.code@javaCompliance=1.7 +# graal.api.replacements +project@com.oracle.graal.api.replacements@subDir=graal +project@com.oracle.graal.api.replacements@sourceDirs=src +project@com.oracle.graal.api.replacements@dependencies=com.oracle.graal.api.meta +project@com.oracle.graal.api.replacements@checkstyle=com.oracle.graal.graph +project@com.oracle.graal.api.replacements@javaCompliance=1.7 + # graal.amd64 project@com.oracle.graal.amd64@subDir=graal project@com.oracle.graal.amd64@sourceDirs=src @@ -185,7 +192,7 @@ # graal.replacements project@com.oracle.graal.replacements@subDir=graal project@com.oracle.graal.replacements@sourceDirs=src -project@com.oracle.graal.replacements@dependencies=com.oracle.graal.compiler,com.oracle.graal.java,com.oracle.graal.word +project@com.oracle.graal.replacements@dependencies=com.oracle.graal.compiler,com.oracle.graal.java,com.oracle.graal.word,com.oracle.graal.api.replacements project@com.oracle.graal.replacements@checkstyle=com.oracle.graal.graph project@com.oracle.graal.replacements@javaCompliance=1.7