@@ -128,16 +128,13 @@ private module SizeBarrier {
128
128
}
129
129
130
130
/**
131
- * Holds if `left < large + state` holds if `g` evaluates to `edge`, where `large` is some
132
- * value that is equal to the size argument of an allocation.
131
+ * Holds if `left < nRight + k` holds if `g` evaluates to `edge`.
133
132
*/
134
- private predicate operandGuardChecks ( IRGuardCondition g , Operand left , int state , boolean edge ) {
135
- exists ( DataFlow:: Node nLeft , DataFlow:: Node nRight , int k |
136
- nLeft .asOperand ( ) = left and
137
- SizeBarrierConfig:: isSink ( nLeft , nRight , g , k , edge ) and
138
- state = getAFlowStateForNode ( nRight ) and
139
- k <= state
140
- )
133
+ private predicate operandGuardChecks (
134
+ IRGuardCondition g , Operand left , DataFlow:: Node right , int k , boolean edge
135
+ ) {
136
+ flowTo ( right ) and
137
+ SizeBarrierConfig:: isSink ( DataFlow:: operandNode ( left ) , right , g , k , edge )
141
138
}
142
139
143
140
/**
@@ -146,22 +143,23 @@ private module SizeBarrier {
146
143
* whether `left <= size` where `size` is the size of an allocation.
147
144
*/
148
145
Instruction getABarrierInstruction0 ( int delta , int k ) {
149
- exists ( IRGuardCondition g , ValueNumber value , Operand use , boolean edge |
150
- use = value .getAUse ( ) and
146
+ exists ( IRGuardCondition g , ValueNumber value , Operand left , boolean edge , DataFlow :: Node right |
147
+ left = value .getAUse ( ) and
151
148
// We know:
152
149
// 1. result <= value + delta (by `bounded`)
153
- // 2. value < size + k + 1 (by `operandGuardChecks`).
154
- // Condition 2 implies: value <= size + k, so if we know
150
+ // 2. value < right + k + 1 (by `operandGuardChecks`).
151
+ // Condition 2 implies: value <= right + k, so if we know
155
152
// that `state >= k + delta` then we have:
156
153
// result <= value + delta (by 1.)
157
- // <= size + k + delta (by 2.)
158
- // <= size + state (by the assumption).
154
+ // <= right + k + delta (by 2.)
155
+ // <= right + state (by the assumption).
159
156
// Callers of `getABarrierInstruction0` should ensure that `state >= k + delta`
160
157
// is satisfied.
161
- operandGuardChecks ( pragma [ only_bind_into ] ( g ) , pragma [ only_bind_into ] ( use ) ,
158
+ operandGuardChecks ( pragma [ only_bind_into ] ( g ) , pragma [ only_bind_into ] ( left ) , right ,
162
159
pragma [ only_bind_into ] ( k + 1 ) , pragma [ only_bind_into ] ( edge ) ) and
163
160
bounded ( result , value .getAnInstruction ( ) , delta ) and
164
- g .controls ( result .getBlock ( ) , edge )
161
+ g .controls ( result .getBlock ( ) , edge ) and
162
+ k + 1 <= getAFlowStateForNode ( right )
165
163
)
166
164
}
167
165
0 commit comments