decompiler
1.0.0
|
A description of a byte-code object referenced by a constant. More...
#include <cpool.hh>
Public Types | |
enum | { primitive =0, string_literal =1, class_reference =2, pointer_method =3, pointer_field =4, array_length =5, instance_of =6, check_cast =7 } |
Generic constant pool tag types. More... | |
enum | { is_constructor = 0x1, is_destructor = 0x2 } |
Public Member Functions | |
CPoolRecord (void) | |
Construct an empty record. | |
~CPoolRecord (void) | |
Destructor. | |
uint4 | getTag (void) const |
Get the type of record. | |
const string & | getToken (void) const |
Get name of method or data-type. | |
const uint1 * | getByteData (void) const |
Get pointer to string literal data. | |
int4 | getByteDataLength (void) const |
Number of bytes of string literal data. | |
Datatype * | getType (void) const |
Get the data-type associated with this. | |
uintb | getValue (void) const |
Get the constant value associated with this. | |
bool | isConstructor (void) const |
Is object a constructor method. | |
bool | isDestructor (void) const |
Is object a destructor method. | |
void | saveXml (ostream &s) const |
Save object to an XML stream. More... | |
void | restoreXml (const Element *el, TypeFactory &typegrp) |
Restore object from XML stream. More... | |
Private Attributes | |
uint4 | tag |
Descriptor of type of the object. | |
uint4 | flags |
Additional boolean properties on the record. | |
string | token |
Name or token associated with the object. | |
uintb | value |
Constant value of the object (if known) | |
Datatype * | type |
Data-type associated with the object. | |
uint1 * | byteData |
For string literals, the raw byte data of the string. | |
int4 | byteDataLen |
The number of bytes in the data for a string literal. | |
Friends | |
class | ConstantPool |
A description of a byte-code object referenced by a constant.
Byte-code languages can make use of objects that the system knows about but which aren't fully embedded in the encoding of instructions that use them. Instead the instruction refers to the object via a special encoded reference. This class describes one object described by such a reference. In order to provide a concrete interpretation of the instruction (i.e. a p-code translation), these objects generally resolve to some sort of constant value (hence the term constant pool). The type of constant goes to the formal CPoolRecord tag field which can be a:
For decompilation, knowing the actual constant a byte-code interpreter would need is secondary to knowing what object is being referenced. So the CPoolRecord can hold a constant value, but generally it provides a data-type associated with the object and a symbol name or other string token naming the object.
anonymous enum |
Generic constant pool tag types.
anonymous enum |
void CPoolRecord::restoreXml | ( | const Element * | el, |
TypeFactory & | typegrp | ||
) |
Restore object from XML stream.
Initialize this CPoolRecord instance from a <cpoolrec> tag.
el | is the <cpoolrec> element |
typegrp | is the TypeFactory used to resolve data-types |
References array_length, byteData, byteDataLen, check_cast, class_reference, flags, Element::getAttributeName(), Element::getAttributeValue(), Element::getChildren(), Element::getContent(), Element::getName(), Element::getNumAttributes(), instance_of, is_constructor, is_destructor, isConstructor(), isDestructor(), pointer_field, pointer_method, primitive, TypeFactory::restoreXmlType(), TypeFactory::restoreXmlTypeWithCodeFlags(), string_literal, tag, token, type, value, and xml_readbool().
Referenced by ConstantPoolInternal::CheapSorter::apply(), ConstantPoolInternal::clear(), isDestructor(), ConstantPoolInternal::restoreXml(), ConstantPool::restoreXmlRecord(), and ConstantPool::~ConstantPool().
void CPoolRecord::saveXml | ( | ostream & | s | ) | const |
Save object to an XML stream.
Save the constant pool object description as a <cpoolrec> tag.
s | is the output stream |
References a_v(), a_v_b(), array_length, byteData, byteDataLen, check_cast, class_reference, instance_of, isConstructor(), isDestructor(), pointer_field, pointer_method, primitive, Datatype::saveXml(), string_literal, tag, token, type, value, and xml_escape().
Referenced by ConstantPoolInternal::CheapSorter::apply(), ConstantPoolInternal::clear(), isDestructor(), and ConstantPool::~ConstantPool().