Mercurial > hg > truffle
annotate graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/PrintStreamOption.java @ 21765:a7a1b9b65bce
Small improvement and clean up of InstanceOfNode.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 07 Jun 2015 00:47:10 +0200 |
parents | f5b549811bac |
children |
rev | line source |
---|---|
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
23 package com.oracle.jvmci.hotspot; |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import java.io.*; |
16128
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
26 import java.lang.management.*; |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
28 import com.oracle.jvmci.options.*; |
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
29 |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 /** |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 * An option that encapsulates and configures a print stream. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 */ |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 public class PrintStreamOption extends OptionValue<String> { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 public PrintStreamOption() { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 super(null); |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 /** |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 * The print stream to which output will be written. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 * |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 * Declared {@code volatile} to enable safe use of double-checked locking in |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
43 * {@link #getStream(CompilerToVM)} and {@link #setValue(Object)}. |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 */ |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 private volatile PrintStream ps; |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 /** |
16128
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
48 * Replace any instance of %p with a an identifying name. Try to get it from the RuntimeMXBean |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
49 * name. |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
50 * |
16128
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
51 * @return the name of the file to log to |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
52 */ |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
53 private String getFilename() { |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
54 String name = getValue(); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
55 if (name.contains("%p")) { |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
56 String runtimeName = ManagementFactory.getRuntimeMXBean().getName(); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
57 try { |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
58 int index = runtimeName.indexOf('@'); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
59 if (index != -1) { |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
60 long pid = Long.parseLong(runtimeName.substring(0, index)); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
61 runtimeName = Long.toString(pid); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
62 } |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
63 name = name.replaceAll("%p", runtimeName); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
64 } catch (NumberFormatException e) { |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
65 |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
66 } |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
67 } |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
68 return name; |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
69 } |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
70 |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
71 /** |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
72 * Gets the print stream configured by this option. If no file is configured, the print stream |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
73 * will output to {@link CompilerToVM#writeDebugOutput(byte[], int, int)}. |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 */ |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
75 public PrintStream getStream(final CompilerToVM compilerToVM) { |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 if (ps == null) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 if (getValue() != null) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 synchronized (this) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 if (ps == null) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 try { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 final boolean enableAutoflush = true; |
16128
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
82 ps = new PrintStream(new FileOutputStream(getFilename()), enableAutoflush); |
18947
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
83 /* Add the JVM and Java arguments to the log file to help identity it. */ |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
84 String inputArguments = String.join(" ", ManagementFactory.getRuntimeMXBean().getInputArguments()); |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
85 ps.println("VM Arguments: " + inputArguments); |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
86 String cmd = System.getProperty("sun.java.command"); |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
87 if (cmd != null) { |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
88 ps.println("sun.java.command=" + cmd); |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
89 } |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 } catch (FileNotFoundException e) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 throw new RuntimeException("couldn't open file: " + getValue(), e); |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 } else { |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
96 OutputStream ttyOut = new OutputStream() { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
97 @Override |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
98 public void write(byte[] b, int off, int len) throws IOException { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
99 if (b == null) { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
100 throw new NullPointerException(); |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
101 } else if (off < 0 || off > b.length || len < 0 || (off + len) > b.length || (off + len) < 0) { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
102 throw new IndexOutOfBoundsException(); |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
103 } else if (len == 0) { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
104 return; |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
105 } |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
106 compilerToVM.writeDebugOutput(b, off, len); |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
107 } |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
108 |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
109 @Override |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
110 public void write(int b) throws IOException { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
111 write(new byte[]{(byte) b}, 0, 1); |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
112 } |
21119
294ed4ce1fa0
PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18947
diff
changeset
|
113 |
294ed4ce1fa0
PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18947
diff
changeset
|
114 @Override |
294ed4ce1fa0
PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18947
diff
changeset
|
115 public void flush() throws IOException { |
294ed4ce1fa0
PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18947
diff
changeset
|
116 compilerToVM.flushDebugOutput(); |
294ed4ce1fa0
PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18947
diff
changeset
|
117 } |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
118 }; |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
119 ps = new PrintStream(ttyOut); |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
120 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 return ps; |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 @Override |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 public void setValue(Object v) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 if (ps != null) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 synchronized (this) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 if (ps != null) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 ps.close(); |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
131 ps = null; |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
132 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
133 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 super.setValue(v); |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 } |
18163
c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents:
16405
diff
changeset
|
137 } |