< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java

Print this page
rev 47219 : Allowing Graal MBean to register as a platform MBean


 265             if (shouldDebugNonSafepoints) {
 266                 GraphBuilderPhase graphBuilderPhase = (GraphBuilderPhase) newGbs.findPhase(GraphBuilderPhase.class).previous();
 267                 GraphBuilderConfiguration graphBuilderConfig = graphBuilderPhase.getGraphBuilderConfig();
 268                 graphBuilderConfig = graphBuilderConfig.withNodeSourcePosition(true);
 269                 GraphBuilderPhase newGraphBuilderPhase = new GraphBuilderPhase(graphBuilderConfig);
 270                 newGbs.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase);
 271             }
 272             if (isOSR) {
 273                 // We must not clear non liveness for OSR compilations.
 274                 GraphBuilderPhase graphBuilderPhase = (GraphBuilderPhase) newGbs.findPhase(GraphBuilderPhase.class).previous();
 275                 GraphBuilderConfiguration graphBuilderConfig = graphBuilderPhase.getGraphBuilderConfig();
 276                 GraphBuilderPhase newGraphBuilderPhase = new GraphBuilderPhase(graphBuilderConfig);
 277                 newGbs.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase);
 278                 newGbs.appendPhase(new OnStackReplacementPhase());
 279             }
 280             return newGbs;
 281         }
 282         return suite;
 283     }
 284 







 285     /**
 286      * Converts {@code method} to a String with {@link JavaMethod#format(String)} and the format
 287      * string {@code "%H.%n(%p)"}.
 288      */
 289     static String str(JavaMethod method) {
 290         return method.format("%H.%n(%p)");
 291     }
 292 
 293     /**
 294      * Wraps {@code obj} in a {@link Formatter} that standardizes formatting for certain objects.
 295      */
 296     static Formattable fmt(Object obj) {
 297         return new Formattable() {
 298             @Override
 299             public void formatTo(Formatter buf, int flags, int width, int precision) {
 300                 if (obj instanceof Throwable) {
 301                     ByteArrayOutputStream baos = new ByteArrayOutputStream();
 302                     ((Throwable) obj).printStackTrace(new PrintStream(baos));
 303                     buf.format("%s", baos.toString());
 304                 } else if (obj instanceof StackTraceElement[]) {


 265             if (shouldDebugNonSafepoints) {
 266                 GraphBuilderPhase graphBuilderPhase = (GraphBuilderPhase) newGbs.findPhase(GraphBuilderPhase.class).previous();
 267                 GraphBuilderConfiguration graphBuilderConfig = graphBuilderPhase.getGraphBuilderConfig();
 268                 graphBuilderConfig = graphBuilderConfig.withNodeSourcePosition(true);
 269                 GraphBuilderPhase newGraphBuilderPhase = new GraphBuilderPhase(graphBuilderConfig);
 270                 newGbs.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase);
 271             }
 272             if (isOSR) {
 273                 // We must not clear non liveness for OSR compilations.
 274                 GraphBuilderPhase graphBuilderPhase = (GraphBuilderPhase) newGbs.findPhase(GraphBuilderPhase.class).previous();
 275                 GraphBuilderConfiguration graphBuilderConfig = graphBuilderPhase.getGraphBuilderConfig();
 276                 GraphBuilderPhase newGraphBuilderPhase = new GraphBuilderPhase(graphBuilderConfig);
 277                 newGbs.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase);
 278                 newGbs.appendPhase(new OnStackReplacementPhase());
 279             }
 280             return newGbs;
 281         }
 282         return suite;
 283     }
 284 
 285     public Object mbean() {
 286         if (graalRuntime instanceof HotSpotGraalRuntime) {
 287             return ((HotSpotGraalRuntime)graalRuntime).mbean();
 288         }
 289         return null;
 290     }
 291 
 292     /**
 293      * Converts {@code method} to a String with {@link JavaMethod#format(String)} and the format
 294      * string {@code "%H.%n(%p)"}.
 295      */
 296     static String str(JavaMethod method) {
 297         return method.format("%H.%n(%p)");
 298     }
 299 
 300     /**
 301      * Wraps {@code obj} in a {@link Formatter} that standardizes formatting for certain objects.
 302      */
 303     static Formattable fmt(Object obj) {
 304         return new Formattable() {
 305             @Override
 306             public void formatTo(Formatter buf, int flags, int width, int precision) {
 307                 if (obj instanceof Throwable) {
 308                     ByteArrayOutputStream baos = new ByteArrayOutputStream();
 309                     ((Throwable) obj).printStackTrace(new PrintStream(baos));
 310                     buf.format("%s", baos.toString());
 311                 } else if (obj instanceof StackTraceElement[]) {
< prev index next >