Mercurial > hg > truffle
changeset 19598:15ef24874df7
Add assertion to ObjectValue conversion
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Wed, 25 Feb 2015 19:13:16 -0800 |
parents | dcfdd60edaf1 |
children | 3ba5b1c55996 |
files | src/share/vm/code/debugInfo.cpp src/share/vm/code/debugInfo.hpp src/share/vm/code/debugInfoRec.cpp src/share/vm/code/scopeDesc.cpp |
diffstat | 4 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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; }
--- 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);
--- 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);
--- 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();