oop DebugInfoReadStream::read_oop() {
nmethod* nm = const_cast<CompiledMethod*>(code())->as_nmethod_or_null();
oop o; if (nm != NULL) { // Despite these oops being found inside nmethods that are on-stack, // they are not kept alive by all GCs (e.g. G1 and Shenandoah).
o = nm->oop_at_phantom(read_int());
} else {
o = code()->oop_at(read_int());
}
assert(oopDesc::is_oop_or_null(o), "oop only"); return o;
}
ScopeValue* DebugInfoReadStream::read_object_value(bool is_auto_box) { int id = read_int(); #ifdef ASSERT
assert(_obj_pool != NULL, "object pool does not exist"); for (int i = _obj_pool->length() - 1; i >= 0; i--) {
assert(_obj_pool->at(i)->as_ObjectValue()->id() != id, "should not be read twice");
} #endif
ObjectValue* result = is_auto_box ? new AutoBoxObjectValue(id) : new ObjectValue(id); // Cache the object since an object field could reference it.
_obj_pool->push(result);
result->read_object(this); return result;
}
ScopeValue* DebugInfoReadStream::get_cached_object() { int id = read_int();
assert(_obj_pool != NULL, "object pool does not exist"); for (int i = _obj_pool->length() - 1; i >= 0; i--) {
ObjectValue* ov = _obj_pool->at(i)->as_ObjectValue(); if (ov->id() == id) { return ov;
}
}
ShouldNotReachHere(); return NULL;
}
ScopeValue* ScopeValue::read_from(DebugInfoReadStream* stream) {
ScopeValue* result = NULL; switch(stream->read_int()) { case LOCATION_CODE: result = new LocationValue(stream); break; case CONSTANT_INT_CODE: result = new ConstantIntValue(stream); break; case CONSTANT_OOP_CODE: result = new ConstantOopReadValue(stream); break; case CONSTANT_LONG_CODE: result = new ConstantLongValue(stream); break; case CONSTANT_DOUBLE_CODE: result = new ConstantDoubleValue(stream); break; case OBJECT_CODE: result = stream->read_object_value(false/*is_auto_box*/); break; case AUTO_BOX_OBJECT_CODE: result = stream->read_object_value(true/*is_auto_box*/); break; case OBJECT_ID_CODE: result = stream->get_cached_object(); break; case MARKER_CODE: result = new MarkerValue(); break; default: ShouldNotReachHere();
} return result;
}
void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) { #ifdef ASSERT
{ // cannot use ThreadInVMfromNative here since in case of JVMCI compiler, // thread is already in VM state.
ThreadInVMfromUnknown tiv;
assert(JNIHandles::resolve(value()) == NULL ||
Universe::heap()->is_in(JNIHandles::resolve(value())), "Should be in heap");
} #endif
stream->write_int(CONSTANT_OOP_CODE);
stream->write_handle(value());
}
void ConstantOopWriteValue::print_on(outputStream* st) const { // using ThreadInVMfromUnknown here since in case of JVMCI compiler, // thread is already in VM state.
ThreadInVMfromUnknown tiv;
JNIHandles::resolve(value())->print_value_on(st);
}
// ConstantOopReadValue
ConstantOopReadValue::ConstantOopReadValue(DebugInfoReadStream* stream) {
_value = Handle(Thread::current(), stream->read_oop());
assert(_value() == NULL ||
Universe::heap()->is_in(_value()), "Should be in heap");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.