changeset 22626:b6b46b741102

added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
author Doug Simon <doug.simon@oracle.com>
date Tue, 29 Sep 2015 15:55:37 +0200
parents 545590b1ab83
children e778e9aaed23 2e71226319da
files jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime.java jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java
diffstat 3 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java	Tue Sep 29 14:43:37 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java	Tue Sep 29 15:55:37 2015 +0200
@@ -566,7 +566,7 @@
      * Writes {@code length} bytes from {@code buf} starting at offset {@code offset} to the
      * HotSpot's log stream. No range checking is performed.
      */
-    public void writeDebugOutput(byte[] bytes, int offset, int length) {
+    void writeDebugOutput(byte[] bytes, int offset, int length) {
         writeDebugOutputImpl(bytes, offset, length);
     }
 
@@ -575,7 +575,7 @@
     /**
      * Flush HotSpot's log stream.
      */
-    public void flushDebugOutput() {
+    void flushDebugOutput() {
         flushDebugOutputImpl();
     }
 
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime.java	Tue Sep 29 14:43:37 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime.java	Tue Sep 29 15:55:37 2015 +0200
@@ -24,6 +24,8 @@
 
 import static jdk.internal.jvmci.inittimer.InitTimer.timer;
 
+import java.io.IOException;
+import java.io.OutputStream;
 import java.lang.reflect.Array;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
@@ -338,4 +340,31 @@
         }
         return value.toString();
     }
+
+    public OutputStream getLogStream() {
+        return new OutputStream() {
+
+            @Override
+            public void write(byte[] b, int off, int len) throws IOException {
+                if (b == null) {
+                    throw new NullPointerException();
+                } else if (off < 0 || off > b.length || len < 0 || (off + len) > b.length || (off + len) < 0) {
+                    throw new IndexOutOfBoundsException();
+                } else if (len == 0) {
+                    return;
+                }
+                compilerToVm.writeDebugOutput(b, off, len);
+            }
+
+            @Override
+            public void write(int b) throws IOException {
+                write(new byte[]{(byte) b}, 0, 1);
+            }
+
+            @Override
+            public void flush() throws IOException {
+                compilerToVm.flushDebugOutput();
+            }
+        };
+    }
 }
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java	Tue Sep 29 14:43:37 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java	Tue Sep 29 15:55:37 2015 +0200
@@ -22,6 +22,8 @@
  */
 package jdk.internal.jvmci.hotspot;
 
+import java.io.OutputStream;
+
 import jdk.internal.jvmci.common.JVMCIError;
 import jdk.internal.jvmci.compiler.Compiler;
 import jdk.internal.jvmci.meta.JVMCIMetaAccessContext;
@@ -45,6 +47,11 @@
     Compiler getCompiler();
 
     /**
+     * Gets an output stream that writes to the HotSpot's {@code tty} stream.
+     */
+    OutputStream getLogStream();
+
+    /**
      * Converts a name to a Java type. This method attempts to resolve {@code name} to a
      * {@link ResolvedJavaType}.
      *