Mercurial > hg > graal-compiler
comparison 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 |
comparison
equal
deleted
inserted
replaced
1428:695451afc619 | 1429:abc670a709dc |
---|---|
31 static oop getObject(jlong id); | 31 static oop getObject(jlong id); |
32 | 32 |
33 public: | 33 public: |
34 // this enum needs to have the same values as the one in HotSpotProxy.java | 34 // this enum needs to have the same values as the one in HotSpotProxy.java |
35 enum CompilerObjectType { | 35 enum CompilerObjectType { |
36 STUB = 0x100000000000000l, | 36 STUB = 0x100000000000000l, // address |
37 METHOD = 0x200000000000000l, | 37 METHOD = 0x200000000000000l, // methodOop |
38 CLASS = 0x300000000000000l, | 38 CLASS = 0x300000000000000l, // klassOop |
39 SYMBOL = 0x400000000000000l, | 39 SYMBOL = 0x400000000000000l, // symbolOop |
40 CONSTANT_POOL = 0x500000000000000l, | 40 CONSTANT_POOL = 0x500000000000000l, // constantPoolOop |
41 CONSTANT = 0x600000000000000l, | 41 CONSTANT = 0x600000000000000l, // oop |
42 TYPE_MASK = 0xf00000000000000l, | 42 TYPE_MASK = 0xf00000000000000l, |
43 DUMMY_CONSTANT = 0x6ffffffffffffffl | 43 DUMMY_CONSTANT = 0x6ffffffffffffffl |
44 }; | 44 }; |
45 | 45 |
46 static void initializeObjects(); | 46 static void initializeObjects(); |
47 static void cleanupLocalObjects(); | 47 static void cleanupLocalObjects(); |
48 | 48 |
49 // Adds a stub address, and returns the corresponding vmId (which is of type STUB) | |
49 static jlong addStub(address stub); | 50 static jlong addStub(address stub); |
51 | |
52 // Adds an object, and returns the corresponding vmId (with the given type) | |
50 static jlong add(Handle obj, CompilerObjectType type); | 53 static jlong add(Handle obj, CompilerObjectType type); |
54 | |
55 // Adds an object, and returns the corresponding vmId (the type of which is determined by the template parameter) | |
51 template <typename T> static jlong add(T obj); | 56 template <typename T> static jlong add(T obj); |
52 | 57 |
58 | |
59 // Returns the stub address with the given vmId | |
53 static address getStub(jlong id); | 60 static address getStub(jlong id); |
61 // Returns the stub address with the given vmId taken from a java.lang.Long | |
62 static address getStub(oop id); | |
63 | |
64 // 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) | |
54 template <typename T> static T get(jlong id); | 65 template <typename T> static T get(jlong id); |
55 | 66 |
67 | |
68 // Helper function to convert a symbolOop to a java.lang.String object | |
56 template <typename T> static T toString(symbolOop symbol, TRAPS); | 69 template <typename T> static T toString(symbolOop symbol, TRAPS); |
70 | |
71 // 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) | |
57 static symbolOop toSymbol(jstring string); | 72 static symbolOop toSymbol(jstring string); |
73 | |
74 static jlong getBoxedLong(oop obj); | |
58 }; | 75 }; |
59 | 76 |
60 template <> inline jlong VmIds::add<methodOop>(methodOop obj){ | 77 template <> inline jlong VmIds::add<methodOop>(methodOop obj){ |
61 assert(obj != NULL && obj->is_method(), "trying to add NULL or mistyped object"); | 78 assert(obj != NULL, "trying to add NULL<methodOop>"); |
79 assert(obj->is_method(), "trying to add mistyped object"); | |
62 return add(Handle(obj), METHOD); | 80 return add(Handle(obj), METHOD); |
63 } | 81 } |
64 template <> inline jlong VmIds::add<klassOop>(klassOop obj) { | 82 template <> inline jlong VmIds::add<klassOop>(klassOop obj) { |
65 assert(obj != NULL && obj->is_klass(), "trying to add NULL or mistyped object"); | 83 assert(obj != NULL, "trying to add NULL<klassOop>"); |
84 assert(obj->is_klass(), "trying to add mistyped object"); | |
66 return add(Handle(obj), CLASS); | 85 return add(Handle(obj), CLASS); |
67 } | 86 } |
68 template <> inline jlong VmIds::add<symbolOop>(symbolOop obj) { | 87 template <> inline jlong VmIds::add<symbolOop>(symbolOop obj) { |
69 assert(obj != NULL && obj->is_symbol(), "trying to add NULL or mistyped object"); | 88 assert(obj != NULL, "trying to add NULL<symbolOop>"); |
89 assert(obj->is_symbol(), "trying to add mistyped object"); | |
70 return add(Handle(obj), SYMBOL); | 90 return add(Handle(obj), SYMBOL); |
71 } | 91 } |
72 template <> inline jlong VmIds::add<constantPoolOop>(constantPoolOop obj) { | 92 template <> inline jlong VmIds::add<constantPoolOop>(constantPoolOop obj) { |
73 assert(obj != NULL && obj->is_constantPool(), "trying to add NULL or mistyped object"); | 93 assert(obj != NULL, "trying to add NULL<constantPoolOop>"); |
94 assert(obj->is_constantPool(), "trying to add mistyped object"); | |
74 return add(Handle(obj), CONSTANT_POOL); | 95 return add(Handle(obj), CONSTANT_POOL); |
75 } | 96 } |
76 template <> inline jlong VmIds::add<oop>(oop obj) { | 97 template <> inline jlong VmIds::add<oop>(oop obj) { |
77 assert(obj != NULL && obj->is_oop(), "trying to add NULL or mistyped object"); | 98 assert(obj != NULL, "trying to add NULL<oop>"); |
99 assert(obj->is_oop(), "trying to add mistyped object"); | |
78 return add(Handle(obj), CONSTANT); | 100 return add(Handle(obj), CONSTANT); |
79 } | 101 } |
80 | 102 |
81 template <> inline methodOop VmIds::get<methodOop>(jlong id){ | 103 template <> inline methodOop VmIds::get<methodOop>(jlong id){ |
82 assert((id & TYPE_MASK) == METHOD, "METHOD expected"); | 104 assert((id & TYPE_MASK) == METHOD, "METHOD expected"); |
102 assert((id & TYPE_MASK) == CONSTANT, "CONSTANT expected"); | 124 assert((id & TYPE_MASK) == CONSTANT, "CONSTANT expected"); |
103 assert(getObject(id)->is_oop(true), "oop expected"); | 125 assert(getObject(id)->is_oop(true), "oop expected"); |
104 return (oop)getObject(id); | 126 return (oop)getObject(id); |
105 } | 127 } |
106 | 128 |
129 inline address VmIds::getStub(oop obj) { | |
130 return getStub(getBoxedLong(obj)); | |
131 } | |
132 | |
107 template <> inline Handle VmIds::toString<Handle>(symbolOop symbol, TRAPS) { | 133 template <> inline Handle VmIds::toString<Handle>(symbolOop symbol, TRAPS) { |
108 return java_lang_String::create_from_symbol(symbol, THREAD); | 134 return java_lang_String::create_from_symbol(symbol, THREAD); |
109 } | 135 } |
110 template <> inline oop VmIds::toString<oop>(symbolOop symbol, TRAPS) { | 136 template <> inline oop VmIds::toString<oop>(symbolOop symbol, TRAPS) { |
111 return toString<Handle>(symbol, THREAD)(); | 137 return toString<Handle>(symbol, THREAD)(); |
119 | 145 |
120 inline symbolOop VmIds::toSymbol(jstring string) { | 146 inline symbolOop VmIds::toSymbol(jstring string) { |
121 return java_lang_String::as_symbol_or_null(JNIHandles::resolve(string)); | 147 return java_lang_String::as_symbol_or_null(JNIHandles::resolve(string)); |
122 } | 148 } |
123 | 149 |
150 inline jlong VmIds::getBoxedLong(oop obj) { | |
151 assert(obj->is_oop(true), "cannot unbox null or non-oop"); | |
152 return obj->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG)); | |
153 } |