< prev index next >

src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java

Print this page




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package jdk.vm.ci.hotspot;
  24 
  25 import java.io.OutputStream;
  26 

  27 import jdk.vm.ci.common.JVMCIError;
  28 import jdk.vm.ci.meta.JVMCIMetaAccessContext;
  29 import jdk.vm.ci.meta.JavaKind;
  30 import jdk.vm.ci.meta.JavaType;
  31 import jdk.vm.ci.meta.ResolvedJavaType;
  32 import jdk.vm.ci.runtime.JVMCIRuntime;
  33 import jdk.internal.misc.Unsafe;
  34 
  35 //JaCoCo Exclude
  36 
  37 /**
  38  * Configuration information for the HotSpot JVMCI runtime.
  39  */
  40 public interface HotSpotJVMCIRuntimeProvider extends JVMCIRuntime {
  41 
  42     HotSpotVMConfig getConfig();
  43 
  44     CompilerToVM getCompilerToVM();
  45 
  46     /**
  47      * Gets an output stream that writes to the HotSpot's {@code tty} stream.
  48      */
  49     OutputStream getLogStream();
  50 
  51     /**
  52      * Converts a name to a Java type. This method attempts to resolve {@code name} to a
  53      * {@link ResolvedJavaType}.
  54      *
  55      * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format
  56      * @param accessingType the context of resolution which must be non-null
  57      * @param resolve specifies whether resolution failure results in an unresolved type being
  58      *            return or a {@link LinkageError} being thrown
  59      * @return a Java type for {@code name} which is guaranteed to be of type
  60      *         {@link ResolvedJavaType} if {@code resolve == true}
  61      * @throws LinkageError if {@code resolve == true} and the resolution failed
  62      * @throws NullPointerException if {@code accessingClass} is {@code null}
  63      */
  64     JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve);
  65 
  66     /**
  67      * Gets the JVMCI mirror for a {@link Class} object.
  68      *
  69      * @return the {@link ResolvedJavaType} corresponding to {@code javaClass}
  70      */
  71     ResolvedJavaType fromClass(Class<?> clazz);
  72 
  73     JVMCIMetaAccessContext getMetaAccessContext();
  74 
  75     /**
  76      * The offset from the origin of an array to the first element.
  77      *
  78      * @return the offset in bytes
  79      */
  80     static int getArrayBaseOffset(JavaKind kind) {
  81         switch (kind) {
  82             case Boolean:
  83                 return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
  84             case Byte:
  85                 return Unsafe.ARRAY_BYTE_BASE_OFFSET;
  86             case Char:
  87                 return Unsafe.ARRAY_CHAR_BASE_OFFSET;
  88             case Short:
  89                 return Unsafe.ARRAY_SHORT_BASE_OFFSET;
  90             case Int:
  91                 return Unsafe.ARRAY_INT_BASE_OFFSET;
  92             case Long:
  93                 return Unsafe.ARRAY_LONG_BASE_OFFSET;
  94             case Float:




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package jdk.vm.ci.hotspot;
  24 
  25 import java.io.OutputStream;
  26 
  27 import jdk.internal.misc.Unsafe;
  28 import jdk.vm.ci.common.JVMCIError;

  29 import jdk.vm.ci.meta.JavaKind;
  30 import jdk.vm.ci.meta.JavaType;
  31 import jdk.vm.ci.meta.ResolvedJavaType;
  32 import jdk.vm.ci.runtime.JVMCIRuntime;



  33 
  34 /**
  35  * Configuration information for the HotSpot JVMCI runtime.
  36  */
  37 public interface HotSpotJVMCIRuntimeProvider extends JVMCIRuntime {
  38 
  39     HotSpotVMConfig getConfig();
  40 
  41     CompilerToVM getCompilerToVM();
  42 
  43     /**
  44      * Gets an output stream that writes to the HotSpot's {@code tty} stream.
  45      */
  46     OutputStream getLogStream();
  47 
  48     /**
  49      * Converts a name to a Java type. This method attempts to resolve {@code name} to a
  50      * {@link ResolvedJavaType}.
  51      *
  52      * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format
  53      * @param accessingType the context of resolution which must be non-null
  54      * @param resolve specifies whether resolution failure results in an unresolved type being
  55      *            return or a {@link LinkageError} being thrown
  56      * @return a Java type for {@code name} which is guaranteed to be of type
  57      *         {@link ResolvedJavaType} if {@code resolve == true}
  58      * @throws LinkageError if {@code resolve == true} and the resolution failed
  59      * @throws NullPointerException if {@code accessingClass} is {@code null}
  60      */
  61     JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve);
  62 
  63     /**
  64      * Gets the JVMCI mirror for a {@link Class} object.
  65      *
  66      * @return the {@link ResolvedJavaType} corresponding to {@code javaClass}
  67      */
  68     ResolvedJavaType fromClass(Class<?> clazz);
  69 


  70     /**
  71      * The offset from the origin of an array to the first element.
  72      *
  73      * @return the offset in bytes
  74      */
  75     static int getArrayBaseOffset(JavaKind kind) {
  76         switch (kind) {
  77             case Boolean:
  78                 return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
  79             case Byte:
  80                 return Unsafe.ARRAY_BYTE_BASE_OFFSET;
  81             case Char:
  82                 return Unsafe.ARRAY_CHAR_BASE_OFFSET;
  83             case Short:
  84                 return Unsafe.ARRAY_SHORT_BASE_OFFSET;
  85             case Int:
  86                 return Unsafe.ARRAY_INT_BASE_OFFSET;
  87             case Long:
  88                 return Unsafe.ARRAY_LONG_BASE_OFFSET;
  89             case Float:


< prev index next >