Mercurial > hg > truffle
changeset 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 | 5c80ccb80036 |
children | 8e2985cdaaa5 |
files | src/share/vm/classfile/vmSymbols.hpp src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalCompilerToVM.hpp src/share/vm/graal/graalVMEntries.hpp src/share/vm/graal/graalVMExits.hpp src/share/vm/graal/graalVMToCompiler.hpp |
diffstat | 7 files changed, 179 insertions(+), 179 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/classfile/vmSymbols.hpp Wed Jan 04 20:59:11 2012 +0100 +++ b/src/share/vm/classfile/vmSymbols.hpp Wed Jan 04 21:07:44 2012 +0100 @@ -269,7 +269,7 @@ template(selectAlternative_signature, "(ZLjava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;)Ljava/lang/invoke/MethodHandle;") \ \ /* support for graal */ \ - template(com_sun_hotspot_graal_VMExits, "com/oracle/max/graal/hotspot/VMExits") \ + template(com_sun_hotspot_graal_VMExits, "com/oracle/max/graal/hotspot/bridge/VMToCompiler") \ template(com_sun_hotspot_graal_HotSpotMethodResolved, "com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl") \ template(com_sun_hotspot_graal_HotSpotTargetMethod, "com/oracle/max/graal/hotspot/HotSpotTargetMethod") \ template(com_sun_hotspot_graal_HotSpotField, "com/oracle/max/graal/hotspot/ri/HotSpotField") \ @@ -343,7 +343,7 @@ template(createCiConstantObject_name, "createCiConstantObject") \ template(createCiConstantObject_signature, "(Ljava/lang/Object;)Lcom/oracle/max/cri/ci/CiConstant;") \ template(getVMExits_name, "getVMExits") \ - template(getVMExits_signature, "()Lcom/oracle/max/graal/hotspot/VMExits;") \ + template(getVMExits_signature, "()Lcom/oracle/max/graal/hotspot/VMToCompiler;") \ template(getInstance_name, "getInstance") \ template(initialize_name, "initialize") \ template(getInstance_signature, "()Lcom/oracle/max/graal/hotspot/Compiler;") \
--- a/src/share/vm/graal/graalCodeInstaller.cpp Wed Jan 04 20:59:11 2012 +0100 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Wed Jan 04 21:07:44 2012 +0100 @@ -25,7 +25,7 @@ #include "graal/graalCompiler.hpp" #include "graal/graalCodeInstaller.hpp" #include "graal/graalJavaAccess.hpp" -#include "graal/graalVMEntries.hpp" +#include "graal/graalCompilerToVM.hpp" #include "graal/graalVmIds.hpp" #include "graal/graalEnv.hpp" #include "c1/c1_Runtime1.hpp" @@ -670,7 +670,7 @@ if (inst->is_call()) { // NOTE: for call without a mov, the offset must fit a 32-bit immediate - // see also VMEntries.getMaxCallTargetOffset() + // see also CompilerToVM.getMaxCallTargetOffset() NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); call->set_destination(target_addr); _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
--- a/src/share/vm/graal/graalCompiler.cpp Wed Jan 04 20:59:11 2012 +0100 +++ b/src/share/vm/graal/graalCompiler.cpp Wed Jan 04 21:07:44 2012 +0100 @@ -24,8 +24,8 @@ #include "precompiled.hpp" #include "graal/graalCompiler.hpp" #include "graal/graalJavaAccess.hpp" -#include "graal/graalVMExits.hpp" -#include "graal/graalVMEntries.hpp" +#include "graal/graalVMToCompiler.hpp" +#include "graal/graalCompilerToVM.hpp" #include "graal/graalVmIds.hpp" #include "graal/graalEnv.hpp" #include "c1/c1_Runtime1.hpp" @@ -50,12 +50,12 @@ Runtime1::initialize(THREAD->get_buffer_blob()); JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment(); - jclass klass = env->FindClass("com/oracle/max/graal/hotspot/VMEntriesNative"); + jclass klass = env->FindClass("com/oracle/max/graal/hotspot/bridge/CompilerToVMImpl"); if (klass == NULL) { - tty->print_cr("graal VMEntries class not found"); + tty->print_cr("graal CompilerToVMImpl class not found"); vm_abort(false); } - env->RegisterNatives(klass, VMEntries_methods, VMEntries_methods_count()); + env->RegisterNatives(klass, CompilerToVM_methods, CompilerToVM_methods_count()); ResourceMark rm; HandleMark hm; @@ -69,22 +69,22 @@ { VM_ENTRY_MARK; HandleMark hm; - VMExits::initializeCompiler(); - VMExits::setDefaultOptions(); + VMToCompiler::initializeCompiler(); + VMToCompiler::setDefaultOptions(); for (int i = 0; i < Arguments::num_graal_args(); ++i) { const char* arg = Arguments::graal_args_array()[i]; Handle option = java_lang_String::create_from_str(arg, THREAD); - jboolean result = VMExits::setOption(option); + jboolean result = VMToCompiler::setOption(option); if (!result) { tty->print_cr("Invalid option for graal!"); vm_abort(false); } } if (UseCompiler) { - VMExits::startCompiler(); + VMToCompiler::startCompiler(); _initialized = true; if (BootstrapGraal) { - VMExits::bootstrap(); + VMToCompiler::bootstrap(); } } } @@ -119,7 +119,7 @@ JavaThread::current()->set_env(NULL); JavaThread::current()->set_compiling(true); Handle hotspot_method = GraalCompiler::createHotSpotMethodResolved(method, CHECK); - VMExits::compileMethod(hotspot_method, entry_bci, blocking); + VMToCompiler::compileMethod(hotspot_method, entry_bci, blocking); JavaThread::current()->set_compiling(false); JavaThread::current()->set_env(current_env); } @@ -131,7 +131,7 @@ void GraalCompiler::exit() { if (_initialized) { - VMExits::shutdownCompiler(); + VMToCompiler::shutdownCompiler(); } } @@ -141,7 +141,7 @@ } Handle GraalCompiler::get_RiType(Symbol* klass_name, TRAPS) { - return VMExits::createRiTypeUnresolved(VmIds::toString<Handle>(klass_name, THREAD), THREAD); + return VMToCompiler::createRiTypeUnresolved(VmIds::toString<Handle>(klass_name, THREAD), THREAD); } Handle GraalCompiler::get_RiTypeFromSignature(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) { @@ -158,7 +158,7 @@ return get_RiType(handle, CHECK_NULL); } } else { - return VMExits::createRiTypePrimitive(field_type, CHECK_NULL); + return VMToCompiler::createRiTypePrimitive(field_type, CHECK_NULL); } } @@ -197,7 +197,7 @@ Handle GraalCompiler::get_RiField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS) { Handle name = VmIds::toString<Handle>(field_name, CHECK_NULL); - return VMExits::createRiField(field_holder, name, field_type, offset, flags, CHECK_NULL); + return VMToCompiler::createRiField(field_holder, name, field_type, offset, flags, CHECK_NULL); } Handle GraalCompiler::createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS) { @@ -209,7 +209,7 @@ Handle obj = instanceKlass::cast(HotSpotTypeResolved::klass())->allocate_instance(CHECK_NULL); assert(obj() != NULL, "must succeed in allocating instance"); - HotSpotTypeResolved::set_compiler(obj, VMExits::compilerInstance()()); + HotSpotTypeResolved::set_compiler(obj, VMToCompiler::compilerInstance()()); if (klass->oop_is_instance()) { ResourceMark rm; @@ -255,7 +255,7 @@ Handle obj = instanceKlass::cast(HotSpotMethodResolved::klass())->allocate_instance(CHECK_NULL); assert(obj() != NULL, "must succeed in allocating instance"); - HotSpotMethodResolved::set_compiler(obj, VMExits::compilerInstance()()); + HotSpotMethodResolved::set_compiler(obj, VMToCompiler::compilerInstance()()); // (tw) Cannot use reflection here, because the compiler thread could dead lock with the running application. // oop reflected = getReflectedMethod(method(), CHECK_NULL); HotSpotMethodResolved::set_javaMirror(obj, method());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/vm/graal/graalCompilerToVM.hpp Wed Jan 04 21:07:44 2012 +0100 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#include "prims/jni.h" + +extern JNINativeMethod CompilerToVM_methods[]; +int CompilerToVM_methods_count(); + +methodOop getMethodFromHotSpotMethod(oop hotspotMethod); + +// nothing here - no need to define the jni method implementations in a header file + +
--- a/src/share/vm/graal/graalVMEntries.hpp Wed Jan 04 20:59:11 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include "prims/jni.h" - -extern JNINativeMethod CompilerToVM_methods[]; -int CompilerToVM_methods_count(); - -methodOop getMethodFromHotSpotMethod(oop hotspotMethod); - -// nothing here - no need to define the jni method implementations in a header file - -
--- a/src/share/vm/graal/graalVMExits.hpp Wed Jan 04 20:59:11 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include "memory/allocation.hpp" -#include "oops/oop.hpp" -#include "runtime/handles.hpp" -#include "runtime/thread.hpp" -#include "classfile/javaClasses.hpp" -#include "runtime/jniHandles.hpp" -#include "runtime/javaCalls.hpp" - -class VMToCompiler : public AllStatic { - -private: - static jobject _compilerPermObject; - static jobject _vmExitsPermObject; - static jobject _vmExitsPermKlass; - - static KlassHandle vmExitsKlass(); - static Handle instance(); - -public: - static void initializeCompiler(); - - static Handle compilerInstance(); - - // public static boolean HotSpotOptions.setOption(String option); - static jboolean setOption(Handle option); - - // public static void HotSpotOptions.setDefaultOptions(); - static void setDefaultOptions(); - - // public abstract void compileMethod(long vmId, String name, int entry_bci, boolean blocking); - static void compileMethod(Handle hotspot_method, int entry_bci, jboolean blocking); - - // public abstract void shutdownCompiler(); - static void shutdownCompiler(); - - // public abstract void startCompiler(); - static void startCompiler(); - - // public abstract void bootstrap(); - static void bootstrap(); - - // public abstract RiMethod createRiMethodResolved(long vmId, String name); - static oop createRiMethodResolved(jlong vmId, Handle name, TRAPS); - - // public abstract RiMethod createRiMethodUnresolved(String name, String signature, RiType holder); - static oop createRiMethodUnresolved(Handle name, Handle signature, Handle holder, TRAPS); - - // public abstract RiField createRiField(RiType holder, String name, RiType type, int flags, int offset); - static oop createRiField(Handle holder, Handle name, Handle type, int index, int flags, TRAPS); - - // public abstract RiType createRiType(long vmId, String name); - static oop createRiType(jlong vmId, Handle name, TRAPS); - - // public abstract RiType createRiTypeUnresolved(String name); - static oop createRiTypeUnresolved(Handle name, TRAPS); - - // public abstract RiType createRiTypePrimitive(int basicType); - static oop createRiTypePrimitive(int basicType, TRAPS); - - // public abstract RiSignature createRiSignature(String signature); - static oop createRiSignature(Handle name, TRAPS); - - // public abstract CiConstant createCiConstant(CiKind kind, long value); - static oop createCiConstant(Handle kind, jlong value, TRAPS); - - // public abstract CiConstant createCiConstantFloat(float value); - static oop createCiConstantFloat(jfloat value, TRAPS); - - // public abstract CiConstant createCiConstantDouble(double value); - static oop createCiConstantDouble(jdouble value, TRAPS); - - // public abstract CiConstant createCiConstantObject(long vmId); - static oop createCiConstantObject(Handle object, TRAPS); -}; - -inline void check_pending_exception(const char* message, bool dump_core = false) { - Thread* THREAD = Thread::current(); - if (THREAD->has_pending_exception()) { - Handle exception = PENDING_EXCEPTION; - CLEAR_PENDING_EXCEPTION; - - assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected"); - JavaValue result(T_VOID); - JavaCalls::call_virtual(&result, - exception, - KlassHandle(THREAD, - SystemDictionary::Throwable_klass()), - vmSymbols::printStackTrace_name(), - vmSymbols::void_method_signature(), - THREAD); - - vm_abort(dump_core); - } -} - -inline void check_not_null(void* value, const char* message, bool dump_core = false) { - if (value == NULL) { - tty->print_cr("%s", message); - vm_abort(dump_core); - } -} -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/vm/graal/graalVMToCompiler.hpp Wed Jan 04 21:07:44 2012 +0100 @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#include "memory/allocation.hpp" +#include "oops/oop.hpp" +#include "runtime/handles.hpp" +#include "runtime/thread.hpp" +#include "classfile/javaClasses.hpp" +#include "runtime/jniHandles.hpp" +#include "runtime/javaCalls.hpp" + +class VMToCompiler : public AllStatic { + +private: + static jobject _compilerPermObject; + static jobject _vmExitsPermObject; + static jobject _vmExitsPermKlass; + + static KlassHandle vmExitsKlass(); + static Handle instance(); + +public: + static void initializeCompiler(); + + static Handle compilerInstance(); + + // public static boolean HotSpotOptions.setOption(String option); + static jboolean setOption(Handle option); + + // public static void HotSpotOptions.setDefaultOptions(); + static void setDefaultOptions(); + + // public abstract void compileMethod(long vmId, String name, int entry_bci, boolean blocking); + static void compileMethod(Handle hotspot_method, int entry_bci, jboolean blocking); + + // public abstract void shutdownCompiler(); + static void shutdownCompiler(); + + // public abstract void startCompiler(); + static void startCompiler(); + + // public abstract void bootstrap(); + static void bootstrap(); + + // public abstract RiMethod createRiMethodResolved(long vmId, String name); + static oop createRiMethodResolved(jlong vmId, Handle name, TRAPS); + + // public abstract RiMethod createRiMethodUnresolved(String name, String signature, RiType holder); + static oop createRiMethodUnresolved(Handle name, Handle signature, Handle holder, TRAPS); + + // public abstract RiField createRiField(RiType holder, String name, RiType type, int flags, int offset); + static oop createRiField(Handle holder, Handle name, Handle type, int index, int flags, TRAPS); + + // public abstract RiType createRiType(long vmId, String name); + static oop createRiType(jlong vmId, Handle name, TRAPS); + + // public abstract RiType createRiTypeUnresolved(String name); + static oop createRiTypeUnresolved(Handle name, TRAPS); + + // public abstract RiType createRiTypePrimitive(int basicType); + static oop createRiTypePrimitive(int basicType, TRAPS); + + // public abstract RiSignature createRiSignature(String signature); + static oop createRiSignature(Handle name, TRAPS); + + // public abstract CiConstant createCiConstant(CiKind kind, long value); + static oop createCiConstant(Handle kind, jlong value, TRAPS); + + // public abstract CiConstant createCiConstantFloat(float value); + static oop createCiConstantFloat(jfloat value, TRAPS); + + // public abstract CiConstant createCiConstantDouble(double value); + static oop createCiConstantDouble(jdouble value, TRAPS); + + // public abstract CiConstant createCiConstantObject(long vmId); + static oop createCiConstantObject(Handle object, TRAPS); +}; + +inline void check_pending_exception(const char* message, bool dump_core = false) { + Thread* THREAD = Thread::current(); + if (THREAD->has_pending_exception()) { + Handle exception = PENDING_EXCEPTION; + CLEAR_PENDING_EXCEPTION; + + assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected"); + JavaValue result(T_VOID); + JavaCalls::call_virtual(&result, + exception, + KlassHandle(THREAD, + SystemDictionary::Throwable_klass()), + vmSymbols::printStackTrace_name(), + vmSymbols::void_method_signature(), + THREAD); + + vm_abort(dump_core); + } +} + +inline void check_not_null(void* value, const char* message, bool dump_core = false) { + if (value == NULL) { + tty->print_cr("%s", message); + vm_abort(dump_core); + } +} +