annotate graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/Test.java @ 12488:1a4dc163cd0a

abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
author Doug Simon <doug.simon@oracle.com>
date Fri, 18 Oct 2013 18:23:14 +0200
parents 23ccaa863eda
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10482
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.java.decompiler.test;
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25 import java.lang.reflect.*;
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 import com.oracle.graal.api.meta.*;
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28 import com.oracle.graal.api.runtime.*;
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29 import com.oracle.graal.java.decompiler.test.example.*;
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30 import com.oracle.graal.printer.*;
12488
1a4dc163cd0a abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 11959
diff changeset
31 import com.oracle.graal.runtime.*;
10482
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 public class Test {
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 /**
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36 * @param args
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37 * @throws SecurityException
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 * @throws NoSuchMethodException
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39 */
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40 public static void main(String[] args) throws NoSuchMethodException, SecurityException {
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41 DebugEnvironment.initialize(System.out);
12488
1a4dc163cd0a abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 11959
diff changeset
42 MetaAccessProvider metaAccess = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders().getMetaAccess();
10482
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 Method method = Example.class.getDeclaredMethod("loop7", new Class[]{int.class, int.class});
11959
23ccaa863eda made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 10482
diff changeset
44 final ResolvedJavaMethod javaMethod = metaAccess.lookupJavaMethod(method);
10482
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45 TestUtil.compileMethod(javaMethod);
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 }
3e34b0318de6 Experimental decompiler that outputs Java source code from Graal IR for debug purposes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 }