CACAO
Data Structures | Public Types | Public Member Functions | Private Types | Private Attributes
cacao::jit::compiler2::SourceStateInst Class Reference

Provides a mapping from HIR values to baseline IR variables. More...

Inheritance diagram for cacao::jit::compiler2::SourceStateInst:
cacao::jit::compiler2::Instruction cacao::jit::compiler2::Value cacao::jit::compiler2::memory::ManagerMixin< Value >

Data Structures

struct  Javalocal
 Maps a HIR value to a baseline IR javalocal index. More...
 

Public Types

typedef
JavalocalListTy::const_iterator 
const_javalocal_iterator
 
typedef
StackvarListTy::const_iterator 
const_stackvar_iterator
 
typedef ParamListTy::const_iterator const_param_iterator
 
- Public Types inherited from cacao::jit::compiler2::Instruction
enum  InstID {
  UnaryInstID, BinaryInstID, FieldAccessInstID, CHECKNULLInstID,
  ARRAYLENGTHInstID, ARRAYBOUNDSCHECKInstID, NEGInstID, CASTInstID,
  ADDInstID, SUBInstID, MULInstID, DIVInstID,
  REMInstID, SHLInstID, USHRInstID, ANDInstID,
  ORInstID, XORInstID, CMPInstID, CONSTInstID,
  GETFIELDInstID, PUTFIELDInstID, PUTSTATICInstID, GETSTATICInstID,
  INCInstID, AREFInstID, ASTOREInstID, ALOADInstID,
  LOADInstID, NEWInstID, NEWARRAYInstID, ANEWARRAYInstID,
  MULTIANEWARRAYInstID, CHECKCASTInstID, INSTANCEOFInstID, GOTOInstID,
  BUILTINInstID, INVOKEInstID, INVOKEVIRTUALInstID, INVOKESPECIALInstID,
  INVOKESTATICInstID, INVOKEINTERFACEInstID, IFInstID, IF_CMPInstID,
  TABLESWITCHInstID, LOOKUPSWITCHInstID, RETURNInstID, THROWInstID,
  PHIInstID, BeginInstID, EndInstID, SourceStateInstID,
  ReplacementEntryInstID, AssumptionInstID, DeoptimizeInstID, NoInstID
}
 
typedef alloc::vector< Value * >
::type 
OperandListTy
 
typedef alloc::list
< Instruction * >::type 
DepListTy
 
typedef OperandListTy::iterator op_iterator
 
typedef DepListTy::iterator dep_iterator
 
typedef
OperandListTy::const_iterator 
const_op_iterator
 
typedef DepListTy::const_iterator const_dep_iterator
 
- Public Types inherited from cacao::jit::compiler2::Value
typedef alloc::unordered_set
< Instruction * >::type 
UserListTy
 

Public Member Functions

 SourceStateInst (s4 source_location, Instruction *hir_location)
 Construct a SourceStateInst. More...
 
virtual BeginInstget_BeginInst () const
 Get the BeginInst of the block that contains this SourceStateInst. More...
 
s4 get_source_location () const
 
SourceStateInstget_parent () const
 
void set_parent (SourceStateInst *new_parent)
 Set state of the enclosing method in case we are in an inlined region. More...
 
void append_javalocal (Javalocal local)
 Append a new mapping from a HIR Value to a baseline IR javalocal index. More...
 
void append_stackvar (Value *value)
 Append a new value to corresponds to a baseline IR stack variable. More...
 
void append_param (Value *value)
 Append a new value to corresponds to a method parameter. More...
 
const_javalocal_iterator javalocal_begin () const
 
const_javalocal_iterator javalocal_end () const
 
const_stackvar_iterator stackvar_begin () const
 
const_stackvar_iterator stackvar_end () const
 
const_param_iterator param_begin () const
 
const_param_iterator param_end () const
 
virtual void replace_op (Value *v_old, Value *v_new)
 
virtual bool is_homogeneous () const
 
virtual bool is_floating () const
 For now we prevent floating to avoid unforeseen instruction reordering. More...
 
virtual SourceStateInstto_SourceStateInst ()
 Conversion method. More...
 
virtual void accept (InstructionVisitor &v, bool copyOperands)
 Visitor pattern. More...
 
- Public Member Functions inherited from cacao::jit::compiler2::Instruction
 Instruction (InstID opcode, Type::TypeID type, BeginInst *begin=NULL)
 
virtual ~Instruction ()
 
int get_id () const
 return a unique identifier for this instruction More...
 
InstID get_opcode () const
 return the opcode of the instruction More...
 
void set_Method (Method *M)
 
Methodget_Method () const
 
const_op_iterator op_begin () const
 
const_op_iterator op_end () const
 
Valueop_front () const
 
Valueop_back () const
 
size_t op_size () const
 
Valueget_operand (size_t i)
 
int get_operand_index (Value *op) const
 
void append_dep (Instruction *I)
 
void remove_dep (Instruction *I)
 
virtual bool verify () const
 Check if the instruction is in a correct state. More...
 
const_dep_iterator dep_begin () const
 
const_dep_iterator dep_end () const
 
Instructiondep_front () const
 
Instructiondep_back () const
 
size_t dep_size () const
 
const_dep_iterator rdep_begin () const
 
const_dep_iterator rdep_end () const
 
size_t rdep_size () const
 
virtual bool set_BeginInst (BeginInst *b)
 
virtual bool has_side_effects () const
 True the instruction has side effects. More...
 
virtual bool is_arithmetic () const
 True if the instruction is an arithmetic instruction. More...
 
virtual bool is_commutable () const
 True if the operands of the instruction are commutable. More...
 
virtual Instructionto_Instruction ()
 
virtual SourceStateAwareInstto_SourceStateAwareInst ()
 
virtual DereferenceInstto_DereferenceInst ()
 
virtual UnaryInstto_UnaryInst ()
 
virtual BinaryInstto_BinaryInst ()
 
virtual FieldAccessInstto_FieldAccessInst ()
 
virtual CHECKNULLInstto_CHECKNULLInst ()
 
virtual ARRAYLENGTHInstto_ARRAYLENGTHInst ()
 
virtual ARRAYBOUNDSCHECKInstto_ARRAYBOUNDSCHECKInst ()
 
virtual NEGInstto_NEGInst ()
 
virtual CASTInstto_CASTInst ()
 
virtual ADDInstto_ADDInst ()
 
virtual SUBInstto_SUBInst ()
 
virtual MULInstto_MULInst ()
 
virtual DIVInstto_DIVInst ()
 
virtual REMInstto_REMInst ()
 
virtual SHLInstto_SHLInst ()
 
virtual USHRInstto_USHRInst ()
 
virtual ANDInstto_ANDInst ()
 
virtual ORInstto_ORInst ()
 
virtual XORInstto_XORInst ()
 
virtual CMPInstto_CMPInst ()
 
virtual CONSTInstto_CONSTInst ()
 
virtual GETFIELDInstto_GETFIELDInst ()
 
virtual PUTFIELDInstto_PUTFIELDInst ()
 
virtual PUTSTATICInstto_PUTSTATICInst ()
 
virtual GETSTATICInstto_GETSTATICInst ()
 
virtual INCInstto_INCInst ()
 
virtual AREFInstto_AREFInst ()
 
virtual ASTOREInstto_ASTOREInst ()
 
virtual ALOADInstto_ALOADInst ()
 
virtual LOADInstto_LOADInst ()
 
virtual NEWInstto_NEWInst ()
 
virtual NEWARRAYInstto_NEWARRAYInst ()
 
virtual ANEWARRAYInstto_ANEWARRAYInst ()
 
virtual MULTIANEWARRAYInstto_MULTIANEWARRAYInst ()
 
virtual CHECKCASTInstto_CHECKCASTInst ()
 
virtual INSTANCEOFInstto_INSTANCEOFInst ()
 
virtual GOTOInstto_GOTOInst ()
 
virtual BUILTINInstto_BUILTINInst ()
 
virtual INVOKEInstto_INVOKEInst ()
 
virtual INVOKEVIRTUALInstto_INVOKEVIRTUALInst ()
 
virtual INVOKESPECIALInstto_INVOKESPECIALInst ()
 
virtual INVOKESTATICInstto_INVOKESTATICInst ()
 
virtual INVOKEINTERFACEInstto_INVOKEINTERFACEInst ()
 
virtual IFInstto_IFInst ()
 
virtual IF_CMPInstto_IF_CMPInst ()
 
virtual TABLESWITCHInstto_TABLESWITCHInst ()
 
virtual LOOKUPSWITCHInstto_LOOKUPSWITCHInst ()
 
virtual RETURNInstto_RETURNInst ()
 
virtual THROWInstto_THROWInst ()
 
virtual PHIInstto_PHIInst ()
 
virtual BeginInstto_BeginInst ()
 
virtual EndInstto_EndInst ()
 
virtual ReplacementEntryInstto_ReplacementEntryInst ()
 
virtual AssumptionInstto_AssumptionInst ()
 
virtual DeoptimizeInstto_DeoptimizeInst ()
 
const char * get_name () const
 
virtual OStreamprint (OStream &OS) const
 print More...
 
- Public Member Functions inherited from cacao::jit::compiler2::Value
 Value (Type::TypeID type)
 
Type::TypeID get_type () const
 get the value type of the instruction More...
 
virtual ~Value ()
 
UserListTy::const_iterator user_begin () const
 
UserListTy::const_iterator user_end () const
 
size_t user_size () const
 Get the number of (unique) users. More...
 
void replace_value (Value *v)
 Replace this Value this the new one in all users. More...
 

Private Types

typedef alloc::vector
< Javalocal >::type 
JavalocalListTy
 
typedef alloc::vector< Value * >
::type 
StackvarListTy
 
typedef alloc::vector< Value * >
::type 
ParamListTy
 

Private Attributes

s4 source_location
 The program location corresponding to the provided mapping information. More...
 
SourceStateInstparent
 The state of the enclosing method in case we are in an inlined region. More...
 
JavalocalListTy javalocals
 List of mappings from HIR values to baseline IR javalocal indices. More...
 
StackvarListTy stackvars
 List of HIR values that correspond to baseline IR stack variables. More...
 
ParamListTy params
 List of HIR values that correspond to method parameters. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from cacao::jit::compiler2::memory::ManagerMixin< Value >
static voidoperator new (std::size_t size) throw (std::bad_alloc)
 normal new More...
 
static voidoperator new (std::size_t size, void *ptr) throw ()
 placement new More...
 
static voidoperator new (std::size_t size, const std::nothrow_t &nt) throw ()
 nothrow new More...
 
static void operator delete (void *pMemory) throw ()
 normal delete More...
 
static void operator delete (void *pMemory, void *ptr) throw ()
 placement delete More...
 
static void operator delete (void *pMemory, const std::nothrow_t &) throw ()
 nothrow delete More...
 
static voidoperator new[] (std::size_t size) throw (std::bad_alloc)
 normal new[] More...
 
static voidoperator new[] (std::size_t size, void *ptr) throw ()
 placement new[] More...
 
static voidoperator new[] (std::size_t size, const std::nothrow_t &nt) throw ()
 nothrow new[] More...
 
static void operator delete[] (void *pMemory) throw ()
 normal delete[] More...
 
static void operator delete[] (void *pMemory, void *ptr) throw ()
 placement delete[] More...
 
static void operator delete[] (void *pMemory, const std::nothrow_t &) throw ()
 nothrow delete[] More...
 
- Protected Member Functions inherited from cacao::jit::compiler2::Instruction
 Instruction ()
 
void append_op (Value *v)
 
OStreamprint_operands (OStream &OS)
 
- Protected Member Functions inherited from cacao::jit::compiler2::Value
void append_user (Instruction *I)
 
OStreamprint_users (OStream &OS) const
 
void user_remove (Instruction *I)
 
void set_type (Type::TypeID t)
 
- Protected Attributes inherited from cacao::jit::compiler2::Instruction
const InstID opcode
 
Methodmethod
 
const int id
 
BeginInstbegin
 

Detailed Description

Provides a mapping from HIR values to baseline IR variables.

In order to reconstruct the source state during on-stack replacement, it is necessary to be able to reconstruct the machine-independent source state from the current machine-dependent execution state. Due to the generality of the baseline compiler's IR the on-stack replacement mechanism represents the source state in terms of the baseline IR variables. Hence, it is necessary to be able to map compiler2-specific HIR values to baseline IR variables. A SourceStateInst provides such mapping information for a single program location which is identified by the (machine-independent) ID of the corresponding baseline IR instruction.

Definition at line 158 of file Instructions.hpp.

Member Typedef Documentation

Definition at line 223 of file Instructions.hpp.

Definition at line 225 of file Instructions.hpp.

Definition at line 224 of file Instructions.hpp.

Definition at line 187 of file Instructions.hpp.

Definition at line 189 of file Instructions.hpp.

Definition at line 188 of file Instructions.hpp.

Constructor & Destructor Documentation

cacao::jit::compiler2::SourceStateInst::SourceStateInst ( s4  source_location,
Instruction hir_location 
)
inlineexplicit

Construct a SourceStateInst.

Parameters
source_locationThe ID of the baseline IR instruction at the mapped program location.
hir_locationThe HIR instruction that corresponds to the given source_location.

Definition at line 235 of file Instructions.hpp.

Member Function Documentation

virtual void cacao::jit::compiler2::SourceStateInst::accept ( InstructionVisitor v,
bool  copyOperands 
)
inlinevirtual

Visitor pattern.

Implements cacao::jit::compiler2::Instruction.

Definition at line 338 of file Instructions.hpp.

void cacao::jit::compiler2::SourceStateInst::append_javalocal ( Javalocal  local)
inline

Append a new mapping from a HIR Value to a baseline IR javalocal index.

Parameters
localThe Javalocal to append.

Definition at line 273 of file Instructions.hpp.

void cacao::jit::compiler2::SourceStateInst::append_param ( Value value)
inline

Append a new value to corresponds to a method parameter.

Parameters
valueThe value to append.

Definition at line 293 of file Instructions.hpp.

void cacao::jit::compiler2::SourceStateInst::append_stackvar ( Value value)
inline

Append a new value to corresponds to a baseline IR stack variable.

Parameters
valueThe value to append.

Definition at line 283 of file Instructions.hpp.

virtual BeginInst* cacao::jit::compiler2::SourceStateInst::get_BeginInst ( ) const
inlinevirtual

Get the BeginInst of the block that contains this SourceStateInst.

Reimplemented from cacao::jit::compiler2::Instruction.

Definition at line 245 of file Instructions.hpp.

SourceStateInst* cacao::jit::compiler2::SourceStateInst::get_parent ( ) const
inline
Returns
The state of the enclosing method in case we are in an inlined region.

Definition at line 259 of file Instructions.hpp.

s4 cacao::jit::compiler2::SourceStateInst::get_source_location ( ) const
inline
Returns
The program location that corresponds to the given mappings.

Definition at line 254 of file Instructions.hpp.

virtual bool cacao::jit::compiler2::SourceStateInst::is_floating ( ) const
inlinevirtual

For now we prevent floating to avoid unforeseen instruction reordering.

Reimplemented from cacao::jit::compiler2::Instruction.

Definition at line 328 of file Instructions.hpp.

virtual bool cacao::jit::compiler2::SourceStateInst::is_homogeneous ( ) const
inlinevirtual
See Also
Instruction::is_homogeneous()

Reimplemented from cacao::jit::compiler2::Instruction.

Definition at line 323 of file Instructions.hpp.

const_javalocal_iterator cacao::jit::compiler2::SourceStateInst::javalocal_begin ( ) const
inline

Definition at line 298 of file Instructions.hpp.

const_javalocal_iterator cacao::jit::compiler2::SourceStateInst::javalocal_end ( ) const
inline

Definition at line 299 of file Instructions.hpp.

const_param_iterator cacao::jit::compiler2::SourceStateInst::param_begin ( ) const
inline

Definition at line 304 of file Instructions.hpp.

const_param_iterator cacao::jit::compiler2::SourceStateInst::param_end ( ) const
inline

Definition at line 305 of file Instructions.hpp.

virtual void cacao::jit::compiler2::SourceStateInst::replace_op ( Value v_old,
Value v_new 
)
inlinevirtual

Reimplemented from cacao::jit::compiler2::Instruction.

Definition at line 307 of file Instructions.hpp.

void cacao::jit::compiler2::SourceStateInst::set_parent ( SourceStateInst new_parent)
inline

Set state of the enclosing method in case we are in an inlined region.

Parameters
new_parentThe corresponding source state.

Definition at line 266 of file Instructions.hpp.

const_stackvar_iterator cacao::jit::compiler2::SourceStateInst::stackvar_begin ( ) const
inline

Definition at line 301 of file Instructions.hpp.

const_stackvar_iterator cacao::jit::compiler2::SourceStateInst::stackvar_end ( ) const
inline

Definition at line 302 of file Instructions.hpp.

virtual SourceStateInst* cacao::jit::compiler2::SourceStateInst::to_SourceStateInst ( )
inlinevirtual

Conversion method.

Reimplemented from cacao::jit::compiler2::Instruction.

Definition at line 333 of file Instructions.hpp.

Field Documentation

JavalocalListTy cacao::jit::compiler2::SourceStateInst::javalocals
private

List of mappings from HIR values to baseline IR javalocal indices.

Definition at line 209 of file Instructions.hpp.

ParamListTy cacao::jit::compiler2::SourceStateInst::params
private

List of HIR values that correspond to method parameters.

Definition at line 219 of file Instructions.hpp.

SourceStateInst* cacao::jit::compiler2::SourceStateInst::parent
private

The state of the enclosing method in case we are in an inlined region.

Definition at line 204 of file Instructions.hpp.

s4 cacao::jit::compiler2::SourceStateInst::source_location
private

The program location corresponding to the provided mapping information.

The mappings of HIR values to baseline IR variables, which are given by this SourceStateInst, are bound to this exact program location. This location is given in terms of an ID of the corresponding baseline IR instruction.

Definition at line 199 of file Instructions.hpp.

StackvarListTy cacao::jit::compiler2::SourceStateInst::stackvars
private

List of HIR values that correspond to baseline IR stack variables.

Definition at line 214 of file Instructions.hpp.


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