Mercurial > hg > graal-jvmci-8
comparison src/share/vm/jvmci/jvmciCodeInstaller.cpp @ 23330:83b296a07c33
Fix wrong pointer cast.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 21 Mar 2016 18:55:07 +0100 |
parents | f8178417d018 |
children | 19855d029fc0 |
comparison
equal
deleted
inserted
replaced
23329:bc5552dc384b | 23330:83b296a07c33 |
---|---|
157 } | 157 } |
158 } | 158 } |
159 return map; | 159 return map; |
160 } | 160 } |
161 | 161 |
162 MetaspaceObj* CodeInstaller::record_metadata_reference(Handle constant, TRAPS) { | 162 void* CodeInstaller::record_metadata_reference(Handle constant, TRAPS) { |
163 /* | |
164 * This method needs to return a raw (untyped) pointer, since the value of a pointer to the base | |
165 * class is in general not equal to the pointer of the subclass. When patching metaspace pointers, | |
166 * the compiler expects a direct pointer to the subclass (Klass*, Method* or Symbol*), not a | |
167 * pointer to the base class (Metadata* or MetaspaceObj*). | |
168 */ | |
163 oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant); | 169 oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant); |
164 if (obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) { | 170 if (obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) { |
165 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj)); | 171 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj)); |
166 assert(!HotSpotMetaspaceConstantImpl::compressed(constant), err_msg("unexpected compressed klass pointer %s @ " INTPTR_FORMAT, klass->name()->as_C_string(), p2i(klass))); | 172 assert(!HotSpotMetaspaceConstantImpl::compressed(constant), err_msg("unexpected compressed klass pointer %s @ " INTPTR_FORMAT, klass->name()->as_C_string(), p2i(klass))); |
167 int index = _oop_recorder->find_index(klass); | 173 int index = _oop_recorder->find_index(klass); |
175 return method; | 181 return method; |
176 } else if (obj->is_a(HotSpotSymbol::klass())) { | 182 } else if (obj->is_a(HotSpotSymbol::klass())) { |
177 Symbol* symbol = (Symbol*) (address) HotSpotSymbol::pointer(obj); | 183 Symbol* symbol = (Symbol*) (address) HotSpotSymbol::pointer(obj); |
178 assert(!HotSpotMetaspaceConstantImpl::compressed(constant), err_msg("unexpected compressed symbol pointer %s @ " INTPTR_FORMAT, symbol->as_C_string(), p2i(symbol))); | 184 assert(!HotSpotMetaspaceConstantImpl::compressed(constant), err_msg("unexpected compressed symbol pointer %s @ " INTPTR_FORMAT, symbol->as_C_string(), p2i(symbol))); |
179 TRACE_jvmci_3("symbol = %s", symbol->as_C_string()); | 185 TRACE_jvmci_3("symbol = %s", symbol->as_C_string()); |
180 return (MetaspaceObj*) symbol; | 186 return symbol; |
181 } else { | 187 } else { |
182 JVMCI_ERROR_NULL("unexpected metadata reference for constant of type %s", obj->klass()->signature_name()); | 188 JVMCI_ERROR_NULL("unexpected metadata reference for constant of type %s", obj->klass()->signature_name()); |
183 } | 189 } |
184 } | 190 } |
185 | 191 |
610 *((narrowKlass*) dest) = record_narrow_metadata_reference(constant, CHECK_OK); | 616 *((narrowKlass*) dest) = record_narrow_metadata_reference(constant, CHECK_OK); |
611 #else | 617 #else |
612 JVMCI_ERROR_OK("unexpected compressed Klass* in 32-bit mode"); | 618 JVMCI_ERROR_OK("unexpected compressed Klass* in 32-bit mode"); |
613 #endif | 619 #endif |
614 } else { | 620 } else { |
615 *((MetaspaceObj**) dest) = record_metadata_reference(constant, CHECK_OK); | 621 *((void**) dest) = record_metadata_reference(constant, CHECK_OK); |
616 } | 622 } |
617 } else if (constant->is_a(HotSpotObjectConstantImpl::klass())) { | 623 } else if (constant->is_a(HotSpotObjectConstantImpl::klass())) { |
618 Handle obj = HotSpotObjectConstantImpl::object(constant); | 624 Handle obj = HotSpotObjectConstantImpl::object(constant); |
619 jobject value = JNIHandles::make_local(obj()); | 625 jobject value = JNIHandles::make_local(obj()); |
620 int oop_index = _oop_recorder->find_index(value); | 626 int oop_index = _oop_recorder->find_index(value); |