annotate jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIVMEventListener.java @ 21798:395ac43a8578

moved JVMCI sources from graal/ to jvmci/ directory
author Doug Simon <doug.simon@oracle.com>
date Tue, 09 Jun 2015 00:22:49 +0200
parents graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIVMEventListener.java@3d15183f3c93
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21533
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
21780
3d15183f3c93 Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 21616
diff changeset
23 package com.oracle.jvmci.hotspot;
21533
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
21780
3d15183f3c93 Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 21616
diff changeset
25 import static com.oracle.jvmci.hotspot.CompileTheWorld.Options.*;
3d15183f3c93 Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 21616
diff changeset
26
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: 21551
diff changeset
27 import com.oracle.jvmci.debug.*;
21780
3d15183f3c93 Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 21616
diff changeset
28 import com.oracle.jvmci.hotspot.CompileTheWorld.Config;
21604
93f282187d90 moved JVMCI service API into separate com.oracle.jvmci.service module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
29 import com.oracle.jvmci.service.*;
21533
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
30
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31 @ServiceProvider(HotSpotVMEventListener.class)
21780
3d15183f3c93 Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 21616
diff changeset
32 public class HotSpotJVMCIVMEventListener implements HotSpotVMEventListener {
21533
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
33
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34 @Override
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35 public void notifyCompileTheWorld() throws Throwable {
21780
3d15183f3c93 Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 21616
diff changeset
36 CompilerToVM compilerToVM = HotSpotJVMCIRuntime.runtime().getCompilerToVM();
21533
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
37 int iterations = CompileTheWorld.Options.CompileTheWorldIterations.getValue();
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38 for (int i = 0; i < iterations; i++) {
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39 compilerToVM.resetCompilationStatistics();
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
40 TTY.println("CompileTheWorld : iteration " + i);
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
41 CompileTheWorld ctw = new CompileTheWorld(CompileTheWorldClasspath.getValue(), new Config(CompileTheWorldConfig.getValue()), CompileTheWorldStartAt.getValue(),
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 CompileTheWorldStopAt.getValue(), CompileTheWorldMethodFilter.getValue(), CompileTheWorldExcludeMethodFilter.getValue(), CompileTheWorldVerbose.getValue());
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
43 ctw.compile();
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
44 }
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
45 System.exit(0);
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
46 }
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
47
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
48 @Override
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
49 public void notifyShutdown() {
21780
3d15183f3c93 Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 21616
diff changeset
50 // nothing to do
21533
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
51 }
21616
4c146c9367b6 recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21604
diff changeset
52
4c146c9367b6 recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21604
diff changeset
53 @Override
4c146c9367b6 recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21604
diff changeset
54 public void compileMetaspaceMethod(long metaspaceMethod, int entryBCI, long jvmciEnv, int id) {
21780
3d15183f3c93 Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 21616
diff changeset
55 HotSpotResolvedJavaMethod method = HotSpotResolvedJavaMethodImpl.fromMetaspace(metaspaceMethod);
3d15183f3c93 Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 21616
diff changeset
56 CompilationTask.compileMethod(method, entryBCI, jvmciEnv, id);
21616
4c146c9367b6 recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21604
diff changeset
57 }
21533
b118c9be1d1f fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
58 }