8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed

Materialization of primitive boxes should use caches

Reviewed-by: kvn, never
This commit is contained in:
Igor Veresov 2019-06-03 13:21:02 -07:00
parent 7d63888ac8
commit e47daab7b4
18 changed files with 666 additions and 26 deletions

View file

@ -56,7 +56,7 @@ oop DebugInfoReadStream::read_oop() {
return o;
}
ScopeValue* DebugInfoReadStream::read_object_value() {
ScopeValue* DebugInfoReadStream::read_object_value(bool is_auto_box) {
int id = read_int();
#ifdef ASSERT
assert(_obj_pool != NULL, "object pool does not exist");
@ -64,7 +64,7 @@ ScopeValue* DebugInfoReadStream::read_object_value() {
assert(_obj_pool->at(i)->as_ObjectValue()->id() != id, "should not be read twice");
}
#endif
ObjectValue* result = new ObjectValue(id);
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);
@ -88,18 +88,20 @@ ScopeValue* DebugInfoReadStream::get_cached_object() {
enum { LOCATION_CODE = 0, CONSTANT_INT_CODE = 1, CONSTANT_OOP_CODE = 2,
CONSTANT_LONG_CODE = 3, CONSTANT_DOUBLE_CODE = 4,
OBJECT_CODE = 5, OBJECT_ID_CODE = 6 };
OBJECT_CODE = 5, OBJECT_ID_CODE = 6,
AUTO_BOX_OBJECT_CODE = 7 };
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(); break;
case OBJECT_ID_CODE: result = stream->get_cached_object(); break;
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;
default: ShouldNotReachHere();
}
return result;
@ -142,7 +144,7 @@ void ObjectValue::write_on(DebugInfoWriteStream* stream) {
stream->write_int(_id);
} else {
_visited = true;
stream->write_int(OBJECT_CODE);
stream->write_int(is_auto_box() ? AUTO_BOX_OBJECT_CODE : OBJECT_CODE);
stream->write_int(_id);
_klass->write_on(stream);
int length = _field_values.length();
@ -154,7 +156,7 @@ void ObjectValue::write_on(DebugInfoWriteStream* stream) {
}
void ObjectValue::print_on(outputStream* st) const {
st->print("obj[%d]", _id);
st->print("%s[%d]", is_auto_box() ? "box_obj" : "obj", _id);
}
void ObjectValue::print_fields_on(outputStream* st) const {