annotate graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RuntimeCall.java @ 6445:a2299c2fc0c6

added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
author Doug Simon <doug.simon@oracle.com>
date Wed, 26 Sep 2012 13:56:27 +0200
parents 5b419d76b406
children c8759f9f9e3c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
23 package com.oracle.graal.api.code;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5510
diff changeset
25 import static com.oracle.graal.api.meta.Kind.*;
5504
452f91ebdb54 Moved RiKind to cri.ri package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5503
diff changeset
26
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5504
diff changeset
27 import com.oracle.graal.api.meta.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29 /**
6443
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
30 * Enumerates the calls that must be provided by the runtime system. The compiler may generate code that calls the
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
31 * runtime services for unresolved and slow cases of some bytecodes.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32 */
6443
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
33 public class RuntimeCall {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34
6443
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
35 // TODO Move the singletons to projects where they are actually used. A couple of them
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
36 // are HotSpot-specific.
6445
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
37 public static final RuntimeCall UnwindException = new RuntimeCall("UnwindException", Void, true, Object);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
38 public static final RuntimeCall Deoptimize = new RuntimeCall("Deoptimize", Void, true);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
39 public static final RuntimeCall RegisterFinalizer = new RuntimeCall("RegisterFinalizer", Void, true, Object);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
40 public static final RuntimeCall SetDeoptInfo = new RuntimeCall("SetDeoptInfo", Void, true, Object);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
41 public static final RuntimeCall CreateNullPointerException = new RuntimeCall("CreateNullPointerException", Object, true);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
42 public static final RuntimeCall CreateOutOfBoundsException = new RuntimeCall("CreateOutOfBoundsException", Object, true, Int);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
43 public static final RuntimeCall JavaTimeMillis = new RuntimeCall("JavaTimeMillis", Long, false);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
44 public static final RuntimeCall JavaTimeNanos = new RuntimeCall("JavaTimeNanos", Long, false);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
45 public static final RuntimeCall Debug = new RuntimeCall("Debug", Void, true);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
46 public static final RuntimeCall ArithmeticFrem = new RuntimeCall("ArithmeticFrem", Float, false, Float, Float);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
47 public static final RuntimeCall ArithmeticDrem = new RuntimeCall("ArithmeticDrem", Double, false, Double, Double);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
48 public static final RuntimeCall ArithmeticCos = new RuntimeCall("ArithmeticCos", Double, false, Double);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
49 public static final RuntimeCall ArithmeticTan = new RuntimeCall("ArithmeticTan", Double, false, Double);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
50 public static final RuntimeCall ArithmeticSin = new RuntimeCall("ArithmeticSin", Double, false, Double);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
51 public static final RuntimeCall GenericCallback = new RuntimeCall("GenericCallback", Object, true, Object, Object);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
52 public static final RuntimeCall LogPrimitive = new RuntimeCall("LogPrimitive", Void, false, Int, Long, Boolean);
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
53 public static final RuntimeCall LogObject = new RuntimeCall("LogObject", Void, false, Object, Int);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54
6445
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
55 private final String name;
6443
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
56 private final Kind resultKind;
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
57 private final Kind[] argumentKinds;
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
58 private final boolean hasSideEffect;
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
59
6445
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
60 public RuntimeCall(String name, Kind resultKind, boolean hasSideEffect, Kind... args) {
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
61 this.name = name;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 this.resultKind = resultKind;
6443
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
63 this.argumentKinds = args;
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
64 this.hasSideEffect = hasSideEffect;
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
65 }
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
66
6445
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
67 public String getName() {
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
68 return name;
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
69 }
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
70
6443
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
71 public Kind getResultKind() {
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
72 return resultKind;
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
73 }
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
74
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
75 public Kind[] getArgumentKinds() {
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
76 return argumentKinds;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77 }
5580
69358a2182a3 added printf-like facility (Log.java) for logging debug output in snippets
Doug Simon <doug.simon@oracle.com>
parents: 5547
diff changeset
78
69358a2182a3 added printf-like facility (Log.java) for logging debug output in snippets
Doug Simon <doug.simon@oracle.com>
parents: 5547
diff changeset
79 public boolean hasSideEffect() {
6443
5b419d76b406 Make RuntimeCall more extensible by changing it from an enum to a class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6388
diff changeset
80 return hasSideEffect;
5580
69358a2182a3 added printf-like facility (Log.java) for logging debug output in snippets
Doug Simon <doug.simon@oracle.com>
parents: 5547
diff changeset
81 }
6445
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
82
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
83 @Override
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
84 public String toString() {
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
85 return name;
a2299c2fc0c6 added 'name' field to RuntimeCall so that RuntimeCall objects still format nicely in traces and logs as they did when RuntimeCall was an enum
Doug Simon <doug.simon@oracle.com>
parents: 6443
diff changeset
86 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 }