changeset 52934:d8323e0e38af intrinsics

clean up
author jlaskey
date Tue, 30 Oct 2018 14:01:02 -0300
parents 03e5ab63f7b4
children c9d66af26668
files src/jdk.compiler/share/classes/com/sun/tools/javac/comp/IntrinsicsVisitor.java src/jdk.compiler/share/classes/com/sun/tools/javac/intrinsics/IntrinsicContext.java src/jdk.compiler/share/classes/com/sun/tools/javac/intrinsics/ProgramProcessorFactory.java src/jdk.compiler/share/classes/module-info.java
diffstat 4 files changed, 0 insertions(+), 158 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/IntrinsicsVisitor.java	Tue Oct 30 13:53:26 2018 -0300
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/IntrinsicsVisitor.java	Tue Oct 30 14:01:02 2018 -0300
@@ -495,55 +495,5 @@
             log.error(new SimpleDiagnosticPosition(allArgs[arg].pos + offset),
                     Errors.IntrinsicError(message));
         }
-
-        @Override
-        public ClassDesc getThisClass() {
-            return typeClassDesc(thisClass.type);
-        }
-
-        @Override
-        public ClassDesc getOuterMostClass() {
-            return typeClassDesc(outerMostClass.type);
-        }
-
-        @Override
-        public DirectMethodHandleDesc getMethod() {
-            if (thisMethod == null) {
-                return null;
-            }
-
-            Name name = thisMethod.name;
-
-            Kind kind = name == names.init                 ? Kind.CONSTRUCTOR :
-                        (thisMethod.flags() & STATIC) != 0 ? Kind.STATIC :
-                                                             Kind.VIRTUAL;
-
-            ClassDesc returnClassDesc =  typeClassDesc(thisMethod.getReturnType());
-            List<VarSymbol> parameters = thisMethod.getParameters();
-            int length = parameters.length();
-            ClassDesc[] argTypes = new ClassDesc[length];
-            for (int i = 0; i < length; i++) {
-                argTypes[i] = typeClassDesc(parameters.get(i).type);
-            }
-
-            DirectMethodHandleDesc result = MethodHandleDesc.of(
-                    kind,
-                    getThisClass(),
-                    name.toString(),
-                    returnClassDesc,
-                    argTypes
-            );
-            return result;
-        }
-
-        @Override
-        public String getSourceName() {
-            return attrEnv.toplevel.sourcefile.getName();
-        }
-
-        @Override
-        public int getLineNumber() {
-            return attrEnv.toplevel.lineMap.getLineNumber(tree.pos);
-        }
     }
 }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/intrinsics/IntrinsicContext.java	Tue Oct 30 13:53:26 2018 -0300
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/intrinsics/IntrinsicContext.java	Tue Oct 30 14:01:02 2018 -0300
@@ -42,12 +42,5 @@
     public void error(String message);
     public void error(String message, int arg);
     public void error(String message, int arg, int offset);
-
-    public ClassDesc getThisClass();
-    public ClassDesc getOuterMostClass();
-    public DirectMethodHandleDesc getMethod();
-
-    public String getSourceName();
-    public int getLineNumber();
 }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/intrinsics/ProgramProcessorFactory.java	Tue Oct 30 13:53:26 2018 -0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2018, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.sun.tools.javac.intrinsics;
-
-import java.lang.constant.ClassDesc;
-import java.lang.constant.ConstantDesc;
-import java.lang.constant.MethodTypeDesc;
-
-/**
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class ProgramProcessorFactory implements IntrinsicProcessorFactory {
-    @Override
-    public void register() {
-        try {
-            Class<?> program = Class.forName(Object.class.getModule(), "java.lang.Program");
-
-            if (program != null) {
-                Intrinsics.register(this, program, "getThisClass", Class.class);
-                Intrinsics.register(this, program, "getOuterMostClass", Class.class);
-                Intrinsics.register(this, program, "getMethodName", String.class);
-                Intrinsics.register(this, program, "getSourceName", String.class);
-                Intrinsics.register(this, program, "getLineNumber", int.class);
-            }
-        } catch (SecurityException | LinkageError ex) {
-            // Older version of jdk
-        }
-    }
-
-    private static ProgramProcessor instance;
-
-    @Override
-    public IntrinsicProcessor processor() {
-        if (instance == null) {
-            instance = new ProgramProcessor();
-        }
-
-        return instance;
-    }
-
-    static class ProgramProcessor implements IntrinsicProcessor {
-        @Override
-        public Result tryIntrinsify(IntrinsicContext intrinsicContext,
-                                    ClassDesc ownerDesc,
-                                    String methodName,
-                                    MethodTypeDesc methodType,
-                                    boolean isStatic,
-                                    ClassDesc[] argClassDescs,
-                                    ConstantDesc<?>[] constantArgs) {
-            if (ClassDesc.of("java.lang.Program").equals(ownerDesc)) {
-                switch (methodName) {
-                    case "getThisClass": {
-                        return new Result.Ldc(intrinsicContext.getThisClass());
-                    }
-                    case "getOuterMostClass": {
-                        return new Result.Ldc(intrinsicContext.getOuterMostClass());
-                    }
-                    case "getMethodName": {
-                        return new Result.Ldc(intrinsicContext.getMethod().methodName());
-                    }
-                    case "getSourceName": {
-                        return new Result.Ldc(intrinsicContext.getSourceName());
-                    }
-                    case "getLineNumber": {
-                        return new Result.Ldc(intrinsicContext.getLineNumber());
-                    }
-                }
-            }
-
-            return new Result.None();
-        }
-    }
-}
-
--- a/src/jdk.compiler/share/classes/module-info.java	Tue Oct 30 13:53:26 2018 -0300
+++ b/src/jdk.compiler/share/classes/module-info.java	Tue Oct 30 14:01:02 2018 -0300
@@ -140,7 +140,6 @@
     provides com.sun.tools.javac.intrinsics.IntrinsicProcessorFactory with
         com.sun.tools.javac.intrinsics.FormatterProcessorFactory,
         com.sun.tools.javac.intrinsics.HashProcessorFactory,
-        com.sun.tools.javac.intrinsics.ProgramProcessorFactory,
         com.sun.tools.javac.intrinsics.StringProcessorFactory;
 
 }