Ghidra Decompiler Analysis Engine
Public Types | Public Member Functions | 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

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...
 

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

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

anonymous enum
Enumerator
is_constructor 

Referenced method is a constructor.

is_destructor 

Referenced method is a destructor.

Member Function Documentation

◆ restoreXml()

void CPoolRecord::restoreXml ( const Element el,
TypeFactory typegrp 
)

Restore object from XML stream.

Initialize this CPoolRecord instance from a <cpoolrec> tag.

Parameters
elis the <cpoolrec> element
typegrpis the TypeFactory used to resolve data-types

◆ saveXml()

void CPoolRecord::saveXml ( ostream &  s) const

Save object to an XML stream.

Save the constant pool object description as a <cpoolrec> tag.

Parameters
sis the output stream

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