Mercurial > hg > graal-compiler
diff src/share/vm/c1x/c1x_VmIds.hpp @ 1429:abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
* -Dc1x.debug=true turns on the logging proxies and lots of log output on the java side
* provide more information about types to the compiler (type hierarchy, etc)
* provide exception handler tables to the compiler
* add exception handlers to the nmethod
* correct implementation of ExceptionObject
* exception handling/unwinding entry points
* modified versions of handle/unwind exception stubs using standard calling conventions
* exception throwing
* implicit null pointer exception, implicit div by 0 exception
* arraystore/classcast/arrayindex exceptions
* checkcast implementation
* newarray, anewarray, multinewarray implementation
* correct new instance initialization
* access to java class mirrors (for ldc)
* unresolved methods
* class resolving - class patching (asssembly prototype copying)
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Tue, 31 Aug 2010 22:13:30 -0700 |
parents | 695451afc619 |
children | 72cfb36c6bb2 |
line wrap: on
line diff
--- a/src/share/vm/c1x/c1x_VmIds.hpp Thu Aug 19 14:34:52 2010 -0700 +++ b/src/share/vm/c1x/c1x_VmIds.hpp Tue Aug 31 22:13:30 2010 -0700 @@ -33,12 +33,12 @@ public: // this enum needs to have the same values as the one in HotSpotProxy.java enum CompilerObjectType { - STUB = 0x100000000000000l, - METHOD = 0x200000000000000l, - CLASS = 0x300000000000000l, - SYMBOL = 0x400000000000000l, - CONSTANT_POOL = 0x500000000000000l, - CONSTANT = 0x600000000000000l, + STUB = 0x100000000000000l, // address + METHOD = 0x200000000000000l, // methodOop + CLASS = 0x300000000000000l, // klassOop + SYMBOL = 0x400000000000000l, // symbolOop + CONSTANT_POOL = 0x500000000000000l, // constantPoolOop + CONSTANT = 0x600000000000000l, // oop TYPE_MASK = 0xf00000000000000l, DUMMY_CONSTANT = 0x6ffffffffffffffl }; @@ -46,35 +46,57 @@ static void initializeObjects(); static void cleanupLocalObjects(); + // Adds a stub address, and returns the corresponding vmId (which is of type STUB) static jlong addStub(address stub); + + // Adds an object, and returns the corresponding vmId (with the given type) static jlong add(Handle obj, CompilerObjectType type); + + // Adds an object, and returns the corresponding vmId (the type of which is determined by the template parameter) template <typename T> static jlong add(T obj); + + // Returns the stub address with the given vmId static address getStub(jlong id); + // Returns the stub address with the given vmId taken from a java.lang.Long + static address getStub(oop id); + + // Returns the object with the given id, the return type is defined by the template parameter (which must correspond to the actual type of the vmId) template <typename T> static T get(jlong id); + + // Helper function to convert a symbolOop to a java.lang.String object template <typename T> static T toString(symbolOop symbol, TRAPS); + + // Helper function to convert a java.lang.String object to a symbolOop (this will return NULL if the symbol doesn't exist in the system) static symbolOop toSymbol(jstring string); + + static jlong getBoxedLong(oop obj); }; template <> inline jlong VmIds::add<methodOop>(methodOop obj){ - assert(obj != NULL && obj->is_method(), "trying to add NULL or mistyped object"); + assert(obj != NULL, "trying to add NULL<methodOop>"); + assert(obj->is_method(), "trying to add mistyped object"); return add(Handle(obj), METHOD); } template <> inline jlong VmIds::add<klassOop>(klassOop obj) { - assert(obj != NULL && obj->is_klass(), "trying to add NULL or mistyped object"); + assert(obj != NULL, "trying to add NULL<klassOop>"); + assert(obj->is_klass(), "trying to add mistyped object"); return add(Handle(obj), CLASS); } template <> inline jlong VmIds::add<symbolOop>(symbolOop obj) { - assert(obj != NULL && obj->is_symbol(), "trying to add NULL or mistyped object"); + assert(obj != NULL, "trying to add NULL<symbolOop>"); + assert(obj->is_symbol(), "trying to add mistyped object"); return add(Handle(obj), SYMBOL); } template <> inline jlong VmIds::add<constantPoolOop>(constantPoolOop obj) { - assert(obj != NULL && obj->is_constantPool(), "trying to add NULL or mistyped object"); + assert(obj != NULL, "trying to add NULL<constantPoolOop>"); + assert(obj->is_constantPool(), "trying to add mistyped object"); return add(Handle(obj), CONSTANT_POOL); } template <> inline jlong VmIds::add<oop>(oop obj) { - assert(obj != NULL && obj->is_oop(), "trying to add NULL or mistyped object"); + assert(obj != NULL, "trying to add NULL<oop>"); + assert(obj->is_oop(), "trying to add mistyped object"); return add(Handle(obj), CONSTANT); } @@ -104,6 +126,10 @@ return (oop)getObject(id); } +inline address VmIds::getStub(oop obj) { + return getStub(getBoxedLong(obj)); +} + template <> inline Handle VmIds::toString<Handle>(symbolOop symbol, TRAPS) { return java_lang_String::create_from_symbol(symbol, THREAD); } @@ -121,3 +147,7 @@ return java_lang_String::as_symbol_or_null(JNIHandles::resolve(string)); } +inline jlong VmIds::getBoxedLong(oop obj) { + assert(obj->is_oop(true), "cannot unbox null or non-oop"); + return obj->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG)); +}