comparison src/share/vm/graal/graalVMToCompiler.hpp @ 4221:bcbb918f5ac6

Renaming of VMExits and VMEntries part 2.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 04 Jan 2012 21:07:44 +0100
parents src/share/vm/graal/graalVMExits.hpp@5c80ccb80036
children bf63d72879aa
comparison
equal deleted inserted replaced
4220:5c80ccb80036 4221:bcbb918f5ac6
1 /*
2 * Copyright (c) 2011, 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
24 #include "memory/allocation.hpp"
25 #include "oops/oop.hpp"
26 #include "runtime/handles.hpp"
27 #include "runtime/thread.hpp"
28 #include "classfile/javaClasses.hpp"
29 #include "runtime/jniHandles.hpp"
30 #include "runtime/javaCalls.hpp"
31
32 class VMToCompiler : public AllStatic {
33
34 private:
35 static jobject _compilerPermObject;
36 static jobject _vmExitsPermObject;
37 static jobject _vmExitsPermKlass;
38
39 static KlassHandle vmExitsKlass();
40 static Handle instance();
41
42 public:
43 static void initializeCompiler();
44
45 static Handle compilerInstance();
46
47 // public static boolean HotSpotOptions.setOption(String option);
48 static jboolean setOption(Handle option);
49
50 // public static void HotSpotOptions.setDefaultOptions();
51 static void setDefaultOptions();
52
53 // public abstract void compileMethod(long vmId, String name, int entry_bci, boolean blocking);
54 static void compileMethod(Handle hotspot_method, int entry_bci, jboolean blocking);
55
56 // public abstract void shutdownCompiler();
57 static void shutdownCompiler();
58
59 // public abstract void startCompiler();
60 static void startCompiler();
61
62 // public abstract void bootstrap();
63 static void bootstrap();
64
65 // public abstract RiMethod createRiMethodResolved(long vmId, String name);
66 static oop createRiMethodResolved(jlong vmId, Handle name, TRAPS);
67
68 // public abstract RiMethod createRiMethodUnresolved(String name, String signature, RiType holder);
69 static oop createRiMethodUnresolved(Handle name, Handle signature, Handle holder, TRAPS);
70
71 // public abstract RiField createRiField(RiType holder, String name, RiType type, int flags, int offset);
72 static oop createRiField(Handle holder, Handle name, Handle type, int index, int flags, TRAPS);
73
74 // public abstract RiType createRiType(long vmId, String name);
75 static oop createRiType(jlong vmId, Handle name, TRAPS);
76
77 // public abstract RiType createRiTypeUnresolved(String name);
78 static oop createRiTypeUnresolved(Handle name, TRAPS);
79
80 // public abstract RiType createRiTypePrimitive(int basicType);
81 static oop createRiTypePrimitive(int basicType, TRAPS);
82
83 // public abstract RiSignature createRiSignature(String signature);
84 static oop createRiSignature(Handle name, TRAPS);
85
86 // public abstract CiConstant createCiConstant(CiKind kind, long value);
87 static oop createCiConstant(Handle kind, jlong value, TRAPS);
88
89 // public abstract CiConstant createCiConstantFloat(float value);
90 static oop createCiConstantFloat(jfloat value, TRAPS);
91
92 // public abstract CiConstant createCiConstantDouble(double value);
93 static oop createCiConstantDouble(jdouble value, TRAPS);
94
95 // public abstract CiConstant createCiConstantObject(long vmId);
96 static oop createCiConstantObject(Handle object, TRAPS);
97 };
98
99 inline void check_pending_exception(const char* message, bool dump_core = false) {
100 Thread* THREAD = Thread::current();
101 if (THREAD->has_pending_exception()) {
102 Handle exception = PENDING_EXCEPTION;
103 CLEAR_PENDING_EXCEPTION;
104
105 assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected");
106 JavaValue result(T_VOID);
107 JavaCalls::call_virtual(&result,
108 exception,
109 KlassHandle(THREAD,
110 SystemDictionary::Throwable_klass()),
111 vmSymbols::printStackTrace_name(),
112 vmSymbols::void_method_signature(),
113 THREAD);
114
115 vm_abort(dump_core);
116 }
117 }
118
119 inline void check_not_null(void* value, const char* message, bool dump_core = false) {
120 if (value == NULL) {
121 tty->print_cr("%s", message);
122 vm_abort(dump_core);
123 }
124 }
125