mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8139170: JVMCI refresh
Reviewed-by: kvn
This commit is contained in:
parent
a4e16dd190
commit
a38ea495d6
246 changed files with 4445 additions and 2901 deletions
|
@ -142,42 +142,38 @@ OopMap* CodeInstaller::create_oop_map(oop debug_info) {
|
|||
return map;
|
||||
}
|
||||
|
||||
static void record_metadata_reference(oop obj, jlong prim, jboolean compressed, OopRecorder* oop_recorder) {
|
||||
Metadata* CodeInstaller::record_metadata_reference(Handle& constant) {
|
||||
oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
|
||||
if (obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) {
|
||||
Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
|
||||
if (compressed) {
|
||||
assert(Klass::decode_klass((narrowKlass) prim) == klass, "%s @ " INTPTR_FORMAT " != " PTR64_FORMAT, klass->name()->as_C_string(), p2i(klass), prim);
|
||||
} else {
|
||||
assert((Klass*) prim == klass, "%s @ " INTPTR_FORMAT " != " PTR64_FORMAT, klass->name()->as_C_string(), p2i(klass), prim);
|
||||
}
|
||||
int index = oop_recorder->find_index(klass);
|
||||
TRACE_jvmci_3("metadata[%d of %d] = %s", index, oop_recorder->metadata_count(), klass->name()->as_C_string());
|
||||
assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed klass pointer %s @ " INTPTR_FORMAT, klass->name()->as_C_string(), p2i(klass));
|
||||
int index = _oop_recorder->find_index(klass);
|
||||
TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string());
|
||||
return klass;
|
||||
} else if (obj->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
|
||||
Method* method = (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(obj);
|
||||
assert(!compressed, "unexpected compressed method pointer %s @ " INTPTR_FORMAT " = " PTR64_FORMAT, method->name()->as_C_string(), p2i(method), prim);
|
||||
int index = oop_recorder->find_index(method);
|
||||
TRACE_jvmci_3("metadata[%d of %d] = %s", index, oop_recorder->metadata_count(), method->name()->as_C_string());
|
||||
assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed method pointer %s @ " INTPTR_FORMAT, method->name()->as_C_string(), p2i(method));
|
||||
int index = _oop_recorder->find_index(method);
|
||||
TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), method->name()->as_C_string());
|
||||
return method;
|
||||
} else {
|
||||
assert(java_lang_String::is_instance(obj),
|
||||
"unexpected metadata reference (%s) for constant " JLONG_FORMAT " (" PTR64_FORMAT ")", obj->klass()->name()->as_C_string(), prim, prim);
|
||||
fatal("unexpected metadata reference for constant of type %s", obj->klass()->name()->as_C_string());
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Records any Metadata values embedded in a Constant (e.g., the value returned by HotSpotResolvedObjectTypeImpl.klass()).
|
||||
static void record_metadata_in_constant(oop constant, OopRecorder* oop_recorder) {
|
||||
if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
|
||||
oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
|
||||
jlong prim = HotSpotMetaspaceConstantImpl::primitive(constant);
|
||||
assert(obj != NULL, "must have an object");
|
||||
assert(prim != 0, "must have a primitive value");
|
||||
#ifdef _LP64
|
||||
narrowKlass CodeInstaller::record_narrow_metadata_reference(Handle& constant) {
|
||||
oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
|
||||
assert(HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected uncompressed pointer");
|
||||
assert(obj->is_a(HotSpotResolvedObjectTypeImpl::klass()), "unexpected compressed pointer of type %s", obj->klass()->name()->as_C_string());
|
||||
|
||||
record_metadata_reference(obj, prim, false, oop_recorder);
|
||||
}
|
||||
}
|
||||
|
||||
static void record_metadata_in_patch(Handle& constant, OopRecorder* oop_recorder) {
|
||||
record_metadata_reference(HotSpotMetaspaceConstantImpl::metaspaceObject(constant), HotSpotMetaspaceConstantImpl::primitive(constant), HotSpotMetaspaceConstantImpl::compressed(constant), oop_recorder);
|
||||
Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
|
||||
int index = _oop_recorder->find_index(klass);
|
||||
TRACE_jvmci_3("narrowKlass[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string());
|
||||
return Klass::encode_klass(klass);
|
||||
}
|
||||
#endif
|
||||
|
||||
Location::Type CodeInstaller::get_oop_type(oop value) {
|
||||
oop lirKind = Value::lirKind(value);
|
||||
|
@ -253,7 +249,6 @@ ScopeValue* CodeInstaller::get_scope_value(oop value, BasicType type, GrowableAr
|
|||
}
|
||||
return value;
|
||||
} else if (value->is_a(JavaConstant::klass())) {
|
||||
record_metadata_in_constant(value, _oop_recorder);
|
||||
if (value->is_a(PrimitiveConstant::klass())) {
|
||||
if (value->is_a(RawConstant::klass())) {
|
||||
jlong prim = PrimitiveConstant::primitive(value);
|
||||
|
@ -379,14 +374,15 @@ void CodeInstaller::initialize_dependencies(oop compiled_code, OopRecorder* reco
|
|||
}
|
||||
}
|
||||
}
|
||||
objArrayHandle methods = HotSpotCompiledCode::methods(compiled_code);
|
||||
if (!methods.is_null()) {
|
||||
int length = methods->length();
|
||||
for (int i = 0; i < length; ++i) {
|
||||
Handle method_handle = methods->obj_at(i);
|
||||
methodHandle method = getMethodFromHotSpotMethod(method_handle());
|
||||
|
||||
_dependencies->assert_evol_method(method());
|
||||
if (JvmtiExport::can_hotswap_or_post_breakpoint()) {
|
||||
objArrayHandle methods = HotSpotCompiledCode::methods(compiled_code);
|
||||
if (!methods.is_null()) {
|
||||
int length = methods->length();
|
||||
for (int i = 0; i < length; ++i) {
|
||||
Handle method_handle = methods->obj_at(i);
|
||||
methodHandle method = getMethodFromHotSpotMethod(method_handle());
|
||||
_dependencies->assert_evol_method(method());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +539,7 @@ void CodeInstaller::initialize_fields(oop target, oop compiled_code) {
|
|||
}
|
||||
|
||||
int CodeInstaller::estimate_stubs_size() {
|
||||
// Return size for all stubs.
|
||||
// Estimate the number of static call stubs that might be emitted.
|
||||
int static_call_stubs = 0;
|
||||
objArrayOop sites = this->sites();
|
||||
for (int i = 0; i < sites->length(); i++) {
|
||||
|
@ -564,6 +560,7 @@ int CodeInstaller::estimate_stubs_size() {
|
|||
|
||||
// perform data and call relocation on the CodeBuffer
|
||||
JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer) {
|
||||
HandleMark hm;
|
||||
objArrayHandle sites = this->sites();
|
||||
int locs_buffer_size = sites->length() * (relocInfo::length_limit + sizeof(relocInfo));
|
||||
|
||||
|
@ -606,14 +603,22 @@ JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer)
|
|||
Handle reference = CompilationResult_DataPatch::reference(patch);
|
||||
assert(reference->is_a(CompilationResult_ConstantReference::klass()), "patch in data section must be a ConstantReference");
|
||||
Handle constant = CompilationResult_ConstantReference::constant(reference);
|
||||
address dest = _constants->start() + CompilationResult_Site::pcOffset(patch);
|
||||
if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
|
||||
record_metadata_in_patch(constant, _oop_recorder);
|
||||
if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
|
||||
#ifdef _LP64
|
||||
*((narrowKlass*) dest) = record_narrow_metadata_reference(constant);
|
||||
#else
|
||||
fatal("unexpected compressed Klass* in 32-bit mode");
|
||||
#endif
|
||||
} else {
|
||||
*((Metadata**) dest) = record_metadata_reference(constant);
|
||||
}
|
||||
} else if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
|
||||
Handle obj = HotSpotObjectConstantImpl::object(constant);
|
||||
jobject value = JNIHandles::make_local(obj());
|
||||
int oop_index = _oop_recorder->find_index(value);
|
||||
|
||||
address dest = _constants->start() + CompilationResult_Site::pcOffset(patch);
|
||||
if (HotSpotObjectConstantImpl::compressed(constant)) {
|
||||
#ifdef _LP64
|
||||
_constants->relocate(dest, oop_Relocation::spec(oop_index), relocInfo::narrow_oop_in_const);
|
||||
|
@ -960,7 +965,7 @@ void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site)
|
|||
if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
|
||||
pd_patch_OopConstant(pc_offset, constant);
|
||||
} else if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
|
||||
record_metadata_in_patch(constant, _oop_recorder);
|
||||
pd_patch_MetaspaceConstant(pc_offset, constant);
|
||||
} else if (constant->is_a(HotSpotSentinelConstant::klass())) {
|
||||
fatal("sentinel constant unsupported");
|
||||
} else {
|
||||
|
@ -1014,6 +1019,7 @@ void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, oop site) {
|
|||
case POLL_RETURN_FAR:
|
||||
pd_relocate_poll(pc, id);
|
||||
break;
|
||||
case CARD_TABLE_SHIFT:
|
||||
case CARD_TABLE_ADDRESS:
|
||||
case HEAP_TOP_ADDRESS:
|
||||
case HEAP_END_ADDRESS:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue