public class TypeSafeInstructionFactory
extends java.lang.Object
As the name states this SSAInstructionFactory does type checks. If they pass the actual instructions are generated using the JavaInstructionFactory.
Obviously this factory is not complete yet. It's extended on demand.
JavaLanguage.JavaInstructionFactory| Modifier and Type | Field and Description |
|---|---|
protected IClassHierarchy |
cha |
protected JavaLanguage.JavaInstructionFactory |
insts |
| Constructor and Description |
|---|
TypeSafeInstructionFactory(IClassHierarchy cha) |
| Modifier and Type | Method and Description |
|---|---|
SSAArrayLoadInstruction |
ArrayLoadInstruction(int iindex,
SSAValue result,
SSAValue array,
int index)
result = array[index].
|
SSAArrayStoreInstruction |
ArrayStoreInstruction(int iindex,
SSAValue array,
int index,
SSAValue value)
array[index] = value.
|
SSAConditionalBranchInstruction |
ConditionalBranchInstruction(int iindex,
com.ibm.wala.shrikeBT.IConditionalBranchInstruction.IOperator operator,
TypeReference type,
int val1,
int val2,
int target) |
SSAGetInstruction |
GetInstruction(int iindex,
SSAValue targetValue,
FieldReference field)
Reads static field into targetValue.
|
SSAGetInstruction |
GetInstruction(int iindex,
SSAValue targetValue,
SSAValue containingInstance,
FieldReference field)
targetValue = containingInstance.field.
|
SSAGotoInstruction |
GotoInstruction(int iindex,
int target)
Unconditionally jump to a (non-Phi) Instruction.
|
SSAAbstractInvokeInstruction |
InvokeInstruction(int iindex,
java.util.List<? extends SSAValue> params,
SSAValue exception,
CallSiteReference site)
Instruction that calls a void-method.
|
SSAAbstractInvokeInstruction |
InvokeInstruction(int iindex,
SSAValue result,
java.util.List<? extends SSAValue> params,
SSAValue exception,
CallSiteReference site)
result = site(params).
|
boolean |
isAssignableFrom(TypeReference from,
TypeReference to) |
SSANewInstruction |
NewInstruction(int iindex,
SSAValue result,
NewSiteReference site) |
SSANewInstruction |
NewInstruction(int iindex,
SSAValue result,
NewSiteReference site,
java.util.Collection<? extends SSAValue> params) |
SSAPhiInstruction |
PhiInstruction(int iindex,
SSAValue result,
java.util.Collection<? extends SSAValue> params)
Combine SSA-Values into a newone.
|
SSAPutInstruction |
PutInstruction(int iindex,
SSAValue newValue,
FieldReference field)
Writes newValue to static field.
|
SSAPutInstruction |
PutInstruction(int iindex,
SSAValue targetInstance,
SSAValue newValue,
FieldReference field)
Writes newValue to field of targetInstance.
|
SSAReturnInstruction |
ReturnInstruction(int iindex)
Return from a void-function.
|
SSAReturnInstruction |
ReturnInstruction(int iindex,
SSAValue result)
Check if the type of the SSAValue is assignable to the return-value of the method it's valid
in.
|
protected final JavaLanguage.JavaInstructionFactory insts
protected final IClassHierarchy cha
public TypeSafeInstructionFactory(IClassHierarchy cha)
public SSAAbstractInvokeInstruction InvokeInstruction(int iindex, SSAValue result, java.util.List<? extends SSAValue> params, SSAValue exception, CallSiteReference site)
Instruction that calls a method which has a return-value.
All parameters (but exception) are typechecked first. If the check passes they get unpacked and handed over to the corresponding JavaInstructionFactory.InvokeInstruction.
Calls result.setAssigned()
iindex - Zero or a positive number unique to any instruction of the same methodresult - Where to place the return-value of the called method. Is SSAValue.setAssigned()
automatically.params - Parameters to the call starting with the implicit this-pointer if necessaryexception - An SSAValue receiving the exception-object when something in the method throws
unhandledsite - The CallSiteReference to this call.JavaLanguage.JavaInstructionFactory.InvokeInstruction(int, int,
int[], int, CallSiteReference,
com.ibm.wala.shrikeCT.BootstrapMethodsReader.BootstrapMethod)public SSAAbstractInvokeInstruction InvokeInstruction(int iindex, java.util.List<? extends SSAValue> params, SSAValue exception, CallSiteReference site)
All parameters (but exception) are typechecked first. If the check passes they get unpacked and handed over to the corresponding JavaInstructionFactory.InvokeInstruction.
iindex - Zero or a positive number unique to any instruction of the same methodparams - Parameters to the call starting with the implicit this-pointer if necessaryexception - An SSAValue receiving the exception-object when something in the method throws
unhandledsite - The CallSiteReference to this call.JavaLanguage.JavaInstructionFactory.InvokeInstruction(int, int[],
int, CallSiteReference, com.ibm.wala.shrikeCT.BootstrapMethodsReader.BootstrapMethod)public SSAReturnInstruction ReturnInstruction(int iindex, SSAValue result)
If type check passes the corresponding ReturnInstruction of the JavaInstructionFactory is called.
iindex - Zero or a positive number unique to any instruction of the same methodresult - SSAValue to return _with_ validIn _set_!java.lang.IllegalArgumentException - if result has no validIn setJavaLanguage.JavaInstructionFactory.ReturnInstruction(int, int,
boolean)public SSAGetInstruction GetInstruction(int iindex, SSAValue targetValue, SSAValue containingInstance, FieldReference field)
Reads field from containingInstance into targetValue. If type check passes the corresponding GetInstruction of the JavaInstructionFactory is called. Calls targetValue.setAssigned()
iindex - Zero or a positive number unique to any instruction of the same methodtargetValue - the result of the GetInstruction is placed therecontainingInstance - The Object instance to read the field fromfield - The description of the fieldJavaLanguage.JavaInstructionFactory.GetInstruction(int, int, int,
FieldReference)public SSAGetInstruction GetInstruction(int iindex, SSAValue targetValue, FieldReference field)
If type check passes the corresponding GetInstruction of the JavaInstructionFactory is called. Calls targetValue.setAssigned()
iindex - Zero or a positive number unique to any instruction of the same methodtargetValue - the result of the GetInstruction is placed therefield - The description of the fieldJavaLanguage.JavaInstructionFactory.GetInstruction(int, int, int,
FieldReference)public SSAPutInstruction PutInstruction(int iindex, SSAValue targetInstance, SSAValue newValue, FieldReference field)
If type check passes the corresponding PutInstruction of the JavaInstructionFactory is called.
iindex - Zero or a psitive number unique to any instruction of the same methodtargetInstance - the instance of the object to write a field ofnewValue - The value to write to the fieldfield - The description of the targetJavaLanguage.JavaInstructionFactory.PutInstruction(int, int, int,
FieldReference)public SSAPutInstruction PutInstruction(int iindex, SSAValue newValue, FieldReference field)
If type check passes the corresponding PutInstruction of the JavaInstructionFactory is called.
iindex - Zero or a psitive number unique to any instruction of the same methodnewValue - The value to write to the fieldfield - The description of the targetJavaLanguage.JavaInstructionFactory.PutInstruction(int, int, int,
FieldReference)public SSANewInstruction NewInstruction(int iindex, SSAValue result, NewSiteReference site)
public SSANewInstruction NewInstruction(int iindex, SSAValue result, NewSiteReference site, java.util.Collection<? extends SSAValue> params)
public SSAPhiInstruction PhiInstruction(int iindex, SSAValue result, java.util.Collection<? extends SSAValue> params)
If type check passes the corresponding PhiInstruction of the JavaInstructionFactory is called. Calls result.setAssigned().
iindex - Zero or a positive number unique to any instruction of the same methodresult - Where to write result toparams - at least one SSAValue to read fromJavaLanguage.JavaInstructionFactory.PhiInstruction(int, int,
int[])public boolean isAssignableFrom(TypeReference from, TypeReference to)
public SSAReturnInstruction ReturnInstruction(int iindex)
Handed through to JavaInstructionFactory directly (unless the iindex is negative).
iindex - Zero or a positive number unique to any instruction of the same methodpublic SSAGotoInstruction GotoInstruction(int iindex, int target)
target - the iindex of the instruction to jump topublic SSAConditionalBranchInstruction ConditionalBranchInstruction(int iindex, com.ibm.wala.shrikeBT.IConditionalBranchInstruction.IOperator operator, TypeReference type, int val1, int val2, int target)
public SSAArrayLoadInstruction ArrayLoadInstruction(int iindex, SSAValue result, SSAValue array, int index)
Load a a reference from an array.
result - The SSAValue to store the loaded stuff inarray - The array to load fromindex - Te position in array to load frompublic SSAArrayStoreInstruction ArrayStoreInstruction(int iindex, SSAValue array, int index, SSAValue value)
Save a value to a specific position in an Array.
array - the array to store toindex - the position in the array to place value atvalue - The SSAValue to store in the array