decompiler  1.0.0
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
CPoolRecord Class Reference

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.
 
DatatypegetType (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)
 
Datatypetype
 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
 

Detailed Description

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.

Member Enumeration Documentation

anonymous enum

Generic constant pool tag types.

Enumerator
primitive 

Constant value of data-type type, cpool operator can be eliminated.

string_literal 

Constant reference to string (passed back as byteData)

class_reference 

Reference to (system level) class object, token holds class name.

pointer_method 

Pointer to a method, name in token, signature in type.

pointer_field 

Pointer to a field, name in token, data-type in type.

array_length 

Integer length, token is language specific indicator, type is integral data-type.

instance_of 

Boolean value, token is language specific indicator, type is boolean data-type.

check_cast 

Pointer to object, new name in token, new data-type in type.

anonymous enum
Enumerator
is_constructor 

Referenced method is a constructor.

is_destructor 

Referenced method is a destructor.

Member Function Documentation

void CPoolRecord::restoreXml ( const Element el,
TypeFactory typegrp 
)
void CPoolRecord::saveXml ( ostream &  s) const

The documentation for this class was generated from the following files: