decompiler  1.0.0
Public Member Functions | List of all members
ghidra::CastStrategyJava Class Reference

Casting strategies that are specific to the Java language. More...

#include <cast.hh>

Inheritance diagram for ghidra::CastStrategyJava:
ghidra::CastStrategyC ghidra::CastStrategy

Public Member Functions

virtual DatatypecastStandard (Datatype *reqtype, Datatype *curtype, bool care_uint_int, bool care_ptr_uint) const
 Does there need to be a visible cast between the given data-types. More...
 
virtual bool isZextCast (Datatype *outtype, Datatype *intype) const
 Is zero-extending an input data-type, producing an output data-type, considered a cast. More...
 
- Public Member Functions inherited from ghidra::CastStrategyC
virtual int4 localExtensionType (const Varnode *vn, const PcodeOp *op) const
 Decide on integer promotion by examining just local properties of the given Varnode. More...
 
virtual int4 intPromotionType (const Varnode *vn) const
 Calculate the integer promotion code of a given Varnode. More...
 
virtual bool checkIntPromotionForCompare (const PcodeOp *op, int4 slot) const
 Check if integer promotion forces a cast for the given comparison op and slot. More...
 
virtual bool checkIntPromotionForExtension (const PcodeOp *op) const
 Check if integer promotion forces a cast for the input to the given extension. More...
 
virtual bool isExtensionCastImplied (const PcodeOp *op, const PcodeOp *readOp) const
 Is the given ZEXT/SEXT cast implied by the expression its in? More...
 
virtual DatatypearithmeticOutputStandard (const PcodeOp *op)
 What is the output data-type produced by the given integer arithmetic operation. More...
 
virtual bool isSubpieceCast (Datatype *outtype, Datatype *intype, uint4 offset) const
 Is truncating an input data-type, producing an output data-type, considered a cast. More...
 
virtual bool isSubpieceCastEndian (Datatype *outtype, Datatype *intype, uint4 offset, bool isbigend) const
 Is the given data-type truncation considered a cast, given endianess concerns. More...
 
virtual bool isSextCast (Datatype *outtype, Datatype *intype) const
 Is sign-extending an input data-type, producing an output data-type, considered a cast. More...
 
- Public Member Functions inherited from ghidra::CastStrategy
 CastStrategy (void)
 Constructor.
 
void setTypeFactory (TypeFactory *t)
 Establish the data-type factory. More...
 
virtual ~CastStrategy (void)
 Destructor.
 
bool markExplicitUnsigned (PcodeOp *op, int4 slot) const
 Check if a constant input should be explicitly labeled as an unsigned token. More...
 
bool markExplicitLongSize (PcodeOp *op, int4 slot) const
 Check is a constant input should be explicitly labeled as a long integer token. More...
 
bool caresAboutCharRepresentation (const Varnode *vn, const PcodeOp *op) const
 For the given PcodeOp, does it matter if a constant operand is presented as a character or integer. More...
 

Additional Inherited Members

- Public Types inherited from ghidra::CastStrategy
enum  IntPromotionCode {
  NO_PROMOTION = -1, UNKNOWN_PROMOTION = 0, UNSIGNED_EXTENSION = 1, SIGNED_EXTENSION = 2,
  EITHER_EXTENSION = 3
}
 Types of integer promotion. More...
 
- Protected Attributes inherited from ghidra::CastStrategy
TypeFactorytlst
 Type factory associated with the Architecture.
 
int4 promoteSize
 Size of int data-type, (size that integers get promoted to)
 

Detailed Description

Casting strategies that are specific to the Java language.

This is nearly identical to the strategy for C, but there is some change to account for the way object references are encoded as pointer data-types within the decompiler's data-type system.

Member Function Documentation

◆ castStandard()

Datatype * ghidra::CastStrategyJava::castStandard ( Datatype reqtype,
Datatype curtype,
bool  care_uint_int,
bool  care_ptr_uint 
) const
virtual

Does there need to be a visible cast between the given data-types.

The cast is from a current data-type to an expected data-type. NULL is returned if no cast is required, otherwise the data-type to cast to (usually the expected data-type) is returned.

Parameters
reqtypeis the expected data-type
curtypeis the current data-type
care_uint_intis true if we care about a change in signedness
care_ptr_uintis true if we care about conversions between pointers and unsigned values
Returns
NULL to indicate no cast, or the data-type to cast to

Reimplemented from ghidra::CastStrategyC.

References ghidra::Datatype::getMetatype(), ghidra::Datatype::getSize(), ghidra::TYPE_BOOL, ghidra::TYPE_CODE, ghidra::TYPE_INT, ghidra::TYPE_PTR, ghidra::TYPE_UINT, ghidra::TYPE_UNKNOWN, and ghidra::TYPE_VOID.

◆ isZextCast()

bool ghidra::CastStrategyJava::isZextCast ( Datatype outtype,
Datatype intype 
) const
virtual

Is zero-extending an input data-type, producing an output data-type, considered a cast.

Data-types must be provided from the input and output of an INT_ZEXT operation.

Parameters
outtypeis the output data-type
intypeis the input data-type
Returns
true if the INT_ZEXT should be represented as a cast

Reimplemented from ghidra::CastStrategyC.

References ghidra::Datatype::getMetatype(), ghidra::Datatype::getSize(), ghidra::Datatype::isCharPrint(), ghidra::TYPE_BOOL, ghidra::TYPE_INT, and ghidra::TYPE_UINT.


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