# HG changeset patch # User Thomas Wuerthinger # Date 1294422528 -3600 # Node ID cf75612bdaa588cb7eb1dce7f47dbd682d50ac39 # Parent 9c96c873c42b4ed6578d9eec921c59bed26226bd Renamed file. diff -r 9c96c873c42b -r cf75612bdaa5 src/share/vm/c1x/c1x_CodeInstaller.cpp --- a/src/share/vm/c1x/c1x_CodeInstaller.cpp Fri Jan 07 18:45:09 2011 +0100 +++ b/src/share/vm/c1x/c1x_CodeInstaller.cpp Fri Jan 07 18:48:48 2011 +0100 @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "c1x/c1x_Compiler.hpp" #include "c1x/c1x_CodeInstaller.hpp" -#include "c1x/c1x_TargetMethod.hpp" +#include "c1x/c1x_JavaAccess.hpp" #include "c1x/c1x_VmIds.hpp" #include "c1/c1_Runtime1.hpp" #include "vmreg_x86.inline.hpp" diff -r 9c96c873c42b -r cf75612bdaa5 src/share/vm/c1x/c1x_Compiler.cpp --- a/src/share/vm/c1x/c1x_Compiler.cpp Fri Jan 07 18:45:09 2011 +0100 +++ b/src/share/vm/c1x/c1x_Compiler.cpp Fri Jan 07 18:48:48 2011 +0100 @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "c1x/c1x_Compiler.hpp" -#include "c1x/c1x_TargetMethod.hpp" +#include "c1x/c1x_JavaAccess.hpp" #include "c1x/c1x_VMExits.hpp" #include "c1x/c1x_VMEntries.hpp" #include "c1x/c1x_VmIds.hpp" diff -r 9c96c873c42b -r cf75612bdaa5 src/share/vm/c1x/c1x_JavaAccess.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/vm/c1x/c1x_JavaAccess.cpp Fri Jan 07 18:48:48 2011 +0100 @@ -0,0 +1,83 @@ +/* + * Copyright 2000-2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ + +#include "precompiled.hpp" +#include "c1x/c1x_JavaAccess.hpp" + +// This function is similar to javaClasses.cpp, it computes the field offset of a (static or instance) field. +// It looks up the name and signature symbols without creating new ones, all the symbols of these classes need to be already loaded. + +static void compute_offset(int &dest_offset, klassOop klass_oop, const char* name, const char* signature, bool static_field) { + symbolOop name_symbol = SymbolTable::probe(name, strlen(name)); + symbolOop signature_symbol = SymbolTable::probe(signature, strlen(signature)); +#ifdef DEBUG + if (name_symbol == NULL) { + tty->print_cr("symbol with name %s was not found in symbol table (klass=%s)", name, klass_oop->klass_part()->name()->as_C_string()); + } +#endif + assert(name_symbol != NULL, "symbol not found - class layout changed?"); + assert(signature_symbol != NULL, "symbol not found - class layout changed?"); + + instanceKlass* ik = instanceKlass::cast(klass_oop); + fieldDescriptor fd; + if (!ik->find_field(name_symbol, signature_symbol, &fd)) { + ResourceMark rm; + tty->print_cr("Invalid layout of %s at %s", name_symbol->as_C_string(), ik->external_name()); + fatal("Invalid layout of preloaded class"); + } + assert(fd.is_static() == static_field, "static/instance mismatch"); + dest_offset = fd.offset(); +} + +// This piece of macro magic creates the contents of the c1x_compute_offsets method that initializes the field indices of all the access classes. + +#define START_CLASS(name) { klassOop k = SystemDictionary::name##_klass(); + +#define END_CLASS } + +#define FIELD(klass, name, signature, static_field) compute_offset(klass::_##name##_offset, k, #name, signature, static_field); +#define CHAR_FIELD(klass, name) FIELD(klass, name, "C", false) +#define INT_FIELD(klass, name) FIELD(klass, name, "I", false) +#define BOOLEAN_FIELD(klass, name) FIELD(klass, name, "Z", false) +#define LONG_FIELD(klass, name) FIELD(klass, name, "J", false) +#define OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, false) +#define STATIC_OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, true) + + +void c1x_compute_offsets() { + COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, OOP_FIELD, STATIC_OOP_FIELD) +} + +#define EMPTY0 +#define EMPTY1(x) +#define EMPTY2(x,y) +#define FIELD2(klass, name) int klass::_##name##_offset = 0; +#define FIELD3(klass, name, sig) FIELD2(klass, name) + +COMPILER_CLASSES_DO(EMPTY1, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, FIELD3) + + + + + diff -r 9c96c873c42b -r cf75612bdaa5 src/share/vm/c1x/c1x_JavaAccess.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/vm/c1x/c1x_JavaAccess.hpp Fri Jan 07 18:48:48 2011 +0100 @@ -0,0 +1,230 @@ +/* + * Copyright 2000-2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ + +void c1x_compute_offsets(); + +/* This macro defines the structure of the CiTargetMethod - classes. + * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles. + * + * The public interface of these classes will look like this: + + * class CiStackSlot : AllStatic { + * public: + * static klassOop klass(); + * static jint index(oop obj); + * static jint index(Handle obj); + * static jint index(jobject obj); + * static void set_index(oop obj, jint x); + * static void set_index(Handle obj, jint x); + * static void set_index(jobject obj, jint x); + * }; + * + */ + +#define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, oop_field, static_oop_field) \ + start_class(HotSpotTypeResolved) \ + oop_field(HotSpotTypeResolved, javaMirror, "Ljava/lang/Class;") \ + oop_field(HotSpotTypeResolved, name, "Ljava/lang/String;") \ + int_field(HotSpotTypeResolved, accessFlags) \ + boolean_field(HotSpotTypeResolved, hasFinalizer) \ + boolean_field(HotSpotTypeResolved, hasSubclass) \ + boolean_field(HotSpotTypeResolved, hasFinalizableSubclass) \ + boolean_field(HotSpotTypeResolved, isInitialized) \ + boolean_field(HotSpotTypeResolved, isArrayClass) \ + boolean_field(HotSpotTypeResolved, isInstanceClass) \ + boolean_field(HotSpotTypeResolved, isInterface) \ + int_field(HotSpotTypeResolved, instanceSize) \ + oop_field(HotSpotTypeResolved, componentType, "Lcom/sun/cri/ri/RiType;") \ + end_class \ + start_class(HotSpotField) \ + oop_field(HotSpotField, constant, "Lcom/sun/cri/ci/CiConstant;") \ + end_class \ + start_class(HotSpotMethodResolved) \ + long_field(HotSpotMethodResolved, vmId) \ + end_class \ + start_class(HotSpotProxy) \ + static_oop_field(HotSpotProxy, DUMMY_CONSTANT_OBJ, "Ljava/lang/Long;") \ + end_class \ + start_class(HotSpotTargetMethod) \ + oop_field(HotSpotTargetMethod, targetMethod, "Lcom/sun/cri/ci/CiTargetMethod;") \ + oop_field(HotSpotTargetMethod, method, "Lcom/sun/hotspot/c1x/HotSpotMethodResolved;")\ + oop_field(HotSpotTargetMethod, name, "Ljava/lang/String;") \ + oop_field(HotSpotTargetMethod, sites, "[Lcom/sun/cri/ci/CiTargetMethod$Site;") \ + oop_field(HotSpotTargetMethod, exceptionHandlers, "[Lcom/sun/cri/ci/CiTargetMethod$ExceptionHandler;") \ + end_class \ + start_class(HotSpotExceptionHandler) \ + int_field(HotSpotExceptionHandler, startBci) \ + int_field(HotSpotExceptionHandler, endBci) \ + int_field(HotSpotExceptionHandler, handlerBci) \ + int_field(HotSpotExceptionHandler, catchClassIndex) \ + oop_field(HotSpotExceptionHandler, catchClass, "Lcom/sun/cri/ri/RiType;") \ + end_class \ + start_class(CiTargetMethod) \ + int_field(CiTargetMethod, frameSize) \ + int_field(CiTargetMethod, customStackAreaOffset) \ + oop_field(CiTargetMethod, targetCode, "[B") \ + int_field(CiTargetMethod, targetCodeSize) \ + end_class \ + start_class(CiTargetMethod_Site) \ + int_field(CiTargetMethod_Site, pcOffset) \ + end_class \ + start_class(CiTargetMethod_Call) \ + oop_field(CiTargetMethod_Call, runtimeCall, "Lcom/sun/cri/ci/CiRuntimeCall;") \ + oop_field(CiTargetMethod_Call, method, "Lcom/sun/cri/ri/RiMethod;") \ + oop_field(CiTargetMethod_Call, symbol, "Ljava/lang/String;") \ + oop_field(CiTargetMethod_Call, globalStubID, "Ljava/lang/Object;") \ + oop_field(CiTargetMethod_Call, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \ + end_class \ + start_class(CiTargetMethod_DataPatch) \ + oop_field(CiTargetMethod_DataPatch, constant, "Lcom/sun/cri/ci/CiConstant;") \ + end_class \ + start_class(CiTargetMethod_Safepoint) \ + oop_field(CiTargetMethod_Safepoint, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \ + end_class \ + start_class(CiTargetMethod_ExceptionHandler) \ + int_field(CiTargetMethod_ExceptionHandler, handlerPos) \ + int_field(CiTargetMethod_ExceptionHandler, handlerBci) \ + int_field(CiTargetMethod_ExceptionHandler, bci) \ + int_field(CiTargetMethod_ExceptionHandler, scopeLevel) \ + oop_field(CiTargetMethod_ExceptionHandler, exceptionType, "Lcom/sun/cri/ri/RiType;")\ + end_class \ + start_class(CiTargetMethod_Mark) \ + oop_field(CiTargetMethod_Mark, id, "Ljava/lang/Object;") \ + oop_field(CiTargetMethod_Mark, references, "[Lcom/sun/cri/ci/CiTargetMethod$Mark;") \ + end_class \ + start_class(CiDebugInfo) \ + oop_field(CiDebugInfo, codePos, "Lcom/sun/cri/ci/CiCodePos;") \ + oop_field(CiDebugInfo, registerRefMap, "Lcom/sun/cri/ci/CiBitMap;") \ + oop_field(CiDebugInfo, frameRefMap, "Lcom/sun/cri/ci/CiBitMap;") \ + end_class \ + start_class(CiBitMap) \ + int_field(CiBitMap, size) \ + long_field(CiBitMap, low) \ + oop_field(CiBitMap, extra, "[J") \ + end_class \ + start_class(CiDebugInfo_Frame) \ + oop_field(CiDebugInfo_Frame, values, "[Lcom/sun/cri/ci/CiValue;") \ + int_field(CiDebugInfo_Frame, numLocals) \ + int_field(CiDebugInfo_Frame, numStack) \ + int_field(CiDebugInfo_Frame, numLocks) \ + end_class \ + start_class(CiCodePos) \ + oop_field(CiCodePos, caller, "Lcom/sun/cri/ci/CiCodePos;") \ + oop_field(CiCodePos, method, "Lcom/sun/cri/ri/RiMethod;") \ + int_field(CiCodePos, bci) \ + end_class \ + start_class(CiConstant) \ + oop_field(CiConstant, kind, "Lcom/sun/cri/ci/CiKind;") \ + oop_field(CiConstant, object, "Ljava/lang/Object;") \ + long_field(CiConstant, primitive) \ + end_class \ + start_class(CiKind) \ + char_field(CiKind, typeChar) \ + static_oop_field(CiKind, Boolean, "Lcom/sun/cri/ci/CiKind;"); \ + static_oop_field(CiKind, Byte, "Lcom/sun/cri/ci/CiKind;"); \ + static_oop_field(CiKind, Char, "Lcom/sun/cri/ci/CiKind;"); \ + static_oop_field(CiKind, Short, "Lcom/sun/cri/ci/CiKind;"); \ + static_oop_field(CiKind, Int, "Lcom/sun/cri/ci/CiKind;"); \ + static_oop_field(CiKind, Long, "Lcom/sun/cri/ci/CiKind;"); \ + end_class \ + start_class(CiRuntimeCall) \ + static_oop_field(CiRuntimeCall, UnwindException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, RegisterFinalizer, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, HandleException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, OSRMigrationEnd, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, JavaTimeMillis, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, JavaTimeNanos, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, Debug, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, ArithmethicLrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, ArithmeticLdiv, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, ArithmeticFrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, ArithmeticDrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, ArithmeticCos, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, ArithmeticTan, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, ArithmeticLog, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, ArithmeticLog10, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, ArithmeticSin, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + end_class \ + start_class(RiMethod) \ + end_class \ + start_class(CiValue) \ + oop_field(CiValue, kind, "Lcom/sun/cri/ci/CiKind;") \ + static_oop_field(CiValue, IllegalValue, "Lcom/sun/cri/ci/CiValue;"); \ + end_class \ + start_class(CiRegisterValue) \ + oop_field(CiRegisterValue, reg, "Lcom/sun/cri/ci/CiRegister;") \ + end_class \ + start_class(CiRegister) \ + int_field(CiRegister, number) \ + end_class \ + start_class(CiStackSlot) \ + int_field(CiStackSlot, index) \ + end_class \ + /* end*/ + + + + +#define START_CLASS(name) \ + class name : AllStatic { \ + private: \ + friend class C1XCompiler; \ + static void check(oop obj) { assert(obj != NULL, "NULL field access of class " #name); assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected"); } \ + static void compute_offsets(); \ + public: \ + static klassOop klass() { return SystemDictionary::name##_klass(); } + +#define END_CLASS }; + +#define FIELD(name, type, accessor) \ + static int _##name##_offset; \ + static type name(oop obj) { check(obj); return obj->accessor(_##name##_offset); } \ + static type name(Handle obj) { check(obj()); return obj->accessor(_##name##_offset); } \ + static type name(jobject obj) { check(JNIHandles::resolve(obj)); return JNIHandles::resolve(obj)->accessor(_##name##_offset); } \ + static void set_##name(oop obj, type x) { check(obj); obj->accessor##_put(_##name##_offset, x); } \ + static void set_##name(Handle obj, type x) { check(obj()); obj->accessor##_put(_##name##_offset, x); } \ + static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj)); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); } + +#define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field) +#define INT_FIELD(klass, name) FIELD(name, jint, int_field) +#define BOOLEAN_FIELD(klass, name) FIELD(name, jboolean, bool_field) +#define LONG_FIELD(klass, name) FIELD(name, jlong, long_field) +#define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field) +#define STATIC_OOP_FIELD(klassName, name, signature) \ + static int _##name##_offset; \ + static oop name() { return klassName::klass()->obj_field(_##name##_offset); } \ + static void set_##name(oop x) { klassName::klass()->obj_field_put(_##name##_offset, x); } + +COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, OOP_FIELD, STATIC_OOP_FIELD) +#undef START_CLASS +#undef END_CLASS +#undef FIELD +#undef CHAR_FIELD +#undef INT_FIELD +#undef BOOLEAN_FIELD +#undef LONG_FIELD +#undef OOP_FIELD +#undef STATIC_OOP_FIELD + + diff -r 9c96c873c42b -r cf75612bdaa5 src/share/vm/c1x/c1x_TargetMethod.cpp --- a/src/share/vm/c1x/c1x_TargetMethod.cpp Fri Jan 07 18:45:09 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2000-2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - */ - -#include "precompiled.hpp" -#include "c1x/c1x_TargetMethod.hpp" - -// This function is similar to javaClasses.cpp, it computes the field offset of a (static or instance) field. -// It looks up the name and signature symbols without creating new ones, all the symbols of these classes need to be already loaded. - -static void compute_offset(int &dest_offset, klassOop klass_oop, const char* name, const char* signature, bool static_field) { - symbolOop name_symbol = SymbolTable::probe(name, strlen(name)); - symbolOop signature_symbol = SymbolTable::probe(signature, strlen(signature)); -#ifdef DEBUG - if (name_symbol == NULL) { - tty->print_cr("symbol with name %s was not found in symbol table (klass=%s)", name, klass_oop->klass_part()->name()->as_C_string()); - } -#endif - assert(name_symbol != NULL, "symbol not found - class layout changed?"); - assert(signature_symbol != NULL, "symbol not found - class layout changed?"); - - instanceKlass* ik = instanceKlass::cast(klass_oop); - fieldDescriptor fd; - if (!ik->find_field(name_symbol, signature_symbol, &fd)) { - ResourceMark rm; - tty->print_cr("Invalid layout of %s at %s", name_symbol->as_C_string(), ik->external_name()); - fatal("Invalid layout of preloaded class"); - } - assert(fd.is_static() == static_field, "static/instance mismatch"); - dest_offset = fd.offset(); -} - -// This piece of macro magic creates the contents of the c1x_compute_offsets method that initializes the field indices of all the access classes. - -#define START_CLASS(name) { klassOop k = SystemDictionary::name##_klass(); - -#define END_CLASS } - -#define FIELD(klass, name, signature, static_field) compute_offset(klass::_##name##_offset, k, #name, signature, static_field); -#define CHAR_FIELD(klass, name) FIELD(klass, name, "C", false) -#define INT_FIELD(klass, name) FIELD(klass, name, "I", false) -#define BOOLEAN_FIELD(klass, name) FIELD(klass, name, "Z", false) -#define LONG_FIELD(klass, name) FIELD(klass, name, "J", false) -#define OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, false) -#define STATIC_OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, true) - - -void c1x_compute_offsets() { - COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, OOP_FIELD, STATIC_OOP_FIELD) -} - -#define EMPTY0 -#define EMPTY1(x) -#define EMPTY2(x,y) -#define FIELD2(klass, name) int klass::_##name##_offset = 0; -#define FIELD3(klass, name, sig) FIELD2(klass, name) - -COMPILER_CLASSES_DO(EMPTY1, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, FIELD3) - - - - - diff -r 9c96c873c42b -r cf75612bdaa5 src/share/vm/c1x/c1x_TargetMethod.hpp --- a/src/share/vm/c1x/c1x_TargetMethod.hpp Fri Jan 07 18:45:09 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,230 +0,0 @@ -/* - * Copyright 2000-2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - */ - -void c1x_compute_offsets(); - -/* This macro defines the structure of the CiTargetMethod - classes. - * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles. - * - * The public interface of these classes will look like this: - - * class CiStackSlot : AllStatic { - * public: - * static klassOop klass(); - * static jint index(oop obj); - * static jint index(Handle obj); - * static jint index(jobject obj); - * static void set_index(oop obj, jint x); - * static void set_index(Handle obj, jint x); - * static void set_index(jobject obj, jint x); - * }; - * - */ - -#define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, oop_field, static_oop_field) \ - start_class(HotSpotTypeResolved) \ - oop_field(HotSpotTypeResolved, javaMirror, "Ljava/lang/Class;") \ - oop_field(HotSpotTypeResolved, name, "Ljava/lang/String;") \ - int_field(HotSpotTypeResolved, accessFlags) \ - boolean_field(HotSpotTypeResolved, hasFinalizer) \ - boolean_field(HotSpotTypeResolved, hasSubclass) \ - boolean_field(HotSpotTypeResolved, hasFinalizableSubclass) \ - boolean_field(HotSpotTypeResolved, isInitialized) \ - boolean_field(HotSpotTypeResolved, isArrayClass) \ - boolean_field(HotSpotTypeResolved, isInstanceClass) \ - boolean_field(HotSpotTypeResolved, isInterface) \ - int_field(HotSpotTypeResolved, instanceSize) \ - oop_field(HotSpotTypeResolved, componentType, "Lcom/sun/cri/ri/RiType;") \ - end_class \ - start_class(HotSpotField) \ - oop_field(HotSpotField, constant, "Lcom/sun/cri/ci/CiConstant;") \ - end_class \ - start_class(HotSpotMethodResolved) \ - long_field(HotSpotMethodResolved, vmId) \ - end_class \ - start_class(HotSpotProxy) \ - static_oop_field(HotSpotProxy, DUMMY_CONSTANT_OBJ, "Ljava/lang/Long;") \ - end_class \ - start_class(HotSpotTargetMethod) \ - oop_field(HotSpotTargetMethod, targetMethod, "Lcom/sun/cri/ci/CiTargetMethod;") \ - oop_field(HotSpotTargetMethod, method, "Lcom/sun/hotspot/c1x/HotSpotMethodResolved;")\ - oop_field(HotSpotTargetMethod, name, "Ljava/lang/String;") \ - oop_field(HotSpotTargetMethod, sites, "[Lcom/sun/cri/ci/CiTargetMethod$Site;") \ - oop_field(HotSpotTargetMethod, exceptionHandlers, "[Lcom/sun/cri/ci/CiTargetMethod$ExceptionHandler;") \ - end_class \ - start_class(HotSpotExceptionHandler) \ - int_field(HotSpotExceptionHandler, startBci) \ - int_field(HotSpotExceptionHandler, endBci) \ - int_field(HotSpotExceptionHandler, handlerBci) \ - int_field(HotSpotExceptionHandler, catchClassIndex) \ - oop_field(HotSpotExceptionHandler, catchClass, "Lcom/sun/cri/ri/RiType;") \ - end_class \ - start_class(CiTargetMethod) \ - int_field(CiTargetMethod, frameSize) \ - int_field(CiTargetMethod, customStackAreaOffset) \ - oop_field(CiTargetMethod, targetCode, "[B") \ - int_field(CiTargetMethod, targetCodeSize) \ - end_class \ - start_class(CiTargetMethod_Site) \ - int_field(CiTargetMethod_Site, pcOffset) \ - end_class \ - start_class(CiTargetMethod_Call) \ - oop_field(CiTargetMethod_Call, runtimeCall, "Lcom/sun/cri/ci/CiRuntimeCall;") \ - oop_field(CiTargetMethod_Call, method, "Lcom/sun/cri/ri/RiMethod;") \ - oop_field(CiTargetMethod_Call, symbol, "Ljava/lang/String;") \ - oop_field(CiTargetMethod_Call, globalStubID, "Ljava/lang/Object;") \ - oop_field(CiTargetMethod_Call, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \ - end_class \ - start_class(CiTargetMethod_DataPatch) \ - oop_field(CiTargetMethod_DataPatch, constant, "Lcom/sun/cri/ci/CiConstant;") \ - end_class \ - start_class(CiTargetMethod_Safepoint) \ - oop_field(CiTargetMethod_Safepoint, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \ - end_class \ - start_class(CiTargetMethod_ExceptionHandler) \ - int_field(CiTargetMethod_ExceptionHandler, handlerPos) \ - int_field(CiTargetMethod_ExceptionHandler, handlerBci) \ - int_field(CiTargetMethod_ExceptionHandler, bci) \ - int_field(CiTargetMethod_ExceptionHandler, scopeLevel) \ - oop_field(CiTargetMethod_ExceptionHandler, exceptionType, "Lcom/sun/cri/ri/RiType;")\ - end_class \ - start_class(CiTargetMethod_Mark) \ - oop_field(CiTargetMethod_Mark, id, "Ljava/lang/Object;") \ - oop_field(CiTargetMethod_Mark, references, "[Lcom/sun/cri/ci/CiTargetMethod$Mark;") \ - end_class \ - start_class(CiDebugInfo) \ - oop_field(CiDebugInfo, codePos, "Lcom/sun/cri/ci/CiCodePos;") \ - oop_field(CiDebugInfo, registerRefMap, "Lcom/sun/cri/ci/CiBitMap;") \ - oop_field(CiDebugInfo, frameRefMap, "Lcom/sun/cri/ci/CiBitMap;") \ - end_class \ - start_class(CiBitMap) \ - int_field(CiBitMap, size) \ - long_field(CiBitMap, low) \ - oop_field(CiBitMap, extra, "[J") \ - end_class \ - start_class(CiDebugInfo_Frame) \ - oop_field(CiDebugInfo_Frame, values, "[Lcom/sun/cri/ci/CiValue;") \ - int_field(CiDebugInfo_Frame, numLocals) \ - int_field(CiDebugInfo_Frame, numStack) \ - int_field(CiDebugInfo_Frame, numLocks) \ - end_class \ - start_class(CiCodePos) \ - oop_field(CiCodePos, caller, "Lcom/sun/cri/ci/CiCodePos;") \ - oop_field(CiCodePos, method, "Lcom/sun/cri/ri/RiMethod;") \ - int_field(CiCodePos, bci) \ - end_class \ - start_class(CiConstant) \ - oop_field(CiConstant, kind, "Lcom/sun/cri/ci/CiKind;") \ - oop_field(CiConstant, object, "Ljava/lang/Object;") \ - long_field(CiConstant, primitive) \ - end_class \ - start_class(CiKind) \ - char_field(CiKind, typeChar) \ - static_oop_field(CiKind, Boolean, "Lcom/sun/cri/ci/CiKind;"); \ - static_oop_field(CiKind, Byte, "Lcom/sun/cri/ci/CiKind;"); \ - static_oop_field(CiKind, Char, "Lcom/sun/cri/ci/CiKind;"); \ - static_oop_field(CiKind, Short, "Lcom/sun/cri/ci/CiKind;"); \ - static_oop_field(CiKind, Int, "Lcom/sun/cri/ci/CiKind;"); \ - static_oop_field(CiKind, Long, "Lcom/sun/cri/ci/CiKind;"); \ - end_class \ - start_class(CiRuntimeCall) \ - static_oop_field(CiRuntimeCall, UnwindException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, RegisterFinalizer, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, HandleException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, OSRMigrationEnd, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, JavaTimeMillis, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, JavaTimeNanos, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, Debug, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmethicLrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticLdiv, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticFrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticDrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticCos, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticTan, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticLog, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticLog10, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticSin, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ - end_class \ - start_class(RiMethod) \ - end_class \ - start_class(CiValue) \ - oop_field(CiValue, kind, "Lcom/sun/cri/ci/CiKind;") \ - static_oop_field(CiValue, IllegalValue, "Lcom/sun/cri/ci/CiValue;"); \ - end_class \ - start_class(CiRegisterValue) \ - oop_field(CiRegisterValue, reg, "Lcom/sun/cri/ci/CiRegister;") \ - end_class \ - start_class(CiRegister) \ - int_field(CiRegister, number) \ - end_class \ - start_class(CiStackSlot) \ - int_field(CiStackSlot, index) \ - end_class \ - /* end*/ - - - - -#define START_CLASS(name) \ - class name : AllStatic { \ - private: \ - friend class C1XCompiler; \ - static void check(oop obj) { assert(obj != NULL, "NULL field access of class " #name); assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected"); } \ - static void compute_offsets(); \ - public: \ - static klassOop klass() { return SystemDictionary::name##_klass(); } - -#define END_CLASS }; - -#define FIELD(name, type, accessor) \ - static int _##name##_offset; \ - static type name(oop obj) { check(obj); return obj->accessor(_##name##_offset); } \ - static type name(Handle obj) { check(obj()); return obj->accessor(_##name##_offset); } \ - static type name(jobject obj) { check(JNIHandles::resolve(obj)); return JNIHandles::resolve(obj)->accessor(_##name##_offset); } \ - static void set_##name(oop obj, type x) { check(obj); obj->accessor##_put(_##name##_offset, x); } \ - static void set_##name(Handle obj, type x) { check(obj()); obj->accessor##_put(_##name##_offset, x); } \ - static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj)); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); } - -#define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field) -#define INT_FIELD(klass, name) FIELD(name, jint, int_field) -#define BOOLEAN_FIELD(klass, name) FIELD(name, jboolean, bool_field) -#define LONG_FIELD(klass, name) FIELD(name, jlong, long_field) -#define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field) -#define STATIC_OOP_FIELD(klassName, name, signature) \ - static int _##name##_offset; \ - static oop name() { return klassName::klass()->obj_field(_##name##_offset); } \ - static void set_##name(oop x) { klassName::klass()->obj_field_put(_##name##_offset, x); } - -COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, OOP_FIELD, STATIC_OOP_FIELD) -#undef START_CLASS -#undef END_CLASS -#undef FIELD -#undef CHAR_FIELD -#undef INT_FIELD -#undef BOOLEAN_FIELD -#undef LONG_FIELD -#undef OOP_FIELD -#undef STATIC_OOP_FIELD - - diff -r 9c96c873c42b -r cf75612bdaa5 src/share/vm/c1x/c1x_VMEntries.cpp --- a/src/share/vm/c1x/c1x_VMEntries.cpp Fri Jan 07 18:45:09 2011 +0100 +++ b/src/share/vm/c1x/c1x_VMEntries.cpp Fri Jan 07 18:48:48 2011 +0100 @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "c1x/c1x_VMEntries.hpp" #include "c1x/c1x_Compiler.hpp" -#include "c1x/c1x_TargetMethod.hpp" +#include "c1x/c1x_JavaAccess.hpp" #include "c1x/c1x_CodeInstaller.hpp" #include "c1x/c1x_VMExits.hpp" #include "c1x/c1x_VmIds.hpp"