@@ -53,16 +53,16 @@ private predicate operandIsConsumedWithoutEscaping(Operand operand) {
5353 instr instanceof PointerDiffInstruction
5454 )
5555 )
56- // or
57- // // Some standard function arguments never escape
58- // isNeverEscapesArgument(operand)
56+ or
57+ // Some standard function arguments never escape
58+ isNeverEscapesArgument ( operand )
5959}
6060
6161private predicate operandEscapesDomain ( Operand operand ) {
6262 not operandIsConsumedWithoutEscaping ( operand ) and
6363 not operandIsPropagated ( operand , _) and
6464 not isArgumentForParameter ( _, operand , _) and
65- // not isOnlyEscapesViaReturnArgument(operand) and
65+ not isOnlyEscapesViaReturnArgument ( operand ) and
6666 not operand .getUse ( ) instanceof ReturnValueInstruction and
6767 not operand instanceof PhiInputOperand
6868}
@@ -126,7 +126,6 @@ private predicate operandIsPropagated(Operand operand, IntValue bitOffset) {
126126 // virtual memory model for the IR I don't think such conversions provide any meaningful
127127 // information;
128128 // Conversion to another pointer type propagates the source address.
129- // REVIEW: Is this needed?
130129 exists ( ConvertInstruction convert , Type resultType |
131130 convert = instr and
132131 resultType = convert .getResultType ( ) and
@@ -141,15 +140,16 @@ private predicate operandIsPropagated(Operand operand, IntValue bitOffset) {
141140 // the address with an offset.
142141 bitOffset = getPointerBitOffset ( instr .( PointerOffsetInstruction ) )
143142 or
144- // or
145- // // Computing a field address from a pointer propagates the address plus the
146- // // offset of the field.
147- // bitOffset = getFieldBitOffset(instr.(FieldAddressInstruction).getField())
143+ // Computing a field address from a pointer propagates the address plus the
144+ // offset of the field.
145+ // TODO: Fix once class layout is synthesized
146+ // bitOffset = Ints::unknown()
147+ //or
148148 // A copy propagates the source value.
149149 operand = instr .( CopyInstruction ) .getSourceValueOperand ( ) and bitOffset = 0
150- // or
151- // // Some functions are known to propagate an argument
152- // isAlwaysReturnedArgument(operand) and bitOffset = 0
150+ or
151+ // Some functions are known to propagate an argument
152+ isAlwaysReturnedArgument ( operand ) and bitOffset = 0
153153 )
154154 )
155155}
@@ -169,8 +169,8 @@ private predicate operandEscapesNonReturn(Operand operand) {
169169 )
170170 )
171171 or
172- // or
173- // isOnlyEscapesViaReturnArgument(operand) and resultEscapesNonReturn(operand.getUse())
172+ isOnlyEscapesViaReturnArgument ( operand ) and resultEscapesNonReturn ( operand . getUse ( ) )
173+ or
174174 operand instanceof PhiInputOperand and
175175 resultEscapesNonReturn ( operand .getUse ( ) )
176176 or
@@ -192,8 +192,8 @@ private predicate operandMayReachReturn(Operand operand) {
192192 // The address is returned
193193 operand .getUse ( ) instanceof ReturnValueInstruction
194194 or
195- // or
196- // isOnlyEscapesViaReturnArgument(operand) and resultMayReachReturn(operand.getUse())
195+ isOnlyEscapesViaReturnArgument ( operand ) and resultMayReachReturn ( operand . getUse ( ) )
196+ or
197197 operand instanceof PhiInputOperand and
198198 resultMayReachReturn ( operand .getUse ( ) )
199199}
@@ -218,7 +218,7 @@ private predicate operandReturned(Operand operand, IntValue bitOffset) {
218218 operand .getUse ( ) instanceof ReturnValueInstruction and
219219 bitOffset = 0
220220 or
221- // isOnlyEscapesViaReturnArgument(operand) and
221+ isOnlyEscapesViaReturnArgument ( operand ) and
222222 resultReturned ( operand .getUse ( ) , _) and
223223 bitOffset = Ints:: unknown ( )
224224}
@@ -240,28 +240,12 @@ private predicate isArgumentForParameter(CallInstruction ci, Operand operand, In
240240 )
241241}
242242
243- // REVIEW: Those three predicates are used to model the behaviour of C++ library functions
244- // for which the code was not accessible, so we should ignore them
245- //private predicate isAlwaysReturnedArgument(Operand operand) {
246- // exists(AliasFunction f |
247- // f = operand.getUse().(CallInstruction).getStaticCallTarget() and
248- // f.parameterIsAlwaysReturned(operand.(PositionalArgumentOperand).getIndex())
249- // )
250- //}
251- //
252- //private predicate isOnlyEscapesViaReturnArgument(Operand operand) {
253- // exists(AliasFunction f |
254- // f = operand.getUse().(CallInstruction).getStaticCallTarget() and
255- // f.parameterEscapesOnlyViaReturn(operand.(PositionalArgumentOperand).getIndex())
256- // )
257- //}
258- //
259- //private predicate isNeverEscapesArgument(Operand operand) {
260- // exists(AliasFunction f |
261- // f = operand.getUse().(CallInstruction).getStaticCallTarget() and
262- // f.parameterNeverEscapes(operand.(PositionalArgumentOperand).getIndex())
263- // )
264- //}
243+ private predicate isAlwaysReturnedArgument ( Operand operand ) { none ( ) }
244+
245+ private predicate isOnlyEscapesViaReturnArgument ( Operand operand ) { none ( ) }
246+
247+ private predicate isNeverEscapesArgument ( Operand operand ) { none ( ) }
248+
265249private predicate resultReturned ( Instruction instr , IntValue bitOffset ) {
266250 operandReturned ( instr .getAUse ( ) , bitOffset )
267251}
0 commit comments