comparison graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugEnvironment.java @ 21780:3d15183f3c93

Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Wed, 03 Jun 2015 15:47:54 +0200
parents graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java@b1530a6cce8c
children 5b9adb645217
comparison
equal deleted inserted replaced
21779:20ace3139510 21780:3d15183f3c93
1 /*
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
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
21 * questions.
22 */
23 package com.oracle.jvmci.debug;
24
25 import static com.oracle.jvmci.debug.JVMCIDebugConfig.*;
26
27 import java.io.*;
28 import java.util.*;
29
30 import com.oracle.jvmci.service.*;
31
32 public class DebugEnvironment {
33
34 public static JVMCIDebugConfig initialize(PrintStream log) {
35
36 // Ensure Graal runtime is initialized prior to Debug being initialized as the former
37 // may include processing command line options used by the latter.
38 // Graal.getRuntime();
39
40 if (!Debug.isEnabled()) {
41 log.println("WARNING: Scope debugging needs to be enabled with -esa or -D" + Debug.Initialization.INITIALIZER_PROPERTY_NAME + "=true");
42 return null;
43 }
44 List<DebugDumpHandler> dumpHandlers = new ArrayList<>();
45 List<DebugVerifyHandler> verifyHandlers = new ArrayList<>();
46 JVMCIDebugConfig debugConfig = new JVMCIDebugConfig(Log.getValue(), Meter.getValue(), TrackMemUse.getValue(), Time.getValue(), Dump.getValue(), Verify.getValue(), MethodFilter.getValue(),
47 log, dumpHandlers, verifyHandlers);
48
49 for (DebugConfigCustomizer customizer : Services.load(DebugConfigCustomizer.class)) {
50 customizer.customize(debugConfig);
51 }
52
53 Debug.setConfig(debugConfig);
54 return debugConfig;
55 }
56 }