changeset 21119:294ed4ce1fa0

PrintStreamOption: also forward flushes to the VM
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Fri, 24 Apr 2015 17:27:32 +0200
parents ae4941602cfa
children c92676a390b8
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/PrintStreamOption.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java src/share/vm/graal/graalCompilerToVM.cpp
diffstat 4 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/PrintStreamOption.java	Mon Apr 27 12:04:10 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/PrintStreamOption.java	Fri Apr 24 17:27:32 2015 +0200
@@ -111,6 +111,11 @@
                     public void write(int b) throws IOException {
                         write(new byte[]{(byte) b}, 0, 1);
                     }
+
+                    @Override
+                    public void flush() throws IOException {
+                        compilerToVM.flushDebugOutput();
+                    }
                 };
                 ps = new PrintStream(ttyOut);
             }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Mon Apr 27 12:04:10 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Fri Apr 24 17:27:32 2015 +0200
@@ -387,4 +387,6 @@
     boolean shouldDebugNonSafepoints();
 
     void writeDebugOutput(byte[] bytes, int offset, int length);
+
+    void flushDebugOutput();
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Mon Apr 27 12:04:10 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Fri Apr 24 17:27:32 2015 +0200
@@ -206,4 +206,6 @@
     public native boolean shouldDebugNonSafepoints();
 
     public native void writeDebugOutput(byte[] bytes, int offset, int length);
+
+    public native void flushDebugOutput();
 }
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Mon Apr 27 12:04:10 2015 +0200
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Fri Apr 24 17:27:32 2015 +0200
@@ -1019,6 +1019,10 @@
   }
 C2V_END
 
+C2V_VMENTRY(void, flushDebugOutput, (JNIEnv*, jobject))
+  tty->flush();
+C2V_END
+
 
 #define CC (char*)  /*cast a literal from (const char*)*/
 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
@@ -1099,6 +1103,7 @@
   {CC"materializeVirtualObjects",                    CC"("HS_STACK_FRAME_REF"Z)V",                                             FN_PTR(materializeVirtualObjects)},
   {CC"shouldDebugNonSafepoints",                     CC"()Z",                                                                  FN_PTR(shouldDebugNonSafepoints)},
   {CC"writeDebugOutput",                             CC"([BII)V",                                                              FN_PTR(writeDebugOutput)},
+  {CC"flushDebugOutput",                             CC"()V",                                                                  FN_PTR(flushDebugOutput)},
 };
 
 int CompilerToVM_methods_count() {