src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/PrintStreamOptionKey.java
equal
deleted
inserted
replaced
18 * |
18 * |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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 |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
|
23 |
|
24 |
23 package org.graalvm.compiler.hotspot; |
25 package org.graalvm.compiler.hotspot; |
24 |
26 |
25 import java.io.FileNotFoundException; |
27 import java.io.FileNotFoundException; |
26 import java.io.FileOutputStream; |
28 import java.io.FileOutputStream; |
27 import java.io.IOException; |
29 import java.io.IOException; |
32 import org.graalvm.compiler.options.OptionKey; |
34 import org.graalvm.compiler.options.OptionKey; |
33 import org.graalvm.compiler.options.OptionValues; |
35 import org.graalvm.compiler.options.OptionValues; |
34 import org.graalvm.compiler.serviceprovider.GraalServices; |
36 import org.graalvm.compiler.serviceprovider.GraalServices; |
35 |
37 |
36 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; |
38 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; |
37 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; |
|
38 |
39 |
39 /** |
40 /** |
40 * An option for a configurable file name that can also open a {@link PrintStream} on the file. If |
41 * An option for a configurable file name that can also open a {@link PrintStream} on the file. If |
41 * no value is given for the option, the stream will output to HotSpot's |
42 * no value is given for the option, the stream will output to HotSpot's |
42 * {@link HotSpotJVMCIRuntimeProvider#getLogStream() log} stream |
43 * {@link HotSpotJVMCIRuntime#getLogStream() log} stream |
43 */ |
44 */ |
44 public class PrintStreamOptionKey extends OptionKey<String> { |
45 public class PrintStreamOptionKey extends OptionKey<String> { |
45 |
46 |
46 public PrintStreamOptionKey() { |
47 public PrintStreamOptionKey() { |
47 super(null); |
48 super(null); |
61 } |
62 } |
62 return name; |
63 return name; |
63 } |
64 } |
64 |
65 |
65 /** |
66 /** |
66 * An output stream that redirects to {@link HotSpotJVMCIRuntimeProvider#getLogStream()}. The |
67 * An output stream that redirects to {@link HotSpotJVMCIRuntime#getLogStream()}. The |
67 * {@link HotSpotJVMCIRuntimeProvider#getLogStream()} value is only accessed the first time an |
68 * {@link HotSpotJVMCIRuntime#getLogStream()} value is only accessed the first time an IO |
68 * IO operation is performed on the stream. This is required to break a deadlock in early JVMCI |
69 * operation is performed on the stream. This is required to break a deadlock in early JVMCI |
69 * initialization. |
70 * initialization. |
70 */ |
71 */ |
71 static class DelayedOutputStream extends OutputStream { |
72 static class DelayedOutputStream extends OutputStream { |
72 private volatile OutputStream lazy; |
73 private volatile OutputStream lazy; |
73 |
74 |
103 } |
104 } |
104 } |
105 } |
105 |
106 |
106 /** |
107 /** |
107 * Gets the print stream configured by this option. If no file is configured, the print stream |
108 * Gets the print stream configured by this option. If no file is configured, the print stream |
108 * will output to HotSpot's {@link HotSpotJVMCIRuntimeProvider#getLogStream() log} stream. |
109 * will output to HotSpot's {@link HotSpotJVMCIRuntime#getLogStream() log} stream. |
109 */ |
110 */ |
110 public PrintStream getStream(OptionValues options) { |
111 public PrintStream getStream(OptionValues options) { |
111 String nameTemplate = getValue(options); |
112 String nameTemplate = getValue(options); |
112 if (nameTemplate != null) { |
113 if (nameTemplate != null) { |
113 String name = makeFilename(nameTemplate); |
114 String name = makeFilename(nameTemplate); |