# HG changeset patch # User Tom Rodriguez # Date 1424920396 28800 # Node ID 15ef24874df796913c2f68144287d798c752db4a # Parent dcfdd60edaf1451936648670f5821b75cf6cf152 Add assertion to ObjectValue conversion diff -r dcfdd60edaf1 -r 15ef24874df7 src/share/vm/code/debugInfo.cpp --- a/src/share/vm/code/debugInfo.cpp Wed Feb 25 19:05:03 2015 -0800 +++ b/src/share/vm/code/debugInfo.cpp Wed Feb 25 19:13:16 2015 -0800 @@ -52,7 +52,7 @@ #ifdef ASSERT assert(_obj_pool != NULL, "object pool does not exist"); for (int i = _obj_pool->length() - 1; i >= 0; i--) { - assert(((ObjectValue*) _obj_pool->at(i))->id() != id, "should not be read twice"); + assert(_obj_pool->at(i)->as_ObjectValue()->id() != id, "should not be read twice"); } #endif ObjectValue* result = new ObjectValue(id); @@ -66,7 +66,7 @@ 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 = (ObjectValue*) _obj_pool->at(i); + ObjectValue* ov = _obj_pool->at(i)->as_ObjectValue(); if (ov->id() == id) { return ov; } diff -r dcfdd60edaf1 -r 15ef24874df7 src/share/vm/code/debugInfo.hpp --- a/src/share/vm/code/debugInfo.hpp Wed Feb 25 19:05:03 2015 -0800 +++ b/src/share/vm/code/debugInfo.hpp Wed Feb 25 19:13:16 2015 -0800 @@ -41,6 +41,7 @@ // - ConstantValue describes a constant class ConstantOopReadValue; +class ObjectValue; class ScopeValue: public ResourceObj { public: @@ -58,6 +59,11 @@ return (ConstantOopReadValue*) this; } + ObjectValue* as_ObjectValue() { + assert(is_object(), "must be"); + return (ObjectValue*)this; + } + // Serialization of debugging information virtual void write_on(DebugInfoWriteStream* stream) = 0; static ScopeValue* read_from(DebugInfoReadStream* stream); diff -r dcfdd60edaf1 -r 15ef24874df7 src/share/vm/code/debugInfoRec.cpp --- a/src/share/vm/code/debugInfoRec.cpp Wed Feb 25 19:05:03 2015 -0800 +++ b/src/share/vm/code/debugInfoRec.cpp Wed Feb 25 19:13:16 2015 -0800 @@ -392,7 +392,7 @@ PcDesc* last_pd = &_pcs[_pcs_length-1]; if (objects != NULL) { for (int i = objects->length() - 1; i >= 0; i--) { - ((ObjectValue*) objects->at(i))->set_visited(false); + objects->at(i)->as_ObjectValue()->set_visited(false); } } int offset = serialize_scope_values(objects); diff -r dcfdd60edaf1 -r 15ef24874df7 src/share/vm/code/scopeDesc.cpp --- a/src/share/vm/code/scopeDesc.cpp Wed Feb 25 19:05:03 2015 -0800 +++ b/src/share/vm/code/scopeDesc.cpp Wed Feb 25 19:13:16 2015 -0800 @@ -230,7 +230,7 @@ if (NOT_GRAAL(DoEscapeAnalysis &&) is_top() && _objects != NULL) { tty->print_cr("Objects"); for (int i = 0; i < _objects->length(); i++) { - ObjectValue* sv = (ObjectValue*) _objects->at(i); + ObjectValue* sv = _objects->at(i)->as_ObjectValue(); tty->print(" - %d: ", sv->id()); sv->print_fields_on(tty); tty->cr();