001// ***** This file is automatically generated from FunctionBinary.java.jpp 002// ***** (and files it recursively includes). 003 004package daikon.inv.ternary.threeScalar; 005 006import daikon.*; 007import daikon.derive.unary.*; 008import daikon.inv.*; 009import daikon.inv.binary.twoScalar.*; 010import daikon.inv.unary.scalar.*; 011import daikon.suppress.*; 012import java.lang.reflect.*; 013import java.util.*; 014import java.util.logging.Logger; 015import org.checkerframework.checker.lock.qual.GuardSatisfied; 016import org.checkerframework.checker.nullness.qual.Nullable; 017import org.checkerframework.dataflow.qual.Pure; 018import org.checkerframework.dataflow.qual.SideEffectFree; 019import org.plumelib.util.ArraysPlume; 020import org.plumelib.util.MathPlume; 021import typequals.prototype.qual.NonPrototype; 022import typequals.prototype.qual.Prototype; 023 024/** 025 * Base class for each of the FunctionBinary functions and permutatons. Most of the work is done 026 * here. The subclasses basically define the function and return information describing the function 027 * and permutation to these methods. 028 */ 029@SuppressWarnings("UnusedVariable") // generated code, complex rules for when var is used 030public abstract class FunctionBinary extends ThreeScalar { 031 static final long serialVersionUID = 20031030L; 032 033 /** Boolean. True if FunctionBinary invariants should be considered. */ 034 public static boolean dkconfig_enabled = false; 035 036 public static Logger debug = 037 Logger.getLogger("daikon.inv.ternary.threeScalar.#CLASSNAME"); 038 039 static final int[][] var_indices; 040 static { 041 var_indices = new int[7][]; 042 var_indices[1] = new int[] { 0, 1, 2 }; 043 var_indices[2] = new int[] { 1, 0, 2 }; 044 var_indices[3] = new int[] { 2, 0, 1 }; 045 var_indices[4] = new int[] { 0, 2, 1 }; 046 var_indices[5] = new int[] { 1, 2, 0 }; 047 var_indices[6] = new int[] { 2, 1, 0 }; 048 } 049 050 protected FunctionBinary(PptSlice ppt) { 051 super(ppt); 052 } 053 054 protected @Prototype FunctionBinary() { 055 super(); 056 } 057 058 @Override 059 public boolean enabled() { 060 return dkconfig_enabled; 061 } 062 063 @Override 064 public boolean instantiate_ok(VarInfo[] vis) { 065 066 if (!valid_types(vis)) { 067 return false; 068 } 069 070 // Make sure that each variable is integral (not boolean or hashcode) 071 if (!vis[0].file_rep_type.isIntegral() 072 || !vis[1].file_rep_type.isIntegral() 073 || !vis[2].file_rep_type.isIntegral()) 074 return false; 075 076 return true; 077 } 078 079 // check_modified relies on func having no side effects. 080 abstract long func(long arg1, long arg2); 081 @Pure 082 abstract boolean is_symmetric(); 083 abstract String[] get_method_name(@GuardSatisfied FunctionBinary this); 084 abstract int get_var_order(@GuardSatisfied FunctionBinary this); 085 abstract void set_function_id(int function_id); 086 abstract int get_function_id(); 087 088 /** 089 * Map from function name (eg, MultiplyLong, MinimumFloat) to an array of instances (one for each 090 * valid permutation) for that function. 091 */ 092 private static Map<String,@Prototype FunctionBinary[]> functions = new LinkedHashMap<>(); 093 094 /** 095 * A list indexed by function number to an array of instances (one for each valid permutation) for 096 * that function. The array is the same one as is stored in the functions Map. This provides a 097 * faster access mechanism once we have the function id (which are calculated the first time 098 * through). 099 */ 100 private static List<@Prototype FunctionBinary[]> func_list = new ArrayList<>(); 101 102 private static void build_func_list() { 103 104 // Reflection seems to confuse clover 105 ///CLOVER:OFF 106 107 // Build the map of functions to array of instances for that function 108 debug.fine("Processing FunctionBinary"); 109 functions = new LinkedHashMap<>(); 110 @SuppressWarnings("unchecked") 111 Class<@Prototype FunctionBinary>[] subclasses = (Class<@Prototype FunctionBinary>[]) FunctionBinary.class.getDeclaredClasses(); 112 for (int ii = 0; ii < subclasses.length; ii++) { 113 Class<@Prototype FunctionBinary> subc = subclasses[ii]; 114 String function = subc.getName(); 115 if (function.indexOf("CLOVER") >= 0) { 116 continue; 117 } 118 function = function.replaceFirst(".*FunctionBinary\\$", ""); 119 function = function.replaceFirst("_.*", ""); 120 if (function.equals("SubClass")) { 121 continue; 122 } 123 @Prototype FunctionBinary[] fb_arr = functions.get(function); 124 if (fb_arr == null) { 125 fb_arr = new @Prototype FunctionBinary[7]; 126 functions.put(function, fb_arr); 127 func_list.add(fb_arr); 128 } 129 int func_id = func_list.indexOf(fb_arr); 130 @SuppressWarnings({"nonprototype"}) 131 @Prototype FunctionBinary fb; 132 try { 133 Constructor<@Prototype FunctionBinary> con = subc.getDeclaredConstructor(new Class<?>[] {}); 134 fb = con.newInstance(new Object[] {}); 135 } catch (Exception e) { 136 throw new Error(" can't create instance for " + subc.getName() 137 + ": '" + e + "' ii = " + ii); 138 } 139 assert fb_arr[fb.get_var_order()] == null; 140 fb_arr[fb.get_var_order()] = fb; 141 fb.set_function_id(func_id); 142 debug.fine("Adding " + function + " " + fb.getClass().getName() 143 + " " + fb.get_var_order() + " " + fb.get_function_id()); 144 } 145 ///CLOVER:ON 146 } 147 148 /** Returns a list of all of the FunctionBinary prototype invariants. */ 149 public static List<@Prototype Invariant> get_proto_all() { 150 151 List<@Prototype Invariant> result = new ArrayList<>(); 152 153 // If this is the first call 154 if (functions.isEmpty()) { 155 build_func_list(); 156 } 157 158 // Get the proto invariant for all of the subclasses and return them 159 for (@Prototype FunctionBinary[] fb_arr : func_list) { 160 for (int jj = 1; jj < fb_arr.length; jj++) { 161 @Prototype FunctionBinary fb = fb_arr[jj]; 162 if (fb != null) { 163 result.add(fb); 164 } 165 } 166 } 167 return result; 168 } 169 170 /** Permuted result var. */ 171 public VarInfo resultVar() { 172 return ppt.var_infos[var_indices[get_var_order()][0]]; 173 } 174 175 /** Permuted arg1 var. */ 176 public VarInfo argVar1() { 177 return ppt.var_infos[var_indices[get_var_order()][1]]; 178 } 179 180 /** Permuted arg2 var. */ 181 public VarInfo argVar2() { 182 return ppt.var_infos[var_indices[get_var_order()][2]]; 183 } 184 185 /** 186 * Apply the specified sample to the function, returning the result. The caller is responsible 187 * for permuting the arguments. 188 */ 189 public InvariantStatus check_ordered(long result, long arg1, 190 long arg2, int count) { 191 // This implementation relies on func having no side effects. 192 try { 193 if (!(result == func(arg1, arg2))) { 194 return InvariantStatus.FALSIFIED; 195 } 196 } catch (Exception e) { 197 return InvariantStatus.FALSIFIED; 198 } 199 return InvariantStatus.NO_CHANGE; 200 } 201 202 /** 203 * Apply the specified sample to the function, returning the result. The caller is responsible 204 * for permuting the arguments. 205 */ 206 public InvariantStatus add_ordered(long result, long arg1, 207 long arg2, int count) { 208 return check_ordered(result, arg1, arg2, count); 209 } 210 211 /** 212 * Reorganize our already-seen state as if the variables had shifted order underneath us 213 * (re-arrangement given by the permutation). We accomplish this by returning the class that 214 * corresponds to the new permutation. 215 */ 216 @Override 217 protected Invariant resurrect_done(int[] permutation) { 218 219 assert permutation.length == 3; 220 assert ArraysPlume.fnIsPermutation(permutation); 221 222 int[] new_order = new int[3]; 223 int[] old_order = var_indices[get_var_order()]; 224 225 // "permutation" is a permutation on the var_info array. old_order 226 // was the permutation that took the formatted invariant to the 227 // var_info array, so old_order^-1 is the permutation from the 228 // var_info array to the old formatted invariant. We want to find 229 // a new_order so that when we first do "permutation", then 230 // apply the new permutation from the var_info array to the 231 // formatted invariant, we get the same formatted invariant. 232 // What we want, then. is: 233 // new_order^-1 o permutation = old_order^-1 234 // rearranging, this is equivalent to 235 // new_order = permutation o old_order 236 new_order[0] = permutation[old_order[0]]; 237 new_order[1] = permutation[old_order[1]]; 238 new_order[2] = permutation[old_order[2]]; 239 240 // Force symmetric functions into a canonical form so that 241 // we can match them when necessary and they always print the same. 242 // For example, order of 0, 1, 2 and 0, 2, 1 represent the same 243 // invariant for a symmetric function. This forces them to always 244 // be represented as 0, 1, 2 245 if (is_symmetric()) { 246 if (new_order[2] < new_order[1]) { 247 int tmp = new_order[2]; 248 new_order[2] = new_order[1]; 249 new_order[1] = tmp; 250 } 251 } 252 253 // Look for the new order in the list of possible orders 254 int var_order = -1; 255 for (int i = 0; i < var_indices.length; i++) { 256 if (Arrays.equals(new_order, var_indices[i])) { 257 var_order = i; 258 break; 259 } 260 } 261 assert var_order != -1; 262 263 // If the var order hasn't changed, we don't need to do anything 264 if (var_order == get_var_order()) { 265 return this; 266 } 267 268 // Find the class that corresponds to the new order 269 if (functions.isEmpty()) { 270 build_func_list(); 271 } 272 int func_id = get_function_id(); 273 @Prototype FunctionBinary[] fb_arr = func_list.get(func_id); 274 assert fb_arr != null; 275 for (int ii = 0; ii < fb_arr.length; ii++) { 276 if ((fb_arr[ii] != null) && (fb_arr[ii].get_var_order() == var_order)) { 277 return fb_arr[ii].instantiate_dyn(ppt); 278 } 279 } 280 281 throw new Error("Could not find new ordering"); 282 } 283 284 @Override 285 public String repr(@GuardSatisfied FunctionBinary this) { 286 return format(); 287 } 288 289 @SideEffectFree 290 @Override 291 public String format_using(@GuardSatisfied FunctionBinary this, OutputFormat format) { 292 if (format == OutputFormat.SIMPLIFY) { 293 return format_simplify(); 294 } 295 if (format == OutputFormat.CSHARPCONTRACT) { 296 return format_csharp_contract(); 297 } 298 299 int var_order = get_var_order(); 300 String[] methodname = get_method_name(); 301 302 VarInfo argresultvi = ppt.var_infos[var_indices[var_order][0]]; 303 VarInfo arg1vi = ppt.var_infos[var_indices[var_order][1]]; 304 VarInfo arg2vi = ppt.var_infos[var_indices[var_order][2]]; 305 306 String argresult_name = argresultvi.name_using(format); 307 String arg1_name = arg1vi.name_using(format); 308 String arg2_name = arg2vi.name_using(format); 309 310 if (format == OutputFormat.DAIKON) { 311 return argresult_name + " == (" + methodname[0] + arg1_name 312 + methodname[1] + arg2_name + methodname[2] + ")"; 313 } 314 315 if (format.isJavaFamily()) { 316 if (methodname[1].equals(" || ") || methodname[1].equals(" && ")) { 317 return "(" + argresult_name + " != 0) == ((" + methodname[0] + arg1_name + " != 0)" 318 + methodname[1] + "(" + arg2_name + methodname[2] + " != 0))"; 319 } else { 320 return argresult_name + " == (" + methodname[0] + arg1_name 321 + methodname[1] + arg2_name + methodname[2] + ")"; 322 } 323 } 324 325 return format_unimplemented(format); 326 } 327 328 public String format_simplify(@GuardSatisfied FunctionBinary this) { 329 int var_order = get_var_order(); 330 String[] methodname = get_method_name(); 331 VarInfo[] vis = ppt.var_infos; 332 333 String result = vis[var_indices[var_order][0]].simplifyFixedupName(); 334 String arg1 = vis[var_indices[var_order][1]].simplifyFixedupName(); 335 String arg2 = vis[var_indices[var_order][2]].simplifyFixedupName(); 336 String func = null; 337 if (methodname[1].equals(" * ")) { 338 func = "*"; 339 } else if (methodname[1].equals(" | ")) { 340 func = "|java-bitwise-or|"; 341 } else if (methodname[1].equals(" || ")) { 342 func = "|java-logical-or|"; 343 } else if (methodname[1].equals(", ")) { 344 if (methodname[0].equals("java.lang.Math.min(")) { 345 func = "min"; 346 } else if (methodname[0].equals("java.lang.Math.max(")) { 347 func = "max"; 348 } else if (methodname[0].equals("org.plumelib.util.MathPlume.gcd(")) { 349 func = "gcd"; 350 } else if (methodname[0].equals("java.lang.Math.pow(")) { 351 func = "pow"; 352 } else if (methodname[0].equals("org.plumelib.util.MathPlume.logicalXor(")) { 353 func = "|java-logical-xor|"; 354 } 355 } else { 356 assert methodname[0].equals(""); 357 assert methodname[2].equals(""); 358 func = "|java-" + methodname[1].trim() + "|"; 359 } 360 if (func == null) { 361 return "format_simplify_contract() doesn't know function " + methodname[0] + "-" 362 + methodname[1] + "-" + methodname[2]; 363 } 364 return "(EQ " + result + " (" + func + " " + arg1 + " " + arg2 + "))"; 365 } 366 367 public String format_csharp_contract(@GuardSatisfied FunctionBinary this) { 368 int var_order = get_var_order(); 369 String[] methodname = get_method_name(); 370 371 VarInfo argresultvi = ppt.var_infos[var_indices[var_order][0]]; 372 VarInfo arg1vi = ppt.var_infos[var_indices[var_order][1]]; 373 VarInfo arg2vi = ppt.var_infos[var_indices[var_order][2]]; 374 String result = argresultvi.csharp_name(); 375 String arg1 = arg1vi.csharp_name(); 376 String arg2 = arg2vi.csharp_name(); 377 String operator = null; 378 379 if (methodname[1].equals(" * ")) { 380 operator = "*"; 381 } else if (methodname[1].equals(" | ")) { 382 operator = "|"; 383 } else if (methodname[1].equals(" & ")) { 384 operator = "&"; 385 } else if (methodname[1].equals(" / ")) { 386 operator = "/"; 387 } else if (methodname[1].equals(" ^ ")) { 388 operator = "^"; 389 } else if (methodname[1].equals(" % ")) { 390 operator = "%"; 391 } else if (methodname[1].equals(" && ")) { 392 operator = "&&"; 393 } else if (methodname[1].equals(" || ")) { 394 operator = "||"; 395 } else if (methodname[1].equals(" >> ")) { 396 operator = ">>"; 397 } else if (methodname[1].equals(" >>> ")) { 398 return result + " == " + arg1 + ".UnsignedRightShift(" + arg2 + ")"; 399 //return result + " == CSharpDaikonLib.Extensions.UnsignedRightShift(" + arg1 + ", " + arg2 + ")"; 400 } else if (methodname[1].equals(" << ")) { 401 operator = "<<"; 402 } 403 404 if (operator != null) { 405 return result + " == (" + arg1 + " " + operator + " " + arg2 + ")"; 406 } 407 408 String func = null; 409 if (methodname[1].equals(", ")) { 410 if (methodname[0].equals("java.lang.Math.min(")) { 411 func = "Math.Min"; 412 } else if (methodname[0].equals("java.lang.Math.max(")) { 413 func = "Math.Max"; 414 } else if (methodname[0].equals("org.plumelib.util.MathPlume.gcd(")) { 415 return result + " == CSharpDaikonLib.Extensions.GCD(" + arg1 + ", " + arg2 + ")"; 416 } else if (methodname[0].equals("java.lang.Math.pow(")) { 417 return result + " == " + arg1 + ".Pow(" + arg2 + ")"; 418 } else if (methodname[0].equals("org.plumelib.util.MathPlume.logicalXor(")) { 419 return result + " == (" + arg1 + " ^ " + arg2 + ")"; 420 } 421 } else { 422 assert methodname[0].equals(""); 423 assert methodname[2].equals(""); 424 func = "|" + methodname[1].trim() + "|"; 425 } 426 427 if (func == null) { 428 return "format_csharp_contract() doesn't know function " + methodname[0] + "-" + methodname[1] + "-" + methodname[2]; 429 } 430 return result + " == " + func + "(" + arg1 + ", " + arg2 + ")"; 431 } 432 433 // If our classes match, we must match 434 @Pure 435 @Override 436 public boolean isSameFormula(Invariant other) { 437 return true; 438 } 439 @Override 440 public double computeConfidence() { 441 if (logOn()) { 442 VarInfo v1 = ppt.var_infos[0]; 443 VarInfo v2 = ppt.var_infos[1]; 444 VarInfo v3 = ppt.var_infos[2]; 445 log("computeConfidence(%s: num_values = %s, num_values(%s)=%s, num_values(%s)=%s, num_values(%s)=%s", 446 format(), ppt.num_values(), 447 v1.name(), ppt.parent.num_values(v1), 448 v2.name(), ppt.parent.num_values(v2), 449 v3.name(), ppt.parent.num_values(v3)); 450 } 451 return Invariant.conf_is_ge(ppt.num_values(), 5); 452 } 453 454 /** If the arg is a sequence size, return the sequence; otherwise return null. */ 455 private @Nullable VarInfo sized_sequence(VarInfo size) { 456 if (size.derived instanceof SequenceLength) { 457 return ((SequenceLength)size.derived).base; 458 } 459 return null; 460 } 461 462 @Pure 463 @Override 464 public @Nullable DiscardInfo isObviousDynamically(VarInfo[] vis) { 465 466 DiscardInfo super_result = super.isObviousDynamically(vis); 467 if (super_result != null) { 468 return super_result; 469 } 470 471 // Discard if any two of the three variables are the sizes of the 472 // same arrays. 473 VarInfo arr1 = sized_sequence(vis[0]); 474 VarInfo arr2 = sized_sequence(vis[1]); 475 VarInfo arr3 = sized_sequence(vis[2]); 476 if (((arr1 != null) && (arr1 == arr2)) 477 || ((arr1 != null) && (arr1 == arr3)) 478 || ((arr2 != null) && (arr2 == arr3))) { 479 return new DiscardInfo(this, DiscardCode.obvious, 480 "two are sizes of same array: " 481 + vis[0].name() + " " 482 + vis[1].name() + " " 483 + vis[2].name()); 484 } 485 486 return null; 487 } 488 489 // default is that it is not this function, overriden in the subclass 490 @Pure 491 public boolean isMultiply() { 492 return false; 493 } 494 495/** 496 * Represents the invariant {@code x = Multiply(y, z)} over three long 497 * scalars. 498 */ 499public static class MultiplyLong_xyz extends FunctionBinary { 500 static final long serialVersionUID = 20031030L; 501 502 private static @Prototype MultiplyLong_xyz proto = new @Prototype MultiplyLong_xyz (); 503 504 /** Returns the prototype invariant for MultiplyLong_xyz */ 505 public static @Prototype MultiplyLong_xyz get_proto() { 506 return proto; 507 } 508 509 @Override 510 protected MultiplyLong_xyz instantiate_dyn(@Prototype MultiplyLong_xyz this, PptSlice slice) { 511 return new MultiplyLong_xyz (slice); 512 } 513 514 private MultiplyLong_xyz (PptSlice slice) { 515 super(slice); 516 } 517 518 public @Prototype MultiplyLong_xyz () { 519 super(); 520 } 521 522 private static String[] method_name = new String[] {"", " * ", ""}; 523 524 @Override 525 public String[] get_method_name(@GuardSatisfied MultiplyLong_xyz this) { 526 return method_name; 527 } 528 529 private static int function_id = -1; 530 531 @Override 532 public int get_function_id() { 533 return function_id; 534 } 535 536 @Override 537 public void set_function_id(int function_id) { 538 assert MultiplyLong_xyz.function_id == -1; 539 MultiplyLong_xyz.function_id = function_id; 540 } 541 542 private static int var_order = 1; 543 544 @Override 545 public int get_var_order(@GuardSatisfied MultiplyLong_xyz this) { 546 return var_order; 547 } 548 549 @Pure 550 @Override 551 public boolean is_symmetric() { 552 553 return true; 554 } 555 556 @Override 557 558 public long func(long y, long z) { 559 560 return y * z; 561 } 562 563 @Override 564 public InvariantStatus check_modified(long x, long y, 565 long z, int count) { 566 return check_ordered(x, y, z, count); 567 } 568 569 @Override 570 public InvariantStatus add_modified(long x, long y, 571 long z, int count) { 572 if (Debug.logDetail()) { 573 log("result=%s, arg1=%s, arg2=%s", x, y, z); 574 } 575 return add_ordered(x, y, z, count); 576 } 577 578 @Pure 579 @Override 580 public boolean isMultiply() { 581 return true; 582 } 583 584 @Pure 585 @Override 586 public boolean isExact() { 587 return true; 588 } 589 590 /** Returns a list of non-instantiating suppressions for this invariant. */ 591 @Pure 592 @Override 593 public @Nullable NISuppressionSet get_ni_suppressions() { 594 if (NIS.dkconfig_enabled && dkconfig_enabled) { 595 return suppressions; 596 } else { 597 return null; 598 } 599 } 600 601 /** definition of this invariant (the suppressee) */ 602 private static NISuppressee suppressee = new NISuppressee(MultiplyLong_xyz.class, 3); 603 604 // suppressor definitions (used below) 605 private static NISuppressor result_eq_arg1 = 606 new NISuppressor(0, 1, IntEqual.class); 607 private static NISuppressor result_eq_arg2 = 608 new NISuppressor(0, 2, IntEqual.class); 609 private static NISuppressor arg1_eq_arg2 = 610 new NISuppressor(1, 2, IntEqual.class); 611 612 private static NISuppressor result_lt_arg1 = 613 new NISuppressor(0, 1, IntLessThan.class); 614 private static NISuppressor result_lt_arg2 = 615 new NISuppressor(0, 2, IntLessThan.class); 616 private static NISuppressor arg1_lt_arg2 = 617 new NISuppressor(1, 2, IntLessThan.class); 618 private static NISuppressor arg2_lt_arg1 = 619 new NISuppressor(2, 1, IntLessThan.class); 620 621 private static NISuppressor result_le_arg1 = 622 new NISuppressor(0, 1, IntLessEqual.class); 623 private static NISuppressor result_le_arg2 = 624 new NISuppressor(0, 2, IntLessEqual.class); 625 private static NISuppressor arg1_le_arg2 = 626 new NISuppressor(1, 2, IntLessEqual.class); 627 private static NISuppressor arg2_le_arg1 = 628 new NISuppressor(2, 1, IntLessEqual.class); 629 630 private static NISuppressor result_track0_arg1 = 631 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 632 private static NISuppressor result_track0_arg2 = 633 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 634 private static NISuppressor arg1_track0_arg2 = 635 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 636 private static NISuppressor arg1_track0_result = 637 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 638 private static NISuppressor arg2_track0_result = 639 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 640 private static NISuppressor arg2_track0_arg1 = 641 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 642 643 private static NISuppressor result_eq_1 = 644 new NISuppressor(0, RangeInt.EqualOne.class); 645 private static NISuppressor arg1_eq_1 = 646 new NISuppressor(1, RangeInt.EqualOne.class); 647 private static NISuppressor arg2_eq_1 = 648 new NISuppressor(2, RangeInt.EqualOne.class); 649 650 private static NISuppressor result_eq_0 = 651 new NISuppressor(0, RangeInt.EqualZero.class); 652 private static NISuppressor arg1_eq_0 = 653 new NISuppressor(1, RangeInt.EqualZero.class); 654 private static NISuppressor arg2_eq_0 = 655 new NISuppressor(2, RangeInt.EqualZero.class); 656 657 private static NISuppressor result_ne_0 = 658 new NISuppressor(0, NonZero.class); 659 private static NISuppressor arg1_ne_0 = 660 new NISuppressor(1, NonZero.class); 661 private static NISuppressor arg2_ne_0 = 662 new NISuppressor(2, NonZero.class); 663 664 private static NISuppressor result_ge_0 = 665 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 666 private static NISuppressor arg1_ge_0 = 667 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 668 private static NISuppressor arg2_ge_0 = 669 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 670 671 private static NISuppressor result_ge_64 = 672 new NISuppressor(0, RangeInt.GreaterEqual64.class); 673 private static NISuppressor arg1_ge_64 = 674 new NISuppressor(1, RangeInt.GreaterEqual64.class); 675 private static NISuppressor arg2_ge_64 = 676 new NISuppressor(2, RangeInt.GreaterEqual64.class); 677 678 private static NISuppressor result_boolean = 679 new NISuppressor(0, RangeInt.BooleanVal.class); 680 private static NISuppressor arg1_boolean = 681 new NISuppressor(1, RangeInt.BooleanVal.class); 682 private static NISuppressor arg2_boolean = 683 new NISuppressor(2, RangeInt.BooleanVal.class); 684 685 private static NISuppressor result_even = 686 new NISuppressor(0, RangeInt.Even.class); 687 private static NISuppressor arg1_even = 688 new NISuppressor(1, RangeInt.Even.class); 689 private static NISuppressor arg2_even = 690 new NISuppressor(2, RangeInt.Even.class); 691 692 private static NISuppressor result_power2 = 693 new NISuppressor(0, RangeInt.PowerOfTwo.class); 694 private static NISuppressor arg1_power2 = 695 new NISuppressor(1, RangeInt.PowerOfTwo.class); 696 private static NISuppressor arg2_power2 = 697 new NISuppressor(2, RangeInt.PowerOfTwo.class); 698 699 private static NISuppressor result_and0_arg1 = 700 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 701 private static NISuppressor result_and0_arg2 = 702 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 703 private static NISuppressor arg1_and0_arg2 = 704 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 705 706 // The arguments to bitwise subset are backwards from what one 707 // might expect. The second argument is a subset of the first 708 // argument 709 private static NISuppressor arg1_bw_subset_arg2 = 710 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 711 private static NISuppressor arg2_bw_subset_arg1 = 712 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 713 714 private static NISuppressor result_shift0_arg1 = 715 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 716 private static NISuppressor result_shift0_arg2 = 717 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 718 private static NISuppressor arg1_shift0_arg2 = 719 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 720 721 private static NISuppressor arg2_divides_arg1 = 722 new NISuppressor(1, 2, NumericInt.Divides.class); 723 private static NISuppressor arg1_divides_arg2 = 724 new NISuppressor(2, 1, NumericInt.Divides.class); 725 726 private static NISuppressor arg2_valid_shift = 727 new NISuppressor(2, RangeInt.Bound0_63.class); 728 729 private static NISuppressionSet suppressions = 730 new NISuppressionSet( 731 new NISuppression[] { 732 733 // (r == 0) && (y == 0) ==> r = y * z 734 new NISuppression(result_eq_0, arg1_eq_0, suppressee), 735 736 // (r == 0) && (z == 0) ==> r = y * z 737 new NISuppression(result_eq_0, arg2_eq_0, suppressee), 738 739 // (r == y) && (z == 1) ==> r = y * z 740 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 741 742 // (r == z) && (y == 1) ==> r = y * z 743 new NISuppression(result_eq_arg2, arg1_eq_1, suppressee), 744 745 // (r == y) && (z boolean) && (z==0 ==> y==0) 746 // x = x * 0 is true if x == 0 747 // x = x * 1 is true for all x 748 new NISuppression(arg2_boolean, arg2_track0_arg1, result_eq_arg1, 749 suppressee), 750 751 // (r == z) && (y boolean) && (y==0 ==> z=0) 752 new NISuppression(result_eq_arg2, arg1_track0_arg2, arg1_boolean, 753 suppressee), 754 755 }); 756 757 // Create a suppression factory for functionBinary 758 759} 760 761/** 762 * Represents the invariant {@code y = Multiply(x, z)} over three long 763 * scalars. 764 */ 765public static class MultiplyLong_yxz extends FunctionBinary { 766 static final long serialVersionUID = 20031030L; 767 768 private static @Prototype MultiplyLong_yxz proto = new @Prototype MultiplyLong_yxz (); 769 770 /** Returns the prototype invariant for MultiplyLong_yxz */ 771 public static @Prototype MultiplyLong_yxz get_proto() { 772 return proto; 773 } 774 775 @Override 776 protected MultiplyLong_yxz instantiate_dyn(@Prototype MultiplyLong_yxz this, PptSlice slice) { 777 return new MultiplyLong_yxz (slice); 778 } 779 780 private MultiplyLong_yxz (PptSlice slice) { 781 super(slice); 782 } 783 784 public @Prototype MultiplyLong_yxz () { 785 super(); 786 } 787 788 private static String[] method_name = new String[] {"", " * ", ""}; 789 790 @Override 791 public String[] get_method_name(@GuardSatisfied MultiplyLong_yxz this) { 792 return method_name; 793 } 794 795 private static int function_id = -1; 796 797 @Override 798 public int get_function_id() { 799 return function_id; 800 } 801 802 @Override 803 public void set_function_id(int function_id) { 804 assert MultiplyLong_yxz.function_id == -1; 805 MultiplyLong_yxz.function_id = function_id; 806 } 807 808 private static int var_order = 2; 809 810 @Override 811 public int get_var_order(@GuardSatisfied MultiplyLong_yxz this) { 812 return var_order; 813 } 814 815 @Pure 816 @Override 817 public boolean is_symmetric() { 818 819 return true; 820 } 821 822 @Override 823 824 public long func(long x, long z) { 825 826 return x * z; 827 } 828 829 @Override 830 public InvariantStatus check_modified(long x, long y, 831 long z, int count) { 832 return check_ordered(y, x, z, count); 833 } 834 835 @Override 836 public InvariantStatus add_modified(long x, long y, 837 long z, int count) { 838 if (Debug.logDetail()) { 839 log("result=%s, arg1=%s, arg2=%s", y, x, z); 840 } 841 return add_ordered(y, x, z, count); 842 } 843 844 @Pure 845 @Override 846 public boolean isMultiply() { 847 return true; 848 } 849 850 @Pure 851 @Override 852 public boolean isExact() { 853 return true; 854 } 855 856 /** Returns a list of non-instantiating suppressions for this invariant. */ 857 @Pure 858 @Override 859 public @Nullable NISuppressionSet get_ni_suppressions() { 860 if (NIS.dkconfig_enabled && dkconfig_enabled) { 861 return suppressions; 862 } else { 863 return null; 864 } 865 } 866 867 /** definition of this invariant (the suppressee) */ 868 private static NISuppressee suppressee = new NISuppressee(MultiplyLong_yxz.class, 3); 869 870 // suppressor definitions (used below) 871 private static NISuppressor result_eq_arg1 = 872 new NISuppressor(1, 0, IntEqual.class); 873 private static NISuppressor result_eq_arg2 = 874 new NISuppressor(1, 2, IntEqual.class); 875 private static NISuppressor arg1_eq_arg2 = 876 new NISuppressor(0, 2, IntEqual.class); 877 878 private static NISuppressor result_lt_arg1 = 879 new NISuppressor(1, 0, IntLessThan.class); 880 private static NISuppressor result_lt_arg2 = 881 new NISuppressor(1, 2, IntLessThan.class); 882 private static NISuppressor arg1_lt_arg2 = 883 new NISuppressor(0, 2, IntLessThan.class); 884 private static NISuppressor arg2_lt_arg1 = 885 new NISuppressor(2, 0, IntLessThan.class); 886 887 private static NISuppressor result_le_arg1 = 888 new NISuppressor(1, 0, IntLessEqual.class); 889 private static NISuppressor result_le_arg2 = 890 new NISuppressor(1, 2, IntLessEqual.class); 891 private static NISuppressor arg1_le_arg2 = 892 new NISuppressor(0, 2, IntLessEqual.class); 893 private static NISuppressor arg2_le_arg1 = 894 new NISuppressor(2, 0, IntLessEqual.class); 895 896 private static NISuppressor result_track0_arg1 = 897 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 898 private static NISuppressor result_track0_arg2 = 899 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 900 private static NISuppressor arg1_track0_arg2 = 901 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 902 private static NISuppressor arg1_track0_result = 903 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 904 private static NISuppressor arg2_track0_result = 905 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 906 private static NISuppressor arg2_track0_arg1 = 907 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 908 909 private static NISuppressor result_eq_1 = 910 new NISuppressor(1, RangeInt.EqualOne.class); 911 private static NISuppressor arg1_eq_1 = 912 new NISuppressor(0, RangeInt.EqualOne.class); 913 private static NISuppressor arg2_eq_1 = 914 new NISuppressor(2, RangeInt.EqualOne.class); 915 916 private static NISuppressor result_eq_0 = 917 new NISuppressor(1, RangeInt.EqualZero.class); 918 private static NISuppressor arg1_eq_0 = 919 new NISuppressor(0, RangeInt.EqualZero.class); 920 private static NISuppressor arg2_eq_0 = 921 new NISuppressor(2, RangeInt.EqualZero.class); 922 923 private static NISuppressor result_ne_0 = 924 new NISuppressor(1, NonZero.class); 925 private static NISuppressor arg1_ne_0 = 926 new NISuppressor(0, NonZero.class); 927 private static NISuppressor arg2_ne_0 = 928 new NISuppressor(2, NonZero.class); 929 930 private static NISuppressor result_ge_0 = 931 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 932 private static NISuppressor arg1_ge_0 = 933 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 934 private static NISuppressor arg2_ge_0 = 935 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 936 937 private static NISuppressor result_ge_64 = 938 new NISuppressor(1, RangeInt.GreaterEqual64.class); 939 private static NISuppressor arg1_ge_64 = 940 new NISuppressor(0, RangeInt.GreaterEqual64.class); 941 private static NISuppressor arg2_ge_64 = 942 new NISuppressor(2, RangeInt.GreaterEqual64.class); 943 944 private static NISuppressor result_boolean = 945 new NISuppressor(1, RangeInt.BooleanVal.class); 946 private static NISuppressor arg1_boolean = 947 new NISuppressor(0, RangeInt.BooleanVal.class); 948 private static NISuppressor arg2_boolean = 949 new NISuppressor(2, RangeInt.BooleanVal.class); 950 951 private static NISuppressor result_even = 952 new NISuppressor(1, RangeInt.Even.class); 953 private static NISuppressor arg1_even = 954 new NISuppressor(0, RangeInt.Even.class); 955 private static NISuppressor arg2_even = 956 new NISuppressor(2, RangeInt.Even.class); 957 958 private static NISuppressor result_power2 = 959 new NISuppressor(1, RangeInt.PowerOfTwo.class); 960 private static NISuppressor arg1_power2 = 961 new NISuppressor(0, RangeInt.PowerOfTwo.class); 962 private static NISuppressor arg2_power2 = 963 new NISuppressor(2, RangeInt.PowerOfTwo.class); 964 965 private static NISuppressor result_and0_arg1 = 966 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 967 private static NISuppressor result_and0_arg2 = 968 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 969 private static NISuppressor arg1_and0_arg2 = 970 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 971 972 // The arguments to bitwise subset are backwards from what one 973 // might expect. The second argument is a subset of the first 974 // argument 975 private static NISuppressor arg1_bw_subset_arg2 = 976 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 977 private static NISuppressor arg2_bw_subset_arg1 = 978 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 979 980 private static NISuppressor result_shift0_arg1 = 981 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 982 private static NISuppressor result_shift0_arg2 = 983 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 984 private static NISuppressor arg1_shift0_arg2 = 985 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 986 987 private static NISuppressor arg2_divides_arg1 = 988 new NISuppressor(0, 2, NumericInt.Divides.class); 989 private static NISuppressor arg1_divides_arg2 = 990 new NISuppressor(2, 0, NumericInt.Divides.class); 991 992 private static NISuppressor arg2_valid_shift = 993 new NISuppressor(2, RangeInt.Bound0_63.class); 994 995 private static NISuppressionSet suppressions = 996 new NISuppressionSet( 997 new NISuppression[] { 998 999 // (r == 0) && (x == 0) ==> r = x * z 1000 new NISuppression(result_eq_0, arg1_eq_0, suppressee), 1001 1002 // (r == 0) && (z == 0) ==> r = x * z 1003 new NISuppression(result_eq_0, arg2_eq_0, suppressee), 1004 1005 // (r == x) && (z == 1) ==> r = x * z 1006 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 1007 1008 // (r == z) && (x == 1) ==> r = x * z 1009 new NISuppression(result_eq_arg2, arg1_eq_1, suppressee), 1010 1011 // (r == x) && (z boolean) && (z==0 ==> x==0) 1012 // x = x * 0 is true if x == 0 1013 // x = x * 1 is true for all x 1014 new NISuppression(arg2_boolean, arg2_track0_arg1, result_eq_arg1, 1015 suppressee), 1016 1017 // (r == z) && (x boolean) && (x==0 ==> z=0) 1018 new NISuppression(result_eq_arg2, arg1_track0_arg2, arg1_boolean, 1019 suppressee), 1020 1021 }); 1022 1023 // Create a suppression factory for functionBinary 1024 1025} 1026 1027/** 1028 * Represents the invariant {@code z = Multiply(x, y)} over three long 1029 * scalars. 1030 */ 1031public static class MultiplyLong_zxy extends FunctionBinary { 1032 static final long serialVersionUID = 20031030L; 1033 1034 private static @Prototype MultiplyLong_zxy proto = new @Prototype MultiplyLong_zxy (); 1035 1036 /** Returns the prototype invariant for MultiplyLong_zxy */ 1037 public static @Prototype MultiplyLong_zxy get_proto() { 1038 return proto; 1039 } 1040 1041 @Override 1042 protected MultiplyLong_zxy instantiate_dyn(@Prototype MultiplyLong_zxy this, PptSlice slice) { 1043 return new MultiplyLong_zxy (slice); 1044 } 1045 1046 private MultiplyLong_zxy (PptSlice slice) { 1047 super(slice); 1048 } 1049 1050 public @Prototype MultiplyLong_zxy () { 1051 super(); 1052 } 1053 1054 private static String[] method_name = new String[] {"", " * ", ""}; 1055 1056 @Override 1057 public String[] get_method_name(@GuardSatisfied MultiplyLong_zxy this) { 1058 return method_name; 1059 } 1060 1061 private static int function_id = -1; 1062 1063 @Override 1064 public int get_function_id() { 1065 return function_id; 1066 } 1067 1068 @Override 1069 public void set_function_id(int function_id) { 1070 assert MultiplyLong_zxy.function_id == -1; 1071 MultiplyLong_zxy.function_id = function_id; 1072 } 1073 1074 private static int var_order = 3; 1075 1076 @Override 1077 public int get_var_order(@GuardSatisfied MultiplyLong_zxy this) { 1078 return var_order; 1079 } 1080 1081 @Pure 1082 @Override 1083 public boolean is_symmetric() { 1084 1085 return true; 1086 } 1087 1088 @Override 1089 1090 public long func(long x, long y) { 1091 1092 return x * y; 1093 } 1094 1095 @Override 1096 public InvariantStatus check_modified(long x, long y, 1097 long z, int count) { 1098 return check_ordered(z, x, y, count); 1099 } 1100 1101 @Override 1102 public InvariantStatus add_modified(long x, long y, 1103 long z, int count) { 1104 if (Debug.logDetail()) { 1105 log("result=%s, arg1=%s, arg2=%s", z, x, y); 1106 } 1107 return add_ordered(z, x, y, count); 1108 } 1109 1110 @Pure 1111 @Override 1112 public boolean isMultiply() { 1113 return true; 1114 } 1115 1116 @Pure 1117 @Override 1118 public boolean isExact() { 1119 return true; 1120 } 1121 1122 /** Returns a list of non-instantiating suppressions for this invariant. */ 1123 @Pure 1124 @Override 1125 public @Nullable NISuppressionSet get_ni_suppressions() { 1126 if (NIS.dkconfig_enabled && dkconfig_enabled) { 1127 return suppressions; 1128 } else { 1129 return null; 1130 } 1131 } 1132 1133 /** definition of this invariant (the suppressee) */ 1134 private static NISuppressee suppressee = new NISuppressee(MultiplyLong_zxy.class, 3); 1135 1136 // suppressor definitions (used below) 1137 private static NISuppressor result_eq_arg1 = 1138 new NISuppressor(2, 0, IntEqual.class); 1139 private static NISuppressor result_eq_arg2 = 1140 new NISuppressor(2, 1, IntEqual.class); 1141 private static NISuppressor arg1_eq_arg2 = 1142 new NISuppressor(0, 1, IntEqual.class); 1143 1144 private static NISuppressor result_lt_arg1 = 1145 new NISuppressor(2, 0, IntLessThan.class); 1146 private static NISuppressor result_lt_arg2 = 1147 new NISuppressor(2, 1, IntLessThan.class); 1148 private static NISuppressor arg1_lt_arg2 = 1149 new NISuppressor(0, 1, IntLessThan.class); 1150 private static NISuppressor arg2_lt_arg1 = 1151 new NISuppressor(1, 0, IntLessThan.class); 1152 1153 private static NISuppressor result_le_arg1 = 1154 new NISuppressor(2, 0, IntLessEqual.class); 1155 private static NISuppressor result_le_arg2 = 1156 new NISuppressor(2, 1, IntLessEqual.class); 1157 private static NISuppressor arg1_le_arg2 = 1158 new NISuppressor(0, 1, IntLessEqual.class); 1159 private static NISuppressor arg2_le_arg1 = 1160 new NISuppressor(1, 0, IntLessEqual.class); 1161 1162 private static NISuppressor result_track0_arg1 = 1163 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 1164 private static NISuppressor result_track0_arg2 = 1165 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 1166 private static NISuppressor arg1_track0_arg2 = 1167 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 1168 private static NISuppressor arg1_track0_result = 1169 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 1170 private static NISuppressor arg2_track0_result = 1171 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 1172 private static NISuppressor arg2_track0_arg1 = 1173 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 1174 1175 private static NISuppressor result_eq_1 = 1176 new NISuppressor(2, RangeInt.EqualOne.class); 1177 private static NISuppressor arg1_eq_1 = 1178 new NISuppressor(0, RangeInt.EqualOne.class); 1179 private static NISuppressor arg2_eq_1 = 1180 new NISuppressor(1, RangeInt.EqualOne.class); 1181 1182 private static NISuppressor result_eq_0 = 1183 new NISuppressor(2, RangeInt.EqualZero.class); 1184 private static NISuppressor arg1_eq_0 = 1185 new NISuppressor(0, RangeInt.EqualZero.class); 1186 private static NISuppressor arg2_eq_0 = 1187 new NISuppressor(1, RangeInt.EqualZero.class); 1188 1189 private static NISuppressor result_ne_0 = 1190 new NISuppressor(2, NonZero.class); 1191 private static NISuppressor arg1_ne_0 = 1192 new NISuppressor(0, NonZero.class); 1193 private static NISuppressor arg2_ne_0 = 1194 new NISuppressor(1, NonZero.class); 1195 1196 private static NISuppressor result_ge_0 = 1197 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 1198 private static NISuppressor arg1_ge_0 = 1199 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 1200 private static NISuppressor arg2_ge_0 = 1201 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 1202 1203 private static NISuppressor result_ge_64 = 1204 new NISuppressor(2, RangeInt.GreaterEqual64.class); 1205 private static NISuppressor arg1_ge_64 = 1206 new NISuppressor(0, RangeInt.GreaterEqual64.class); 1207 private static NISuppressor arg2_ge_64 = 1208 new NISuppressor(1, RangeInt.GreaterEqual64.class); 1209 1210 private static NISuppressor result_boolean = 1211 new NISuppressor(2, RangeInt.BooleanVal.class); 1212 private static NISuppressor arg1_boolean = 1213 new NISuppressor(0, RangeInt.BooleanVal.class); 1214 private static NISuppressor arg2_boolean = 1215 new NISuppressor(1, RangeInt.BooleanVal.class); 1216 1217 private static NISuppressor result_even = 1218 new NISuppressor(2, RangeInt.Even.class); 1219 private static NISuppressor arg1_even = 1220 new NISuppressor(0, RangeInt.Even.class); 1221 private static NISuppressor arg2_even = 1222 new NISuppressor(1, RangeInt.Even.class); 1223 1224 private static NISuppressor result_power2 = 1225 new NISuppressor(2, RangeInt.PowerOfTwo.class); 1226 private static NISuppressor arg1_power2 = 1227 new NISuppressor(0, RangeInt.PowerOfTwo.class); 1228 private static NISuppressor arg2_power2 = 1229 new NISuppressor(1, RangeInt.PowerOfTwo.class); 1230 1231 private static NISuppressor result_and0_arg1 = 1232 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 1233 private static NISuppressor result_and0_arg2 = 1234 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 1235 private static NISuppressor arg1_and0_arg2 = 1236 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 1237 1238 // The arguments to bitwise subset are backwards from what one 1239 // might expect. The second argument is a subset of the first 1240 // argument 1241 private static NISuppressor arg1_bw_subset_arg2 = 1242 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 1243 private static NISuppressor arg2_bw_subset_arg1 = 1244 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 1245 1246 private static NISuppressor result_shift0_arg1 = 1247 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 1248 private static NISuppressor result_shift0_arg2 = 1249 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 1250 private static NISuppressor arg1_shift0_arg2 = 1251 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 1252 1253 private static NISuppressor arg2_divides_arg1 = 1254 new NISuppressor(0, 1, NumericInt.Divides.class); 1255 private static NISuppressor arg1_divides_arg2 = 1256 new NISuppressor(1, 0, NumericInt.Divides.class); 1257 1258 private static NISuppressor arg2_valid_shift = 1259 new NISuppressor(1, RangeInt.Bound0_63.class); 1260 1261 private static NISuppressionSet suppressions = 1262 new NISuppressionSet( 1263 new NISuppression[] { 1264 1265 // (r == 0) && (x == 0) ==> r = x * y 1266 new NISuppression(result_eq_0, arg1_eq_0, suppressee), 1267 1268 // (r == 0) && (y == 0) ==> r = x * y 1269 new NISuppression(result_eq_0, arg2_eq_0, suppressee), 1270 1271 // (r == x) && (y == 1) ==> r = x * y 1272 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 1273 1274 // (r == y) && (x == 1) ==> r = x * y 1275 new NISuppression(result_eq_arg2, arg1_eq_1, suppressee), 1276 1277 // (r == x) && (y boolean) && (y==0 ==> x==0) 1278 // x = x * 0 is true if x == 0 1279 // x = x * 1 is true for all x 1280 new NISuppression(arg2_boolean, arg2_track0_arg1, result_eq_arg1, 1281 suppressee), 1282 1283 // (r == y) && (x boolean) && (x==0 ==> y=0) 1284 new NISuppression(result_eq_arg2, arg1_track0_arg2, arg1_boolean, 1285 suppressee), 1286 1287 }); 1288 1289 // Create a suppression factory for functionBinary 1290 1291} 1292 1293 // #define EQUALITY_MIN_MAX_SUPPRESS 1294 1295 // default is that it is not this function, overriden in the subclass 1296 @Pure 1297 public boolean isMinimum() { 1298 return false; 1299 } 1300 1301/** 1302 * Represents the invariant {@code x = Minimum(y, z)} over three long 1303 * scalars. 1304 */ 1305public static class MinimumLong_xyz extends FunctionBinary { 1306 static final long serialVersionUID = 20031030L; 1307 1308 private static @Prototype MinimumLong_xyz proto = new @Prototype MinimumLong_xyz (); 1309 1310 /** Returns the prototype invariant for MinimumLong_xyz */ 1311 public static @Prototype MinimumLong_xyz get_proto() { 1312 return proto; 1313 } 1314 1315 @Override 1316 protected MinimumLong_xyz instantiate_dyn(@Prototype MinimumLong_xyz this, PptSlice slice) { 1317 return new MinimumLong_xyz (slice); 1318 } 1319 1320 private MinimumLong_xyz (PptSlice slice) { 1321 super(slice); 1322 } 1323 1324 public @Prototype MinimumLong_xyz () { 1325 super(); 1326 } 1327 1328 private static String[] method_name = new String[] {"java.lang.Math.min(", ", ", ")"}; 1329 1330 @Override 1331 public String[] get_method_name(@GuardSatisfied MinimumLong_xyz this) { 1332 return method_name; 1333 } 1334 1335 private static int function_id = -1; 1336 1337 @Override 1338 public int get_function_id() { 1339 return function_id; 1340 } 1341 1342 @Override 1343 public void set_function_id(int function_id) { 1344 assert MinimumLong_xyz.function_id == -1; 1345 MinimumLong_xyz.function_id = function_id; 1346 } 1347 1348 private static int var_order = 1; 1349 1350 @Override 1351 public int get_var_order(@GuardSatisfied MinimumLong_xyz this) { 1352 return var_order; 1353 } 1354 1355 @Pure 1356 @Override 1357 public boolean is_symmetric() { 1358 1359 return true; 1360 } 1361 1362 @Override 1363 1364 public long func(long y, long z) { 1365 1366 return Math.min(y, z); 1367 } 1368 1369 @Override 1370 public InvariantStatus check_modified(long x, long y, 1371 long z, int count) { 1372 return check_ordered(x, y, z, count); 1373 } 1374 1375 @Override 1376 public InvariantStatus add_modified(long x, long y, 1377 long z, int count) { 1378 if (Debug.logDetail()) { 1379 log("result=%s, arg1=%s, arg2=%s", x, y, z); 1380 } 1381 return add_ordered(x, y, z, count); 1382 } 1383 1384 @Pure 1385 @Override 1386 public boolean isMinimum() { 1387 return true; 1388 } 1389 1390 /** Returns a list of non-instantiating suppressions for this invariant. */ 1391 @Pure 1392 @Override 1393 public @Nullable NISuppressionSet get_ni_suppressions() { 1394 if (NIS.dkconfig_enabled && dkconfig_enabled) { 1395 return suppressions; 1396 } else { 1397 return null; 1398 } 1399 } 1400 1401 /** definition of this invariant (the suppressee) */ 1402 private static NISuppressee suppressee = new NISuppressee(MinimumLong_xyz.class, 3); 1403 1404 // suppressor definitions (used below) 1405 private static NISuppressor result_eq_arg1 = 1406 new NISuppressor(0, 1, IntEqual.class); 1407 private static NISuppressor result_eq_arg2 = 1408 new NISuppressor(0, 2, IntEqual.class); 1409 private static NISuppressor arg1_eq_arg2 = 1410 new NISuppressor(1, 2, IntEqual.class); 1411 1412 private static NISuppressor result_lt_arg1 = 1413 new NISuppressor(0, 1, IntLessThan.class); 1414 private static NISuppressor result_lt_arg2 = 1415 new NISuppressor(0, 2, IntLessThan.class); 1416 private static NISuppressor arg1_lt_arg2 = 1417 new NISuppressor(1, 2, IntLessThan.class); 1418 private static NISuppressor arg2_lt_arg1 = 1419 new NISuppressor(2, 1, IntLessThan.class); 1420 1421 private static NISuppressor result_le_arg1 = 1422 new NISuppressor(0, 1, IntLessEqual.class); 1423 private static NISuppressor result_le_arg2 = 1424 new NISuppressor(0, 2, IntLessEqual.class); 1425 private static NISuppressor arg1_le_arg2 = 1426 new NISuppressor(1, 2, IntLessEqual.class); 1427 private static NISuppressor arg2_le_arg1 = 1428 new NISuppressor(2, 1, IntLessEqual.class); 1429 1430 private static NISuppressor result_track0_arg1 = 1431 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 1432 private static NISuppressor result_track0_arg2 = 1433 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 1434 private static NISuppressor arg1_track0_arg2 = 1435 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 1436 private static NISuppressor arg1_track0_result = 1437 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 1438 private static NISuppressor arg2_track0_result = 1439 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 1440 private static NISuppressor arg2_track0_arg1 = 1441 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 1442 1443 private static NISuppressor result_eq_1 = 1444 new NISuppressor(0, RangeInt.EqualOne.class); 1445 private static NISuppressor arg1_eq_1 = 1446 new NISuppressor(1, RangeInt.EqualOne.class); 1447 private static NISuppressor arg2_eq_1 = 1448 new NISuppressor(2, RangeInt.EqualOne.class); 1449 1450 private static NISuppressor result_eq_0 = 1451 new NISuppressor(0, RangeInt.EqualZero.class); 1452 private static NISuppressor arg1_eq_0 = 1453 new NISuppressor(1, RangeInt.EqualZero.class); 1454 private static NISuppressor arg2_eq_0 = 1455 new NISuppressor(2, RangeInt.EqualZero.class); 1456 1457 private static NISuppressor result_ne_0 = 1458 new NISuppressor(0, NonZero.class); 1459 private static NISuppressor arg1_ne_0 = 1460 new NISuppressor(1, NonZero.class); 1461 private static NISuppressor arg2_ne_0 = 1462 new NISuppressor(2, NonZero.class); 1463 1464 private static NISuppressor result_ge_0 = 1465 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 1466 private static NISuppressor arg1_ge_0 = 1467 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 1468 private static NISuppressor arg2_ge_0 = 1469 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 1470 1471 private static NISuppressor result_ge_64 = 1472 new NISuppressor(0, RangeInt.GreaterEqual64.class); 1473 private static NISuppressor arg1_ge_64 = 1474 new NISuppressor(1, RangeInt.GreaterEqual64.class); 1475 private static NISuppressor arg2_ge_64 = 1476 new NISuppressor(2, RangeInt.GreaterEqual64.class); 1477 1478 private static NISuppressor result_boolean = 1479 new NISuppressor(0, RangeInt.BooleanVal.class); 1480 private static NISuppressor arg1_boolean = 1481 new NISuppressor(1, RangeInt.BooleanVal.class); 1482 private static NISuppressor arg2_boolean = 1483 new NISuppressor(2, RangeInt.BooleanVal.class); 1484 1485 private static NISuppressor result_even = 1486 new NISuppressor(0, RangeInt.Even.class); 1487 private static NISuppressor arg1_even = 1488 new NISuppressor(1, RangeInt.Even.class); 1489 private static NISuppressor arg2_even = 1490 new NISuppressor(2, RangeInt.Even.class); 1491 1492 private static NISuppressor result_power2 = 1493 new NISuppressor(0, RangeInt.PowerOfTwo.class); 1494 private static NISuppressor arg1_power2 = 1495 new NISuppressor(1, RangeInt.PowerOfTwo.class); 1496 private static NISuppressor arg2_power2 = 1497 new NISuppressor(2, RangeInt.PowerOfTwo.class); 1498 1499 private static NISuppressor result_and0_arg1 = 1500 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 1501 private static NISuppressor result_and0_arg2 = 1502 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 1503 private static NISuppressor arg1_and0_arg2 = 1504 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 1505 1506 // The arguments to bitwise subset are backwards from what one 1507 // might expect. The second argument is a subset of the first 1508 // argument 1509 private static NISuppressor arg1_bw_subset_arg2 = 1510 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 1511 private static NISuppressor arg2_bw_subset_arg1 = 1512 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 1513 1514 private static NISuppressor result_shift0_arg1 = 1515 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 1516 private static NISuppressor result_shift0_arg2 = 1517 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 1518 private static NISuppressor arg1_shift0_arg2 = 1519 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 1520 1521 private static NISuppressor arg2_divides_arg1 = 1522 new NISuppressor(1, 2, NumericInt.Divides.class); 1523 private static NISuppressor arg1_divides_arg2 = 1524 new NISuppressor(2, 1, NumericInt.Divides.class); 1525 1526 private static NISuppressor arg2_valid_shift = 1527 new NISuppressor(2, RangeInt.Bound0_63.class); 1528 1529 private static NISuppressionSet suppressions = 1530 new NISuppressionSet( 1531 new NISuppression[] { 1532 1533 // (x == y) && (y <= z) ==> r = min(y, z) 1534 new NISuppression(result_eq_arg1, arg1_le_arg2, suppressee), 1535 1536 // (x == z) && (z <= y) ==> r = min(y, z) 1537 new NISuppression(result_eq_arg2, arg2_le_arg1, suppressee), 1538 1539 // (x boolean) && (y=0 <==> r=0) && (z == 1) 1540 // 0 = min (y, 1), true when (y == 0) 1541 // 1 = min (y, 1), true when (y > 0) 1542 new NISuppression(result_track0_arg1, arg1_track0_result, 1543 result_boolean, arg1_ge_0, arg2_eq_1, suppressee), 1544 1545 // (x boolean) && (z=0 <==> r=0) && (y == 1) 1546 new NISuppression(result_track0_arg2, arg2_track0_result, 1547 result_boolean, arg2_ge_0, arg1_eq_1, suppressee), 1548 1549 }); 1550 1551 // Create a suppression factory for functionBinary 1552 1553} 1554 1555/** 1556 * Represents the invariant {@code y = Minimum(x, z)} over three long 1557 * scalars. 1558 */ 1559public static class MinimumLong_yxz extends FunctionBinary { 1560 static final long serialVersionUID = 20031030L; 1561 1562 private static @Prototype MinimumLong_yxz proto = new @Prototype MinimumLong_yxz (); 1563 1564 /** Returns the prototype invariant for MinimumLong_yxz */ 1565 public static @Prototype MinimumLong_yxz get_proto() { 1566 return proto; 1567 } 1568 1569 @Override 1570 protected MinimumLong_yxz instantiate_dyn(@Prototype MinimumLong_yxz this, PptSlice slice) { 1571 return new MinimumLong_yxz (slice); 1572 } 1573 1574 private MinimumLong_yxz (PptSlice slice) { 1575 super(slice); 1576 } 1577 1578 public @Prototype MinimumLong_yxz () { 1579 super(); 1580 } 1581 1582 private static String[] method_name = new String[] {"java.lang.Math.min(", ", ", ")"}; 1583 1584 @Override 1585 public String[] get_method_name(@GuardSatisfied MinimumLong_yxz this) { 1586 return method_name; 1587 } 1588 1589 private static int function_id = -1; 1590 1591 @Override 1592 public int get_function_id() { 1593 return function_id; 1594 } 1595 1596 @Override 1597 public void set_function_id(int function_id) { 1598 assert MinimumLong_yxz.function_id == -1; 1599 MinimumLong_yxz.function_id = function_id; 1600 } 1601 1602 private static int var_order = 2; 1603 1604 @Override 1605 public int get_var_order(@GuardSatisfied MinimumLong_yxz this) { 1606 return var_order; 1607 } 1608 1609 @Pure 1610 @Override 1611 public boolean is_symmetric() { 1612 1613 return true; 1614 } 1615 1616 @Override 1617 1618 public long func(long x, long z) { 1619 1620 return Math.min(x, z); 1621 } 1622 1623 @Override 1624 public InvariantStatus check_modified(long x, long y, 1625 long z, int count) { 1626 return check_ordered(y, x, z, count); 1627 } 1628 1629 @Override 1630 public InvariantStatus add_modified(long x, long y, 1631 long z, int count) { 1632 if (Debug.logDetail()) { 1633 log("result=%s, arg1=%s, arg2=%s", y, x, z); 1634 } 1635 return add_ordered(y, x, z, count); 1636 } 1637 1638 @Pure 1639 @Override 1640 public boolean isMinimum() { 1641 return true; 1642 } 1643 1644 /** Returns a list of non-instantiating suppressions for this invariant. */ 1645 @Pure 1646 @Override 1647 public @Nullable NISuppressionSet get_ni_suppressions() { 1648 if (NIS.dkconfig_enabled && dkconfig_enabled) { 1649 return suppressions; 1650 } else { 1651 return null; 1652 } 1653 } 1654 1655 /** definition of this invariant (the suppressee) */ 1656 private static NISuppressee suppressee = new NISuppressee(MinimumLong_yxz.class, 3); 1657 1658 // suppressor definitions (used below) 1659 private static NISuppressor result_eq_arg1 = 1660 new NISuppressor(1, 0, IntEqual.class); 1661 private static NISuppressor result_eq_arg2 = 1662 new NISuppressor(1, 2, IntEqual.class); 1663 private static NISuppressor arg1_eq_arg2 = 1664 new NISuppressor(0, 2, IntEqual.class); 1665 1666 private static NISuppressor result_lt_arg1 = 1667 new NISuppressor(1, 0, IntLessThan.class); 1668 private static NISuppressor result_lt_arg2 = 1669 new NISuppressor(1, 2, IntLessThan.class); 1670 private static NISuppressor arg1_lt_arg2 = 1671 new NISuppressor(0, 2, IntLessThan.class); 1672 private static NISuppressor arg2_lt_arg1 = 1673 new NISuppressor(2, 0, IntLessThan.class); 1674 1675 private static NISuppressor result_le_arg1 = 1676 new NISuppressor(1, 0, IntLessEqual.class); 1677 private static NISuppressor result_le_arg2 = 1678 new NISuppressor(1, 2, IntLessEqual.class); 1679 private static NISuppressor arg1_le_arg2 = 1680 new NISuppressor(0, 2, IntLessEqual.class); 1681 private static NISuppressor arg2_le_arg1 = 1682 new NISuppressor(2, 0, IntLessEqual.class); 1683 1684 private static NISuppressor result_track0_arg1 = 1685 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 1686 private static NISuppressor result_track0_arg2 = 1687 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 1688 private static NISuppressor arg1_track0_arg2 = 1689 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 1690 private static NISuppressor arg1_track0_result = 1691 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 1692 private static NISuppressor arg2_track0_result = 1693 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 1694 private static NISuppressor arg2_track0_arg1 = 1695 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 1696 1697 private static NISuppressor result_eq_1 = 1698 new NISuppressor(1, RangeInt.EqualOne.class); 1699 private static NISuppressor arg1_eq_1 = 1700 new NISuppressor(0, RangeInt.EqualOne.class); 1701 private static NISuppressor arg2_eq_1 = 1702 new NISuppressor(2, RangeInt.EqualOne.class); 1703 1704 private static NISuppressor result_eq_0 = 1705 new NISuppressor(1, RangeInt.EqualZero.class); 1706 private static NISuppressor arg1_eq_0 = 1707 new NISuppressor(0, RangeInt.EqualZero.class); 1708 private static NISuppressor arg2_eq_0 = 1709 new NISuppressor(2, RangeInt.EqualZero.class); 1710 1711 private static NISuppressor result_ne_0 = 1712 new NISuppressor(1, NonZero.class); 1713 private static NISuppressor arg1_ne_0 = 1714 new NISuppressor(0, NonZero.class); 1715 private static NISuppressor arg2_ne_0 = 1716 new NISuppressor(2, NonZero.class); 1717 1718 private static NISuppressor result_ge_0 = 1719 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 1720 private static NISuppressor arg1_ge_0 = 1721 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 1722 private static NISuppressor arg2_ge_0 = 1723 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 1724 1725 private static NISuppressor result_ge_64 = 1726 new NISuppressor(1, RangeInt.GreaterEqual64.class); 1727 private static NISuppressor arg1_ge_64 = 1728 new NISuppressor(0, RangeInt.GreaterEqual64.class); 1729 private static NISuppressor arg2_ge_64 = 1730 new NISuppressor(2, RangeInt.GreaterEqual64.class); 1731 1732 private static NISuppressor result_boolean = 1733 new NISuppressor(1, RangeInt.BooleanVal.class); 1734 private static NISuppressor arg1_boolean = 1735 new NISuppressor(0, RangeInt.BooleanVal.class); 1736 private static NISuppressor arg2_boolean = 1737 new NISuppressor(2, RangeInt.BooleanVal.class); 1738 1739 private static NISuppressor result_even = 1740 new NISuppressor(1, RangeInt.Even.class); 1741 private static NISuppressor arg1_even = 1742 new NISuppressor(0, RangeInt.Even.class); 1743 private static NISuppressor arg2_even = 1744 new NISuppressor(2, RangeInt.Even.class); 1745 1746 private static NISuppressor result_power2 = 1747 new NISuppressor(1, RangeInt.PowerOfTwo.class); 1748 private static NISuppressor arg1_power2 = 1749 new NISuppressor(0, RangeInt.PowerOfTwo.class); 1750 private static NISuppressor arg2_power2 = 1751 new NISuppressor(2, RangeInt.PowerOfTwo.class); 1752 1753 private static NISuppressor result_and0_arg1 = 1754 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 1755 private static NISuppressor result_and0_arg2 = 1756 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 1757 private static NISuppressor arg1_and0_arg2 = 1758 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 1759 1760 // The arguments to bitwise subset are backwards from what one 1761 // might expect. The second argument is a subset of the first 1762 // argument 1763 private static NISuppressor arg1_bw_subset_arg2 = 1764 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 1765 private static NISuppressor arg2_bw_subset_arg1 = 1766 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 1767 1768 private static NISuppressor result_shift0_arg1 = 1769 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 1770 private static NISuppressor result_shift0_arg2 = 1771 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 1772 private static NISuppressor arg1_shift0_arg2 = 1773 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 1774 1775 private static NISuppressor arg2_divides_arg1 = 1776 new NISuppressor(0, 2, NumericInt.Divides.class); 1777 private static NISuppressor arg1_divides_arg2 = 1778 new NISuppressor(2, 0, NumericInt.Divides.class); 1779 1780 private static NISuppressor arg2_valid_shift = 1781 new NISuppressor(2, RangeInt.Bound0_63.class); 1782 1783 private static NISuppressionSet suppressions = 1784 new NISuppressionSet( 1785 new NISuppression[] { 1786 1787 // (y == x) && (x <= z) ==> r = min(x, z) 1788 new NISuppression(result_eq_arg1, arg1_le_arg2, suppressee), 1789 1790 // (y == z) && (z <= x) ==> r = min(x, z) 1791 new NISuppression(result_eq_arg2, arg2_le_arg1, suppressee), 1792 1793 // (y boolean) && (x=0 <==> r=0) && (z == 1) 1794 // 0 = min (x, 1), true when (x == 0) 1795 // 1 = min (x, 1), true when (x > 0) 1796 new NISuppression(result_track0_arg1, arg1_track0_result, 1797 result_boolean, arg1_ge_0, arg2_eq_1, suppressee), 1798 1799 // (y boolean) && (z=0 <==> r=0) && (x == 1) 1800 new NISuppression(result_track0_arg2, arg2_track0_result, 1801 result_boolean, arg2_ge_0, arg1_eq_1, suppressee), 1802 1803 }); 1804 1805 // Create a suppression factory for functionBinary 1806 1807} 1808 1809/** 1810 * Represents the invariant {@code z = Minimum(x, y)} over three long 1811 * scalars. 1812 */ 1813public static class MinimumLong_zxy extends FunctionBinary { 1814 static final long serialVersionUID = 20031030L; 1815 1816 private static @Prototype MinimumLong_zxy proto = new @Prototype MinimumLong_zxy (); 1817 1818 /** Returns the prototype invariant for MinimumLong_zxy */ 1819 public static @Prototype MinimumLong_zxy get_proto() { 1820 return proto; 1821 } 1822 1823 @Override 1824 protected MinimumLong_zxy instantiate_dyn(@Prototype MinimumLong_zxy this, PptSlice slice) { 1825 return new MinimumLong_zxy (slice); 1826 } 1827 1828 private MinimumLong_zxy (PptSlice slice) { 1829 super(slice); 1830 } 1831 1832 public @Prototype MinimumLong_zxy () { 1833 super(); 1834 } 1835 1836 private static String[] method_name = new String[] {"java.lang.Math.min(", ", ", ")"}; 1837 1838 @Override 1839 public String[] get_method_name(@GuardSatisfied MinimumLong_zxy this) { 1840 return method_name; 1841 } 1842 1843 private static int function_id = -1; 1844 1845 @Override 1846 public int get_function_id() { 1847 return function_id; 1848 } 1849 1850 @Override 1851 public void set_function_id(int function_id) { 1852 assert MinimumLong_zxy.function_id == -1; 1853 MinimumLong_zxy.function_id = function_id; 1854 } 1855 1856 private static int var_order = 3; 1857 1858 @Override 1859 public int get_var_order(@GuardSatisfied MinimumLong_zxy this) { 1860 return var_order; 1861 } 1862 1863 @Pure 1864 @Override 1865 public boolean is_symmetric() { 1866 1867 return true; 1868 } 1869 1870 @Override 1871 1872 public long func(long x, long y) { 1873 1874 return Math.min(x, y); 1875 } 1876 1877 @Override 1878 public InvariantStatus check_modified(long x, long y, 1879 long z, int count) { 1880 return check_ordered(z, x, y, count); 1881 } 1882 1883 @Override 1884 public InvariantStatus add_modified(long x, long y, 1885 long z, int count) { 1886 if (Debug.logDetail()) { 1887 log("result=%s, arg1=%s, arg2=%s", z, x, y); 1888 } 1889 return add_ordered(z, x, y, count); 1890 } 1891 1892 @Pure 1893 @Override 1894 public boolean isMinimum() { 1895 return true; 1896 } 1897 1898 /** Returns a list of non-instantiating suppressions for this invariant. */ 1899 @Pure 1900 @Override 1901 public @Nullable NISuppressionSet get_ni_suppressions() { 1902 if (NIS.dkconfig_enabled && dkconfig_enabled) { 1903 return suppressions; 1904 } else { 1905 return null; 1906 } 1907 } 1908 1909 /** definition of this invariant (the suppressee) */ 1910 private static NISuppressee suppressee = new NISuppressee(MinimumLong_zxy.class, 3); 1911 1912 // suppressor definitions (used below) 1913 private static NISuppressor result_eq_arg1 = 1914 new NISuppressor(2, 0, IntEqual.class); 1915 private static NISuppressor result_eq_arg2 = 1916 new NISuppressor(2, 1, IntEqual.class); 1917 private static NISuppressor arg1_eq_arg2 = 1918 new NISuppressor(0, 1, IntEqual.class); 1919 1920 private static NISuppressor result_lt_arg1 = 1921 new NISuppressor(2, 0, IntLessThan.class); 1922 private static NISuppressor result_lt_arg2 = 1923 new NISuppressor(2, 1, IntLessThan.class); 1924 private static NISuppressor arg1_lt_arg2 = 1925 new NISuppressor(0, 1, IntLessThan.class); 1926 private static NISuppressor arg2_lt_arg1 = 1927 new NISuppressor(1, 0, IntLessThan.class); 1928 1929 private static NISuppressor result_le_arg1 = 1930 new NISuppressor(2, 0, IntLessEqual.class); 1931 private static NISuppressor result_le_arg2 = 1932 new NISuppressor(2, 1, IntLessEqual.class); 1933 private static NISuppressor arg1_le_arg2 = 1934 new NISuppressor(0, 1, IntLessEqual.class); 1935 private static NISuppressor arg2_le_arg1 = 1936 new NISuppressor(1, 0, IntLessEqual.class); 1937 1938 private static NISuppressor result_track0_arg1 = 1939 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 1940 private static NISuppressor result_track0_arg2 = 1941 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 1942 private static NISuppressor arg1_track0_arg2 = 1943 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 1944 private static NISuppressor arg1_track0_result = 1945 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 1946 private static NISuppressor arg2_track0_result = 1947 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 1948 private static NISuppressor arg2_track0_arg1 = 1949 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 1950 1951 private static NISuppressor result_eq_1 = 1952 new NISuppressor(2, RangeInt.EqualOne.class); 1953 private static NISuppressor arg1_eq_1 = 1954 new NISuppressor(0, RangeInt.EqualOne.class); 1955 private static NISuppressor arg2_eq_1 = 1956 new NISuppressor(1, RangeInt.EqualOne.class); 1957 1958 private static NISuppressor result_eq_0 = 1959 new NISuppressor(2, RangeInt.EqualZero.class); 1960 private static NISuppressor arg1_eq_0 = 1961 new NISuppressor(0, RangeInt.EqualZero.class); 1962 private static NISuppressor arg2_eq_0 = 1963 new NISuppressor(1, RangeInt.EqualZero.class); 1964 1965 private static NISuppressor result_ne_0 = 1966 new NISuppressor(2, NonZero.class); 1967 private static NISuppressor arg1_ne_0 = 1968 new NISuppressor(0, NonZero.class); 1969 private static NISuppressor arg2_ne_0 = 1970 new NISuppressor(1, NonZero.class); 1971 1972 private static NISuppressor result_ge_0 = 1973 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 1974 private static NISuppressor arg1_ge_0 = 1975 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 1976 private static NISuppressor arg2_ge_0 = 1977 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 1978 1979 private static NISuppressor result_ge_64 = 1980 new NISuppressor(2, RangeInt.GreaterEqual64.class); 1981 private static NISuppressor arg1_ge_64 = 1982 new NISuppressor(0, RangeInt.GreaterEqual64.class); 1983 private static NISuppressor arg2_ge_64 = 1984 new NISuppressor(1, RangeInt.GreaterEqual64.class); 1985 1986 private static NISuppressor result_boolean = 1987 new NISuppressor(2, RangeInt.BooleanVal.class); 1988 private static NISuppressor arg1_boolean = 1989 new NISuppressor(0, RangeInt.BooleanVal.class); 1990 private static NISuppressor arg2_boolean = 1991 new NISuppressor(1, RangeInt.BooleanVal.class); 1992 1993 private static NISuppressor result_even = 1994 new NISuppressor(2, RangeInt.Even.class); 1995 private static NISuppressor arg1_even = 1996 new NISuppressor(0, RangeInt.Even.class); 1997 private static NISuppressor arg2_even = 1998 new NISuppressor(1, RangeInt.Even.class); 1999 2000 private static NISuppressor result_power2 = 2001 new NISuppressor(2, RangeInt.PowerOfTwo.class); 2002 private static NISuppressor arg1_power2 = 2003 new NISuppressor(0, RangeInt.PowerOfTwo.class); 2004 private static NISuppressor arg2_power2 = 2005 new NISuppressor(1, RangeInt.PowerOfTwo.class); 2006 2007 private static NISuppressor result_and0_arg1 = 2008 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 2009 private static NISuppressor result_and0_arg2 = 2010 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 2011 private static NISuppressor arg1_and0_arg2 = 2012 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 2013 2014 // The arguments to bitwise subset are backwards from what one 2015 // might expect. The second argument is a subset of the first 2016 // argument 2017 private static NISuppressor arg1_bw_subset_arg2 = 2018 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 2019 private static NISuppressor arg2_bw_subset_arg1 = 2020 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 2021 2022 private static NISuppressor result_shift0_arg1 = 2023 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 2024 private static NISuppressor result_shift0_arg2 = 2025 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 2026 private static NISuppressor arg1_shift0_arg2 = 2027 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 2028 2029 private static NISuppressor arg2_divides_arg1 = 2030 new NISuppressor(0, 1, NumericInt.Divides.class); 2031 private static NISuppressor arg1_divides_arg2 = 2032 new NISuppressor(1, 0, NumericInt.Divides.class); 2033 2034 private static NISuppressor arg2_valid_shift = 2035 new NISuppressor(1, RangeInt.Bound0_63.class); 2036 2037 private static NISuppressionSet suppressions = 2038 new NISuppressionSet( 2039 new NISuppression[] { 2040 2041 // (z == x) && (x <= y) ==> r = min(x, y) 2042 new NISuppression(result_eq_arg1, arg1_le_arg2, suppressee), 2043 2044 // (z == y) && (y <= x) ==> r = min(x, y) 2045 new NISuppression(result_eq_arg2, arg2_le_arg1, suppressee), 2046 2047 // (z boolean) && (x=0 <==> r=0) && (y == 1) 2048 // 0 = min (x, 1), true when (x == 0) 2049 // 1 = min (x, 1), true when (x > 0) 2050 new NISuppression(result_track0_arg1, arg1_track0_result, 2051 result_boolean, arg1_ge_0, arg2_eq_1, suppressee), 2052 2053 // (z boolean) && (y=0 <==> r=0) && (x == 1) 2054 new NISuppression(result_track0_arg2, arg2_track0_result, 2055 result_boolean, arg2_ge_0, arg1_eq_1, suppressee), 2056 2057 }); 2058 2059 // Create a suppression factory for functionBinary 2060 2061} 2062 2063 // #define EQUALITY_MIN_MAX_SUPPRESS 2064 2065 // default is that it is not this function, overriden in the subclass 2066 @Pure 2067 public boolean isMaximum() { 2068 return false; 2069 } 2070 2071/** 2072 * Represents the invariant {@code x = Maximum(y, z)} over three long 2073 * scalars. 2074 */ 2075public static class MaximumLong_xyz extends FunctionBinary { 2076 static final long serialVersionUID = 20031030L; 2077 2078 private static @Prototype MaximumLong_xyz proto = new @Prototype MaximumLong_xyz (); 2079 2080 /** Returns the prototype invariant for MaximumLong_xyz */ 2081 public static @Prototype MaximumLong_xyz get_proto() { 2082 return proto; 2083 } 2084 2085 @Override 2086 protected MaximumLong_xyz instantiate_dyn(@Prototype MaximumLong_xyz this, PptSlice slice) { 2087 return new MaximumLong_xyz (slice); 2088 } 2089 2090 private MaximumLong_xyz (PptSlice slice) { 2091 super(slice); 2092 } 2093 2094 public @Prototype MaximumLong_xyz () { 2095 super(); 2096 } 2097 2098 private static String[] method_name = new String[] {"java.lang.Math.max(", ", ", ")"}; 2099 2100 @Override 2101 public String[] get_method_name(@GuardSatisfied MaximumLong_xyz this) { 2102 return method_name; 2103 } 2104 2105 private static int function_id = -1; 2106 2107 @Override 2108 public int get_function_id() { 2109 return function_id; 2110 } 2111 2112 @Override 2113 public void set_function_id(int function_id) { 2114 assert MaximumLong_xyz.function_id == -1; 2115 MaximumLong_xyz.function_id = function_id; 2116 } 2117 2118 private static int var_order = 1; 2119 2120 @Override 2121 public int get_var_order(@GuardSatisfied MaximumLong_xyz this) { 2122 return var_order; 2123 } 2124 2125 @Pure 2126 @Override 2127 public boolean is_symmetric() { 2128 2129 return true; 2130 } 2131 2132 @Override 2133 2134 public long func(long y, long z) { 2135 2136 return Math.max(y, z); 2137 } 2138 2139 @Override 2140 public InvariantStatus check_modified(long x, long y, 2141 long z, int count) { 2142 return check_ordered(x, y, z, count); 2143 } 2144 2145 @Override 2146 public InvariantStatus add_modified(long x, long y, 2147 long z, int count) { 2148 if (Debug.logDetail()) { 2149 log("result=%s, arg1=%s, arg2=%s", x, y, z); 2150 } 2151 return add_ordered(x, y, z, count); 2152 } 2153 2154 @Pure 2155 @Override 2156 public boolean isMaximum() { 2157 return true; 2158 } 2159 2160 /** Returns a list of non-instantiating suppressions for this invariant. */ 2161 @Pure 2162 @Override 2163 public @Nullable NISuppressionSet get_ni_suppressions() { 2164 if (NIS.dkconfig_enabled && dkconfig_enabled) { 2165 return suppressions; 2166 } else { 2167 return null; 2168 } 2169 } 2170 2171 /** definition of this invariant (the suppressee) */ 2172 private static NISuppressee suppressee = new NISuppressee(MaximumLong_xyz.class, 3); 2173 2174 // suppressor definitions (used below) 2175 private static NISuppressor result_eq_arg1 = 2176 new NISuppressor(0, 1, IntEqual.class); 2177 private static NISuppressor result_eq_arg2 = 2178 new NISuppressor(0, 2, IntEqual.class); 2179 private static NISuppressor arg1_eq_arg2 = 2180 new NISuppressor(1, 2, IntEqual.class); 2181 2182 private static NISuppressor result_lt_arg1 = 2183 new NISuppressor(0, 1, IntLessThan.class); 2184 private static NISuppressor result_lt_arg2 = 2185 new NISuppressor(0, 2, IntLessThan.class); 2186 private static NISuppressor arg1_lt_arg2 = 2187 new NISuppressor(1, 2, IntLessThan.class); 2188 private static NISuppressor arg2_lt_arg1 = 2189 new NISuppressor(2, 1, IntLessThan.class); 2190 2191 private static NISuppressor result_le_arg1 = 2192 new NISuppressor(0, 1, IntLessEqual.class); 2193 private static NISuppressor result_le_arg2 = 2194 new NISuppressor(0, 2, IntLessEqual.class); 2195 private static NISuppressor arg1_le_arg2 = 2196 new NISuppressor(1, 2, IntLessEqual.class); 2197 private static NISuppressor arg2_le_arg1 = 2198 new NISuppressor(2, 1, IntLessEqual.class); 2199 2200 private static NISuppressor result_track0_arg1 = 2201 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 2202 private static NISuppressor result_track0_arg2 = 2203 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 2204 private static NISuppressor arg1_track0_arg2 = 2205 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 2206 private static NISuppressor arg1_track0_result = 2207 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 2208 private static NISuppressor arg2_track0_result = 2209 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 2210 private static NISuppressor arg2_track0_arg1 = 2211 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 2212 2213 private static NISuppressor result_eq_1 = 2214 new NISuppressor(0, RangeInt.EqualOne.class); 2215 private static NISuppressor arg1_eq_1 = 2216 new NISuppressor(1, RangeInt.EqualOne.class); 2217 private static NISuppressor arg2_eq_1 = 2218 new NISuppressor(2, RangeInt.EqualOne.class); 2219 2220 private static NISuppressor result_eq_0 = 2221 new NISuppressor(0, RangeInt.EqualZero.class); 2222 private static NISuppressor arg1_eq_0 = 2223 new NISuppressor(1, RangeInt.EqualZero.class); 2224 private static NISuppressor arg2_eq_0 = 2225 new NISuppressor(2, RangeInt.EqualZero.class); 2226 2227 private static NISuppressor result_ne_0 = 2228 new NISuppressor(0, NonZero.class); 2229 private static NISuppressor arg1_ne_0 = 2230 new NISuppressor(1, NonZero.class); 2231 private static NISuppressor arg2_ne_0 = 2232 new NISuppressor(2, NonZero.class); 2233 2234 private static NISuppressor result_ge_0 = 2235 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 2236 private static NISuppressor arg1_ge_0 = 2237 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 2238 private static NISuppressor arg2_ge_0 = 2239 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 2240 2241 private static NISuppressor result_ge_64 = 2242 new NISuppressor(0, RangeInt.GreaterEqual64.class); 2243 private static NISuppressor arg1_ge_64 = 2244 new NISuppressor(1, RangeInt.GreaterEqual64.class); 2245 private static NISuppressor arg2_ge_64 = 2246 new NISuppressor(2, RangeInt.GreaterEqual64.class); 2247 2248 private static NISuppressor result_boolean = 2249 new NISuppressor(0, RangeInt.BooleanVal.class); 2250 private static NISuppressor arg1_boolean = 2251 new NISuppressor(1, RangeInt.BooleanVal.class); 2252 private static NISuppressor arg2_boolean = 2253 new NISuppressor(2, RangeInt.BooleanVal.class); 2254 2255 private static NISuppressor result_even = 2256 new NISuppressor(0, RangeInt.Even.class); 2257 private static NISuppressor arg1_even = 2258 new NISuppressor(1, RangeInt.Even.class); 2259 private static NISuppressor arg2_even = 2260 new NISuppressor(2, RangeInt.Even.class); 2261 2262 private static NISuppressor result_power2 = 2263 new NISuppressor(0, RangeInt.PowerOfTwo.class); 2264 private static NISuppressor arg1_power2 = 2265 new NISuppressor(1, RangeInt.PowerOfTwo.class); 2266 private static NISuppressor arg2_power2 = 2267 new NISuppressor(2, RangeInt.PowerOfTwo.class); 2268 2269 private static NISuppressor result_and0_arg1 = 2270 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 2271 private static NISuppressor result_and0_arg2 = 2272 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 2273 private static NISuppressor arg1_and0_arg2 = 2274 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 2275 2276 // The arguments to bitwise subset are backwards from what one 2277 // might expect. The second argument is a subset of the first 2278 // argument 2279 private static NISuppressor arg1_bw_subset_arg2 = 2280 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 2281 private static NISuppressor arg2_bw_subset_arg1 = 2282 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 2283 2284 private static NISuppressor result_shift0_arg1 = 2285 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 2286 private static NISuppressor result_shift0_arg2 = 2287 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 2288 private static NISuppressor arg1_shift0_arg2 = 2289 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 2290 2291 private static NISuppressor arg2_divides_arg1 = 2292 new NISuppressor(1, 2, NumericInt.Divides.class); 2293 private static NISuppressor arg1_divides_arg2 = 2294 new NISuppressor(2, 1, NumericInt.Divides.class); 2295 2296 private static NISuppressor arg2_valid_shift = 2297 new NISuppressor(2, RangeInt.Bound0_63.class); 2298 2299 private static NISuppressionSet suppressions = 2300 new NISuppressionSet( 2301 new NISuppression[] { 2302 2303 // (r == y) && (z <= y) ==> r = max(y, z) 2304 new NISuppression(result_eq_arg1, arg2_le_arg1, suppressee), 2305 2306 // (r == z) && (y <= z) ==> r = max(y, z) 2307 new NISuppression(result_eq_arg2, arg1_le_arg2, suppressee), 2308 2309 }); 2310 2311 // Create a suppression factory for functionBinary 2312 2313} 2314 2315/** 2316 * Represents the invariant {@code y = Maximum(x, z)} over three long 2317 * scalars. 2318 */ 2319public static class MaximumLong_yxz extends FunctionBinary { 2320 static final long serialVersionUID = 20031030L; 2321 2322 private static @Prototype MaximumLong_yxz proto = new @Prototype MaximumLong_yxz (); 2323 2324 /** Returns the prototype invariant for MaximumLong_yxz */ 2325 public static @Prototype MaximumLong_yxz get_proto() { 2326 return proto; 2327 } 2328 2329 @Override 2330 protected MaximumLong_yxz instantiate_dyn(@Prototype MaximumLong_yxz this, PptSlice slice) { 2331 return new MaximumLong_yxz (slice); 2332 } 2333 2334 private MaximumLong_yxz (PptSlice slice) { 2335 super(slice); 2336 } 2337 2338 public @Prototype MaximumLong_yxz () { 2339 super(); 2340 } 2341 2342 private static String[] method_name = new String[] {"java.lang.Math.max(", ", ", ")"}; 2343 2344 @Override 2345 public String[] get_method_name(@GuardSatisfied MaximumLong_yxz this) { 2346 return method_name; 2347 } 2348 2349 private static int function_id = -1; 2350 2351 @Override 2352 public int get_function_id() { 2353 return function_id; 2354 } 2355 2356 @Override 2357 public void set_function_id(int function_id) { 2358 assert MaximumLong_yxz.function_id == -1; 2359 MaximumLong_yxz.function_id = function_id; 2360 } 2361 2362 private static int var_order = 2; 2363 2364 @Override 2365 public int get_var_order(@GuardSatisfied MaximumLong_yxz this) { 2366 return var_order; 2367 } 2368 2369 @Pure 2370 @Override 2371 public boolean is_symmetric() { 2372 2373 return true; 2374 } 2375 2376 @Override 2377 2378 public long func(long x, long z) { 2379 2380 return Math.max(x, z); 2381 } 2382 2383 @Override 2384 public InvariantStatus check_modified(long x, long y, 2385 long z, int count) { 2386 return check_ordered(y, x, z, count); 2387 } 2388 2389 @Override 2390 public InvariantStatus add_modified(long x, long y, 2391 long z, int count) { 2392 if (Debug.logDetail()) { 2393 log("result=%s, arg1=%s, arg2=%s", y, x, z); 2394 } 2395 return add_ordered(y, x, z, count); 2396 } 2397 2398 @Pure 2399 @Override 2400 public boolean isMaximum() { 2401 return true; 2402 } 2403 2404 /** Returns a list of non-instantiating suppressions for this invariant. */ 2405 @Pure 2406 @Override 2407 public @Nullable NISuppressionSet get_ni_suppressions() { 2408 if (NIS.dkconfig_enabled && dkconfig_enabled) { 2409 return suppressions; 2410 } else { 2411 return null; 2412 } 2413 } 2414 2415 /** definition of this invariant (the suppressee) */ 2416 private static NISuppressee suppressee = new NISuppressee(MaximumLong_yxz.class, 3); 2417 2418 // suppressor definitions (used below) 2419 private static NISuppressor result_eq_arg1 = 2420 new NISuppressor(1, 0, IntEqual.class); 2421 private static NISuppressor result_eq_arg2 = 2422 new NISuppressor(1, 2, IntEqual.class); 2423 private static NISuppressor arg1_eq_arg2 = 2424 new NISuppressor(0, 2, IntEqual.class); 2425 2426 private static NISuppressor result_lt_arg1 = 2427 new NISuppressor(1, 0, IntLessThan.class); 2428 private static NISuppressor result_lt_arg2 = 2429 new NISuppressor(1, 2, IntLessThan.class); 2430 private static NISuppressor arg1_lt_arg2 = 2431 new NISuppressor(0, 2, IntLessThan.class); 2432 private static NISuppressor arg2_lt_arg1 = 2433 new NISuppressor(2, 0, IntLessThan.class); 2434 2435 private static NISuppressor result_le_arg1 = 2436 new NISuppressor(1, 0, IntLessEqual.class); 2437 private static NISuppressor result_le_arg2 = 2438 new NISuppressor(1, 2, IntLessEqual.class); 2439 private static NISuppressor arg1_le_arg2 = 2440 new NISuppressor(0, 2, IntLessEqual.class); 2441 private static NISuppressor arg2_le_arg1 = 2442 new NISuppressor(2, 0, IntLessEqual.class); 2443 2444 private static NISuppressor result_track0_arg1 = 2445 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 2446 private static NISuppressor result_track0_arg2 = 2447 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 2448 private static NISuppressor arg1_track0_arg2 = 2449 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 2450 private static NISuppressor arg1_track0_result = 2451 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 2452 private static NISuppressor arg2_track0_result = 2453 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 2454 private static NISuppressor arg2_track0_arg1 = 2455 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 2456 2457 private static NISuppressor result_eq_1 = 2458 new NISuppressor(1, RangeInt.EqualOne.class); 2459 private static NISuppressor arg1_eq_1 = 2460 new NISuppressor(0, RangeInt.EqualOne.class); 2461 private static NISuppressor arg2_eq_1 = 2462 new NISuppressor(2, RangeInt.EqualOne.class); 2463 2464 private static NISuppressor result_eq_0 = 2465 new NISuppressor(1, RangeInt.EqualZero.class); 2466 private static NISuppressor arg1_eq_0 = 2467 new NISuppressor(0, RangeInt.EqualZero.class); 2468 private static NISuppressor arg2_eq_0 = 2469 new NISuppressor(2, RangeInt.EqualZero.class); 2470 2471 private static NISuppressor result_ne_0 = 2472 new NISuppressor(1, NonZero.class); 2473 private static NISuppressor arg1_ne_0 = 2474 new NISuppressor(0, NonZero.class); 2475 private static NISuppressor arg2_ne_0 = 2476 new NISuppressor(2, NonZero.class); 2477 2478 private static NISuppressor result_ge_0 = 2479 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 2480 private static NISuppressor arg1_ge_0 = 2481 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 2482 private static NISuppressor arg2_ge_0 = 2483 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 2484 2485 private static NISuppressor result_ge_64 = 2486 new NISuppressor(1, RangeInt.GreaterEqual64.class); 2487 private static NISuppressor arg1_ge_64 = 2488 new NISuppressor(0, RangeInt.GreaterEqual64.class); 2489 private static NISuppressor arg2_ge_64 = 2490 new NISuppressor(2, RangeInt.GreaterEqual64.class); 2491 2492 private static NISuppressor result_boolean = 2493 new NISuppressor(1, RangeInt.BooleanVal.class); 2494 private static NISuppressor arg1_boolean = 2495 new NISuppressor(0, RangeInt.BooleanVal.class); 2496 private static NISuppressor arg2_boolean = 2497 new NISuppressor(2, RangeInt.BooleanVal.class); 2498 2499 private static NISuppressor result_even = 2500 new NISuppressor(1, RangeInt.Even.class); 2501 private static NISuppressor arg1_even = 2502 new NISuppressor(0, RangeInt.Even.class); 2503 private static NISuppressor arg2_even = 2504 new NISuppressor(2, RangeInt.Even.class); 2505 2506 private static NISuppressor result_power2 = 2507 new NISuppressor(1, RangeInt.PowerOfTwo.class); 2508 private static NISuppressor arg1_power2 = 2509 new NISuppressor(0, RangeInt.PowerOfTwo.class); 2510 private static NISuppressor arg2_power2 = 2511 new NISuppressor(2, RangeInt.PowerOfTwo.class); 2512 2513 private static NISuppressor result_and0_arg1 = 2514 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 2515 private static NISuppressor result_and0_arg2 = 2516 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 2517 private static NISuppressor arg1_and0_arg2 = 2518 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 2519 2520 // The arguments to bitwise subset are backwards from what one 2521 // might expect. The second argument is a subset of the first 2522 // argument 2523 private static NISuppressor arg1_bw_subset_arg2 = 2524 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 2525 private static NISuppressor arg2_bw_subset_arg1 = 2526 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 2527 2528 private static NISuppressor result_shift0_arg1 = 2529 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 2530 private static NISuppressor result_shift0_arg2 = 2531 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 2532 private static NISuppressor arg1_shift0_arg2 = 2533 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 2534 2535 private static NISuppressor arg2_divides_arg1 = 2536 new NISuppressor(0, 2, NumericInt.Divides.class); 2537 private static NISuppressor arg1_divides_arg2 = 2538 new NISuppressor(2, 0, NumericInt.Divides.class); 2539 2540 private static NISuppressor arg2_valid_shift = 2541 new NISuppressor(2, RangeInt.Bound0_63.class); 2542 2543 private static NISuppressionSet suppressions = 2544 new NISuppressionSet( 2545 new NISuppression[] { 2546 2547 // (r == x) && (z <= x) ==> r = max(x, z) 2548 new NISuppression(result_eq_arg1, arg2_le_arg1, suppressee), 2549 2550 // (r == z) && (x <= z) ==> r = max(x, z) 2551 new NISuppression(result_eq_arg2, arg1_le_arg2, suppressee), 2552 2553 }); 2554 2555 // Create a suppression factory for functionBinary 2556 2557} 2558 2559/** 2560 * Represents the invariant {@code z = Maximum(x, y)} over three long 2561 * scalars. 2562 */ 2563public static class MaximumLong_zxy extends FunctionBinary { 2564 static final long serialVersionUID = 20031030L; 2565 2566 private static @Prototype MaximumLong_zxy proto = new @Prototype MaximumLong_zxy (); 2567 2568 /** Returns the prototype invariant for MaximumLong_zxy */ 2569 public static @Prototype MaximumLong_zxy get_proto() { 2570 return proto; 2571 } 2572 2573 @Override 2574 protected MaximumLong_zxy instantiate_dyn(@Prototype MaximumLong_zxy this, PptSlice slice) { 2575 return new MaximumLong_zxy (slice); 2576 } 2577 2578 private MaximumLong_zxy (PptSlice slice) { 2579 super(slice); 2580 } 2581 2582 public @Prototype MaximumLong_zxy () { 2583 super(); 2584 } 2585 2586 private static String[] method_name = new String[] {"java.lang.Math.max(", ", ", ")"}; 2587 2588 @Override 2589 public String[] get_method_name(@GuardSatisfied MaximumLong_zxy this) { 2590 return method_name; 2591 } 2592 2593 private static int function_id = -1; 2594 2595 @Override 2596 public int get_function_id() { 2597 return function_id; 2598 } 2599 2600 @Override 2601 public void set_function_id(int function_id) { 2602 assert MaximumLong_zxy.function_id == -1; 2603 MaximumLong_zxy.function_id = function_id; 2604 } 2605 2606 private static int var_order = 3; 2607 2608 @Override 2609 public int get_var_order(@GuardSatisfied MaximumLong_zxy this) { 2610 return var_order; 2611 } 2612 2613 @Pure 2614 @Override 2615 public boolean is_symmetric() { 2616 2617 return true; 2618 } 2619 2620 @Override 2621 2622 public long func(long x, long y) { 2623 2624 return Math.max(x, y); 2625 } 2626 2627 @Override 2628 public InvariantStatus check_modified(long x, long y, 2629 long z, int count) { 2630 return check_ordered(z, x, y, count); 2631 } 2632 2633 @Override 2634 public InvariantStatus add_modified(long x, long y, 2635 long z, int count) { 2636 if (Debug.logDetail()) { 2637 log("result=%s, arg1=%s, arg2=%s", z, x, y); 2638 } 2639 return add_ordered(z, x, y, count); 2640 } 2641 2642 @Pure 2643 @Override 2644 public boolean isMaximum() { 2645 return true; 2646 } 2647 2648 /** Returns a list of non-instantiating suppressions for this invariant. */ 2649 @Pure 2650 @Override 2651 public @Nullable NISuppressionSet get_ni_suppressions() { 2652 if (NIS.dkconfig_enabled && dkconfig_enabled) { 2653 return suppressions; 2654 } else { 2655 return null; 2656 } 2657 } 2658 2659 /** definition of this invariant (the suppressee) */ 2660 private static NISuppressee suppressee = new NISuppressee(MaximumLong_zxy.class, 3); 2661 2662 // suppressor definitions (used below) 2663 private static NISuppressor result_eq_arg1 = 2664 new NISuppressor(2, 0, IntEqual.class); 2665 private static NISuppressor result_eq_arg2 = 2666 new NISuppressor(2, 1, IntEqual.class); 2667 private static NISuppressor arg1_eq_arg2 = 2668 new NISuppressor(0, 1, IntEqual.class); 2669 2670 private static NISuppressor result_lt_arg1 = 2671 new NISuppressor(2, 0, IntLessThan.class); 2672 private static NISuppressor result_lt_arg2 = 2673 new NISuppressor(2, 1, IntLessThan.class); 2674 private static NISuppressor arg1_lt_arg2 = 2675 new NISuppressor(0, 1, IntLessThan.class); 2676 private static NISuppressor arg2_lt_arg1 = 2677 new NISuppressor(1, 0, IntLessThan.class); 2678 2679 private static NISuppressor result_le_arg1 = 2680 new NISuppressor(2, 0, IntLessEqual.class); 2681 private static NISuppressor result_le_arg2 = 2682 new NISuppressor(2, 1, IntLessEqual.class); 2683 private static NISuppressor arg1_le_arg2 = 2684 new NISuppressor(0, 1, IntLessEqual.class); 2685 private static NISuppressor arg2_le_arg1 = 2686 new NISuppressor(1, 0, IntLessEqual.class); 2687 2688 private static NISuppressor result_track0_arg1 = 2689 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 2690 private static NISuppressor result_track0_arg2 = 2691 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 2692 private static NISuppressor arg1_track0_arg2 = 2693 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 2694 private static NISuppressor arg1_track0_result = 2695 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 2696 private static NISuppressor arg2_track0_result = 2697 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 2698 private static NISuppressor arg2_track0_arg1 = 2699 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 2700 2701 private static NISuppressor result_eq_1 = 2702 new NISuppressor(2, RangeInt.EqualOne.class); 2703 private static NISuppressor arg1_eq_1 = 2704 new NISuppressor(0, RangeInt.EqualOne.class); 2705 private static NISuppressor arg2_eq_1 = 2706 new NISuppressor(1, RangeInt.EqualOne.class); 2707 2708 private static NISuppressor result_eq_0 = 2709 new NISuppressor(2, RangeInt.EqualZero.class); 2710 private static NISuppressor arg1_eq_0 = 2711 new NISuppressor(0, RangeInt.EqualZero.class); 2712 private static NISuppressor arg2_eq_0 = 2713 new NISuppressor(1, RangeInt.EqualZero.class); 2714 2715 private static NISuppressor result_ne_0 = 2716 new NISuppressor(2, NonZero.class); 2717 private static NISuppressor arg1_ne_0 = 2718 new NISuppressor(0, NonZero.class); 2719 private static NISuppressor arg2_ne_0 = 2720 new NISuppressor(1, NonZero.class); 2721 2722 private static NISuppressor result_ge_0 = 2723 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 2724 private static NISuppressor arg1_ge_0 = 2725 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 2726 private static NISuppressor arg2_ge_0 = 2727 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 2728 2729 private static NISuppressor result_ge_64 = 2730 new NISuppressor(2, RangeInt.GreaterEqual64.class); 2731 private static NISuppressor arg1_ge_64 = 2732 new NISuppressor(0, RangeInt.GreaterEqual64.class); 2733 private static NISuppressor arg2_ge_64 = 2734 new NISuppressor(1, RangeInt.GreaterEqual64.class); 2735 2736 private static NISuppressor result_boolean = 2737 new NISuppressor(2, RangeInt.BooleanVal.class); 2738 private static NISuppressor arg1_boolean = 2739 new NISuppressor(0, RangeInt.BooleanVal.class); 2740 private static NISuppressor arg2_boolean = 2741 new NISuppressor(1, RangeInt.BooleanVal.class); 2742 2743 private static NISuppressor result_even = 2744 new NISuppressor(2, RangeInt.Even.class); 2745 private static NISuppressor arg1_even = 2746 new NISuppressor(0, RangeInt.Even.class); 2747 private static NISuppressor arg2_even = 2748 new NISuppressor(1, RangeInt.Even.class); 2749 2750 private static NISuppressor result_power2 = 2751 new NISuppressor(2, RangeInt.PowerOfTwo.class); 2752 private static NISuppressor arg1_power2 = 2753 new NISuppressor(0, RangeInt.PowerOfTwo.class); 2754 private static NISuppressor arg2_power2 = 2755 new NISuppressor(1, RangeInt.PowerOfTwo.class); 2756 2757 private static NISuppressor result_and0_arg1 = 2758 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 2759 private static NISuppressor result_and0_arg2 = 2760 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 2761 private static NISuppressor arg1_and0_arg2 = 2762 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 2763 2764 // The arguments to bitwise subset are backwards from what one 2765 // might expect. The second argument is a subset of the first 2766 // argument 2767 private static NISuppressor arg1_bw_subset_arg2 = 2768 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 2769 private static NISuppressor arg2_bw_subset_arg1 = 2770 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 2771 2772 private static NISuppressor result_shift0_arg1 = 2773 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 2774 private static NISuppressor result_shift0_arg2 = 2775 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 2776 private static NISuppressor arg1_shift0_arg2 = 2777 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 2778 2779 private static NISuppressor arg2_divides_arg1 = 2780 new NISuppressor(0, 1, NumericInt.Divides.class); 2781 private static NISuppressor arg1_divides_arg2 = 2782 new NISuppressor(1, 0, NumericInt.Divides.class); 2783 2784 private static NISuppressor arg2_valid_shift = 2785 new NISuppressor(1, RangeInt.Bound0_63.class); 2786 2787 private static NISuppressionSet suppressions = 2788 new NISuppressionSet( 2789 new NISuppression[] { 2790 2791 // (r == x) && (y <= x) ==> r = max(x, y) 2792 new NISuppression(result_eq_arg1, arg2_le_arg1, suppressee), 2793 2794 // (r == y) && (x <= y) ==> r = max(x, y) 2795 new NISuppression(result_eq_arg2, arg1_le_arg2, suppressee), 2796 2797 }); 2798 2799 // Create a suppression factory for functionBinary 2800 2801} 2802 2803 // default is that it is not this function, overriden in the subclass 2804 @Pure 2805 public boolean isDivision() { 2806 return false; 2807 } 2808 2809/** 2810 * Represents the invariant {@code x = Division(y, z)} over three long 2811 * scalars. 2812 */ 2813public static class DivisionLong_xyz extends FunctionBinary { 2814 static final long serialVersionUID = 20031030L; 2815 2816 private static @Prototype DivisionLong_xyz proto = new @Prototype DivisionLong_xyz (); 2817 2818 /** Returns the prototype invariant for DivisionLong_xyz */ 2819 public static @Prototype DivisionLong_xyz get_proto() { 2820 return proto; 2821 } 2822 2823 @Override 2824 protected DivisionLong_xyz instantiate_dyn(@Prototype DivisionLong_xyz this, PptSlice slice) { 2825 return new DivisionLong_xyz (slice); 2826 } 2827 2828 private DivisionLong_xyz (PptSlice slice) { 2829 super(slice); 2830 } 2831 2832 public @Prototype DivisionLong_xyz () { 2833 super(); 2834 } 2835 2836 private static String[] method_name = new String[] {"", " / ", ""}; 2837 2838 @Override 2839 public String[] get_method_name(@GuardSatisfied DivisionLong_xyz this) { 2840 return method_name; 2841 } 2842 2843 private static int function_id = -1; 2844 2845 @Override 2846 public int get_function_id() { 2847 return function_id; 2848 } 2849 2850 @Override 2851 public void set_function_id(int function_id) { 2852 assert DivisionLong_xyz.function_id == -1; 2853 DivisionLong_xyz.function_id = function_id; 2854 } 2855 2856 private static int var_order = 1; 2857 2858 @Override 2859 public int get_var_order(@GuardSatisfied DivisionLong_xyz this) { 2860 return var_order; 2861 } 2862 2863 @Pure 2864 @Override 2865 public boolean is_symmetric() { 2866 2867 return false; 2868 } 2869 2870 @Override 2871 2872 public long func(long y, long z) { 2873 2874 return (y / z); 2875 } 2876 2877 @Override 2878 public InvariantStatus check_modified(long x, long y, 2879 long z, int count) { 2880 return check_ordered(x, y, z, count); 2881 } 2882 2883 @Override 2884 public InvariantStatus add_modified(long x, long y, 2885 long z, int count) { 2886 if (Debug.logDetail()) { 2887 log("result=%s, arg1=%s, arg2=%s", x, y, z); 2888 } 2889 return add_ordered(x, y, z, count); 2890 } 2891 2892 @Pure 2893 @Override 2894 public boolean isDivision() { 2895 return true; 2896 } 2897 2898 @Pure 2899 @Override 2900 public boolean isExact() { 2901 return true; 2902 } 2903 2904 /** Returns a list of non-instantiating suppressions for this invariant. */ 2905 @Pure 2906 @Override 2907 public @Nullable NISuppressionSet get_ni_suppressions() { 2908 if (NIS.dkconfig_enabled && dkconfig_enabled) { 2909 return suppressions; 2910 } else { 2911 return null; 2912 } 2913 } 2914 2915 /** definition of this invariant (the suppressee) */ 2916 private static NISuppressee suppressee = new NISuppressee(DivisionLong_xyz.class, 3); 2917 2918 // suppressor definitions (used below) 2919 private static NISuppressor result_eq_arg1 = 2920 new NISuppressor(0, 1, IntEqual.class); 2921 private static NISuppressor result_eq_arg2 = 2922 new NISuppressor(0, 2, IntEqual.class); 2923 private static NISuppressor arg1_eq_arg2 = 2924 new NISuppressor(1, 2, IntEqual.class); 2925 2926 private static NISuppressor result_lt_arg1 = 2927 new NISuppressor(0, 1, IntLessThan.class); 2928 private static NISuppressor result_lt_arg2 = 2929 new NISuppressor(0, 2, IntLessThan.class); 2930 private static NISuppressor arg1_lt_arg2 = 2931 new NISuppressor(1, 2, IntLessThan.class); 2932 private static NISuppressor arg2_lt_arg1 = 2933 new NISuppressor(2, 1, IntLessThan.class); 2934 2935 private static NISuppressor result_le_arg1 = 2936 new NISuppressor(0, 1, IntLessEqual.class); 2937 private static NISuppressor result_le_arg2 = 2938 new NISuppressor(0, 2, IntLessEqual.class); 2939 private static NISuppressor arg1_le_arg2 = 2940 new NISuppressor(1, 2, IntLessEqual.class); 2941 private static NISuppressor arg2_le_arg1 = 2942 new NISuppressor(2, 1, IntLessEqual.class); 2943 2944 private static NISuppressor result_track0_arg1 = 2945 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 2946 private static NISuppressor result_track0_arg2 = 2947 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 2948 private static NISuppressor arg1_track0_arg2 = 2949 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 2950 private static NISuppressor arg1_track0_result = 2951 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 2952 private static NISuppressor arg2_track0_result = 2953 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 2954 private static NISuppressor arg2_track0_arg1 = 2955 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 2956 2957 private static NISuppressor result_eq_1 = 2958 new NISuppressor(0, RangeInt.EqualOne.class); 2959 private static NISuppressor arg1_eq_1 = 2960 new NISuppressor(1, RangeInt.EqualOne.class); 2961 private static NISuppressor arg2_eq_1 = 2962 new NISuppressor(2, RangeInt.EqualOne.class); 2963 2964 private static NISuppressor result_eq_0 = 2965 new NISuppressor(0, RangeInt.EqualZero.class); 2966 private static NISuppressor arg1_eq_0 = 2967 new NISuppressor(1, RangeInt.EqualZero.class); 2968 private static NISuppressor arg2_eq_0 = 2969 new NISuppressor(2, RangeInt.EqualZero.class); 2970 2971 private static NISuppressor result_ne_0 = 2972 new NISuppressor(0, NonZero.class); 2973 private static NISuppressor arg1_ne_0 = 2974 new NISuppressor(1, NonZero.class); 2975 private static NISuppressor arg2_ne_0 = 2976 new NISuppressor(2, NonZero.class); 2977 2978 private static NISuppressor result_ge_0 = 2979 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 2980 private static NISuppressor arg1_ge_0 = 2981 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 2982 private static NISuppressor arg2_ge_0 = 2983 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 2984 2985 private static NISuppressor result_ge_64 = 2986 new NISuppressor(0, RangeInt.GreaterEqual64.class); 2987 private static NISuppressor arg1_ge_64 = 2988 new NISuppressor(1, RangeInt.GreaterEqual64.class); 2989 private static NISuppressor arg2_ge_64 = 2990 new NISuppressor(2, RangeInt.GreaterEqual64.class); 2991 2992 private static NISuppressor result_boolean = 2993 new NISuppressor(0, RangeInt.BooleanVal.class); 2994 private static NISuppressor arg1_boolean = 2995 new NISuppressor(1, RangeInt.BooleanVal.class); 2996 private static NISuppressor arg2_boolean = 2997 new NISuppressor(2, RangeInt.BooleanVal.class); 2998 2999 private static NISuppressor result_even = 3000 new NISuppressor(0, RangeInt.Even.class); 3001 private static NISuppressor arg1_even = 3002 new NISuppressor(1, RangeInt.Even.class); 3003 private static NISuppressor arg2_even = 3004 new NISuppressor(2, RangeInt.Even.class); 3005 3006 private static NISuppressor result_power2 = 3007 new NISuppressor(0, RangeInt.PowerOfTwo.class); 3008 private static NISuppressor arg1_power2 = 3009 new NISuppressor(1, RangeInt.PowerOfTwo.class); 3010 private static NISuppressor arg2_power2 = 3011 new NISuppressor(2, RangeInt.PowerOfTwo.class); 3012 3013 private static NISuppressor result_and0_arg1 = 3014 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 3015 private static NISuppressor result_and0_arg2 = 3016 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 3017 private static NISuppressor arg1_and0_arg2 = 3018 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 3019 3020 // The arguments to bitwise subset are backwards from what one 3021 // might expect. The second argument is a subset of the first 3022 // argument 3023 private static NISuppressor arg1_bw_subset_arg2 = 3024 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 3025 private static NISuppressor arg2_bw_subset_arg1 = 3026 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 3027 3028 private static NISuppressor result_shift0_arg1 = 3029 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 3030 private static NISuppressor result_shift0_arg2 = 3031 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 3032 private static NISuppressor arg1_shift0_arg2 = 3033 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 3034 3035 private static NISuppressor arg2_divides_arg1 = 3036 new NISuppressor(1, 2, NumericInt.Divides.class); 3037 private static NISuppressor arg1_divides_arg2 = 3038 new NISuppressor(2, 1, NumericInt.Divides.class); 3039 3040 private static NISuppressor arg2_valid_shift = 3041 new NISuppressor(2, RangeInt.Bound0_63.class); 3042 3043 private static NISuppressionSet suppressions = 3044 new NISuppressionSet( 3045 new NISuppression[] { 3046 3047 // (r == 0) && (y < z) && (y >= 0) && (z != 0) ==> r = y / z 3048 new NISuppression(result_eq_0, arg1_lt_arg2, arg1_ge_0, arg2_ne_0, suppressee), 3049 3050 // (y == z) && (z != 0) && (r == 1) 3051 new NISuppression(arg1_eq_arg2, arg2_ne_0, result_eq_1, suppressee), 3052 3053 // (r == y) && (z == 1) ==> r = y / z 3054 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 3055 }); 3056 3057 // Create a suppression factory for functionBinary 3058 3059} 3060 3061/** 3062 * Represents the invariant {@code y = Division(x, z)} over three long 3063 * scalars. 3064 */ 3065public static class DivisionLong_yxz extends FunctionBinary { 3066 static final long serialVersionUID = 20031030L; 3067 3068 private static @Prototype DivisionLong_yxz proto = new @Prototype DivisionLong_yxz (); 3069 3070 /** Returns the prototype invariant for DivisionLong_yxz */ 3071 public static @Prototype DivisionLong_yxz get_proto() { 3072 return proto; 3073 } 3074 3075 @Override 3076 protected DivisionLong_yxz instantiate_dyn(@Prototype DivisionLong_yxz this, PptSlice slice) { 3077 return new DivisionLong_yxz (slice); 3078 } 3079 3080 private DivisionLong_yxz (PptSlice slice) { 3081 super(slice); 3082 } 3083 3084 public @Prototype DivisionLong_yxz () { 3085 super(); 3086 } 3087 3088 private static String[] method_name = new String[] {"", " / ", ""}; 3089 3090 @Override 3091 public String[] get_method_name(@GuardSatisfied DivisionLong_yxz this) { 3092 return method_name; 3093 } 3094 3095 private static int function_id = -1; 3096 3097 @Override 3098 public int get_function_id() { 3099 return function_id; 3100 } 3101 3102 @Override 3103 public void set_function_id(int function_id) { 3104 assert DivisionLong_yxz.function_id == -1; 3105 DivisionLong_yxz.function_id = function_id; 3106 } 3107 3108 private static int var_order = 2; 3109 3110 @Override 3111 public int get_var_order(@GuardSatisfied DivisionLong_yxz this) { 3112 return var_order; 3113 } 3114 3115 @Pure 3116 @Override 3117 public boolean is_symmetric() { 3118 3119 return false; 3120 } 3121 3122 @Override 3123 3124 public long func(long x, long z) { 3125 3126 return (x / z); 3127 } 3128 3129 @Override 3130 public InvariantStatus check_modified(long x, long y, 3131 long z, int count) { 3132 return check_ordered(y, x, z, count); 3133 } 3134 3135 @Override 3136 public InvariantStatus add_modified(long x, long y, 3137 long z, int count) { 3138 if (Debug.logDetail()) { 3139 log("result=%s, arg1=%s, arg2=%s", y, x, z); 3140 } 3141 return add_ordered(y, x, z, count); 3142 } 3143 3144 @Pure 3145 @Override 3146 public boolean isDivision() { 3147 return true; 3148 } 3149 3150 @Pure 3151 @Override 3152 public boolean isExact() { 3153 return true; 3154 } 3155 3156 /** Returns a list of non-instantiating suppressions for this invariant. */ 3157 @Pure 3158 @Override 3159 public @Nullable NISuppressionSet get_ni_suppressions() { 3160 if (NIS.dkconfig_enabled && dkconfig_enabled) { 3161 return suppressions; 3162 } else { 3163 return null; 3164 } 3165 } 3166 3167 /** definition of this invariant (the suppressee) */ 3168 private static NISuppressee suppressee = new NISuppressee(DivisionLong_yxz.class, 3); 3169 3170 // suppressor definitions (used below) 3171 private static NISuppressor result_eq_arg1 = 3172 new NISuppressor(1, 0, IntEqual.class); 3173 private static NISuppressor result_eq_arg2 = 3174 new NISuppressor(1, 2, IntEqual.class); 3175 private static NISuppressor arg1_eq_arg2 = 3176 new NISuppressor(0, 2, IntEqual.class); 3177 3178 private static NISuppressor result_lt_arg1 = 3179 new NISuppressor(1, 0, IntLessThan.class); 3180 private static NISuppressor result_lt_arg2 = 3181 new NISuppressor(1, 2, IntLessThan.class); 3182 private static NISuppressor arg1_lt_arg2 = 3183 new NISuppressor(0, 2, IntLessThan.class); 3184 private static NISuppressor arg2_lt_arg1 = 3185 new NISuppressor(2, 0, IntLessThan.class); 3186 3187 private static NISuppressor result_le_arg1 = 3188 new NISuppressor(1, 0, IntLessEqual.class); 3189 private static NISuppressor result_le_arg2 = 3190 new NISuppressor(1, 2, IntLessEqual.class); 3191 private static NISuppressor arg1_le_arg2 = 3192 new NISuppressor(0, 2, IntLessEqual.class); 3193 private static NISuppressor arg2_le_arg1 = 3194 new NISuppressor(2, 0, IntLessEqual.class); 3195 3196 private static NISuppressor result_track0_arg1 = 3197 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 3198 private static NISuppressor result_track0_arg2 = 3199 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 3200 private static NISuppressor arg1_track0_arg2 = 3201 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 3202 private static NISuppressor arg1_track0_result = 3203 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 3204 private static NISuppressor arg2_track0_result = 3205 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 3206 private static NISuppressor arg2_track0_arg1 = 3207 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 3208 3209 private static NISuppressor result_eq_1 = 3210 new NISuppressor(1, RangeInt.EqualOne.class); 3211 private static NISuppressor arg1_eq_1 = 3212 new NISuppressor(0, RangeInt.EqualOne.class); 3213 private static NISuppressor arg2_eq_1 = 3214 new NISuppressor(2, RangeInt.EqualOne.class); 3215 3216 private static NISuppressor result_eq_0 = 3217 new NISuppressor(1, RangeInt.EqualZero.class); 3218 private static NISuppressor arg1_eq_0 = 3219 new NISuppressor(0, RangeInt.EqualZero.class); 3220 private static NISuppressor arg2_eq_0 = 3221 new NISuppressor(2, RangeInt.EqualZero.class); 3222 3223 private static NISuppressor result_ne_0 = 3224 new NISuppressor(1, NonZero.class); 3225 private static NISuppressor arg1_ne_0 = 3226 new NISuppressor(0, NonZero.class); 3227 private static NISuppressor arg2_ne_0 = 3228 new NISuppressor(2, NonZero.class); 3229 3230 private static NISuppressor result_ge_0 = 3231 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 3232 private static NISuppressor arg1_ge_0 = 3233 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 3234 private static NISuppressor arg2_ge_0 = 3235 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 3236 3237 private static NISuppressor result_ge_64 = 3238 new NISuppressor(1, RangeInt.GreaterEqual64.class); 3239 private static NISuppressor arg1_ge_64 = 3240 new NISuppressor(0, RangeInt.GreaterEqual64.class); 3241 private static NISuppressor arg2_ge_64 = 3242 new NISuppressor(2, RangeInt.GreaterEqual64.class); 3243 3244 private static NISuppressor result_boolean = 3245 new NISuppressor(1, RangeInt.BooleanVal.class); 3246 private static NISuppressor arg1_boolean = 3247 new NISuppressor(0, RangeInt.BooleanVal.class); 3248 private static NISuppressor arg2_boolean = 3249 new NISuppressor(2, RangeInt.BooleanVal.class); 3250 3251 private static NISuppressor result_even = 3252 new NISuppressor(1, RangeInt.Even.class); 3253 private static NISuppressor arg1_even = 3254 new NISuppressor(0, RangeInt.Even.class); 3255 private static NISuppressor arg2_even = 3256 new NISuppressor(2, RangeInt.Even.class); 3257 3258 private static NISuppressor result_power2 = 3259 new NISuppressor(1, RangeInt.PowerOfTwo.class); 3260 private static NISuppressor arg1_power2 = 3261 new NISuppressor(0, RangeInt.PowerOfTwo.class); 3262 private static NISuppressor arg2_power2 = 3263 new NISuppressor(2, RangeInt.PowerOfTwo.class); 3264 3265 private static NISuppressor result_and0_arg1 = 3266 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 3267 private static NISuppressor result_and0_arg2 = 3268 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 3269 private static NISuppressor arg1_and0_arg2 = 3270 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 3271 3272 // The arguments to bitwise subset are backwards from what one 3273 // might expect. The second argument is a subset of the first 3274 // argument 3275 private static NISuppressor arg1_bw_subset_arg2 = 3276 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 3277 private static NISuppressor arg2_bw_subset_arg1 = 3278 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 3279 3280 private static NISuppressor result_shift0_arg1 = 3281 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 3282 private static NISuppressor result_shift0_arg2 = 3283 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 3284 private static NISuppressor arg1_shift0_arg2 = 3285 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 3286 3287 private static NISuppressor arg2_divides_arg1 = 3288 new NISuppressor(0, 2, NumericInt.Divides.class); 3289 private static NISuppressor arg1_divides_arg2 = 3290 new NISuppressor(2, 0, NumericInt.Divides.class); 3291 3292 private static NISuppressor arg2_valid_shift = 3293 new NISuppressor(2, RangeInt.Bound0_63.class); 3294 3295 private static NISuppressionSet suppressions = 3296 new NISuppressionSet( 3297 new NISuppression[] { 3298 3299 // (r == 0) && (x < z) && (x >= 0) && (z != 0) ==> r = x / z 3300 new NISuppression(result_eq_0, arg1_lt_arg2, arg1_ge_0, arg2_ne_0, suppressee), 3301 3302 // (x == z) && (z != 0) && (r == 1) 3303 new NISuppression(arg1_eq_arg2, arg2_ne_0, result_eq_1, suppressee), 3304 3305 // (r == x) && (z == 1) ==> r = x / z 3306 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 3307 }); 3308 3309 // Create a suppression factory for functionBinary 3310 3311} 3312 3313/** 3314 * Represents the invariant {@code z = Division(x, y)} over three long 3315 * scalars. 3316 */ 3317public static class DivisionLong_zxy extends FunctionBinary { 3318 static final long serialVersionUID = 20031030L; 3319 3320 private static @Prototype DivisionLong_zxy proto = new @Prototype DivisionLong_zxy (); 3321 3322 /** Returns the prototype invariant for DivisionLong_zxy */ 3323 public static @Prototype DivisionLong_zxy get_proto() { 3324 return proto; 3325 } 3326 3327 @Override 3328 protected DivisionLong_zxy instantiate_dyn(@Prototype DivisionLong_zxy this, PptSlice slice) { 3329 return new DivisionLong_zxy (slice); 3330 } 3331 3332 private DivisionLong_zxy (PptSlice slice) { 3333 super(slice); 3334 } 3335 3336 public @Prototype DivisionLong_zxy () { 3337 super(); 3338 } 3339 3340 private static String[] method_name = new String[] {"", " / ", ""}; 3341 3342 @Override 3343 public String[] get_method_name(@GuardSatisfied DivisionLong_zxy this) { 3344 return method_name; 3345 } 3346 3347 private static int function_id = -1; 3348 3349 @Override 3350 public int get_function_id() { 3351 return function_id; 3352 } 3353 3354 @Override 3355 public void set_function_id(int function_id) { 3356 assert DivisionLong_zxy.function_id == -1; 3357 DivisionLong_zxy.function_id = function_id; 3358 } 3359 3360 private static int var_order = 3; 3361 3362 @Override 3363 public int get_var_order(@GuardSatisfied DivisionLong_zxy this) { 3364 return var_order; 3365 } 3366 3367 @Pure 3368 @Override 3369 public boolean is_symmetric() { 3370 3371 return false; 3372 } 3373 3374 @Override 3375 3376 public long func(long x, long y) { 3377 3378 return (x / y); 3379 } 3380 3381 @Override 3382 public InvariantStatus check_modified(long x, long y, 3383 long z, int count) { 3384 return check_ordered(z, x, y, count); 3385 } 3386 3387 @Override 3388 public InvariantStatus add_modified(long x, long y, 3389 long z, int count) { 3390 if (Debug.logDetail()) { 3391 log("result=%s, arg1=%s, arg2=%s", z, x, y); 3392 } 3393 return add_ordered(z, x, y, count); 3394 } 3395 3396 @Pure 3397 @Override 3398 public boolean isDivision() { 3399 return true; 3400 } 3401 3402 @Pure 3403 @Override 3404 public boolean isExact() { 3405 return true; 3406 } 3407 3408 /** Returns a list of non-instantiating suppressions for this invariant. */ 3409 @Pure 3410 @Override 3411 public @Nullable NISuppressionSet get_ni_suppressions() { 3412 if (NIS.dkconfig_enabled && dkconfig_enabled) { 3413 return suppressions; 3414 } else { 3415 return null; 3416 } 3417 } 3418 3419 /** definition of this invariant (the suppressee) */ 3420 private static NISuppressee suppressee = new NISuppressee(DivisionLong_zxy.class, 3); 3421 3422 // suppressor definitions (used below) 3423 private static NISuppressor result_eq_arg1 = 3424 new NISuppressor(2, 0, IntEqual.class); 3425 private static NISuppressor result_eq_arg2 = 3426 new NISuppressor(2, 1, IntEqual.class); 3427 private static NISuppressor arg1_eq_arg2 = 3428 new NISuppressor(0, 1, IntEqual.class); 3429 3430 private static NISuppressor result_lt_arg1 = 3431 new NISuppressor(2, 0, IntLessThan.class); 3432 private static NISuppressor result_lt_arg2 = 3433 new NISuppressor(2, 1, IntLessThan.class); 3434 private static NISuppressor arg1_lt_arg2 = 3435 new NISuppressor(0, 1, IntLessThan.class); 3436 private static NISuppressor arg2_lt_arg1 = 3437 new NISuppressor(1, 0, IntLessThan.class); 3438 3439 private static NISuppressor result_le_arg1 = 3440 new NISuppressor(2, 0, IntLessEqual.class); 3441 private static NISuppressor result_le_arg2 = 3442 new NISuppressor(2, 1, IntLessEqual.class); 3443 private static NISuppressor arg1_le_arg2 = 3444 new NISuppressor(0, 1, IntLessEqual.class); 3445 private static NISuppressor arg2_le_arg1 = 3446 new NISuppressor(1, 0, IntLessEqual.class); 3447 3448 private static NISuppressor result_track0_arg1 = 3449 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 3450 private static NISuppressor result_track0_arg2 = 3451 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 3452 private static NISuppressor arg1_track0_arg2 = 3453 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 3454 private static NISuppressor arg1_track0_result = 3455 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 3456 private static NISuppressor arg2_track0_result = 3457 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 3458 private static NISuppressor arg2_track0_arg1 = 3459 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 3460 3461 private static NISuppressor result_eq_1 = 3462 new NISuppressor(2, RangeInt.EqualOne.class); 3463 private static NISuppressor arg1_eq_1 = 3464 new NISuppressor(0, RangeInt.EqualOne.class); 3465 private static NISuppressor arg2_eq_1 = 3466 new NISuppressor(1, RangeInt.EqualOne.class); 3467 3468 private static NISuppressor result_eq_0 = 3469 new NISuppressor(2, RangeInt.EqualZero.class); 3470 private static NISuppressor arg1_eq_0 = 3471 new NISuppressor(0, RangeInt.EqualZero.class); 3472 private static NISuppressor arg2_eq_0 = 3473 new NISuppressor(1, RangeInt.EqualZero.class); 3474 3475 private static NISuppressor result_ne_0 = 3476 new NISuppressor(2, NonZero.class); 3477 private static NISuppressor arg1_ne_0 = 3478 new NISuppressor(0, NonZero.class); 3479 private static NISuppressor arg2_ne_0 = 3480 new NISuppressor(1, NonZero.class); 3481 3482 private static NISuppressor result_ge_0 = 3483 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 3484 private static NISuppressor arg1_ge_0 = 3485 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 3486 private static NISuppressor arg2_ge_0 = 3487 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 3488 3489 private static NISuppressor result_ge_64 = 3490 new NISuppressor(2, RangeInt.GreaterEqual64.class); 3491 private static NISuppressor arg1_ge_64 = 3492 new NISuppressor(0, RangeInt.GreaterEqual64.class); 3493 private static NISuppressor arg2_ge_64 = 3494 new NISuppressor(1, RangeInt.GreaterEqual64.class); 3495 3496 private static NISuppressor result_boolean = 3497 new NISuppressor(2, RangeInt.BooleanVal.class); 3498 private static NISuppressor arg1_boolean = 3499 new NISuppressor(0, RangeInt.BooleanVal.class); 3500 private static NISuppressor arg2_boolean = 3501 new NISuppressor(1, RangeInt.BooleanVal.class); 3502 3503 private static NISuppressor result_even = 3504 new NISuppressor(2, RangeInt.Even.class); 3505 private static NISuppressor arg1_even = 3506 new NISuppressor(0, RangeInt.Even.class); 3507 private static NISuppressor arg2_even = 3508 new NISuppressor(1, RangeInt.Even.class); 3509 3510 private static NISuppressor result_power2 = 3511 new NISuppressor(2, RangeInt.PowerOfTwo.class); 3512 private static NISuppressor arg1_power2 = 3513 new NISuppressor(0, RangeInt.PowerOfTwo.class); 3514 private static NISuppressor arg2_power2 = 3515 new NISuppressor(1, RangeInt.PowerOfTwo.class); 3516 3517 private static NISuppressor result_and0_arg1 = 3518 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 3519 private static NISuppressor result_and0_arg2 = 3520 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 3521 private static NISuppressor arg1_and0_arg2 = 3522 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 3523 3524 // The arguments to bitwise subset are backwards from what one 3525 // might expect. The second argument is a subset of the first 3526 // argument 3527 private static NISuppressor arg1_bw_subset_arg2 = 3528 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 3529 private static NISuppressor arg2_bw_subset_arg1 = 3530 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 3531 3532 private static NISuppressor result_shift0_arg1 = 3533 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 3534 private static NISuppressor result_shift0_arg2 = 3535 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 3536 private static NISuppressor arg1_shift0_arg2 = 3537 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 3538 3539 private static NISuppressor arg2_divides_arg1 = 3540 new NISuppressor(0, 1, NumericInt.Divides.class); 3541 private static NISuppressor arg1_divides_arg2 = 3542 new NISuppressor(1, 0, NumericInt.Divides.class); 3543 3544 private static NISuppressor arg2_valid_shift = 3545 new NISuppressor(1, RangeInt.Bound0_63.class); 3546 3547 private static NISuppressionSet suppressions = 3548 new NISuppressionSet( 3549 new NISuppression[] { 3550 3551 // (r == 0) && (x < y) && (x >= 0) && (y != 0) ==> r = x / y 3552 new NISuppression(result_eq_0, arg1_lt_arg2, arg1_ge_0, arg2_ne_0, suppressee), 3553 3554 // (x == y) && (y != 0) && (r == 1) 3555 new NISuppression(arg1_eq_arg2, arg2_ne_0, result_eq_1, suppressee), 3556 3557 // (r == x) && (y == 1) ==> r = x / y 3558 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 3559 }); 3560 3561 // Create a suppression factory for functionBinary 3562 3563} 3564 3565/** 3566 * Represents the invariant {@code x = Division(z, y)} over three long 3567 * scalars. 3568 */ 3569public static class DivisionLong_xzy extends FunctionBinary { 3570 static final long serialVersionUID = 20031030L; 3571 3572 private static @Prototype DivisionLong_xzy proto = new @Prototype DivisionLong_xzy (); 3573 3574 /** Returns the prototype invariant for DivisionLong_xzy */ 3575 public static @Prototype DivisionLong_xzy get_proto() { 3576 return proto; 3577 } 3578 3579 @Override 3580 protected DivisionLong_xzy instantiate_dyn(@Prototype DivisionLong_xzy this, PptSlice slice) { 3581 return new DivisionLong_xzy (slice); 3582 } 3583 3584 private DivisionLong_xzy (PptSlice slice) { 3585 super(slice); 3586 } 3587 3588 public @Prototype DivisionLong_xzy () { 3589 super(); 3590 } 3591 3592 private static String[] method_name = new String[] {"", " / ", ""}; 3593 3594 @Override 3595 public String[] get_method_name(@GuardSatisfied DivisionLong_xzy this) { 3596 return method_name; 3597 } 3598 3599 private static int function_id = -1; 3600 3601 @Override 3602 public int get_function_id() { 3603 return function_id; 3604 } 3605 3606 @Override 3607 public void set_function_id(int function_id) { 3608 assert DivisionLong_xzy.function_id == -1; 3609 DivisionLong_xzy.function_id = function_id; 3610 } 3611 3612 private static int var_order = 4; 3613 3614 @Override 3615 public int get_var_order(@GuardSatisfied DivisionLong_xzy this) { 3616 return var_order; 3617 } 3618 3619 @Pure 3620 @Override 3621 public boolean is_symmetric() { 3622 3623 return false; 3624 } 3625 3626 @Override 3627 3628 public long func(long z, long y) { 3629 3630 return (z / y); 3631 } 3632 3633 @Override 3634 public InvariantStatus check_modified(long x, long y, 3635 long z, int count) { 3636 return check_ordered(x, z, y, count); 3637 } 3638 3639 @Override 3640 public InvariantStatus add_modified(long x, long y, 3641 long z, int count) { 3642 if (Debug.logDetail()) { 3643 log("result=%s, arg1=%s, arg2=%s", x, z, y); 3644 } 3645 return add_ordered(x, z, y, count); 3646 } 3647 3648 @Pure 3649 @Override 3650 public boolean isDivision() { 3651 return true; 3652 } 3653 3654 @Pure 3655 @Override 3656 public boolean isExact() { 3657 return true; 3658 } 3659 3660 /** Returns a list of non-instantiating suppressions for this invariant. */ 3661 @Pure 3662 @Override 3663 public @Nullable NISuppressionSet get_ni_suppressions() { 3664 if (NIS.dkconfig_enabled && dkconfig_enabled) { 3665 return suppressions; 3666 } else { 3667 return null; 3668 } 3669 } 3670 3671 /** definition of this invariant (the suppressee) */ 3672 private static NISuppressee suppressee = new NISuppressee(DivisionLong_xzy.class, 3); 3673 3674 // suppressor definitions (used below) 3675 private static NISuppressor result_eq_arg1 = 3676 new NISuppressor(0, 2, IntEqual.class); 3677 private static NISuppressor result_eq_arg2 = 3678 new NISuppressor(0, 1, IntEqual.class); 3679 private static NISuppressor arg1_eq_arg2 = 3680 new NISuppressor(2, 1, IntEqual.class); 3681 3682 private static NISuppressor result_lt_arg1 = 3683 new NISuppressor(0, 2, IntLessThan.class); 3684 private static NISuppressor result_lt_arg2 = 3685 new NISuppressor(0, 1, IntLessThan.class); 3686 private static NISuppressor arg1_lt_arg2 = 3687 new NISuppressor(2, 1, IntLessThan.class); 3688 private static NISuppressor arg2_lt_arg1 = 3689 new NISuppressor(1, 2, IntLessThan.class); 3690 3691 private static NISuppressor result_le_arg1 = 3692 new NISuppressor(0, 2, IntLessEqual.class); 3693 private static NISuppressor result_le_arg2 = 3694 new NISuppressor(0, 1, IntLessEqual.class); 3695 private static NISuppressor arg1_le_arg2 = 3696 new NISuppressor(2, 1, IntLessEqual.class); 3697 private static NISuppressor arg2_le_arg1 = 3698 new NISuppressor(1, 2, IntLessEqual.class); 3699 3700 private static NISuppressor result_track0_arg1 = 3701 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 3702 private static NISuppressor result_track0_arg2 = 3703 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 3704 private static NISuppressor arg1_track0_arg2 = 3705 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 3706 private static NISuppressor arg1_track0_result = 3707 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 3708 private static NISuppressor arg2_track0_result = 3709 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 3710 private static NISuppressor arg2_track0_arg1 = 3711 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 3712 3713 private static NISuppressor result_eq_1 = 3714 new NISuppressor(0, RangeInt.EqualOne.class); 3715 private static NISuppressor arg1_eq_1 = 3716 new NISuppressor(2, RangeInt.EqualOne.class); 3717 private static NISuppressor arg2_eq_1 = 3718 new NISuppressor(1, RangeInt.EqualOne.class); 3719 3720 private static NISuppressor result_eq_0 = 3721 new NISuppressor(0, RangeInt.EqualZero.class); 3722 private static NISuppressor arg1_eq_0 = 3723 new NISuppressor(2, RangeInt.EqualZero.class); 3724 private static NISuppressor arg2_eq_0 = 3725 new NISuppressor(1, RangeInt.EqualZero.class); 3726 3727 private static NISuppressor result_ne_0 = 3728 new NISuppressor(0, NonZero.class); 3729 private static NISuppressor arg1_ne_0 = 3730 new NISuppressor(2, NonZero.class); 3731 private static NISuppressor arg2_ne_0 = 3732 new NISuppressor(1, NonZero.class); 3733 3734 private static NISuppressor result_ge_0 = 3735 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 3736 private static NISuppressor arg1_ge_0 = 3737 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 3738 private static NISuppressor arg2_ge_0 = 3739 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 3740 3741 private static NISuppressor result_ge_64 = 3742 new NISuppressor(0, RangeInt.GreaterEqual64.class); 3743 private static NISuppressor arg1_ge_64 = 3744 new NISuppressor(2, RangeInt.GreaterEqual64.class); 3745 private static NISuppressor arg2_ge_64 = 3746 new NISuppressor(1, RangeInt.GreaterEqual64.class); 3747 3748 private static NISuppressor result_boolean = 3749 new NISuppressor(0, RangeInt.BooleanVal.class); 3750 private static NISuppressor arg1_boolean = 3751 new NISuppressor(2, RangeInt.BooleanVal.class); 3752 private static NISuppressor arg2_boolean = 3753 new NISuppressor(1, RangeInt.BooleanVal.class); 3754 3755 private static NISuppressor result_even = 3756 new NISuppressor(0, RangeInt.Even.class); 3757 private static NISuppressor arg1_even = 3758 new NISuppressor(2, RangeInt.Even.class); 3759 private static NISuppressor arg2_even = 3760 new NISuppressor(1, RangeInt.Even.class); 3761 3762 private static NISuppressor result_power2 = 3763 new NISuppressor(0, RangeInt.PowerOfTwo.class); 3764 private static NISuppressor arg1_power2 = 3765 new NISuppressor(2, RangeInt.PowerOfTwo.class); 3766 private static NISuppressor arg2_power2 = 3767 new NISuppressor(1, RangeInt.PowerOfTwo.class); 3768 3769 private static NISuppressor result_and0_arg1 = 3770 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 3771 private static NISuppressor result_and0_arg2 = 3772 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 3773 private static NISuppressor arg1_and0_arg2 = 3774 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 3775 3776 // The arguments to bitwise subset are backwards from what one 3777 // might expect. The second argument is a subset of the first 3778 // argument 3779 private static NISuppressor arg1_bw_subset_arg2 = 3780 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 3781 private static NISuppressor arg2_bw_subset_arg1 = 3782 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 3783 3784 private static NISuppressor result_shift0_arg1 = 3785 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 3786 private static NISuppressor result_shift0_arg2 = 3787 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 3788 private static NISuppressor arg1_shift0_arg2 = 3789 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 3790 3791 private static NISuppressor arg2_divides_arg1 = 3792 new NISuppressor(2, 1, NumericInt.Divides.class); 3793 private static NISuppressor arg1_divides_arg2 = 3794 new NISuppressor(1, 2, NumericInt.Divides.class); 3795 3796 private static NISuppressor arg2_valid_shift = 3797 new NISuppressor(1, RangeInt.Bound0_63.class); 3798 3799 private static NISuppressionSet suppressions = 3800 new NISuppressionSet( 3801 new NISuppression[] { 3802 3803 // (r == 0) && (z < y) && (z >= 0) && (y != 0) ==> r = z / y 3804 new NISuppression(result_eq_0, arg1_lt_arg2, arg1_ge_0, arg2_ne_0, suppressee), 3805 3806 // (z == y) && (y != 0) && (r == 1) 3807 new NISuppression(arg1_eq_arg2, arg2_ne_0, result_eq_1, suppressee), 3808 3809 // (r == z) && (y == 1) ==> r = z / y 3810 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 3811 }); 3812 3813 // Create a suppression factory for functionBinary 3814 3815} 3816 3817/** 3818 * Represents the invariant {@code y = Division(z, x)} over three long 3819 * scalars. 3820 */ 3821public static class DivisionLong_yzx extends FunctionBinary { 3822 static final long serialVersionUID = 20031030L; 3823 3824 private static @Prototype DivisionLong_yzx proto = new @Prototype DivisionLong_yzx (); 3825 3826 /** Returns the prototype invariant for DivisionLong_yzx */ 3827 public static @Prototype DivisionLong_yzx get_proto() { 3828 return proto; 3829 } 3830 3831 @Override 3832 protected DivisionLong_yzx instantiate_dyn(@Prototype DivisionLong_yzx this, PptSlice slice) { 3833 return new DivisionLong_yzx (slice); 3834 } 3835 3836 private DivisionLong_yzx (PptSlice slice) { 3837 super(slice); 3838 } 3839 3840 public @Prototype DivisionLong_yzx () { 3841 super(); 3842 } 3843 3844 private static String[] method_name = new String[] {"", " / ", ""}; 3845 3846 @Override 3847 public String[] get_method_name(@GuardSatisfied DivisionLong_yzx this) { 3848 return method_name; 3849 } 3850 3851 private static int function_id = -1; 3852 3853 @Override 3854 public int get_function_id() { 3855 return function_id; 3856 } 3857 3858 @Override 3859 public void set_function_id(int function_id) { 3860 assert DivisionLong_yzx.function_id == -1; 3861 DivisionLong_yzx.function_id = function_id; 3862 } 3863 3864 private static int var_order = 5; 3865 3866 @Override 3867 public int get_var_order(@GuardSatisfied DivisionLong_yzx this) { 3868 return var_order; 3869 } 3870 3871 @Pure 3872 @Override 3873 public boolean is_symmetric() { 3874 3875 return false; 3876 } 3877 3878 @Override 3879 3880 public long func(long z, long x) { 3881 3882 return (z / x); 3883 } 3884 3885 @Override 3886 public InvariantStatus check_modified(long x, long y, 3887 long z, int count) { 3888 return check_ordered(y, z, x, count); 3889 } 3890 3891 @Override 3892 public InvariantStatus add_modified(long x, long y, 3893 long z, int count) { 3894 if (Debug.logDetail()) { 3895 log("result=%s, arg1=%s, arg2=%s", y, z, x); 3896 } 3897 return add_ordered(y, z, x, count); 3898 } 3899 3900 @Pure 3901 @Override 3902 public boolean isDivision() { 3903 return true; 3904 } 3905 3906 @Pure 3907 @Override 3908 public boolean isExact() { 3909 return true; 3910 } 3911 3912 /** Returns a list of non-instantiating suppressions for this invariant. */ 3913 @Pure 3914 @Override 3915 public @Nullable NISuppressionSet get_ni_suppressions() { 3916 if (NIS.dkconfig_enabled && dkconfig_enabled) { 3917 return suppressions; 3918 } else { 3919 return null; 3920 } 3921 } 3922 3923 /** definition of this invariant (the suppressee) */ 3924 private static NISuppressee suppressee = new NISuppressee(DivisionLong_yzx.class, 3); 3925 3926 // suppressor definitions (used below) 3927 private static NISuppressor result_eq_arg1 = 3928 new NISuppressor(1, 2, IntEqual.class); 3929 private static NISuppressor result_eq_arg2 = 3930 new NISuppressor(1, 0, IntEqual.class); 3931 private static NISuppressor arg1_eq_arg2 = 3932 new NISuppressor(2, 0, IntEqual.class); 3933 3934 private static NISuppressor result_lt_arg1 = 3935 new NISuppressor(1, 2, IntLessThan.class); 3936 private static NISuppressor result_lt_arg2 = 3937 new NISuppressor(1, 0, IntLessThan.class); 3938 private static NISuppressor arg1_lt_arg2 = 3939 new NISuppressor(2, 0, IntLessThan.class); 3940 private static NISuppressor arg2_lt_arg1 = 3941 new NISuppressor(0, 2, IntLessThan.class); 3942 3943 private static NISuppressor result_le_arg1 = 3944 new NISuppressor(1, 2, IntLessEqual.class); 3945 private static NISuppressor result_le_arg2 = 3946 new NISuppressor(1, 0, IntLessEqual.class); 3947 private static NISuppressor arg1_le_arg2 = 3948 new NISuppressor(2, 0, IntLessEqual.class); 3949 private static NISuppressor arg2_le_arg1 = 3950 new NISuppressor(0, 2, IntLessEqual.class); 3951 3952 private static NISuppressor result_track0_arg1 = 3953 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 3954 private static NISuppressor result_track0_arg2 = 3955 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 3956 private static NISuppressor arg1_track0_arg2 = 3957 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 3958 private static NISuppressor arg1_track0_result = 3959 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 3960 private static NISuppressor arg2_track0_result = 3961 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 3962 private static NISuppressor arg2_track0_arg1 = 3963 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 3964 3965 private static NISuppressor result_eq_1 = 3966 new NISuppressor(1, RangeInt.EqualOne.class); 3967 private static NISuppressor arg1_eq_1 = 3968 new NISuppressor(2, RangeInt.EqualOne.class); 3969 private static NISuppressor arg2_eq_1 = 3970 new NISuppressor(0, RangeInt.EqualOne.class); 3971 3972 private static NISuppressor result_eq_0 = 3973 new NISuppressor(1, RangeInt.EqualZero.class); 3974 private static NISuppressor arg1_eq_0 = 3975 new NISuppressor(2, RangeInt.EqualZero.class); 3976 private static NISuppressor arg2_eq_0 = 3977 new NISuppressor(0, RangeInt.EqualZero.class); 3978 3979 private static NISuppressor result_ne_0 = 3980 new NISuppressor(1, NonZero.class); 3981 private static NISuppressor arg1_ne_0 = 3982 new NISuppressor(2, NonZero.class); 3983 private static NISuppressor arg2_ne_0 = 3984 new NISuppressor(0, NonZero.class); 3985 3986 private static NISuppressor result_ge_0 = 3987 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 3988 private static NISuppressor arg1_ge_0 = 3989 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 3990 private static NISuppressor arg2_ge_0 = 3991 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 3992 3993 private static NISuppressor result_ge_64 = 3994 new NISuppressor(1, RangeInt.GreaterEqual64.class); 3995 private static NISuppressor arg1_ge_64 = 3996 new NISuppressor(2, RangeInt.GreaterEqual64.class); 3997 private static NISuppressor arg2_ge_64 = 3998 new NISuppressor(0, RangeInt.GreaterEqual64.class); 3999 4000 private static NISuppressor result_boolean = 4001 new NISuppressor(1, RangeInt.BooleanVal.class); 4002 private static NISuppressor arg1_boolean = 4003 new NISuppressor(2, RangeInt.BooleanVal.class); 4004 private static NISuppressor arg2_boolean = 4005 new NISuppressor(0, RangeInt.BooleanVal.class); 4006 4007 private static NISuppressor result_even = 4008 new NISuppressor(1, RangeInt.Even.class); 4009 private static NISuppressor arg1_even = 4010 new NISuppressor(2, RangeInt.Even.class); 4011 private static NISuppressor arg2_even = 4012 new NISuppressor(0, RangeInt.Even.class); 4013 4014 private static NISuppressor result_power2 = 4015 new NISuppressor(1, RangeInt.PowerOfTwo.class); 4016 private static NISuppressor arg1_power2 = 4017 new NISuppressor(2, RangeInt.PowerOfTwo.class); 4018 private static NISuppressor arg2_power2 = 4019 new NISuppressor(0, RangeInt.PowerOfTwo.class); 4020 4021 private static NISuppressor result_and0_arg1 = 4022 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 4023 private static NISuppressor result_and0_arg2 = 4024 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 4025 private static NISuppressor arg1_and0_arg2 = 4026 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 4027 4028 // The arguments to bitwise subset are backwards from what one 4029 // might expect. The second argument is a subset of the first 4030 // argument 4031 private static NISuppressor arg1_bw_subset_arg2 = 4032 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 4033 private static NISuppressor arg2_bw_subset_arg1 = 4034 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 4035 4036 private static NISuppressor result_shift0_arg1 = 4037 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 4038 private static NISuppressor result_shift0_arg2 = 4039 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 4040 private static NISuppressor arg1_shift0_arg2 = 4041 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 4042 4043 private static NISuppressor arg2_divides_arg1 = 4044 new NISuppressor(2, 0, NumericInt.Divides.class); 4045 private static NISuppressor arg1_divides_arg2 = 4046 new NISuppressor(0, 2, NumericInt.Divides.class); 4047 4048 private static NISuppressor arg2_valid_shift = 4049 new NISuppressor(0, RangeInt.Bound0_63.class); 4050 4051 private static NISuppressionSet suppressions = 4052 new NISuppressionSet( 4053 new NISuppression[] { 4054 4055 // (r == 0) && (z < x) && (z >= 0) && (x != 0) ==> r = z / x 4056 new NISuppression(result_eq_0, arg1_lt_arg2, arg1_ge_0, arg2_ne_0, suppressee), 4057 4058 // (z == x) && (x != 0) && (r == 1) 4059 new NISuppression(arg1_eq_arg2, arg2_ne_0, result_eq_1, suppressee), 4060 4061 // (r == z) && (x == 1) ==> r = z / x 4062 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 4063 }); 4064 4065 // Create a suppression factory for functionBinary 4066 4067} 4068 4069/** 4070 * Represents the invariant {@code z = Division(y, x)} over three long 4071 * scalars. 4072 */ 4073public static class DivisionLong_zyx extends FunctionBinary { 4074 static final long serialVersionUID = 20031030L; 4075 4076 private static @Prototype DivisionLong_zyx proto = new @Prototype DivisionLong_zyx (); 4077 4078 /** Returns the prototype invariant for DivisionLong_zyx */ 4079 public static @Prototype DivisionLong_zyx get_proto() { 4080 return proto; 4081 } 4082 4083 @Override 4084 protected DivisionLong_zyx instantiate_dyn(@Prototype DivisionLong_zyx this, PptSlice slice) { 4085 return new DivisionLong_zyx (slice); 4086 } 4087 4088 private DivisionLong_zyx (PptSlice slice) { 4089 super(slice); 4090 } 4091 4092 public @Prototype DivisionLong_zyx () { 4093 super(); 4094 } 4095 4096 private static String[] method_name = new String[] {"", " / ", ""}; 4097 4098 @Override 4099 public String[] get_method_name(@GuardSatisfied DivisionLong_zyx this) { 4100 return method_name; 4101 } 4102 4103 private static int function_id = -1; 4104 4105 @Override 4106 public int get_function_id() { 4107 return function_id; 4108 } 4109 4110 @Override 4111 public void set_function_id(int function_id) { 4112 assert DivisionLong_zyx.function_id == -1; 4113 DivisionLong_zyx.function_id = function_id; 4114 } 4115 4116 private static int var_order = 6; 4117 4118 @Override 4119 public int get_var_order(@GuardSatisfied DivisionLong_zyx this) { 4120 return var_order; 4121 } 4122 4123 @Pure 4124 @Override 4125 public boolean is_symmetric() { 4126 4127 return false; 4128 } 4129 4130 @Override 4131 4132 public long func(long y, long x) { 4133 4134 return (y / x); 4135 } 4136 4137 @Override 4138 public InvariantStatus check_modified(long x, long y, 4139 long z, int count) { 4140 return check_ordered(z, y, x, count); 4141 } 4142 4143 @Override 4144 public InvariantStatus add_modified(long x, long y, 4145 long z, int count) { 4146 if (Debug.logDetail()) { 4147 log("result=%s, arg1=%s, arg2=%s", z, y, x); 4148 } 4149 return add_ordered(z, y, x, count); 4150 } 4151 4152 @Pure 4153 @Override 4154 public boolean isDivision() { 4155 return true; 4156 } 4157 4158 @Pure 4159 @Override 4160 public boolean isExact() { 4161 return true; 4162 } 4163 4164 /** Returns a list of non-instantiating suppressions for this invariant. */ 4165 @Pure 4166 @Override 4167 public @Nullable NISuppressionSet get_ni_suppressions() { 4168 if (NIS.dkconfig_enabled && dkconfig_enabled) { 4169 return suppressions; 4170 } else { 4171 return null; 4172 } 4173 } 4174 4175 /** definition of this invariant (the suppressee) */ 4176 private static NISuppressee suppressee = new NISuppressee(DivisionLong_zyx.class, 3); 4177 4178 // suppressor definitions (used below) 4179 private static NISuppressor result_eq_arg1 = 4180 new NISuppressor(2, 1, IntEqual.class); 4181 private static NISuppressor result_eq_arg2 = 4182 new NISuppressor(2, 0, IntEqual.class); 4183 private static NISuppressor arg1_eq_arg2 = 4184 new NISuppressor(1, 0, IntEqual.class); 4185 4186 private static NISuppressor result_lt_arg1 = 4187 new NISuppressor(2, 1, IntLessThan.class); 4188 private static NISuppressor result_lt_arg2 = 4189 new NISuppressor(2, 0, IntLessThan.class); 4190 private static NISuppressor arg1_lt_arg2 = 4191 new NISuppressor(1, 0, IntLessThan.class); 4192 private static NISuppressor arg2_lt_arg1 = 4193 new NISuppressor(0, 1, IntLessThan.class); 4194 4195 private static NISuppressor result_le_arg1 = 4196 new NISuppressor(2, 1, IntLessEqual.class); 4197 private static NISuppressor result_le_arg2 = 4198 new NISuppressor(2, 0, IntLessEqual.class); 4199 private static NISuppressor arg1_le_arg2 = 4200 new NISuppressor(1, 0, IntLessEqual.class); 4201 private static NISuppressor arg2_le_arg1 = 4202 new NISuppressor(0, 1, IntLessEqual.class); 4203 4204 private static NISuppressor result_track0_arg1 = 4205 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 4206 private static NISuppressor result_track0_arg2 = 4207 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 4208 private static NISuppressor arg1_track0_arg2 = 4209 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 4210 private static NISuppressor arg1_track0_result = 4211 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 4212 private static NISuppressor arg2_track0_result = 4213 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 4214 private static NISuppressor arg2_track0_arg1 = 4215 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 4216 4217 private static NISuppressor result_eq_1 = 4218 new NISuppressor(2, RangeInt.EqualOne.class); 4219 private static NISuppressor arg1_eq_1 = 4220 new NISuppressor(1, RangeInt.EqualOne.class); 4221 private static NISuppressor arg2_eq_1 = 4222 new NISuppressor(0, RangeInt.EqualOne.class); 4223 4224 private static NISuppressor result_eq_0 = 4225 new NISuppressor(2, RangeInt.EqualZero.class); 4226 private static NISuppressor arg1_eq_0 = 4227 new NISuppressor(1, RangeInt.EqualZero.class); 4228 private static NISuppressor arg2_eq_0 = 4229 new NISuppressor(0, RangeInt.EqualZero.class); 4230 4231 private static NISuppressor result_ne_0 = 4232 new NISuppressor(2, NonZero.class); 4233 private static NISuppressor arg1_ne_0 = 4234 new NISuppressor(1, NonZero.class); 4235 private static NISuppressor arg2_ne_0 = 4236 new NISuppressor(0, NonZero.class); 4237 4238 private static NISuppressor result_ge_0 = 4239 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 4240 private static NISuppressor arg1_ge_0 = 4241 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 4242 private static NISuppressor arg2_ge_0 = 4243 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 4244 4245 private static NISuppressor result_ge_64 = 4246 new NISuppressor(2, RangeInt.GreaterEqual64.class); 4247 private static NISuppressor arg1_ge_64 = 4248 new NISuppressor(1, RangeInt.GreaterEqual64.class); 4249 private static NISuppressor arg2_ge_64 = 4250 new NISuppressor(0, RangeInt.GreaterEqual64.class); 4251 4252 private static NISuppressor result_boolean = 4253 new NISuppressor(2, RangeInt.BooleanVal.class); 4254 private static NISuppressor arg1_boolean = 4255 new NISuppressor(1, RangeInt.BooleanVal.class); 4256 private static NISuppressor arg2_boolean = 4257 new NISuppressor(0, RangeInt.BooleanVal.class); 4258 4259 private static NISuppressor result_even = 4260 new NISuppressor(2, RangeInt.Even.class); 4261 private static NISuppressor arg1_even = 4262 new NISuppressor(1, RangeInt.Even.class); 4263 private static NISuppressor arg2_even = 4264 new NISuppressor(0, RangeInt.Even.class); 4265 4266 private static NISuppressor result_power2 = 4267 new NISuppressor(2, RangeInt.PowerOfTwo.class); 4268 private static NISuppressor arg1_power2 = 4269 new NISuppressor(1, RangeInt.PowerOfTwo.class); 4270 private static NISuppressor arg2_power2 = 4271 new NISuppressor(0, RangeInt.PowerOfTwo.class); 4272 4273 private static NISuppressor result_and0_arg1 = 4274 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 4275 private static NISuppressor result_and0_arg2 = 4276 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 4277 private static NISuppressor arg1_and0_arg2 = 4278 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 4279 4280 // The arguments to bitwise subset are backwards from what one 4281 // might expect. The second argument is a subset of the first 4282 // argument 4283 private static NISuppressor arg1_bw_subset_arg2 = 4284 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 4285 private static NISuppressor arg2_bw_subset_arg1 = 4286 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 4287 4288 private static NISuppressor result_shift0_arg1 = 4289 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 4290 private static NISuppressor result_shift0_arg2 = 4291 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 4292 private static NISuppressor arg1_shift0_arg2 = 4293 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 4294 4295 private static NISuppressor arg2_divides_arg1 = 4296 new NISuppressor(1, 0, NumericInt.Divides.class); 4297 private static NISuppressor arg1_divides_arg2 = 4298 new NISuppressor(0, 1, NumericInt.Divides.class); 4299 4300 private static NISuppressor arg2_valid_shift = 4301 new NISuppressor(0, RangeInt.Bound0_63.class); 4302 4303 private static NISuppressionSet suppressions = 4304 new NISuppressionSet( 4305 new NISuppression[] { 4306 4307 // (r == 0) && (y < x) && (y >= 0) && (x != 0) ==> r = y / x 4308 new NISuppression(result_eq_0, arg1_lt_arg2, arg1_ge_0, arg2_ne_0, suppressee), 4309 4310 // (y == x) && (x != 0) && (r == 1) 4311 new NISuppression(arg1_eq_arg2, arg2_ne_0, result_eq_1, suppressee), 4312 4313 // (r == y) && (x == 1) ==> r = y / x 4314 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 4315 }); 4316 4317 // Create a suppression factory for functionBinary 4318 4319} 4320 4321 // default is that it is not this function, overriden in the subclass 4322 @Pure 4323 public boolean isPower() { 4324 return false; 4325 } 4326 4327/** 4328 * Represents the invariant {@code x = Power(y, z)} over three long 4329 * scalars. 4330 */ 4331public static class PowerLong_xyz extends FunctionBinary { 4332 static final long serialVersionUID = 20031030L; 4333 4334 private static @Prototype PowerLong_xyz proto = new @Prototype PowerLong_xyz (); 4335 4336 /** Returns the prototype invariant for PowerLong_xyz */ 4337 public static @Prototype PowerLong_xyz get_proto() { 4338 return proto; 4339 } 4340 4341 @Override 4342 protected PowerLong_xyz instantiate_dyn(@Prototype PowerLong_xyz this, PptSlice slice) { 4343 return new PowerLong_xyz (slice); 4344 } 4345 4346 private PowerLong_xyz (PptSlice slice) { 4347 super(slice); 4348 } 4349 4350 public @Prototype PowerLong_xyz () { 4351 super(); 4352 } 4353 4354 private static String[] method_name = new String[] {"java.lang.Math.pow(", ", ", ")"}; 4355 4356 @Override 4357 public String[] get_method_name(@GuardSatisfied PowerLong_xyz this) { 4358 return method_name; 4359 } 4360 4361 private static int function_id = -1; 4362 4363 @Override 4364 public int get_function_id() { 4365 return function_id; 4366 } 4367 4368 @Override 4369 public void set_function_id(int function_id) { 4370 assert PowerLong_xyz.function_id == -1; 4371 PowerLong_xyz.function_id = function_id; 4372 } 4373 4374 private static int var_order = 1; 4375 4376 @Override 4377 public int get_var_order(@GuardSatisfied PowerLong_xyz this) { 4378 return var_order; 4379 } 4380 4381 @Pure 4382 @Override 4383 public boolean is_symmetric() { 4384 4385 return false; 4386 } 4387 4388 @Override 4389 4390 public long func(long y, long z) { 4391 4392 return MathPlume.pow(y, z); 4393 } 4394 4395 @Override 4396 public InvariantStatus check_modified(long x, long y, 4397 long z, int count) { 4398 return check_ordered(x, y, z, count); 4399 } 4400 4401 @Override 4402 public InvariantStatus add_modified(long x, long y, 4403 long z, int count) { 4404 if (Debug.logDetail()) { 4405 log("result=%s, arg1=%s, arg2=%s", x, y, z); 4406 } 4407 return add_ordered(x, y, z, count); 4408 } 4409 4410 @Pure 4411 @Override 4412 public boolean isPower() { 4413 return true; 4414 } 4415 4416 @Pure 4417 @Override 4418 public boolean isExact() { 4419 return true; 4420 } 4421 4422 /** Returns a list of non-instantiating suppressions for this invariant. */ 4423 @Pure 4424 @Override 4425 public @Nullable NISuppressionSet get_ni_suppressions() { 4426 if (NIS.dkconfig_enabled && dkconfig_enabled) { 4427 return suppressions; 4428 } else { 4429 return null; 4430 } 4431 } 4432 4433 /** definition of this invariant (the suppressee) */ 4434 private static NISuppressee suppressee = new NISuppressee(PowerLong_xyz.class, 3); 4435 4436 // suppressor definitions (used below) 4437 private static NISuppressor result_eq_arg1 = 4438 new NISuppressor(0, 1, IntEqual.class); 4439 private static NISuppressor result_eq_arg2 = 4440 new NISuppressor(0, 2, IntEqual.class); 4441 private static NISuppressor arg1_eq_arg2 = 4442 new NISuppressor(1, 2, IntEqual.class); 4443 4444 private static NISuppressor result_lt_arg1 = 4445 new NISuppressor(0, 1, IntLessThan.class); 4446 private static NISuppressor result_lt_arg2 = 4447 new NISuppressor(0, 2, IntLessThan.class); 4448 private static NISuppressor arg1_lt_arg2 = 4449 new NISuppressor(1, 2, IntLessThan.class); 4450 private static NISuppressor arg2_lt_arg1 = 4451 new NISuppressor(2, 1, IntLessThan.class); 4452 4453 private static NISuppressor result_le_arg1 = 4454 new NISuppressor(0, 1, IntLessEqual.class); 4455 private static NISuppressor result_le_arg2 = 4456 new NISuppressor(0, 2, IntLessEqual.class); 4457 private static NISuppressor arg1_le_arg2 = 4458 new NISuppressor(1, 2, IntLessEqual.class); 4459 private static NISuppressor arg2_le_arg1 = 4460 new NISuppressor(2, 1, IntLessEqual.class); 4461 4462 private static NISuppressor result_track0_arg1 = 4463 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 4464 private static NISuppressor result_track0_arg2 = 4465 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 4466 private static NISuppressor arg1_track0_arg2 = 4467 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 4468 private static NISuppressor arg1_track0_result = 4469 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 4470 private static NISuppressor arg2_track0_result = 4471 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 4472 private static NISuppressor arg2_track0_arg1 = 4473 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 4474 4475 private static NISuppressor result_eq_1 = 4476 new NISuppressor(0, RangeInt.EqualOne.class); 4477 private static NISuppressor arg1_eq_1 = 4478 new NISuppressor(1, RangeInt.EqualOne.class); 4479 private static NISuppressor arg2_eq_1 = 4480 new NISuppressor(2, RangeInt.EqualOne.class); 4481 4482 private static NISuppressor result_eq_0 = 4483 new NISuppressor(0, RangeInt.EqualZero.class); 4484 private static NISuppressor arg1_eq_0 = 4485 new NISuppressor(1, RangeInt.EqualZero.class); 4486 private static NISuppressor arg2_eq_0 = 4487 new NISuppressor(2, RangeInt.EqualZero.class); 4488 4489 private static NISuppressor result_ne_0 = 4490 new NISuppressor(0, NonZero.class); 4491 private static NISuppressor arg1_ne_0 = 4492 new NISuppressor(1, NonZero.class); 4493 private static NISuppressor arg2_ne_0 = 4494 new NISuppressor(2, NonZero.class); 4495 4496 private static NISuppressor result_ge_0 = 4497 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 4498 private static NISuppressor arg1_ge_0 = 4499 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 4500 private static NISuppressor arg2_ge_0 = 4501 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 4502 4503 private static NISuppressor result_ge_64 = 4504 new NISuppressor(0, RangeInt.GreaterEqual64.class); 4505 private static NISuppressor arg1_ge_64 = 4506 new NISuppressor(1, RangeInt.GreaterEqual64.class); 4507 private static NISuppressor arg2_ge_64 = 4508 new NISuppressor(2, RangeInt.GreaterEqual64.class); 4509 4510 private static NISuppressor result_boolean = 4511 new NISuppressor(0, RangeInt.BooleanVal.class); 4512 private static NISuppressor arg1_boolean = 4513 new NISuppressor(1, RangeInt.BooleanVal.class); 4514 private static NISuppressor arg2_boolean = 4515 new NISuppressor(2, RangeInt.BooleanVal.class); 4516 4517 private static NISuppressor result_even = 4518 new NISuppressor(0, RangeInt.Even.class); 4519 private static NISuppressor arg1_even = 4520 new NISuppressor(1, RangeInt.Even.class); 4521 private static NISuppressor arg2_even = 4522 new NISuppressor(2, RangeInt.Even.class); 4523 4524 private static NISuppressor result_power2 = 4525 new NISuppressor(0, RangeInt.PowerOfTwo.class); 4526 private static NISuppressor arg1_power2 = 4527 new NISuppressor(1, RangeInt.PowerOfTwo.class); 4528 private static NISuppressor arg2_power2 = 4529 new NISuppressor(2, RangeInt.PowerOfTwo.class); 4530 4531 private static NISuppressor result_and0_arg1 = 4532 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 4533 private static NISuppressor result_and0_arg2 = 4534 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 4535 private static NISuppressor arg1_and0_arg2 = 4536 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 4537 4538 // The arguments to bitwise subset are backwards from what one 4539 // might expect. The second argument is a subset of the first 4540 // argument 4541 private static NISuppressor arg1_bw_subset_arg2 = 4542 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 4543 private static NISuppressor arg2_bw_subset_arg1 = 4544 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 4545 4546 private static NISuppressor result_shift0_arg1 = 4547 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 4548 private static NISuppressor result_shift0_arg2 = 4549 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 4550 private static NISuppressor arg1_shift0_arg2 = 4551 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 4552 4553 private static NISuppressor arg2_divides_arg1 = 4554 new NISuppressor(1, 2, NumericInt.Divides.class); 4555 private static NISuppressor arg1_divides_arg2 = 4556 new NISuppressor(2, 1, NumericInt.Divides.class); 4557 4558 private static NISuppressor arg2_valid_shift = 4559 new NISuppressor(2, RangeInt.Bound0_63.class); 4560 4561 // Note that any suppression that doesn't limit z to valid exponents 4562 // (>= 0), must check for valid exponents as well (so that the invariant 4563 // is correctly destroyed on invalid exponents) 4564 // 4565 // Note also that pow(0,0) == 1 and pow(0,x), where (x > 0), == 0 4566 // Another interesting artificat of pow is that for any even base, any 4567 // exponent >= 64 will yield a result of 0. For example, pow(10,256) == 0 4568 // (at least for integers) 4569 4570 private static NISuppressionSet suppressions = 4571 new NISuppressionSet( 4572 new NISuppression[] { 4573 4574 // (r == 1) && (z == 0) ==> r = pow (y, z) 4575 new NISuppression(result_eq_1, arg2_eq_0, suppressee), 4576 4577 // (r == 1) && (y == 1) && (z >= 0) ==> r = pow (y, z) 4578 new NISuppression(result_eq_1, arg1_eq_1, arg2_ge_0, suppressee), 4579 4580 // (r == 0) && (y == 0) && (z > 0) 4581 new NISuppression(result_eq_0, arg1_eq_0, arg2_ne_0, arg2_ge_0, 4582 suppressee), 4583 4584 // (r == y) && (z == 1) ==> r = pow (y, z) 4585 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 4586 4587 // (r == 0) && (y even) && (z >= 64) 4588 // with each multiply there is one more zero in the result and since 4589 // a long has 64 bits in it, it becomes zero at that point 4590 new NISuppression(result_eq_0, arg1_even, arg2_ge_64, suppressee), 4591 4592 // (r == 1) && (y boolean) && (y==0 <==> z==0) && (z >= 0) 4593 // 1 = pow (0, z) true iff (z == 0) 4594 // 1 = pow (1, z) true when z valid exponent 4595 new NISuppression(arg1_track0_arg2, arg2_ge_0, arg1_boolean, 4596 result_eq_1, suppressee), 4597 4598 // (r == y) && (r boolean) && (z > 0) 4599 // 0 = pow (0, z) true when z != 0 4600 // 1 = pow (1, z) true when z valid exponent 4601 new NISuppression(result_eq_arg1, result_boolean, arg2_ne_0, 4602 arg2_ge_0, suppressee), 4603 4604 }); 4605 4606 // Create a suppression factory for functionBinary 4607 4608} 4609 4610/** 4611 * Represents the invariant {@code y = Power(x, z)} over three long 4612 * scalars. 4613 */ 4614public static class PowerLong_yxz extends FunctionBinary { 4615 static final long serialVersionUID = 20031030L; 4616 4617 private static @Prototype PowerLong_yxz proto = new @Prototype PowerLong_yxz (); 4618 4619 /** Returns the prototype invariant for PowerLong_yxz */ 4620 public static @Prototype PowerLong_yxz get_proto() { 4621 return proto; 4622 } 4623 4624 @Override 4625 protected PowerLong_yxz instantiate_dyn(@Prototype PowerLong_yxz this, PptSlice slice) { 4626 return new PowerLong_yxz (slice); 4627 } 4628 4629 private PowerLong_yxz (PptSlice slice) { 4630 super(slice); 4631 } 4632 4633 public @Prototype PowerLong_yxz () { 4634 super(); 4635 } 4636 4637 private static String[] method_name = new String[] {"java.lang.Math.pow(", ", ", ")"}; 4638 4639 @Override 4640 public String[] get_method_name(@GuardSatisfied PowerLong_yxz this) { 4641 return method_name; 4642 } 4643 4644 private static int function_id = -1; 4645 4646 @Override 4647 public int get_function_id() { 4648 return function_id; 4649 } 4650 4651 @Override 4652 public void set_function_id(int function_id) { 4653 assert PowerLong_yxz.function_id == -1; 4654 PowerLong_yxz.function_id = function_id; 4655 } 4656 4657 private static int var_order = 2; 4658 4659 @Override 4660 public int get_var_order(@GuardSatisfied PowerLong_yxz this) { 4661 return var_order; 4662 } 4663 4664 @Pure 4665 @Override 4666 public boolean is_symmetric() { 4667 4668 return false; 4669 } 4670 4671 @Override 4672 4673 public long func(long x, long z) { 4674 4675 return MathPlume.pow(x, z); 4676 } 4677 4678 @Override 4679 public InvariantStatus check_modified(long x, long y, 4680 long z, int count) { 4681 return check_ordered(y, x, z, count); 4682 } 4683 4684 @Override 4685 public InvariantStatus add_modified(long x, long y, 4686 long z, int count) { 4687 if (Debug.logDetail()) { 4688 log("result=%s, arg1=%s, arg2=%s", y, x, z); 4689 } 4690 return add_ordered(y, x, z, count); 4691 } 4692 4693 @Pure 4694 @Override 4695 public boolean isPower() { 4696 return true; 4697 } 4698 4699 @Pure 4700 @Override 4701 public boolean isExact() { 4702 return true; 4703 } 4704 4705 /** Returns a list of non-instantiating suppressions for this invariant. */ 4706 @Pure 4707 @Override 4708 public @Nullable NISuppressionSet get_ni_suppressions() { 4709 if (NIS.dkconfig_enabled && dkconfig_enabled) { 4710 return suppressions; 4711 } else { 4712 return null; 4713 } 4714 } 4715 4716 /** definition of this invariant (the suppressee) */ 4717 private static NISuppressee suppressee = new NISuppressee(PowerLong_yxz.class, 3); 4718 4719 // suppressor definitions (used below) 4720 private static NISuppressor result_eq_arg1 = 4721 new NISuppressor(1, 0, IntEqual.class); 4722 private static NISuppressor result_eq_arg2 = 4723 new NISuppressor(1, 2, IntEqual.class); 4724 private static NISuppressor arg1_eq_arg2 = 4725 new NISuppressor(0, 2, IntEqual.class); 4726 4727 private static NISuppressor result_lt_arg1 = 4728 new NISuppressor(1, 0, IntLessThan.class); 4729 private static NISuppressor result_lt_arg2 = 4730 new NISuppressor(1, 2, IntLessThan.class); 4731 private static NISuppressor arg1_lt_arg2 = 4732 new NISuppressor(0, 2, IntLessThan.class); 4733 private static NISuppressor arg2_lt_arg1 = 4734 new NISuppressor(2, 0, IntLessThan.class); 4735 4736 private static NISuppressor result_le_arg1 = 4737 new NISuppressor(1, 0, IntLessEqual.class); 4738 private static NISuppressor result_le_arg2 = 4739 new NISuppressor(1, 2, IntLessEqual.class); 4740 private static NISuppressor arg1_le_arg2 = 4741 new NISuppressor(0, 2, IntLessEqual.class); 4742 private static NISuppressor arg2_le_arg1 = 4743 new NISuppressor(2, 0, IntLessEqual.class); 4744 4745 private static NISuppressor result_track0_arg1 = 4746 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 4747 private static NISuppressor result_track0_arg2 = 4748 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 4749 private static NISuppressor arg1_track0_arg2 = 4750 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 4751 private static NISuppressor arg1_track0_result = 4752 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 4753 private static NISuppressor arg2_track0_result = 4754 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 4755 private static NISuppressor arg2_track0_arg1 = 4756 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 4757 4758 private static NISuppressor result_eq_1 = 4759 new NISuppressor(1, RangeInt.EqualOne.class); 4760 private static NISuppressor arg1_eq_1 = 4761 new NISuppressor(0, RangeInt.EqualOne.class); 4762 private static NISuppressor arg2_eq_1 = 4763 new NISuppressor(2, RangeInt.EqualOne.class); 4764 4765 private static NISuppressor result_eq_0 = 4766 new NISuppressor(1, RangeInt.EqualZero.class); 4767 private static NISuppressor arg1_eq_0 = 4768 new NISuppressor(0, RangeInt.EqualZero.class); 4769 private static NISuppressor arg2_eq_0 = 4770 new NISuppressor(2, RangeInt.EqualZero.class); 4771 4772 private static NISuppressor result_ne_0 = 4773 new NISuppressor(1, NonZero.class); 4774 private static NISuppressor arg1_ne_0 = 4775 new NISuppressor(0, NonZero.class); 4776 private static NISuppressor arg2_ne_0 = 4777 new NISuppressor(2, NonZero.class); 4778 4779 private static NISuppressor result_ge_0 = 4780 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 4781 private static NISuppressor arg1_ge_0 = 4782 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 4783 private static NISuppressor arg2_ge_0 = 4784 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 4785 4786 private static NISuppressor result_ge_64 = 4787 new NISuppressor(1, RangeInt.GreaterEqual64.class); 4788 private static NISuppressor arg1_ge_64 = 4789 new NISuppressor(0, RangeInt.GreaterEqual64.class); 4790 private static NISuppressor arg2_ge_64 = 4791 new NISuppressor(2, RangeInt.GreaterEqual64.class); 4792 4793 private static NISuppressor result_boolean = 4794 new NISuppressor(1, RangeInt.BooleanVal.class); 4795 private static NISuppressor arg1_boolean = 4796 new NISuppressor(0, RangeInt.BooleanVal.class); 4797 private static NISuppressor arg2_boolean = 4798 new NISuppressor(2, RangeInt.BooleanVal.class); 4799 4800 private static NISuppressor result_even = 4801 new NISuppressor(1, RangeInt.Even.class); 4802 private static NISuppressor arg1_even = 4803 new NISuppressor(0, RangeInt.Even.class); 4804 private static NISuppressor arg2_even = 4805 new NISuppressor(2, RangeInt.Even.class); 4806 4807 private static NISuppressor result_power2 = 4808 new NISuppressor(1, RangeInt.PowerOfTwo.class); 4809 private static NISuppressor arg1_power2 = 4810 new NISuppressor(0, RangeInt.PowerOfTwo.class); 4811 private static NISuppressor arg2_power2 = 4812 new NISuppressor(2, RangeInt.PowerOfTwo.class); 4813 4814 private static NISuppressor result_and0_arg1 = 4815 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 4816 private static NISuppressor result_and0_arg2 = 4817 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 4818 private static NISuppressor arg1_and0_arg2 = 4819 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 4820 4821 // The arguments to bitwise subset are backwards from what one 4822 // might expect. The second argument is a subset of the first 4823 // argument 4824 private static NISuppressor arg1_bw_subset_arg2 = 4825 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 4826 private static NISuppressor arg2_bw_subset_arg1 = 4827 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 4828 4829 private static NISuppressor result_shift0_arg1 = 4830 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 4831 private static NISuppressor result_shift0_arg2 = 4832 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 4833 private static NISuppressor arg1_shift0_arg2 = 4834 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 4835 4836 private static NISuppressor arg2_divides_arg1 = 4837 new NISuppressor(0, 2, NumericInt.Divides.class); 4838 private static NISuppressor arg1_divides_arg2 = 4839 new NISuppressor(2, 0, NumericInt.Divides.class); 4840 4841 private static NISuppressor arg2_valid_shift = 4842 new NISuppressor(2, RangeInt.Bound0_63.class); 4843 4844 // Note that any suppression that doesn't limit z to valid exponents 4845 // (>= 0), must check for valid exponents as well (so that the invariant 4846 // is correctly destroyed on invalid exponents) 4847 // 4848 // Note also that pow(0,0) == 1 and pow(0,x), where (x > 0), == 0 4849 // Another interesting artificat of pow is that for any even base, any 4850 // exponent >= 64 will yield a result of 0. For example, pow(10,256) == 0 4851 // (at least for integers) 4852 4853 private static NISuppressionSet suppressions = 4854 new NISuppressionSet( 4855 new NISuppression[] { 4856 4857 // (r == 1) && (z == 0) ==> r = pow (x, z) 4858 new NISuppression(result_eq_1, arg2_eq_0, suppressee), 4859 4860 // (r == 1) && (x == 1) && (z >= 0) ==> r = pow (x, z) 4861 new NISuppression(result_eq_1, arg1_eq_1, arg2_ge_0, suppressee), 4862 4863 // (r == 0) && (x == 0) && (z > 0) 4864 new NISuppression(result_eq_0, arg1_eq_0, arg2_ne_0, arg2_ge_0, 4865 suppressee), 4866 4867 // (r == x) && (z == 1) ==> r = pow (x, z) 4868 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 4869 4870 // (r == 0) && (x even) && (z >= 64) 4871 // with each multiply there is one more zero in the result and since 4872 // a long has 64 bits in it, it becomes zero at that point 4873 new NISuppression(result_eq_0, arg1_even, arg2_ge_64, suppressee), 4874 4875 // (r == 1) && (x boolean) && (x==0 <==> z==0) && (z >= 0) 4876 // 1 = pow (0, z) true iff (z == 0) 4877 // 1 = pow (1, z) true when z valid exponent 4878 new NISuppression(arg1_track0_arg2, arg2_ge_0, arg1_boolean, 4879 result_eq_1, suppressee), 4880 4881 // (r == x) && (r boolean) && (z > 0) 4882 // 0 = pow (0, z) true when z != 0 4883 // 1 = pow (1, z) true when z valid exponent 4884 new NISuppression(result_eq_arg1, result_boolean, arg2_ne_0, 4885 arg2_ge_0, suppressee), 4886 4887 }); 4888 4889 // Create a suppression factory for functionBinary 4890 4891} 4892 4893/** 4894 * Represents the invariant {@code z = Power(x, y)} over three long 4895 * scalars. 4896 */ 4897public static class PowerLong_zxy extends FunctionBinary { 4898 static final long serialVersionUID = 20031030L; 4899 4900 private static @Prototype PowerLong_zxy proto = new @Prototype PowerLong_zxy (); 4901 4902 /** Returns the prototype invariant for PowerLong_zxy */ 4903 public static @Prototype PowerLong_zxy get_proto() { 4904 return proto; 4905 } 4906 4907 @Override 4908 protected PowerLong_zxy instantiate_dyn(@Prototype PowerLong_zxy this, PptSlice slice) { 4909 return new PowerLong_zxy (slice); 4910 } 4911 4912 private PowerLong_zxy (PptSlice slice) { 4913 super(slice); 4914 } 4915 4916 public @Prototype PowerLong_zxy () { 4917 super(); 4918 } 4919 4920 private static String[] method_name = new String[] {"java.lang.Math.pow(", ", ", ")"}; 4921 4922 @Override 4923 public String[] get_method_name(@GuardSatisfied PowerLong_zxy this) { 4924 return method_name; 4925 } 4926 4927 private static int function_id = -1; 4928 4929 @Override 4930 public int get_function_id() { 4931 return function_id; 4932 } 4933 4934 @Override 4935 public void set_function_id(int function_id) { 4936 assert PowerLong_zxy.function_id == -1; 4937 PowerLong_zxy.function_id = function_id; 4938 } 4939 4940 private static int var_order = 3; 4941 4942 @Override 4943 public int get_var_order(@GuardSatisfied PowerLong_zxy this) { 4944 return var_order; 4945 } 4946 4947 @Pure 4948 @Override 4949 public boolean is_symmetric() { 4950 4951 return false; 4952 } 4953 4954 @Override 4955 4956 public long func(long x, long y) { 4957 4958 return MathPlume.pow(x, y); 4959 } 4960 4961 @Override 4962 public InvariantStatus check_modified(long x, long y, 4963 long z, int count) { 4964 return check_ordered(z, x, y, count); 4965 } 4966 4967 @Override 4968 public InvariantStatus add_modified(long x, long y, 4969 long z, int count) { 4970 if (Debug.logDetail()) { 4971 log("result=%s, arg1=%s, arg2=%s", z, x, y); 4972 } 4973 return add_ordered(z, x, y, count); 4974 } 4975 4976 @Pure 4977 @Override 4978 public boolean isPower() { 4979 return true; 4980 } 4981 4982 @Pure 4983 @Override 4984 public boolean isExact() { 4985 return true; 4986 } 4987 4988 /** Returns a list of non-instantiating suppressions for this invariant. */ 4989 @Pure 4990 @Override 4991 public @Nullable NISuppressionSet get_ni_suppressions() { 4992 if (NIS.dkconfig_enabled && dkconfig_enabled) { 4993 return suppressions; 4994 } else { 4995 return null; 4996 } 4997 } 4998 4999 /** definition of this invariant (the suppressee) */ 5000 private static NISuppressee suppressee = new NISuppressee(PowerLong_zxy.class, 3); 5001 5002 // suppressor definitions (used below) 5003 private static NISuppressor result_eq_arg1 = 5004 new NISuppressor(2, 0, IntEqual.class); 5005 private static NISuppressor result_eq_arg2 = 5006 new NISuppressor(2, 1, IntEqual.class); 5007 private static NISuppressor arg1_eq_arg2 = 5008 new NISuppressor(0, 1, IntEqual.class); 5009 5010 private static NISuppressor result_lt_arg1 = 5011 new NISuppressor(2, 0, IntLessThan.class); 5012 private static NISuppressor result_lt_arg2 = 5013 new NISuppressor(2, 1, IntLessThan.class); 5014 private static NISuppressor arg1_lt_arg2 = 5015 new NISuppressor(0, 1, IntLessThan.class); 5016 private static NISuppressor arg2_lt_arg1 = 5017 new NISuppressor(1, 0, IntLessThan.class); 5018 5019 private static NISuppressor result_le_arg1 = 5020 new NISuppressor(2, 0, IntLessEqual.class); 5021 private static NISuppressor result_le_arg2 = 5022 new NISuppressor(2, 1, IntLessEqual.class); 5023 private static NISuppressor arg1_le_arg2 = 5024 new NISuppressor(0, 1, IntLessEqual.class); 5025 private static NISuppressor arg2_le_arg1 = 5026 new NISuppressor(1, 0, IntLessEqual.class); 5027 5028 private static NISuppressor result_track0_arg1 = 5029 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 5030 private static NISuppressor result_track0_arg2 = 5031 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 5032 private static NISuppressor arg1_track0_arg2 = 5033 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 5034 private static NISuppressor arg1_track0_result = 5035 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 5036 private static NISuppressor arg2_track0_result = 5037 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 5038 private static NISuppressor arg2_track0_arg1 = 5039 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 5040 5041 private static NISuppressor result_eq_1 = 5042 new NISuppressor(2, RangeInt.EqualOne.class); 5043 private static NISuppressor arg1_eq_1 = 5044 new NISuppressor(0, RangeInt.EqualOne.class); 5045 private static NISuppressor arg2_eq_1 = 5046 new NISuppressor(1, RangeInt.EqualOne.class); 5047 5048 private static NISuppressor result_eq_0 = 5049 new NISuppressor(2, RangeInt.EqualZero.class); 5050 private static NISuppressor arg1_eq_0 = 5051 new NISuppressor(0, RangeInt.EqualZero.class); 5052 private static NISuppressor arg2_eq_0 = 5053 new NISuppressor(1, RangeInt.EqualZero.class); 5054 5055 private static NISuppressor result_ne_0 = 5056 new NISuppressor(2, NonZero.class); 5057 private static NISuppressor arg1_ne_0 = 5058 new NISuppressor(0, NonZero.class); 5059 private static NISuppressor arg2_ne_0 = 5060 new NISuppressor(1, NonZero.class); 5061 5062 private static NISuppressor result_ge_0 = 5063 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 5064 private static NISuppressor arg1_ge_0 = 5065 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 5066 private static NISuppressor arg2_ge_0 = 5067 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 5068 5069 private static NISuppressor result_ge_64 = 5070 new NISuppressor(2, RangeInt.GreaterEqual64.class); 5071 private static NISuppressor arg1_ge_64 = 5072 new NISuppressor(0, RangeInt.GreaterEqual64.class); 5073 private static NISuppressor arg2_ge_64 = 5074 new NISuppressor(1, RangeInt.GreaterEqual64.class); 5075 5076 private static NISuppressor result_boolean = 5077 new NISuppressor(2, RangeInt.BooleanVal.class); 5078 private static NISuppressor arg1_boolean = 5079 new NISuppressor(0, RangeInt.BooleanVal.class); 5080 private static NISuppressor arg2_boolean = 5081 new NISuppressor(1, RangeInt.BooleanVal.class); 5082 5083 private static NISuppressor result_even = 5084 new NISuppressor(2, RangeInt.Even.class); 5085 private static NISuppressor arg1_even = 5086 new NISuppressor(0, RangeInt.Even.class); 5087 private static NISuppressor arg2_even = 5088 new NISuppressor(1, RangeInt.Even.class); 5089 5090 private static NISuppressor result_power2 = 5091 new NISuppressor(2, RangeInt.PowerOfTwo.class); 5092 private static NISuppressor arg1_power2 = 5093 new NISuppressor(0, RangeInt.PowerOfTwo.class); 5094 private static NISuppressor arg2_power2 = 5095 new NISuppressor(1, RangeInt.PowerOfTwo.class); 5096 5097 private static NISuppressor result_and0_arg1 = 5098 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 5099 private static NISuppressor result_and0_arg2 = 5100 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 5101 private static NISuppressor arg1_and0_arg2 = 5102 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 5103 5104 // The arguments to bitwise subset are backwards from what one 5105 // might expect. The second argument is a subset of the first 5106 // argument 5107 private static NISuppressor arg1_bw_subset_arg2 = 5108 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 5109 private static NISuppressor arg2_bw_subset_arg1 = 5110 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 5111 5112 private static NISuppressor result_shift0_arg1 = 5113 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 5114 private static NISuppressor result_shift0_arg2 = 5115 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 5116 private static NISuppressor arg1_shift0_arg2 = 5117 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 5118 5119 private static NISuppressor arg2_divides_arg1 = 5120 new NISuppressor(0, 1, NumericInt.Divides.class); 5121 private static NISuppressor arg1_divides_arg2 = 5122 new NISuppressor(1, 0, NumericInt.Divides.class); 5123 5124 private static NISuppressor arg2_valid_shift = 5125 new NISuppressor(1, RangeInt.Bound0_63.class); 5126 5127 // Note that any suppression that doesn't limit y to valid exponents 5128 // (>= 0), must check for valid exponents as well (so that the invariant 5129 // is correctly destroyed on invalid exponents) 5130 // 5131 // Note also that pow(0,0) == 1 and pow(0,x), where (x > 0), == 0 5132 // Another interesting artificat of pow is that for any even base, any 5133 // exponent >= 64 will yield a result of 0. For example, pow(10,256) == 0 5134 // (at least for integers) 5135 5136 private static NISuppressionSet suppressions = 5137 new NISuppressionSet( 5138 new NISuppression[] { 5139 5140 // (r == 1) && (y == 0) ==> r = pow (x, y) 5141 new NISuppression(result_eq_1, arg2_eq_0, suppressee), 5142 5143 // (r == 1) && (x == 1) && (y >= 0) ==> r = pow (x, y) 5144 new NISuppression(result_eq_1, arg1_eq_1, arg2_ge_0, suppressee), 5145 5146 // (r == 0) && (x == 0) && (y > 0) 5147 new NISuppression(result_eq_0, arg1_eq_0, arg2_ne_0, arg2_ge_0, 5148 suppressee), 5149 5150 // (r == x) && (y == 1) ==> r = pow (x, y) 5151 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 5152 5153 // (r == 0) && (x even) && (y >= 64) 5154 // with each multiply there is one more zero in the result and since 5155 // a long has 64 bits in it, it becomes zero at that point 5156 new NISuppression(result_eq_0, arg1_even, arg2_ge_64, suppressee), 5157 5158 // (r == 1) && (x boolean) && (x==0 <==> y==0) && (y >= 0) 5159 // 1 = pow (0, y) true iff (y == 0) 5160 // 1 = pow (1, y) true when y valid exponent 5161 new NISuppression(arg1_track0_arg2, arg2_ge_0, arg1_boolean, 5162 result_eq_1, suppressee), 5163 5164 // (r == x) && (r boolean) && (y > 0) 5165 // 0 = pow (0, y) true when y != 0 5166 // 1 = pow (1, y) true when y valid exponent 5167 new NISuppression(result_eq_arg1, result_boolean, arg2_ne_0, 5168 arg2_ge_0, suppressee), 5169 5170 }); 5171 5172 // Create a suppression factory for functionBinary 5173 5174} 5175 5176/** 5177 * Represents the invariant {@code x = Power(z, y)} over three long 5178 * scalars. 5179 */ 5180public static class PowerLong_xzy extends FunctionBinary { 5181 static final long serialVersionUID = 20031030L; 5182 5183 private static @Prototype PowerLong_xzy proto = new @Prototype PowerLong_xzy (); 5184 5185 /** Returns the prototype invariant for PowerLong_xzy */ 5186 public static @Prototype PowerLong_xzy get_proto() { 5187 return proto; 5188 } 5189 5190 @Override 5191 protected PowerLong_xzy instantiate_dyn(@Prototype PowerLong_xzy this, PptSlice slice) { 5192 return new PowerLong_xzy (slice); 5193 } 5194 5195 private PowerLong_xzy (PptSlice slice) { 5196 super(slice); 5197 } 5198 5199 public @Prototype PowerLong_xzy () { 5200 super(); 5201 } 5202 5203 private static String[] method_name = new String[] {"java.lang.Math.pow(", ", ", ")"}; 5204 5205 @Override 5206 public String[] get_method_name(@GuardSatisfied PowerLong_xzy this) { 5207 return method_name; 5208 } 5209 5210 private static int function_id = -1; 5211 5212 @Override 5213 public int get_function_id() { 5214 return function_id; 5215 } 5216 5217 @Override 5218 public void set_function_id(int function_id) { 5219 assert PowerLong_xzy.function_id == -1; 5220 PowerLong_xzy.function_id = function_id; 5221 } 5222 5223 private static int var_order = 4; 5224 5225 @Override 5226 public int get_var_order(@GuardSatisfied PowerLong_xzy this) { 5227 return var_order; 5228 } 5229 5230 @Pure 5231 @Override 5232 public boolean is_symmetric() { 5233 5234 return false; 5235 } 5236 5237 @Override 5238 5239 public long func(long z, long y) { 5240 5241 return MathPlume.pow(z, y); 5242 } 5243 5244 @Override 5245 public InvariantStatus check_modified(long x, long y, 5246 long z, int count) { 5247 return check_ordered(x, z, y, count); 5248 } 5249 5250 @Override 5251 public InvariantStatus add_modified(long x, long y, 5252 long z, int count) { 5253 if (Debug.logDetail()) { 5254 log("result=%s, arg1=%s, arg2=%s", x, z, y); 5255 } 5256 return add_ordered(x, z, y, count); 5257 } 5258 5259 @Pure 5260 @Override 5261 public boolean isPower() { 5262 return true; 5263 } 5264 5265 @Pure 5266 @Override 5267 public boolean isExact() { 5268 return true; 5269 } 5270 5271 /** Returns a list of non-instantiating suppressions for this invariant. */ 5272 @Pure 5273 @Override 5274 public @Nullable NISuppressionSet get_ni_suppressions() { 5275 if (NIS.dkconfig_enabled && dkconfig_enabled) { 5276 return suppressions; 5277 } else { 5278 return null; 5279 } 5280 } 5281 5282 /** definition of this invariant (the suppressee) */ 5283 private static NISuppressee suppressee = new NISuppressee(PowerLong_xzy.class, 3); 5284 5285 // suppressor definitions (used below) 5286 private static NISuppressor result_eq_arg1 = 5287 new NISuppressor(0, 2, IntEqual.class); 5288 private static NISuppressor result_eq_arg2 = 5289 new NISuppressor(0, 1, IntEqual.class); 5290 private static NISuppressor arg1_eq_arg2 = 5291 new NISuppressor(2, 1, IntEqual.class); 5292 5293 private static NISuppressor result_lt_arg1 = 5294 new NISuppressor(0, 2, IntLessThan.class); 5295 private static NISuppressor result_lt_arg2 = 5296 new NISuppressor(0, 1, IntLessThan.class); 5297 private static NISuppressor arg1_lt_arg2 = 5298 new NISuppressor(2, 1, IntLessThan.class); 5299 private static NISuppressor arg2_lt_arg1 = 5300 new NISuppressor(1, 2, IntLessThan.class); 5301 5302 private static NISuppressor result_le_arg1 = 5303 new NISuppressor(0, 2, IntLessEqual.class); 5304 private static NISuppressor result_le_arg2 = 5305 new NISuppressor(0, 1, IntLessEqual.class); 5306 private static NISuppressor arg1_le_arg2 = 5307 new NISuppressor(2, 1, IntLessEqual.class); 5308 private static NISuppressor arg2_le_arg1 = 5309 new NISuppressor(1, 2, IntLessEqual.class); 5310 5311 private static NISuppressor result_track0_arg1 = 5312 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 5313 private static NISuppressor result_track0_arg2 = 5314 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 5315 private static NISuppressor arg1_track0_arg2 = 5316 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 5317 private static NISuppressor arg1_track0_result = 5318 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 5319 private static NISuppressor arg2_track0_result = 5320 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 5321 private static NISuppressor arg2_track0_arg1 = 5322 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 5323 5324 private static NISuppressor result_eq_1 = 5325 new NISuppressor(0, RangeInt.EqualOne.class); 5326 private static NISuppressor arg1_eq_1 = 5327 new NISuppressor(2, RangeInt.EqualOne.class); 5328 private static NISuppressor arg2_eq_1 = 5329 new NISuppressor(1, RangeInt.EqualOne.class); 5330 5331 private static NISuppressor result_eq_0 = 5332 new NISuppressor(0, RangeInt.EqualZero.class); 5333 private static NISuppressor arg1_eq_0 = 5334 new NISuppressor(2, RangeInt.EqualZero.class); 5335 private static NISuppressor arg2_eq_0 = 5336 new NISuppressor(1, RangeInt.EqualZero.class); 5337 5338 private static NISuppressor result_ne_0 = 5339 new NISuppressor(0, NonZero.class); 5340 private static NISuppressor arg1_ne_0 = 5341 new NISuppressor(2, NonZero.class); 5342 private static NISuppressor arg2_ne_0 = 5343 new NISuppressor(1, NonZero.class); 5344 5345 private static NISuppressor result_ge_0 = 5346 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 5347 private static NISuppressor arg1_ge_0 = 5348 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 5349 private static NISuppressor arg2_ge_0 = 5350 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 5351 5352 private static NISuppressor result_ge_64 = 5353 new NISuppressor(0, RangeInt.GreaterEqual64.class); 5354 private static NISuppressor arg1_ge_64 = 5355 new NISuppressor(2, RangeInt.GreaterEqual64.class); 5356 private static NISuppressor arg2_ge_64 = 5357 new NISuppressor(1, RangeInt.GreaterEqual64.class); 5358 5359 private static NISuppressor result_boolean = 5360 new NISuppressor(0, RangeInt.BooleanVal.class); 5361 private static NISuppressor arg1_boolean = 5362 new NISuppressor(2, RangeInt.BooleanVal.class); 5363 private static NISuppressor arg2_boolean = 5364 new NISuppressor(1, RangeInt.BooleanVal.class); 5365 5366 private static NISuppressor result_even = 5367 new NISuppressor(0, RangeInt.Even.class); 5368 private static NISuppressor arg1_even = 5369 new NISuppressor(2, RangeInt.Even.class); 5370 private static NISuppressor arg2_even = 5371 new NISuppressor(1, RangeInt.Even.class); 5372 5373 private static NISuppressor result_power2 = 5374 new NISuppressor(0, RangeInt.PowerOfTwo.class); 5375 private static NISuppressor arg1_power2 = 5376 new NISuppressor(2, RangeInt.PowerOfTwo.class); 5377 private static NISuppressor arg2_power2 = 5378 new NISuppressor(1, RangeInt.PowerOfTwo.class); 5379 5380 private static NISuppressor result_and0_arg1 = 5381 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 5382 private static NISuppressor result_and0_arg2 = 5383 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 5384 private static NISuppressor arg1_and0_arg2 = 5385 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 5386 5387 // The arguments to bitwise subset are backwards from what one 5388 // might expect. The second argument is a subset of the first 5389 // argument 5390 private static NISuppressor arg1_bw_subset_arg2 = 5391 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 5392 private static NISuppressor arg2_bw_subset_arg1 = 5393 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 5394 5395 private static NISuppressor result_shift0_arg1 = 5396 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 5397 private static NISuppressor result_shift0_arg2 = 5398 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 5399 private static NISuppressor arg1_shift0_arg2 = 5400 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 5401 5402 private static NISuppressor arg2_divides_arg1 = 5403 new NISuppressor(2, 1, NumericInt.Divides.class); 5404 private static NISuppressor arg1_divides_arg2 = 5405 new NISuppressor(1, 2, NumericInt.Divides.class); 5406 5407 private static NISuppressor arg2_valid_shift = 5408 new NISuppressor(1, RangeInt.Bound0_63.class); 5409 5410 // Note that any suppression that doesn't limit y to valid exponents 5411 // (>= 0), must check for valid exponents as well (so that the invariant 5412 // is correctly destroyed on invalid exponents) 5413 // 5414 // Note also that pow(0,0) == 1 and pow(0,x), where (x > 0), == 0 5415 // Another interesting artificat of pow is that for any even base, any 5416 // exponent >= 64 will yield a result of 0. For example, pow(10,256) == 0 5417 // (at least for integers) 5418 5419 private static NISuppressionSet suppressions = 5420 new NISuppressionSet( 5421 new NISuppression[] { 5422 5423 // (r == 1) && (y == 0) ==> r = pow (z, y) 5424 new NISuppression(result_eq_1, arg2_eq_0, suppressee), 5425 5426 // (r == 1) && (z == 1) && (y >= 0) ==> r = pow (z, y) 5427 new NISuppression(result_eq_1, arg1_eq_1, arg2_ge_0, suppressee), 5428 5429 // (r == 0) && (z == 0) && (y > 0) 5430 new NISuppression(result_eq_0, arg1_eq_0, arg2_ne_0, arg2_ge_0, 5431 suppressee), 5432 5433 // (r == z) && (y == 1) ==> r = pow (z, y) 5434 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 5435 5436 // (r == 0) && (z even) && (y >= 64) 5437 // with each multiply there is one more zero in the result and since 5438 // a long has 64 bits in it, it becomes zero at that point 5439 new NISuppression(result_eq_0, arg1_even, arg2_ge_64, suppressee), 5440 5441 // (r == 1) && (z boolean) && (z==0 <==> y==0) && (y >= 0) 5442 // 1 = pow (0, y) true iff (y == 0) 5443 // 1 = pow (1, y) true when y valid exponent 5444 new NISuppression(arg1_track0_arg2, arg2_ge_0, arg1_boolean, 5445 result_eq_1, suppressee), 5446 5447 // (r == z) && (r boolean) && (y > 0) 5448 // 0 = pow (0, y) true when y != 0 5449 // 1 = pow (1, y) true when y valid exponent 5450 new NISuppression(result_eq_arg1, result_boolean, arg2_ne_0, 5451 arg2_ge_0, suppressee), 5452 5453 }); 5454 5455 // Create a suppression factory for functionBinary 5456 5457} 5458 5459/** 5460 * Represents the invariant {@code y = Power(z, x)} over three long 5461 * scalars. 5462 */ 5463public static class PowerLong_yzx extends FunctionBinary { 5464 static final long serialVersionUID = 20031030L; 5465 5466 private static @Prototype PowerLong_yzx proto = new @Prototype PowerLong_yzx (); 5467 5468 /** Returns the prototype invariant for PowerLong_yzx */ 5469 public static @Prototype PowerLong_yzx get_proto() { 5470 return proto; 5471 } 5472 5473 @Override 5474 protected PowerLong_yzx instantiate_dyn(@Prototype PowerLong_yzx this, PptSlice slice) { 5475 return new PowerLong_yzx (slice); 5476 } 5477 5478 private PowerLong_yzx (PptSlice slice) { 5479 super(slice); 5480 } 5481 5482 public @Prototype PowerLong_yzx () { 5483 super(); 5484 } 5485 5486 private static String[] method_name = new String[] {"java.lang.Math.pow(", ", ", ")"}; 5487 5488 @Override 5489 public String[] get_method_name(@GuardSatisfied PowerLong_yzx this) { 5490 return method_name; 5491 } 5492 5493 private static int function_id = -1; 5494 5495 @Override 5496 public int get_function_id() { 5497 return function_id; 5498 } 5499 5500 @Override 5501 public void set_function_id(int function_id) { 5502 assert PowerLong_yzx.function_id == -1; 5503 PowerLong_yzx.function_id = function_id; 5504 } 5505 5506 private static int var_order = 5; 5507 5508 @Override 5509 public int get_var_order(@GuardSatisfied PowerLong_yzx this) { 5510 return var_order; 5511 } 5512 5513 @Pure 5514 @Override 5515 public boolean is_symmetric() { 5516 5517 return false; 5518 } 5519 5520 @Override 5521 5522 public long func(long z, long x) { 5523 5524 return MathPlume.pow(z, x); 5525 } 5526 5527 @Override 5528 public InvariantStatus check_modified(long x, long y, 5529 long z, int count) { 5530 return check_ordered(y, z, x, count); 5531 } 5532 5533 @Override 5534 public InvariantStatus add_modified(long x, long y, 5535 long z, int count) { 5536 if (Debug.logDetail()) { 5537 log("result=%s, arg1=%s, arg2=%s", y, z, x); 5538 } 5539 return add_ordered(y, z, x, count); 5540 } 5541 5542 @Pure 5543 @Override 5544 public boolean isPower() { 5545 return true; 5546 } 5547 5548 @Pure 5549 @Override 5550 public boolean isExact() { 5551 return true; 5552 } 5553 5554 /** Returns a list of non-instantiating suppressions for this invariant. */ 5555 @Pure 5556 @Override 5557 public @Nullable NISuppressionSet get_ni_suppressions() { 5558 if (NIS.dkconfig_enabled && dkconfig_enabled) { 5559 return suppressions; 5560 } else { 5561 return null; 5562 } 5563 } 5564 5565 /** definition of this invariant (the suppressee) */ 5566 private static NISuppressee suppressee = new NISuppressee(PowerLong_yzx.class, 3); 5567 5568 // suppressor definitions (used below) 5569 private static NISuppressor result_eq_arg1 = 5570 new NISuppressor(1, 2, IntEqual.class); 5571 private static NISuppressor result_eq_arg2 = 5572 new NISuppressor(1, 0, IntEqual.class); 5573 private static NISuppressor arg1_eq_arg2 = 5574 new NISuppressor(2, 0, IntEqual.class); 5575 5576 private static NISuppressor result_lt_arg1 = 5577 new NISuppressor(1, 2, IntLessThan.class); 5578 private static NISuppressor result_lt_arg2 = 5579 new NISuppressor(1, 0, IntLessThan.class); 5580 private static NISuppressor arg1_lt_arg2 = 5581 new NISuppressor(2, 0, IntLessThan.class); 5582 private static NISuppressor arg2_lt_arg1 = 5583 new NISuppressor(0, 2, IntLessThan.class); 5584 5585 private static NISuppressor result_le_arg1 = 5586 new NISuppressor(1, 2, IntLessEqual.class); 5587 private static NISuppressor result_le_arg2 = 5588 new NISuppressor(1, 0, IntLessEqual.class); 5589 private static NISuppressor arg1_le_arg2 = 5590 new NISuppressor(2, 0, IntLessEqual.class); 5591 private static NISuppressor arg2_le_arg1 = 5592 new NISuppressor(0, 2, IntLessEqual.class); 5593 5594 private static NISuppressor result_track0_arg1 = 5595 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 5596 private static NISuppressor result_track0_arg2 = 5597 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 5598 private static NISuppressor arg1_track0_arg2 = 5599 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 5600 private static NISuppressor arg1_track0_result = 5601 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 5602 private static NISuppressor arg2_track0_result = 5603 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 5604 private static NISuppressor arg2_track0_arg1 = 5605 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 5606 5607 private static NISuppressor result_eq_1 = 5608 new NISuppressor(1, RangeInt.EqualOne.class); 5609 private static NISuppressor arg1_eq_1 = 5610 new NISuppressor(2, RangeInt.EqualOne.class); 5611 private static NISuppressor arg2_eq_1 = 5612 new NISuppressor(0, RangeInt.EqualOne.class); 5613 5614 private static NISuppressor result_eq_0 = 5615 new NISuppressor(1, RangeInt.EqualZero.class); 5616 private static NISuppressor arg1_eq_0 = 5617 new NISuppressor(2, RangeInt.EqualZero.class); 5618 private static NISuppressor arg2_eq_0 = 5619 new NISuppressor(0, RangeInt.EqualZero.class); 5620 5621 private static NISuppressor result_ne_0 = 5622 new NISuppressor(1, NonZero.class); 5623 private static NISuppressor arg1_ne_0 = 5624 new NISuppressor(2, NonZero.class); 5625 private static NISuppressor arg2_ne_0 = 5626 new NISuppressor(0, NonZero.class); 5627 5628 private static NISuppressor result_ge_0 = 5629 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 5630 private static NISuppressor arg1_ge_0 = 5631 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 5632 private static NISuppressor arg2_ge_0 = 5633 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 5634 5635 private static NISuppressor result_ge_64 = 5636 new NISuppressor(1, RangeInt.GreaterEqual64.class); 5637 private static NISuppressor arg1_ge_64 = 5638 new NISuppressor(2, RangeInt.GreaterEqual64.class); 5639 private static NISuppressor arg2_ge_64 = 5640 new NISuppressor(0, RangeInt.GreaterEqual64.class); 5641 5642 private static NISuppressor result_boolean = 5643 new NISuppressor(1, RangeInt.BooleanVal.class); 5644 private static NISuppressor arg1_boolean = 5645 new NISuppressor(2, RangeInt.BooleanVal.class); 5646 private static NISuppressor arg2_boolean = 5647 new NISuppressor(0, RangeInt.BooleanVal.class); 5648 5649 private static NISuppressor result_even = 5650 new NISuppressor(1, RangeInt.Even.class); 5651 private static NISuppressor arg1_even = 5652 new NISuppressor(2, RangeInt.Even.class); 5653 private static NISuppressor arg2_even = 5654 new NISuppressor(0, RangeInt.Even.class); 5655 5656 private static NISuppressor result_power2 = 5657 new NISuppressor(1, RangeInt.PowerOfTwo.class); 5658 private static NISuppressor arg1_power2 = 5659 new NISuppressor(2, RangeInt.PowerOfTwo.class); 5660 private static NISuppressor arg2_power2 = 5661 new NISuppressor(0, RangeInt.PowerOfTwo.class); 5662 5663 private static NISuppressor result_and0_arg1 = 5664 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 5665 private static NISuppressor result_and0_arg2 = 5666 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 5667 private static NISuppressor arg1_and0_arg2 = 5668 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 5669 5670 // The arguments to bitwise subset are backwards from what one 5671 // might expect. The second argument is a subset of the first 5672 // argument 5673 private static NISuppressor arg1_bw_subset_arg2 = 5674 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 5675 private static NISuppressor arg2_bw_subset_arg1 = 5676 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 5677 5678 private static NISuppressor result_shift0_arg1 = 5679 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 5680 private static NISuppressor result_shift0_arg2 = 5681 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 5682 private static NISuppressor arg1_shift0_arg2 = 5683 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 5684 5685 private static NISuppressor arg2_divides_arg1 = 5686 new NISuppressor(2, 0, NumericInt.Divides.class); 5687 private static NISuppressor arg1_divides_arg2 = 5688 new NISuppressor(0, 2, NumericInt.Divides.class); 5689 5690 private static NISuppressor arg2_valid_shift = 5691 new NISuppressor(0, RangeInt.Bound0_63.class); 5692 5693 // Note that any suppression that doesn't limit x to valid exponents 5694 // (>= 0), must check for valid exponents as well (so that the invariant 5695 // is correctly destroyed on invalid exponents) 5696 // 5697 // Note also that pow(0,0) == 1 and pow(0,x), where (x > 0), == 0 5698 // Another interesting artificat of pow is that for any even base, any 5699 // exponent >= 64 will yield a result of 0. For example, pow(10,256) == 0 5700 // (at least for integers) 5701 5702 private static NISuppressionSet suppressions = 5703 new NISuppressionSet( 5704 new NISuppression[] { 5705 5706 // (r == 1) && (x == 0) ==> r = pow (z, x) 5707 new NISuppression(result_eq_1, arg2_eq_0, suppressee), 5708 5709 // (r == 1) && (z == 1) && (x >= 0) ==> r = pow (z, x) 5710 new NISuppression(result_eq_1, arg1_eq_1, arg2_ge_0, suppressee), 5711 5712 // (r == 0) && (z == 0) && (x > 0) 5713 new NISuppression(result_eq_0, arg1_eq_0, arg2_ne_0, arg2_ge_0, 5714 suppressee), 5715 5716 // (r == z) && (x == 1) ==> r = pow (z, x) 5717 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 5718 5719 // (r == 0) && (z even) && (x >= 64) 5720 // with each multiply there is one more zero in the result and since 5721 // a long has 64 bits in it, it becomes zero at that point 5722 new NISuppression(result_eq_0, arg1_even, arg2_ge_64, suppressee), 5723 5724 // (r == 1) && (z boolean) && (z==0 <==> x==0) && (x >= 0) 5725 // 1 = pow (0, x) true iff (x == 0) 5726 // 1 = pow (1, x) true when x valid exponent 5727 new NISuppression(arg1_track0_arg2, arg2_ge_0, arg1_boolean, 5728 result_eq_1, suppressee), 5729 5730 // (r == z) && (r boolean) && (x > 0) 5731 // 0 = pow (0, x) true when x != 0 5732 // 1 = pow (1, x) true when x valid exponent 5733 new NISuppression(result_eq_arg1, result_boolean, arg2_ne_0, 5734 arg2_ge_0, suppressee), 5735 5736 }); 5737 5738 // Create a suppression factory for functionBinary 5739 5740} 5741 5742/** 5743 * Represents the invariant {@code z = Power(y, x)} over three long 5744 * scalars. 5745 */ 5746public static class PowerLong_zyx extends FunctionBinary { 5747 static final long serialVersionUID = 20031030L; 5748 5749 private static @Prototype PowerLong_zyx proto = new @Prototype PowerLong_zyx (); 5750 5751 /** Returns the prototype invariant for PowerLong_zyx */ 5752 public static @Prototype PowerLong_zyx get_proto() { 5753 return proto; 5754 } 5755 5756 @Override 5757 protected PowerLong_zyx instantiate_dyn(@Prototype PowerLong_zyx this, PptSlice slice) { 5758 return new PowerLong_zyx (slice); 5759 } 5760 5761 private PowerLong_zyx (PptSlice slice) { 5762 super(slice); 5763 } 5764 5765 public @Prototype PowerLong_zyx () { 5766 super(); 5767 } 5768 5769 private static String[] method_name = new String[] {"java.lang.Math.pow(", ", ", ")"}; 5770 5771 @Override 5772 public String[] get_method_name(@GuardSatisfied PowerLong_zyx this) { 5773 return method_name; 5774 } 5775 5776 private static int function_id = -1; 5777 5778 @Override 5779 public int get_function_id() { 5780 return function_id; 5781 } 5782 5783 @Override 5784 public void set_function_id(int function_id) { 5785 assert PowerLong_zyx.function_id == -1; 5786 PowerLong_zyx.function_id = function_id; 5787 } 5788 5789 private static int var_order = 6; 5790 5791 @Override 5792 public int get_var_order(@GuardSatisfied PowerLong_zyx this) { 5793 return var_order; 5794 } 5795 5796 @Pure 5797 @Override 5798 public boolean is_symmetric() { 5799 5800 return false; 5801 } 5802 5803 @Override 5804 5805 public long func(long y, long x) { 5806 5807 return MathPlume.pow(y, x); 5808 } 5809 5810 @Override 5811 public InvariantStatus check_modified(long x, long y, 5812 long z, int count) { 5813 return check_ordered(z, y, x, count); 5814 } 5815 5816 @Override 5817 public InvariantStatus add_modified(long x, long y, 5818 long z, int count) { 5819 if (Debug.logDetail()) { 5820 log("result=%s, arg1=%s, arg2=%s", z, y, x); 5821 } 5822 return add_ordered(z, y, x, count); 5823 } 5824 5825 @Pure 5826 @Override 5827 public boolean isPower() { 5828 return true; 5829 } 5830 5831 @Pure 5832 @Override 5833 public boolean isExact() { 5834 return true; 5835 } 5836 5837 /** Returns a list of non-instantiating suppressions for this invariant. */ 5838 @Pure 5839 @Override 5840 public @Nullable NISuppressionSet get_ni_suppressions() { 5841 if (NIS.dkconfig_enabled && dkconfig_enabled) { 5842 return suppressions; 5843 } else { 5844 return null; 5845 } 5846 } 5847 5848 /** definition of this invariant (the suppressee) */ 5849 private static NISuppressee suppressee = new NISuppressee(PowerLong_zyx.class, 3); 5850 5851 // suppressor definitions (used below) 5852 private static NISuppressor result_eq_arg1 = 5853 new NISuppressor(2, 1, IntEqual.class); 5854 private static NISuppressor result_eq_arg2 = 5855 new NISuppressor(2, 0, IntEqual.class); 5856 private static NISuppressor arg1_eq_arg2 = 5857 new NISuppressor(1, 0, IntEqual.class); 5858 5859 private static NISuppressor result_lt_arg1 = 5860 new NISuppressor(2, 1, IntLessThan.class); 5861 private static NISuppressor result_lt_arg2 = 5862 new NISuppressor(2, 0, IntLessThan.class); 5863 private static NISuppressor arg1_lt_arg2 = 5864 new NISuppressor(1, 0, IntLessThan.class); 5865 private static NISuppressor arg2_lt_arg1 = 5866 new NISuppressor(0, 1, IntLessThan.class); 5867 5868 private static NISuppressor result_le_arg1 = 5869 new NISuppressor(2, 1, IntLessEqual.class); 5870 private static NISuppressor result_le_arg2 = 5871 new NISuppressor(2, 0, IntLessEqual.class); 5872 private static NISuppressor arg1_le_arg2 = 5873 new NISuppressor(1, 0, IntLessEqual.class); 5874 private static NISuppressor arg2_le_arg1 = 5875 new NISuppressor(0, 1, IntLessEqual.class); 5876 5877 private static NISuppressor result_track0_arg1 = 5878 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 5879 private static NISuppressor result_track0_arg2 = 5880 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 5881 private static NISuppressor arg1_track0_arg2 = 5882 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 5883 private static NISuppressor arg1_track0_result = 5884 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 5885 private static NISuppressor arg2_track0_result = 5886 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 5887 private static NISuppressor arg2_track0_arg1 = 5888 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 5889 5890 private static NISuppressor result_eq_1 = 5891 new NISuppressor(2, RangeInt.EqualOne.class); 5892 private static NISuppressor arg1_eq_1 = 5893 new NISuppressor(1, RangeInt.EqualOne.class); 5894 private static NISuppressor arg2_eq_1 = 5895 new NISuppressor(0, RangeInt.EqualOne.class); 5896 5897 private static NISuppressor result_eq_0 = 5898 new NISuppressor(2, RangeInt.EqualZero.class); 5899 private static NISuppressor arg1_eq_0 = 5900 new NISuppressor(1, RangeInt.EqualZero.class); 5901 private static NISuppressor arg2_eq_0 = 5902 new NISuppressor(0, RangeInt.EqualZero.class); 5903 5904 private static NISuppressor result_ne_0 = 5905 new NISuppressor(2, NonZero.class); 5906 private static NISuppressor arg1_ne_0 = 5907 new NISuppressor(1, NonZero.class); 5908 private static NISuppressor arg2_ne_0 = 5909 new NISuppressor(0, NonZero.class); 5910 5911 private static NISuppressor result_ge_0 = 5912 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 5913 private static NISuppressor arg1_ge_0 = 5914 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 5915 private static NISuppressor arg2_ge_0 = 5916 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 5917 5918 private static NISuppressor result_ge_64 = 5919 new NISuppressor(2, RangeInt.GreaterEqual64.class); 5920 private static NISuppressor arg1_ge_64 = 5921 new NISuppressor(1, RangeInt.GreaterEqual64.class); 5922 private static NISuppressor arg2_ge_64 = 5923 new NISuppressor(0, RangeInt.GreaterEqual64.class); 5924 5925 private static NISuppressor result_boolean = 5926 new NISuppressor(2, RangeInt.BooleanVal.class); 5927 private static NISuppressor arg1_boolean = 5928 new NISuppressor(1, RangeInt.BooleanVal.class); 5929 private static NISuppressor arg2_boolean = 5930 new NISuppressor(0, RangeInt.BooleanVal.class); 5931 5932 private static NISuppressor result_even = 5933 new NISuppressor(2, RangeInt.Even.class); 5934 private static NISuppressor arg1_even = 5935 new NISuppressor(1, RangeInt.Even.class); 5936 private static NISuppressor arg2_even = 5937 new NISuppressor(0, RangeInt.Even.class); 5938 5939 private static NISuppressor result_power2 = 5940 new NISuppressor(2, RangeInt.PowerOfTwo.class); 5941 private static NISuppressor arg1_power2 = 5942 new NISuppressor(1, RangeInt.PowerOfTwo.class); 5943 private static NISuppressor arg2_power2 = 5944 new NISuppressor(0, RangeInt.PowerOfTwo.class); 5945 5946 private static NISuppressor result_and0_arg1 = 5947 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 5948 private static NISuppressor result_and0_arg2 = 5949 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 5950 private static NISuppressor arg1_and0_arg2 = 5951 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 5952 5953 // The arguments to bitwise subset are backwards from what one 5954 // might expect. The second argument is a subset of the first 5955 // argument 5956 private static NISuppressor arg1_bw_subset_arg2 = 5957 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 5958 private static NISuppressor arg2_bw_subset_arg1 = 5959 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 5960 5961 private static NISuppressor result_shift0_arg1 = 5962 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 5963 private static NISuppressor result_shift0_arg2 = 5964 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 5965 private static NISuppressor arg1_shift0_arg2 = 5966 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 5967 5968 private static NISuppressor arg2_divides_arg1 = 5969 new NISuppressor(1, 0, NumericInt.Divides.class); 5970 private static NISuppressor arg1_divides_arg2 = 5971 new NISuppressor(0, 1, NumericInt.Divides.class); 5972 5973 private static NISuppressor arg2_valid_shift = 5974 new NISuppressor(0, RangeInt.Bound0_63.class); 5975 5976 // Note that any suppression that doesn't limit x to valid exponents 5977 // (>= 0), must check for valid exponents as well (so that the invariant 5978 // is correctly destroyed on invalid exponents) 5979 // 5980 // Note also that pow(0,0) == 1 and pow(0,x), where (x > 0), == 0 5981 // Another interesting artificat of pow is that for any even base, any 5982 // exponent >= 64 will yield a result of 0. For example, pow(10,256) == 0 5983 // (at least for integers) 5984 5985 private static NISuppressionSet suppressions = 5986 new NISuppressionSet( 5987 new NISuppression[] { 5988 5989 // (r == 1) && (x == 0) ==> r = pow (y, x) 5990 new NISuppression(result_eq_1, arg2_eq_0, suppressee), 5991 5992 // (r == 1) && (y == 1) && (x >= 0) ==> r = pow (y, x) 5993 new NISuppression(result_eq_1, arg1_eq_1, arg2_ge_0, suppressee), 5994 5995 // (r == 0) && (y == 0) && (x > 0) 5996 new NISuppression(result_eq_0, arg1_eq_0, arg2_ne_0, arg2_ge_0, 5997 suppressee), 5998 5999 // (r == y) && (x == 1) ==> r = pow (y, x) 6000 new NISuppression(result_eq_arg1, arg2_eq_1, suppressee), 6001 6002 // (r == 0) && (y even) && (x >= 64) 6003 // with each multiply there is one more zero in the result and since 6004 // a long has 64 bits in it, it becomes zero at that point 6005 new NISuppression(result_eq_0, arg1_even, arg2_ge_64, suppressee), 6006 6007 // (r == 1) && (y boolean) && (y==0 <==> x==0) && (x >= 0) 6008 // 1 = pow (0, x) true iff (x == 0) 6009 // 1 = pow (1, x) true when x valid exponent 6010 new NISuppression(arg1_track0_arg2, arg2_ge_0, arg1_boolean, 6011 result_eq_1, suppressee), 6012 6013 // (r == y) && (r boolean) && (x > 0) 6014 // 0 = pow (0, x) true when x != 0 6015 // 1 = pow (1, x) true when x valid exponent 6016 new NISuppression(result_eq_arg1, result_boolean, arg2_ne_0, 6017 arg2_ge_0, suppressee), 6018 6019 }); 6020 6021 // Create a suppression factory for functionBinary 6022 6023} 6024 6025 // #define EQUALITY_SUPPRESS 1 6026 6027 // default is that it is not this function, overriden in the subclass 6028 @Pure 6029 public boolean isBitwiseAnd() { 6030 return false; 6031 } 6032 6033/** 6034 * Represents the invariant {@code x = BitwiseAnd(y, z)} over three long 6035 * scalars. 6036 */ 6037public static class BitwiseAndLong_xyz extends FunctionBinary { 6038 static final long serialVersionUID = 20031030L; 6039 6040 private static @Prototype BitwiseAndLong_xyz proto = new @Prototype BitwiseAndLong_xyz (); 6041 6042 /** Returns the prototype invariant for BitwiseAndLong_xyz */ 6043 public static @Prototype BitwiseAndLong_xyz get_proto() { 6044 return proto; 6045 } 6046 6047 @Override 6048 protected BitwiseAndLong_xyz instantiate_dyn(@Prototype BitwiseAndLong_xyz this, PptSlice slice) { 6049 return new BitwiseAndLong_xyz (slice); 6050 } 6051 6052 private BitwiseAndLong_xyz (PptSlice slice) { 6053 super(slice); 6054 } 6055 6056 public @Prototype BitwiseAndLong_xyz () { 6057 super(); 6058 } 6059 6060 private static String[] method_name = new String[] {"", " & ", ""}; 6061 6062 @Override 6063 public String[] get_method_name(@GuardSatisfied BitwiseAndLong_xyz this) { 6064 return method_name; 6065 } 6066 6067 private static int function_id = -1; 6068 6069 @Override 6070 public int get_function_id() { 6071 return function_id; 6072 } 6073 6074 @Override 6075 public void set_function_id(int function_id) { 6076 assert BitwiseAndLong_xyz.function_id == -1; 6077 BitwiseAndLong_xyz.function_id = function_id; 6078 } 6079 6080 private static int var_order = 1; 6081 6082 @Override 6083 public int get_var_order(@GuardSatisfied BitwiseAndLong_xyz this) { 6084 return var_order; 6085 } 6086 6087 @Pure 6088 @Override 6089 public boolean is_symmetric() { 6090 6091 return true; 6092 } 6093 6094 @Override 6095 6096 public long func(long y, long z) { 6097 6098 return (y & z); 6099 } 6100 6101 @Override 6102 public InvariantStatus check_modified(long x, long y, 6103 long z, int count) { 6104 return check_ordered(x, y, z, count); 6105 } 6106 6107 @Override 6108 public InvariantStatus add_modified(long x, long y, 6109 long z, int count) { 6110 if (Debug.logDetail()) { 6111 log("result=%s, arg1=%s, arg2=%s", x, y, z); 6112 } 6113 return add_ordered(x, y, z, count); 6114 } 6115 6116 @Pure 6117 @Override 6118 public boolean isBitwiseAnd() { 6119 return true; 6120 } 6121 6122 @Pure 6123 @Override 6124 public boolean isExact() { 6125 return true; 6126 } 6127 6128 /** Returns a list of non-instantiating suppressions for this invariant. */ 6129 @Pure 6130 @Override 6131 public @Nullable NISuppressionSet get_ni_suppressions() { 6132 if (NIS.dkconfig_enabled && dkconfig_enabled) { 6133 return suppressions; 6134 } else { 6135 return null; 6136 } 6137 } 6138 6139 /** definition of this invariant (the suppressee) */ 6140 private static NISuppressee suppressee = new NISuppressee(BitwiseAndLong_xyz.class, 3); 6141 6142 // suppressor definitions (used below) 6143 private static NISuppressor result_eq_arg1 = 6144 new NISuppressor(0, 1, IntEqual.class); 6145 private static NISuppressor result_eq_arg2 = 6146 new NISuppressor(0, 2, IntEqual.class); 6147 private static NISuppressor arg1_eq_arg2 = 6148 new NISuppressor(1, 2, IntEqual.class); 6149 6150 private static NISuppressor result_lt_arg1 = 6151 new NISuppressor(0, 1, IntLessThan.class); 6152 private static NISuppressor result_lt_arg2 = 6153 new NISuppressor(0, 2, IntLessThan.class); 6154 private static NISuppressor arg1_lt_arg2 = 6155 new NISuppressor(1, 2, IntLessThan.class); 6156 private static NISuppressor arg2_lt_arg1 = 6157 new NISuppressor(2, 1, IntLessThan.class); 6158 6159 private static NISuppressor result_le_arg1 = 6160 new NISuppressor(0, 1, IntLessEqual.class); 6161 private static NISuppressor result_le_arg2 = 6162 new NISuppressor(0, 2, IntLessEqual.class); 6163 private static NISuppressor arg1_le_arg2 = 6164 new NISuppressor(1, 2, IntLessEqual.class); 6165 private static NISuppressor arg2_le_arg1 = 6166 new NISuppressor(2, 1, IntLessEqual.class); 6167 6168 private static NISuppressor result_track0_arg1 = 6169 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 6170 private static NISuppressor result_track0_arg2 = 6171 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 6172 private static NISuppressor arg1_track0_arg2 = 6173 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 6174 private static NISuppressor arg1_track0_result = 6175 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 6176 private static NISuppressor arg2_track0_result = 6177 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 6178 private static NISuppressor arg2_track0_arg1 = 6179 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 6180 6181 private static NISuppressor result_eq_1 = 6182 new NISuppressor(0, RangeInt.EqualOne.class); 6183 private static NISuppressor arg1_eq_1 = 6184 new NISuppressor(1, RangeInt.EqualOne.class); 6185 private static NISuppressor arg2_eq_1 = 6186 new NISuppressor(2, RangeInt.EqualOne.class); 6187 6188 private static NISuppressor result_eq_0 = 6189 new NISuppressor(0, RangeInt.EqualZero.class); 6190 private static NISuppressor arg1_eq_0 = 6191 new NISuppressor(1, RangeInt.EqualZero.class); 6192 private static NISuppressor arg2_eq_0 = 6193 new NISuppressor(2, RangeInt.EqualZero.class); 6194 6195 private static NISuppressor result_ne_0 = 6196 new NISuppressor(0, NonZero.class); 6197 private static NISuppressor arg1_ne_0 = 6198 new NISuppressor(1, NonZero.class); 6199 private static NISuppressor arg2_ne_0 = 6200 new NISuppressor(2, NonZero.class); 6201 6202 private static NISuppressor result_ge_0 = 6203 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 6204 private static NISuppressor arg1_ge_0 = 6205 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 6206 private static NISuppressor arg2_ge_0 = 6207 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 6208 6209 private static NISuppressor result_ge_64 = 6210 new NISuppressor(0, RangeInt.GreaterEqual64.class); 6211 private static NISuppressor arg1_ge_64 = 6212 new NISuppressor(1, RangeInt.GreaterEqual64.class); 6213 private static NISuppressor arg2_ge_64 = 6214 new NISuppressor(2, RangeInt.GreaterEqual64.class); 6215 6216 private static NISuppressor result_boolean = 6217 new NISuppressor(0, RangeInt.BooleanVal.class); 6218 private static NISuppressor arg1_boolean = 6219 new NISuppressor(1, RangeInt.BooleanVal.class); 6220 private static NISuppressor arg2_boolean = 6221 new NISuppressor(2, RangeInt.BooleanVal.class); 6222 6223 private static NISuppressor result_even = 6224 new NISuppressor(0, RangeInt.Even.class); 6225 private static NISuppressor arg1_even = 6226 new NISuppressor(1, RangeInt.Even.class); 6227 private static NISuppressor arg2_even = 6228 new NISuppressor(2, RangeInt.Even.class); 6229 6230 private static NISuppressor result_power2 = 6231 new NISuppressor(0, RangeInt.PowerOfTwo.class); 6232 private static NISuppressor arg1_power2 = 6233 new NISuppressor(1, RangeInt.PowerOfTwo.class); 6234 private static NISuppressor arg2_power2 = 6235 new NISuppressor(2, RangeInt.PowerOfTwo.class); 6236 6237 private static NISuppressor result_and0_arg1 = 6238 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 6239 private static NISuppressor result_and0_arg2 = 6240 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 6241 private static NISuppressor arg1_and0_arg2 = 6242 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 6243 6244 // The arguments to bitwise subset are backwards from what one 6245 // might expect. The second argument is a subset of the first 6246 // argument 6247 private static NISuppressor arg1_bw_subset_arg2 = 6248 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 6249 private static NISuppressor arg2_bw_subset_arg1 = 6250 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 6251 6252 private static NISuppressor result_shift0_arg1 = 6253 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 6254 private static NISuppressor result_shift0_arg2 = 6255 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 6256 private static NISuppressor arg1_shift0_arg2 = 6257 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 6258 6259 private static NISuppressor arg2_divides_arg1 = 6260 new NISuppressor(1, 2, NumericInt.Divides.class); 6261 private static NISuppressor arg1_divides_arg2 = 6262 new NISuppressor(2, 1, NumericInt.Divides.class); 6263 6264 private static NISuppressor arg2_valid_shift = 6265 new NISuppressor(2, RangeInt.Bound0_63.class); 6266 6267 private static NISuppressionSet suppressions = 6268 new NISuppressionSet( 6269 new NISuppression[] { 6270 6271 // (r == y) && (y == z) && (r == z) ==> r = y & z 6272 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 6273 suppressee), 6274 6275 // (r == y) && (y bitwise subset z) 6276 new NISuppression(result_eq_arg1, arg1_bw_subset_arg2, suppressee), 6277 6278 // (r == z) && (z bitwise subset y) 6279 new NISuppression(result_eq_arg2, arg2_bw_subset_arg1, suppressee), 6280 6281 // (r == 0) && (y & z == 0) ==> r = y & z 6282 new NISuppression(result_eq_0, arg1_and0_arg2, suppressee), 6283 6284 // All of these are subsummed by the prior one 6285 // (r == 0) && (y == 0) ==> r = y & z 6286 // new NISuppression (result_eq_0, arg1_eq_0, suppressee), 6287 6288 // (r == 0) && (z == 0) ==> r = y & z 6289 // new NISuppression (result_eq_0, arg2_eq_0, suppressee), 6290 6291 // (r == 0) && (y boolean) && (z is even) 6292 // new NISuppression (result_eq_0, arg1_boolean, arg2_even, suppressee), 6293 6294 // (r == 0) && (z boolean) && (y is even) 6295 // new NISuppression (result_eq_0, arg2_boolean, arg1_even, suppressee), 6296 6297 // (r == 0) && (z > y) && (z power2) && (y >= 0) 6298 // new NISuppression (result_eq_0, arg1_lt_arg2, arg2_power2, arg1_ge_0, 6299 // suppressee), 6300 6301 // (r == 0) && (y > z) && (y power2) && (z >= 0) 6302 // new NISuppression (result_eq_0, arg2_lt_arg1, arg1_power2, arg2_ge_0, 6303 // suppressee), 6304 6305 // (r == y) && (r boolean) && (z == 1) 6306 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_1, 6307 suppressee), 6308 6309 // (r == z) && (r boolean) && (y == 1) 6310 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_1, 6311 suppressee), 6312 6313 }); 6314 6315 // Create a suppression factory for functionBinary 6316 6317} 6318 6319/** 6320 * Represents the invariant {@code y = BitwiseAnd(x, z)} over three long 6321 * scalars. 6322 */ 6323public static class BitwiseAndLong_yxz extends FunctionBinary { 6324 static final long serialVersionUID = 20031030L; 6325 6326 private static @Prototype BitwiseAndLong_yxz proto = new @Prototype BitwiseAndLong_yxz (); 6327 6328 /** Returns the prototype invariant for BitwiseAndLong_yxz */ 6329 public static @Prototype BitwiseAndLong_yxz get_proto() { 6330 return proto; 6331 } 6332 6333 @Override 6334 protected BitwiseAndLong_yxz instantiate_dyn(@Prototype BitwiseAndLong_yxz this, PptSlice slice) { 6335 return new BitwiseAndLong_yxz (slice); 6336 } 6337 6338 private BitwiseAndLong_yxz (PptSlice slice) { 6339 super(slice); 6340 } 6341 6342 public @Prototype BitwiseAndLong_yxz () { 6343 super(); 6344 } 6345 6346 private static String[] method_name = new String[] {"", " & ", ""}; 6347 6348 @Override 6349 public String[] get_method_name(@GuardSatisfied BitwiseAndLong_yxz this) { 6350 return method_name; 6351 } 6352 6353 private static int function_id = -1; 6354 6355 @Override 6356 public int get_function_id() { 6357 return function_id; 6358 } 6359 6360 @Override 6361 public void set_function_id(int function_id) { 6362 assert BitwiseAndLong_yxz.function_id == -1; 6363 BitwiseAndLong_yxz.function_id = function_id; 6364 } 6365 6366 private static int var_order = 2; 6367 6368 @Override 6369 public int get_var_order(@GuardSatisfied BitwiseAndLong_yxz this) { 6370 return var_order; 6371 } 6372 6373 @Pure 6374 @Override 6375 public boolean is_symmetric() { 6376 6377 return true; 6378 } 6379 6380 @Override 6381 6382 public long func(long x, long z) { 6383 6384 return (x & z); 6385 } 6386 6387 @Override 6388 public InvariantStatus check_modified(long x, long y, 6389 long z, int count) { 6390 return check_ordered(y, x, z, count); 6391 } 6392 6393 @Override 6394 public InvariantStatus add_modified(long x, long y, 6395 long z, int count) { 6396 if (Debug.logDetail()) { 6397 log("result=%s, arg1=%s, arg2=%s", y, x, z); 6398 } 6399 return add_ordered(y, x, z, count); 6400 } 6401 6402 @Pure 6403 @Override 6404 public boolean isBitwiseAnd() { 6405 return true; 6406 } 6407 6408 @Pure 6409 @Override 6410 public boolean isExact() { 6411 return true; 6412 } 6413 6414 /** Returns a list of non-instantiating suppressions for this invariant. */ 6415 @Pure 6416 @Override 6417 public @Nullable NISuppressionSet get_ni_suppressions() { 6418 if (NIS.dkconfig_enabled && dkconfig_enabled) { 6419 return suppressions; 6420 } else { 6421 return null; 6422 } 6423 } 6424 6425 /** definition of this invariant (the suppressee) */ 6426 private static NISuppressee suppressee = new NISuppressee(BitwiseAndLong_yxz.class, 3); 6427 6428 // suppressor definitions (used below) 6429 private static NISuppressor result_eq_arg1 = 6430 new NISuppressor(1, 0, IntEqual.class); 6431 private static NISuppressor result_eq_arg2 = 6432 new NISuppressor(1, 2, IntEqual.class); 6433 private static NISuppressor arg1_eq_arg2 = 6434 new NISuppressor(0, 2, IntEqual.class); 6435 6436 private static NISuppressor result_lt_arg1 = 6437 new NISuppressor(1, 0, IntLessThan.class); 6438 private static NISuppressor result_lt_arg2 = 6439 new NISuppressor(1, 2, IntLessThan.class); 6440 private static NISuppressor arg1_lt_arg2 = 6441 new NISuppressor(0, 2, IntLessThan.class); 6442 private static NISuppressor arg2_lt_arg1 = 6443 new NISuppressor(2, 0, IntLessThan.class); 6444 6445 private static NISuppressor result_le_arg1 = 6446 new NISuppressor(1, 0, IntLessEqual.class); 6447 private static NISuppressor result_le_arg2 = 6448 new NISuppressor(1, 2, IntLessEqual.class); 6449 private static NISuppressor arg1_le_arg2 = 6450 new NISuppressor(0, 2, IntLessEqual.class); 6451 private static NISuppressor arg2_le_arg1 = 6452 new NISuppressor(2, 0, IntLessEqual.class); 6453 6454 private static NISuppressor result_track0_arg1 = 6455 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 6456 private static NISuppressor result_track0_arg2 = 6457 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 6458 private static NISuppressor arg1_track0_arg2 = 6459 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 6460 private static NISuppressor arg1_track0_result = 6461 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 6462 private static NISuppressor arg2_track0_result = 6463 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 6464 private static NISuppressor arg2_track0_arg1 = 6465 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 6466 6467 private static NISuppressor result_eq_1 = 6468 new NISuppressor(1, RangeInt.EqualOne.class); 6469 private static NISuppressor arg1_eq_1 = 6470 new NISuppressor(0, RangeInt.EqualOne.class); 6471 private static NISuppressor arg2_eq_1 = 6472 new NISuppressor(2, RangeInt.EqualOne.class); 6473 6474 private static NISuppressor result_eq_0 = 6475 new NISuppressor(1, RangeInt.EqualZero.class); 6476 private static NISuppressor arg1_eq_0 = 6477 new NISuppressor(0, RangeInt.EqualZero.class); 6478 private static NISuppressor arg2_eq_0 = 6479 new NISuppressor(2, RangeInt.EqualZero.class); 6480 6481 private static NISuppressor result_ne_0 = 6482 new NISuppressor(1, NonZero.class); 6483 private static NISuppressor arg1_ne_0 = 6484 new NISuppressor(0, NonZero.class); 6485 private static NISuppressor arg2_ne_0 = 6486 new NISuppressor(2, NonZero.class); 6487 6488 private static NISuppressor result_ge_0 = 6489 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 6490 private static NISuppressor arg1_ge_0 = 6491 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 6492 private static NISuppressor arg2_ge_0 = 6493 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 6494 6495 private static NISuppressor result_ge_64 = 6496 new NISuppressor(1, RangeInt.GreaterEqual64.class); 6497 private static NISuppressor arg1_ge_64 = 6498 new NISuppressor(0, RangeInt.GreaterEqual64.class); 6499 private static NISuppressor arg2_ge_64 = 6500 new NISuppressor(2, RangeInt.GreaterEqual64.class); 6501 6502 private static NISuppressor result_boolean = 6503 new NISuppressor(1, RangeInt.BooleanVal.class); 6504 private static NISuppressor arg1_boolean = 6505 new NISuppressor(0, RangeInt.BooleanVal.class); 6506 private static NISuppressor arg2_boolean = 6507 new NISuppressor(2, RangeInt.BooleanVal.class); 6508 6509 private static NISuppressor result_even = 6510 new NISuppressor(1, RangeInt.Even.class); 6511 private static NISuppressor arg1_even = 6512 new NISuppressor(0, RangeInt.Even.class); 6513 private static NISuppressor arg2_even = 6514 new NISuppressor(2, RangeInt.Even.class); 6515 6516 private static NISuppressor result_power2 = 6517 new NISuppressor(1, RangeInt.PowerOfTwo.class); 6518 private static NISuppressor arg1_power2 = 6519 new NISuppressor(0, RangeInt.PowerOfTwo.class); 6520 private static NISuppressor arg2_power2 = 6521 new NISuppressor(2, RangeInt.PowerOfTwo.class); 6522 6523 private static NISuppressor result_and0_arg1 = 6524 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 6525 private static NISuppressor result_and0_arg2 = 6526 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 6527 private static NISuppressor arg1_and0_arg2 = 6528 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 6529 6530 // The arguments to bitwise subset are backwards from what one 6531 // might expect. The second argument is a subset of the first 6532 // argument 6533 private static NISuppressor arg1_bw_subset_arg2 = 6534 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 6535 private static NISuppressor arg2_bw_subset_arg1 = 6536 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 6537 6538 private static NISuppressor result_shift0_arg1 = 6539 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 6540 private static NISuppressor result_shift0_arg2 = 6541 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 6542 private static NISuppressor arg1_shift0_arg2 = 6543 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 6544 6545 private static NISuppressor arg2_divides_arg1 = 6546 new NISuppressor(0, 2, NumericInt.Divides.class); 6547 private static NISuppressor arg1_divides_arg2 = 6548 new NISuppressor(2, 0, NumericInt.Divides.class); 6549 6550 private static NISuppressor arg2_valid_shift = 6551 new NISuppressor(2, RangeInt.Bound0_63.class); 6552 6553 private static NISuppressionSet suppressions = 6554 new NISuppressionSet( 6555 new NISuppression[] { 6556 6557 // (r == x) && (x == z) && (r == z) ==> r = x & z 6558 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 6559 suppressee), 6560 6561 // (r == x) && (x bitwise subset z) 6562 new NISuppression(result_eq_arg1, arg1_bw_subset_arg2, suppressee), 6563 6564 // (r == z) && (z bitwise subset x) 6565 new NISuppression(result_eq_arg2, arg2_bw_subset_arg1, suppressee), 6566 6567 // (r == 0) && (x & z == 0) ==> r = x & z 6568 new NISuppression(result_eq_0, arg1_and0_arg2, suppressee), 6569 6570 // All of these are subsummed by the prior one 6571 // (r == 0) && (x == 0) ==> r = x & z 6572 // new NISuppression (result_eq_0, arg1_eq_0, suppressee), 6573 6574 // (r == 0) && (z == 0) ==> r = x & z 6575 // new NISuppression (result_eq_0, arg2_eq_0, suppressee), 6576 6577 // (r == 0) && (x boolean) && (z is even) 6578 // new NISuppression (result_eq_0, arg1_boolean, arg2_even, suppressee), 6579 6580 // (r == 0) && (z boolean) && (x is even) 6581 // new NISuppression (result_eq_0, arg2_boolean, arg1_even, suppressee), 6582 6583 // (r == 0) && (z > x) && (z power2) && (x >= 0) 6584 // new NISuppression (result_eq_0, arg1_lt_arg2, arg2_power2, arg1_ge_0, 6585 // suppressee), 6586 6587 // (r == 0) && (x > z) && (x power2) && (z >= 0) 6588 // new NISuppression (result_eq_0, arg2_lt_arg1, arg1_power2, arg2_ge_0, 6589 // suppressee), 6590 6591 // (r == x) && (r boolean) && (z == 1) 6592 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_1, 6593 suppressee), 6594 6595 // (r == z) && (r boolean) && (x == 1) 6596 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_1, 6597 suppressee), 6598 6599 }); 6600 6601 // Create a suppression factory for functionBinary 6602 6603} 6604 6605/** 6606 * Represents the invariant {@code z = BitwiseAnd(x, y)} over three long 6607 * scalars. 6608 */ 6609public static class BitwiseAndLong_zxy extends FunctionBinary { 6610 static final long serialVersionUID = 20031030L; 6611 6612 private static @Prototype BitwiseAndLong_zxy proto = new @Prototype BitwiseAndLong_zxy (); 6613 6614 /** Returns the prototype invariant for BitwiseAndLong_zxy */ 6615 public static @Prototype BitwiseAndLong_zxy get_proto() { 6616 return proto; 6617 } 6618 6619 @Override 6620 protected BitwiseAndLong_zxy instantiate_dyn(@Prototype BitwiseAndLong_zxy this, PptSlice slice) { 6621 return new BitwiseAndLong_zxy (slice); 6622 } 6623 6624 private BitwiseAndLong_zxy (PptSlice slice) { 6625 super(slice); 6626 } 6627 6628 public @Prototype BitwiseAndLong_zxy () { 6629 super(); 6630 } 6631 6632 private static String[] method_name = new String[] {"", " & ", ""}; 6633 6634 @Override 6635 public String[] get_method_name(@GuardSatisfied BitwiseAndLong_zxy this) { 6636 return method_name; 6637 } 6638 6639 private static int function_id = -1; 6640 6641 @Override 6642 public int get_function_id() { 6643 return function_id; 6644 } 6645 6646 @Override 6647 public void set_function_id(int function_id) { 6648 assert BitwiseAndLong_zxy.function_id == -1; 6649 BitwiseAndLong_zxy.function_id = function_id; 6650 } 6651 6652 private static int var_order = 3; 6653 6654 @Override 6655 public int get_var_order(@GuardSatisfied BitwiseAndLong_zxy this) { 6656 return var_order; 6657 } 6658 6659 @Pure 6660 @Override 6661 public boolean is_symmetric() { 6662 6663 return true; 6664 } 6665 6666 @Override 6667 6668 public long func(long x, long y) { 6669 6670 return (x & y); 6671 } 6672 6673 @Override 6674 public InvariantStatus check_modified(long x, long y, 6675 long z, int count) { 6676 return check_ordered(z, x, y, count); 6677 } 6678 6679 @Override 6680 public InvariantStatus add_modified(long x, long y, 6681 long z, int count) { 6682 if (Debug.logDetail()) { 6683 log("result=%s, arg1=%s, arg2=%s", z, x, y); 6684 } 6685 return add_ordered(z, x, y, count); 6686 } 6687 6688 @Pure 6689 @Override 6690 public boolean isBitwiseAnd() { 6691 return true; 6692 } 6693 6694 @Pure 6695 @Override 6696 public boolean isExact() { 6697 return true; 6698 } 6699 6700 /** Returns a list of non-instantiating suppressions for this invariant. */ 6701 @Pure 6702 @Override 6703 public @Nullable NISuppressionSet get_ni_suppressions() { 6704 if (NIS.dkconfig_enabled && dkconfig_enabled) { 6705 return suppressions; 6706 } else { 6707 return null; 6708 } 6709 } 6710 6711 /** definition of this invariant (the suppressee) */ 6712 private static NISuppressee suppressee = new NISuppressee(BitwiseAndLong_zxy.class, 3); 6713 6714 // suppressor definitions (used below) 6715 private static NISuppressor result_eq_arg1 = 6716 new NISuppressor(2, 0, IntEqual.class); 6717 private static NISuppressor result_eq_arg2 = 6718 new NISuppressor(2, 1, IntEqual.class); 6719 private static NISuppressor arg1_eq_arg2 = 6720 new NISuppressor(0, 1, IntEqual.class); 6721 6722 private static NISuppressor result_lt_arg1 = 6723 new NISuppressor(2, 0, IntLessThan.class); 6724 private static NISuppressor result_lt_arg2 = 6725 new NISuppressor(2, 1, IntLessThan.class); 6726 private static NISuppressor arg1_lt_arg2 = 6727 new NISuppressor(0, 1, IntLessThan.class); 6728 private static NISuppressor arg2_lt_arg1 = 6729 new NISuppressor(1, 0, IntLessThan.class); 6730 6731 private static NISuppressor result_le_arg1 = 6732 new NISuppressor(2, 0, IntLessEqual.class); 6733 private static NISuppressor result_le_arg2 = 6734 new NISuppressor(2, 1, IntLessEqual.class); 6735 private static NISuppressor arg1_le_arg2 = 6736 new NISuppressor(0, 1, IntLessEqual.class); 6737 private static NISuppressor arg2_le_arg1 = 6738 new NISuppressor(1, 0, IntLessEqual.class); 6739 6740 private static NISuppressor result_track0_arg1 = 6741 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 6742 private static NISuppressor result_track0_arg2 = 6743 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 6744 private static NISuppressor arg1_track0_arg2 = 6745 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 6746 private static NISuppressor arg1_track0_result = 6747 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 6748 private static NISuppressor arg2_track0_result = 6749 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 6750 private static NISuppressor arg2_track0_arg1 = 6751 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 6752 6753 private static NISuppressor result_eq_1 = 6754 new NISuppressor(2, RangeInt.EqualOne.class); 6755 private static NISuppressor arg1_eq_1 = 6756 new NISuppressor(0, RangeInt.EqualOne.class); 6757 private static NISuppressor arg2_eq_1 = 6758 new NISuppressor(1, RangeInt.EqualOne.class); 6759 6760 private static NISuppressor result_eq_0 = 6761 new NISuppressor(2, RangeInt.EqualZero.class); 6762 private static NISuppressor arg1_eq_0 = 6763 new NISuppressor(0, RangeInt.EqualZero.class); 6764 private static NISuppressor arg2_eq_0 = 6765 new NISuppressor(1, RangeInt.EqualZero.class); 6766 6767 private static NISuppressor result_ne_0 = 6768 new NISuppressor(2, NonZero.class); 6769 private static NISuppressor arg1_ne_0 = 6770 new NISuppressor(0, NonZero.class); 6771 private static NISuppressor arg2_ne_0 = 6772 new NISuppressor(1, NonZero.class); 6773 6774 private static NISuppressor result_ge_0 = 6775 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 6776 private static NISuppressor arg1_ge_0 = 6777 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 6778 private static NISuppressor arg2_ge_0 = 6779 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 6780 6781 private static NISuppressor result_ge_64 = 6782 new NISuppressor(2, RangeInt.GreaterEqual64.class); 6783 private static NISuppressor arg1_ge_64 = 6784 new NISuppressor(0, RangeInt.GreaterEqual64.class); 6785 private static NISuppressor arg2_ge_64 = 6786 new NISuppressor(1, RangeInt.GreaterEqual64.class); 6787 6788 private static NISuppressor result_boolean = 6789 new NISuppressor(2, RangeInt.BooleanVal.class); 6790 private static NISuppressor arg1_boolean = 6791 new NISuppressor(0, RangeInt.BooleanVal.class); 6792 private static NISuppressor arg2_boolean = 6793 new NISuppressor(1, RangeInt.BooleanVal.class); 6794 6795 private static NISuppressor result_even = 6796 new NISuppressor(2, RangeInt.Even.class); 6797 private static NISuppressor arg1_even = 6798 new NISuppressor(0, RangeInt.Even.class); 6799 private static NISuppressor arg2_even = 6800 new NISuppressor(1, RangeInt.Even.class); 6801 6802 private static NISuppressor result_power2 = 6803 new NISuppressor(2, RangeInt.PowerOfTwo.class); 6804 private static NISuppressor arg1_power2 = 6805 new NISuppressor(0, RangeInt.PowerOfTwo.class); 6806 private static NISuppressor arg2_power2 = 6807 new NISuppressor(1, RangeInt.PowerOfTwo.class); 6808 6809 private static NISuppressor result_and0_arg1 = 6810 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 6811 private static NISuppressor result_and0_arg2 = 6812 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 6813 private static NISuppressor arg1_and0_arg2 = 6814 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 6815 6816 // The arguments to bitwise subset are backwards from what one 6817 // might expect. The second argument is a subset of the first 6818 // argument 6819 private static NISuppressor arg1_bw_subset_arg2 = 6820 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 6821 private static NISuppressor arg2_bw_subset_arg1 = 6822 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 6823 6824 private static NISuppressor result_shift0_arg1 = 6825 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 6826 private static NISuppressor result_shift0_arg2 = 6827 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 6828 private static NISuppressor arg1_shift0_arg2 = 6829 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 6830 6831 private static NISuppressor arg2_divides_arg1 = 6832 new NISuppressor(0, 1, NumericInt.Divides.class); 6833 private static NISuppressor arg1_divides_arg2 = 6834 new NISuppressor(1, 0, NumericInt.Divides.class); 6835 6836 private static NISuppressor arg2_valid_shift = 6837 new NISuppressor(1, RangeInt.Bound0_63.class); 6838 6839 private static NISuppressionSet suppressions = 6840 new NISuppressionSet( 6841 new NISuppression[] { 6842 6843 // (r == x) && (x == y) && (r == y) ==> r = x & y 6844 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 6845 suppressee), 6846 6847 // (r == x) && (x bitwise subset y) 6848 new NISuppression(result_eq_arg1, arg1_bw_subset_arg2, suppressee), 6849 6850 // (r == y) && (y bitwise subset x) 6851 new NISuppression(result_eq_arg2, arg2_bw_subset_arg1, suppressee), 6852 6853 // (r == 0) && (x & y == 0) ==> r = x & y 6854 new NISuppression(result_eq_0, arg1_and0_arg2, suppressee), 6855 6856 // All of these are subsummed by the prior one 6857 // (r == 0) && (x == 0) ==> r = x & y 6858 // new NISuppression (result_eq_0, arg1_eq_0, suppressee), 6859 6860 // (r == 0) && (y == 0) ==> r = x & y 6861 // new NISuppression (result_eq_0, arg2_eq_0, suppressee), 6862 6863 // (r == 0) && (x boolean) && (y is even) 6864 // new NISuppression (result_eq_0, arg1_boolean, arg2_even, suppressee), 6865 6866 // (r == 0) && (y boolean) && (x is even) 6867 // new NISuppression (result_eq_0, arg2_boolean, arg1_even, suppressee), 6868 6869 // (r == 0) && (y > x) && (y power2) && (x >= 0) 6870 // new NISuppression (result_eq_0, arg1_lt_arg2, arg2_power2, arg1_ge_0, 6871 // suppressee), 6872 6873 // (r == 0) && (x > y) && (x power2) && (y >= 0) 6874 // new NISuppression (result_eq_0, arg2_lt_arg1, arg1_power2, arg2_ge_0, 6875 // suppressee), 6876 6877 // (r == x) && (r boolean) && (y == 1) 6878 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_1, 6879 suppressee), 6880 6881 // (r == y) && (r boolean) && (x == 1) 6882 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_1, 6883 suppressee), 6884 6885 }); 6886 6887 // Create a suppression factory for functionBinary 6888 6889} 6890 6891 // default is that it is not this function, overriden in the subclass 6892 @Pure 6893 public boolean isLogicalAnd() { 6894 return false; 6895 } 6896 6897/** 6898 * Represents the invariant {@code x = LogicalAnd(y, z)} over three long 6899 * scalars. For logical operations, Daikon treats 0 as false and all other values as true. 6900 */ 6901public static class LogicalAndLong_xyz extends FunctionBinary { 6902 static final long serialVersionUID = 20031030L; 6903 6904 private static @Prototype LogicalAndLong_xyz proto = new @Prototype LogicalAndLong_xyz (); 6905 6906 /** Returns the prototype invariant for LogicalAndLong_xyz */ 6907 public static @Prototype LogicalAndLong_xyz get_proto() { 6908 return proto; 6909 } 6910 6911 @Override 6912 protected LogicalAndLong_xyz instantiate_dyn(@Prototype LogicalAndLong_xyz this, PptSlice slice) { 6913 return new LogicalAndLong_xyz (slice); 6914 } 6915 6916 private LogicalAndLong_xyz (PptSlice slice) { 6917 super(slice); 6918 } 6919 6920 public @Prototype LogicalAndLong_xyz () { 6921 super(); 6922 } 6923 6924 private static String[] method_name = new String[] {"", " && ", ""}; 6925 6926 @Override 6927 public String[] get_method_name(@GuardSatisfied LogicalAndLong_xyz this) { 6928 return method_name; 6929 } 6930 6931 private static int function_id = -1; 6932 6933 @Override 6934 public int get_function_id() { 6935 return function_id; 6936 } 6937 6938 @Override 6939 public void set_function_id(int function_id) { 6940 assert LogicalAndLong_xyz.function_id == -1; 6941 LogicalAndLong_xyz.function_id = function_id; 6942 } 6943 6944 private static int var_order = 1; 6945 6946 @Override 6947 public int get_var_order(@GuardSatisfied LogicalAndLong_xyz this) { 6948 return var_order; 6949 } 6950 6951 @Pure 6952 @Override 6953 public boolean is_symmetric() { 6954 6955 return true; 6956 } 6957 6958 @Override 6959 6960 public long func(long y, long z) { 6961 6962 if ((y < 0) || (y > 1)) { 6963 throw new ArithmeticException("arg1 (" + y + ") is not boolean "); 6964 } 6965 if ((z < 0) || (z > 1)) { 6966 throw new ArithmeticException("arg2 (" + z + ") is not boolean "); 6967 } 6968 6969 return (((y != 0) && ( z != 0)) ? 1 : 0); 6970 } 6971 6972 @Override 6973 public InvariantStatus check_modified(long x, long y, 6974 long z, int count) { 6975 return check_ordered(x, y, z, count); 6976 } 6977 6978 @Override 6979 public InvariantStatus add_modified(long x, long y, 6980 long z, int count) { 6981 if (Debug.logDetail()) { 6982 log("result=%s, arg1=%s, arg2=%s", x, y, z); 6983 } 6984 return add_ordered(x, y, z, count); 6985 } 6986 6987 @Pure 6988 @Override 6989 public boolean isLogicalAnd() { 6990 return true; 6991 } 6992 6993 /** Returns a list of non-instantiating suppressions for this invariant. */ 6994 @Pure 6995 @Override 6996 public @Nullable NISuppressionSet get_ni_suppressions() { 6997 if (NIS.dkconfig_enabled && dkconfig_enabled) { 6998 return suppressions; 6999 } else { 7000 return null; 7001 } 7002 } 7003 7004 /** definition of this invariant (the suppressee) */ 7005 private static NISuppressee suppressee = new NISuppressee(LogicalAndLong_xyz.class, 3); 7006 7007 // suppressor definitions (used below) 7008 private static NISuppressor result_eq_arg1 = 7009 new NISuppressor(0, 1, IntEqual.class); 7010 private static NISuppressor result_eq_arg2 = 7011 new NISuppressor(0, 2, IntEqual.class); 7012 private static NISuppressor arg1_eq_arg2 = 7013 new NISuppressor(1, 2, IntEqual.class); 7014 7015 private static NISuppressor result_lt_arg1 = 7016 new NISuppressor(0, 1, IntLessThan.class); 7017 private static NISuppressor result_lt_arg2 = 7018 new NISuppressor(0, 2, IntLessThan.class); 7019 private static NISuppressor arg1_lt_arg2 = 7020 new NISuppressor(1, 2, IntLessThan.class); 7021 private static NISuppressor arg2_lt_arg1 = 7022 new NISuppressor(2, 1, IntLessThan.class); 7023 7024 private static NISuppressor result_le_arg1 = 7025 new NISuppressor(0, 1, IntLessEqual.class); 7026 private static NISuppressor result_le_arg2 = 7027 new NISuppressor(0, 2, IntLessEqual.class); 7028 private static NISuppressor arg1_le_arg2 = 7029 new NISuppressor(1, 2, IntLessEqual.class); 7030 private static NISuppressor arg2_le_arg1 = 7031 new NISuppressor(2, 1, IntLessEqual.class); 7032 7033 private static NISuppressor result_track0_arg1 = 7034 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 7035 private static NISuppressor result_track0_arg2 = 7036 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 7037 private static NISuppressor arg1_track0_arg2 = 7038 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 7039 private static NISuppressor arg1_track0_result = 7040 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 7041 private static NISuppressor arg2_track0_result = 7042 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 7043 private static NISuppressor arg2_track0_arg1 = 7044 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 7045 7046 private static NISuppressor result_eq_1 = 7047 new NISuppressor(0, RangeInt.EqualOne.class); 7048 private static NISuppressor arg1_eq_1 = 7049 new NISuppressor(1, RangeInt.EqualOne.class); 7050 private static NISuppressor arg2_eq_1 = 7051 new NISuppressor(2, RangeInt.EqualOne.class); 7052 7053 private static NISuppressor result_eq_0 = 7054 new NISuppressor(0, RangeInt.EqualZero.class); 7055 private static NISuppressor arg1_eq_0 = 7056 new NISuppressor(1, RangeInt.EqualZero.class); 7057 private static NISuppressor arg2_eq_0 = 7058 new NISuppressor(2, RangeInt.EqualZero.class); 7059 7060 private static NISuppressor result_ne_0 = 7061 new NISuppressor(0, NonZero.class); 7062 private static NISuppressor arg1_ne_0 = 7063 new NISuppressor(1, NonZero.class); 7064 private static NISuppressor arg2_ne_0 = 7065 new NISuppressor(2, NonZero.class); 7066 7067 private static NISuppressor result_ge_0 = 7068 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 7069 private static NISuppressor arg1_ge_0 = 7070 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 7071 private static NISuppressor arg2_ge_0 = 7072 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 7073 7074 private static NISuppressor result_ge_64 = 7075 new NISuppressor(0, RangeInt.GreaterEqual64.class); 7076 private static NISuppressor arg1_ge_64 = 7077 new NISuppressor(1, RangeInt.GreaterEqual64.class); 7078 private static NISuppressor arg2_ge_64 = 7079 new NISuppressor(2, RangeInt.GreaterEqual64.class); 7080 7081 private static NISuppressor result_boolean = 7082 new NISuppressor(0, RangeInt.BooleanVal.class); 7083 private static NISuppressor arg1_boolean = 7084 new NISuppressor(1, RangeInt.BooleanVal.class); 7085 private static NISuppressor arg2_boolean = 7086 new NISuppressor(2, RangeInt.BooleanVal.class); 7087 7088 private static NISuppressor result_even = 7089 new NISuppressor(0, RangeInt.Even.class); 7090 private static NISuppressor arg1_even = 7091 new NISuppressor(1, RangeInt.Even.class); 7092 private static NISuppressor arg2_even = 7093 new NISuppressor(2, RangeInt.Even.class); 7094 7095 private static NISuppressor result_power2 = 7096 new NISuppressor(0, RangeInt.PowerOfTwo.class); 7097 private static NISuppressor arg1_power2 = 7098 new NISuppressor(1, RangeInt.PowerOfTwo.class); 7099 private static NISuppressor arg2_power2 = 7100 new NISuppressor(2, RangeInt.PowerOfTwo.class); 7101 7102 private static NISuppressor result_and0_arg1 = 7103 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 7104 private static NISuppressor result_and0_arg2 = 7105 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 7106 private static NISuppressor arg1_and0_arg2 = 7107 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 7108 7109 // The arguments to bitwise subset are backwards from what one 7110 // might expect. The second argument is a subset of the first 7111 // argument 7112 private static NISuppressor arg1_bw_subset_arg2 = 7113 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 7114 private static NISuppressor arg2_bw_subset_arg1 = 7115 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 7116 7117 private static NISuppressor result_shift0_arg1 = 7118 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 7119 private static NISuppressor result_shift0_arg2 = 7120 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 7121 private static NISuppressor arg1_shift0_arg2 = 7122 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 7123 7124 private static NISuppressor arg2_divides_arg1 = 7125 new NISuppressor(1, 2, NumericInt.Divides.class); 7126 private static NISuppressor arg1_divides_arg2 = 7127 new NISuppressor(2, 1, NumericInt.Divides.class); 7128 7129 private static NISuppressor arg2_valid_shift = 7130 new NISuppressor(2, RangeInt.Bound0_63.class); 7131 7132 private static NISuppressionSet suppressions = 7133 new NISuppressionSet( 7134 new NISuppression[] { 7135 7136 // (r == y) && (y == z) && (r == z) && (r is boolean) 7137 // ==> r = y && z 7138 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 7139 result_boolean, suppressee), 7140 7141 // (r == 0) && (y == 0) && (z is boolean) ==> r = y && z 7142 new NISuppression(result_eq_0, arg1_eq_0, arg2_boolean, suppressee), 7143 7144 // (r == 0) && (z == 0) && (y is boolean) ==> r = y && z 7145 new NISuppression(result_eq_0, arg2_eq_0, arg1_boolean, suppressee), 7146 7147 // (r == 0) && (y == 0) && (z boolean) ==> r = y && z 7148 new NISuppression(result_eq_0, arg1_eq_0, arg2_boolean, suppressee), 7149 7150 // (r == 0) && (z == 0) && (y boolean) ==> r = y && z 7151 new NISuppression(result_eq_0, arg2_eq_0, arg1_boolean, suppressee), 7152 7153 // (r == y) && (r boolean) && (z == 1) 7154 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_1, 7155 suppressee), 7156 7157 // (r == z) && (r boolean) && (y == 1) 7158 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_1, 7159 suppressee), 7160 7161 }); 7162 7163 // Create a suppression factory for functionBinary 7164 7165} 7166 7167/** 7168 * Represents the invariant {@code y = LogicalAnd(x, z)} over three long 7169 * scalars. For logical operations, Daikon treats 0 as false and all other values as true. 7170 */ 7171public static class LogicalAndLong_yxz extends FunctionBinary { 7172 static final long serialVersionUID = 20031030L; 7173 7174 private static @Prototype LogicalAndLong_yxz proto = new @Prototype LogicalAndLong_yxz (); 7175 7176 /** Returns the prototype invariant for LogicalAndLong_yxz */ 7177 public static @Prototype LogicalAndLong_yxz get_proto() { 7178 return proto; 7179 } 7180 7181 @Override 7182 protected LogicalAndLong_yxz instantiate_dyn(@Prototype LogicalAndLong_yxz this, PptSlice slice) { 7183 return new LogicalAndLong_yxz (slice); 7184 } 7185 7186 private LogicalAndLong_yxz (PptSlice slice) { 7187 super(slice); 7188 } 7189 7190 public @Prototype LogicalAndLong_yxz () { 7191 super(); 7192 } 7193 7194 private static String[] method_name = new String[] {"", " && ", ""}; 7195 7196 @Override 7197 public String[] get_method_name(@GuardSatisfied LogicalAndLong_yxz this) { 7198 return method_name; 7199 } 7200 7201 private static int function_id = -1; 7202 7203 @Override 7204 public int get_function_id() { 7205 return function_id; 7206 } 7207 7208 @Override 7209 public void set_function_id(int function_id) { 7210 assert LogicalAndLong_yxz.function_id == -1; 7211 LogicalAndLong_yxz.function_id = function_id; 7212 } 7213 7214 private static int var_order = 2; 7215 7216 @Override 7217 public int get_var_order(@GuardSatisfied LogicalAndLong_yxz this) { 7218 return var_order; 7219 } 7220 7221 @Pure 7222 @Override 7223 public boolean is_symmetric() { 7224 7225 return true; 7226 } 7227 7228 @Override 7229 7230 public long func(long x, long z) { 7231 7232 if ((x < 0) || (x > 1)) { 7233 throw new ArithmeticException("arg1 (" + x + ") is not boolean "); 7234 } 7235 if ((z < 0) || (z > 1)) { 7236 throw new ArithmeticException("arg2 (" + z + ") is not boolean "); 7237 } 7238 7239 return (((x != 0) && ( z != 0)) ? 1 : 0); 7240 } 7241 7242 @Override 7243 public InvariantStatus check_modified(long x, long y, 7244 long z, int count) { 7245 return check_ordered(y, x, z, count); 7246 } 7247 7248 @Override 7249 public InvariantStatus add_modified(long x, long y, 7250 long z, int count) { 7251 if (Debug.logDetail()) { 7252 log("result=%s, arg1=%s, arg2=%s", y, x, z); 7253 } 7254 return add_ordered(y, x, z, count); 7255 } 7256 7257 @Pure 7258 @Override 7259 public boolean isLogicalAnd() { 7260 return true; 7261 } 7262 7263 /** Returns a list of non-instantiating suppressions for this invariant. */ 7264 @Pure 7265 @Override 7266 public @Nullable NISuppressionSet get_ni_suppressions() { 7267 if (NIS.dkconfig_enabled && dkconfig_enabled) { 7268 return suppressions; 7269 } else { 7270 return null; 7271 } 7272 } 7273 7274 /** definition of this invariant (the suppressee) */ 7275 private static NISuppressee suppressee = new NISuppressee(LogicalAndLong_yxz.class, 3); 7276 7277 // suppressor definitions (used below) 7278 private static NISuppressor result_eq_arg1 = 7279 new NISuppressor(1, 0, IntEqual.class); 7280 private static NISuppressor result_eq_arg2 = 7281 new NISuppressor(1, 2, IntEqual.class); 7282 private static NISuppressor arg1_eq_arg2 = 7283 new NISuppressor(0, 2, IntEqual.class); 7284 7285 private static NISuppressor result_lt_arg1 = 7286 new NISuppressor(1, 0, IntLessThan.class); 7287 private static NISuppressor result_lt_arg2 = 7288 new NISuppressor(1, 2, IntLessThan.class); 7289 private static NISuppressor arg1_lt_arg2 = 7290 new NISuppressor(0, 2, IntLessThan.class); 7291 private static NISuppressor arg2_lt_arg1 = 7292 new NISuppressor(2, 0, IntLessThan.class); 7293 7294 private static NISuppressor result_le_arg1 = 7295 new NISuppressor(1, 0, IntLessEqual.class); 7296 private static NISuppressor result_le_arg2 = 7297 new NISuppressor(1, 2, IntLessEqual.class); 7298 private static NISuppressor arg1_le_arg2 = 7299 new NISuppressor(0, 2, IntLessEqual.class); 7300 private static NISuppressor arg2_le_arg1 = 7301 new NISuppressor(2, 0, IntLessEqual.class); 7302 7303 private static NISuppressor result_track0_arg1 = 7304 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 7305 private static NISuppressor result_track0_arg2 = 7306 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 7307 private static NISuppressor arg1_track0_arg2 = 7308 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 7309 private static NISuppressor arg1_track0_result = 7310 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 7311 private static NISuppressor arg2_track0_result = 7312 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 7313 private static NISuppressor arg2_track0_arg1 = 7314 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 7315 7316 private static NISuppressor result_eq_1 = 7317 new NISuppressor(1, RangeInt.EqualOne.class); 7318 private static NISuppressor arg1_eq_1 = 7319 new NISuppressor(0, RangeInt.EqualOne.class); 7320 private static NISuppressor arg2_eq_1 = 7321 new NISuppressor(2, RangeInt.EqualOne.class); 7322 7323 private static NISuppressor result_eq_0 = 7324 new NISuppressor(1, RangeInt.EqualZero.class); 7325 private static NISuppressor arg1_eq_0 = 7326 new NISuppressor(0, RangeInt.EqualZero.class); 7327 private static NISuppressor arg2_eq_0 = 7328 new NISuppressor(2, RangeInt.EqualZero.class); 7329 7330 private static NISuppressor result_ne_0 = 7331 new NISuppressor(1, NonZero.class); 7332 private static NISuppressor arg1_ne_0 = 7333 new NISuppressor(0, NonZero.class); 7334 private static NISuppressor arg2_ne_0 = 7335 new NISuppressor(2, NonZero.class); 7336 7337 private static NISuppressor result_ge_0 = 7338 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 7339 private static NISuppressor arg1_ge_0 = 7340 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 7341 private static NISuppressor arg2_ge_0 = 7342 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 7343 7344 private static NISuppressor result_ge_64 = 7345 new NISuppressor(1, RangeInt.GreaterEqual64.class); 7346 private static NISuppressor arg1_ge_64 = 7347 new NISuppressor(0, RangeInt.GreaterEqual64.class); 7348 private static NISuppressor arg2_ge_64 = 7349 new NISuppressor(2, RangeInt.GreaterEqual64.class); 7350 7351 private static NISuppressor result_boolean = 7352 new NISuppressor(1, RangeInt.BooleanVal.class); 7353 private static NISuppressor arg1_boolean = 7354 new NISuppressor(0, RangeInt.BooleanVal.class); 7355 private static NISuppressor arg2_boolean = 7356 new NISuppressor(2, RangeInt.BooleanVal.class); 7357 7358 private static NISuppressor result_even = 7359 new NISuppressor(1, RangeInt.Even.class); 7360 private static NISuppressor arg1_even = 7361 new NISuppressor(0, RangeInt.Even.class); 7362 private static NISuppressor arg2_even = 7363 new NISuppressor(2, RangeInt.Even.class); 7364 7365 private static NISuppressor result_power2 = 7366 new NISuppressor(1, RangeInt.PowerOfTwo.class); 7367 private static NISuppressor arg1_power2 = 7368 new NISuppressor(0, RangeInt.PowerOfTwo.class); 7369 private static NISuppressor arg2_power2 = 7370 new NISuppressor(2, RangeInt.PowerOfTwo.class); 7371 7372 private static NISuppressor result_and0_arg1 = 7373 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 7374 private static NISuppressor result_and0_arg2 = 7375 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 7376 private static NISuppressor arg1_and0_arg2 = 7377 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 7378 7379 // The arguments to bitwise subset are backwards from what one 7380 // might expect. The second argument is a subset of the first 7381 // argument 7382 private static NISuppressor arg1_bw_subset_arg2 = 7383 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 7384 private static NISuppressor arg2_bw_subset_arg1 = 7385 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 7386 7387 private static NISuppressor result_shift0_arg1 = 7388 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 7389 private static NISuppressor result_shift0_arg2 = 7390 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 7391 private static NISuppressor arg1_shift0_arg2 = 7392 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 7393 7394 private static NISuppressor arg2_divides_arg1 = 7395 new NISuppressor(0, 2, NumericInt.Divides.class); 7396 private static NISuppressor arg1_divides_arg2 = 7397 new NISuppressor(2, 0, NumericInt.Divides.class); 7398 7399 private static NISuppressor arg2_valid_shift = 7400 new NISuppressor(2, RangeInt.Bound0_63.class); 7401 7402 private static NISuppressionSet suppressions = 7403 new NISuppressionSet( 7404 new NISuppression[] { 7405 7406 // (r == x) && (x == z) && (r == z) && (r is boolean) 7407 // ==> r = x && z 7408 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 7409 result_boolean, suppressee), 7410 7411 // (r == 0) && (x == 0) && (z is boolean) ==> r = x && z 7412 new NISuppression(result_eq_0, arg1_eq_0, arg2_boolean, suppressee), 7413 7414 // (r == 0) && (z == 0) && (x is boolean) ==> r = x && z 7415 new NISuppression(result_eq_0, arg2_eq_0, arg1_boolean, suppressee), 7416 7417 // (r == 0) && (x == 0) && (z boolean) ==> r = x && z 7418 new NISuppression(result_eq_0, arg1_eq_0, arg2_boolean, suppressee), 7419 7420 // (r == 0) && (z == 0) && (x boolean) ==> r = x && z 7421 new NISuppression(result_eq_0, arg2_eq_0, arg1_boolean, suppressee), 7422 7423 // (r == x) && (r boolean) && (z == 1) 7424 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_1, 7425 suppressee), 7426 7427 // (r == z) && (r boolean) && (x == 1) 7428 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_1, 7429 suppressee), 7430 7431 }); 7432 7433 // Create a suppression factory for functionBinary 7434 7435} 7436 7437/** 7438 * Represents the invariant {@code z = LogicalAnd(x, y)} over three long 7439 * scalars. For logical operations, Daikon treats 0 as false and all other values as true. 7440 */ 7441public static class LogicalAndLong_zxy extends FunctionBinary { 7442 static final long serialVersionUID = 20031030L; 7443 7444 private static @Prototype LogicalAndLong_zxy proto = new @Prototype LogicalAndLong_zxy (); 7445 7446 /** Returns the prototype invariant for LogicalAndLong_zxy */ 7447 public static @Prototype LogicalAndLong_zxy get_proto() { 7448 return proto; 7449 } 7450 7451 @Override 7452 protected LogicalAndLong_zxy instantiate_dyn(@Prototype LogicalAndLong_zxy this, PptSlice slice) { 7453 return new LogicalAndLong_zxy (slice); 7454 } 7455 7456 private LogicalAndLong_zxy (PptSlice slice) { 7457 super(slice); 7458 } 7459 7460 public @Prototype LogicalAndLong_zxy () { 7461 super(); 7462 } 7463 7464 private static String[] method_name = new String[] {"", " && ", ""}; 7465 7466 @Override 7467 public String[] get_method_name(@GuardSatisfied LogicalAndLong_zxy this) { 7468 return method_name; 7469 } 7470 7471 private static int function_id = -1; 7472 7473 @Override 7474 public int get_function_id() { 7475 return function_id; 7476 } 7477 7478 @Override 7479 public void set_function_id(int function_id) { 7480 assert LogicalAndLong_zxy.function_id == -1; 7481 LogicalAndLong_zxy.function_id = function_id; 7482 } 7483 7484 private static int var_order = 3; 7485 7486 @Override 7487 public int get_var_order(@GuardSatisfied LogicalAndLong_zxy this) { 7488 return var_order; 7489 } 7490 7491 @Pure 7492 @Override 7493 public boolean is_symmetric() { 7494 7495 return true; 7496 } 7497 7498 @Override 7499 7500 public long func(long x, long y) { 7501 7502 if ((x < 0) || (x > 1)) { 7503 throw new ArithmeticException("arg1 (" + x + ") is not boolean "); 7504 } 7505 if ((y < 0) || (y > 1)) { 7506 throw new ArithmeticException("arg2 (" + y + ") is not boolean "); 7507 } 7508 7509 return (((x != 0) && ( y != 0)) ? 1 : 0); 7510 } 7511 7512 @Override 7513 public InvariantStatus check_modified(long x, long y, 7514 long z, int count) { 7515 return check_ordered(z, x, y, count); 7516 } 7517 7518 @Override 7519 public InvariantStatus add_modified(long x, long y, 7520 long z, int count) { 7521 if (Debug.logDetail()) { 7522 log("result=%s, arg1=%s, arg2=%s", z, x, y); 7523 } 7524 return add_ordered(z, x, y, count); 7525 } 7526 7527 @Pure 7528 @Override 7529 public boolean isLogicalAnd() { 7530 return true; 7531 } 7532 7533 /** Returns a list of non-instantiating suppressions for this invariant. */ 7534 @Pure 7535 @Override 7536 public @Nullable NISuppressionSet get_ni_suppressions() { 7537 if (NIS.dkconfig_enabled && dkconfig_enabled) { 7538 return suppressions; 7539 } else { 7540 return null; 7541 } 7542 } 7543 7544 /** definition of this invariant (the suppressee) */ 7545 private static NISuppressee suppressee = new NISuppressee(LogicalAndLong_zxy.class, 3); 7546 7547 // suppressor definitions (used below) 7548 private static NISuppressor result_eq_arg1 = 7549 new NISuppressor(2, 0, IntEqual.class); 7550 private static NISuppressor result_eq_arg2 = 7551 new NISuppressor(2, 1, IntEqual.class); 7552 private static NISuppressor arg1_eq_arg2 = 7553 new NISuppressor(0, 1, IntEqual.class); 7554 7555 private static NISuppressor result_lt_arg1 = 7556 new NISuppressor(2, 0, IntLessThan.class); 7557 private static NISuppressor result_lt_arg2 = 7558 new NISuppressor(2, 1, IntLessThan.class); 7559 private static NISuppressor arg1_lt_arg2 = 7560 new NISuppressor(0, 1, IntLessThan.class); 7561 private static NISuppressor arg2_lt_arg1 = 7562 new NISuppressor(1, 0, IntLessThan.class); 7563 7564 private static NISuppressor result_le_arg1 = 7565 new NISuppressor(2, 0, IntLessEqual.class); 7566 private static NISuppressor result_le_arg2 = 7567 new NISuppressor(2, 1, IntLessEqual.class); 7568 private static NISuppressor arg1_le_arg2 = 7569 new NISuppressor(0, 1, IntLessEqual.class); 7570 private static NISuppressor arg2_le_arg1 = 7571 new NISuppressor(1, 0, IntLessEqual.class); 7572 7573 private static NISuppressor result_track0_arg1 = 7574 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 7575 private static NISuppressor result_track0_arg2 = 7576 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 7577 private static NISuppressor arg1_track0_arg2 = 7578 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 7579 private static NISuppressor arg1_track0_result = 7580 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 7581 private static NISuppressor arg2_track0_result = 7582 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 7583 private static NISuppressor arg2_track0_arg1 = 7584 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 7585 7586 private static NISuppressor result_eq_1 = 7587 new NISuppressor(2, RangeInt.EqualOne.class); 7588 private static NISuppressor arg1_eq_1 = 7589 new NISuppressor(0, RangeInt.EqualOne.class); 7590 private static NISuppressor arg2_eq_1 = 7591 new NISuppressor(1, RangeInt.EqualOne.class); 7592 7593 private static NISuppressor result_eq_0 = 7594 new NISuppressor(2, RangeInt.EqualZero.class); 7595 private static NISuppressor arg1_eq_0 = 7596 new NISuppressor(0, RangeInt.EqualZero.class); 7597 private static NISuppressor arg2_eq_0 = 7598 new NISuppressor(1, RangeInt.EqualZero.class); 7599 7600 private static NISuppressor result_ne_0 = 7601 new NISuppressor(2, NonZero.class); 7602 private static NISuppressor arg1_ne_0 = 7603 new NISuppressor(0, NonZero.class); 7604 private static NISuppressor arg2_ne_0 = 7605 new NISuppressor(1, NonZero.class); 7606 7607 private static NISuppressor result_ge_0 = 7608 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 7609 private static NISuppressor arg1_ge_0 = 7610 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 7611 private static NISuppressor arg2_ge_0 = 7612 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 7613 7614 private static NISuppressor result_ge_64 = 7615 new NISuppressor(2, RangeInt.GreaterEqual64.class); 7616 private static NISuppressor arg1_ge_64 = 7617 new NISuppressor(0, RangeInt.GreaterEqual64.class); 7618 private static NISuppressor arg2_ge_64 = 7619 new NISuppressor(1, RangeInt.GreaterEqual64.class); 7620 7621 private static NISuppressor result_boolean = 7622 new NISuppressor(2, RangeInt.BooleanVal.class); 7623 private static NISuppressor arg1_boolean = 7624 new NISuppressor(0, RangeInt.BooleanVal.class); 7625 private static NISuppressor arg2_boolean = 7626 new NISuppressor(1, RangeInt.BooleanVal.class); 7627 7628 private static NISuppressor result_even = 7629 new NISuppressor(2, RangeInt.Even.class); 7630 private static NISuppressor arg1_even = 7631 new NISuppressor(0, RangeInt.Even.class); 7632 private static NISuppressor arg2_even = 7633 new NISuppressor(1, RangeInt.Even.class); 7634 7635 private static NISuppressor result_power2 = 7636 new NISuppressor(2, RangeInt.PowerOfTwo.class); 7637 private static NISuppressor arg1_power2 = 7638 new NISuppressor(0, RangeInt.PowerOfTwo.class); 7639 private static NISuppressor arg2_power2 = 7640 new NISuppressor(1, RangeInt.PowerOfTwo.class); 7641 7642 private static NISuppressor result_and0_arg1 = 7643 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 7644 private static NISuppressor result_and0_arg2 = 7645 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 7646 private static NISuppressor arg1_and0_arg2 = 7647 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 7648 7649 // The arguments to bitwise subset are backwards from what one 7650 // might expect. The second argument is a subset of the first 7651 // argument 7652 private static NISuppressor arg1_bw_subset_arg2 = 7653 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 7654 private static NISuppressor arg2_bw_subset_arg1 = 7655 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 7656 7657 private static NISuppressor result_shift0_arg1 = 7658 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 7659 private static NISuppressor result_shift0_arg2 = 7660 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 7661 private static NISuppressor arg1_shift0_arg2 = 7662 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 7663 7664 private static NISuppressor arg2_divides_arg1 = 7665 new NISuppressor(0, 1, NumericInt.Divides.class); 7666 private static NISuppressor arg1_divides_arg2 = 7667 new NISuppressor(1, 0, NumericInt.Divides.class); 7668 7669 private static NISuppressor arg2_valid_shift = 7670 new NISuppressor(1, RangeInt.Bound0_63.class); 7671 7672 private static NISuppressionSet suppressions = 7673 new NISuppressionSet( 7674 new NISuppression[] { 7675 7676 // (r == x) && (x == y) && (r == y) && (r is boolean) 7677 // ==> r = x && y 7678 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 7679 result_boolean, suppressee), 7680 7681 // (r == 0) && (x == 0) && (y is boolean) ==> r = x && y 7682 new NISuppression(result_eq_0, arg1_eq_0, arg2_boolean, suppressee), 7683 7684 // (r == 0) && (y == 0) && (x is boolean) ==> r = x && y 7685 new NISuppression(result_eq_0, arg2_eq_0, arg1_boolean, suppressee), 7686 7687 // (r == 0) && (x == 0) && (y boolean) ==> r = x && y 7688 new NISuppression(result_eq_0, arg1_eq_0, arg2_boolean, suppressee), 7689 7690 // (r == 0) && (y == 0) && (x boolean) ==> r = x && y 7691 new NISuppression(result_eq_0, arg2_eq_0, arg1_boolean, suppressee), 7692 7693 // (r == x) && (r boolean) && (y == 1) 7694 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_1, 7695 suppressee), 7696 7697 // (r == y) && (r boolean) && (x == 1) 7698 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_1, 7699 suppressee), 7700 7701 }); 7702 7703 // Create a suppression factory for functionBinary 7704 7705} 7706 7707 // default is that it is not this function, overriden in the subclass 7708 @Pure 7709 public boolean isBitwiseXor() { 7710 return false; 7711 } 7712 7713/** 7714 * Represents the invariant {@code x = BitwiseXor(y, z)} over three long 7715 * scalars. 7716 */ 7717public static class BitwiseXorLong_xyz extends FunctionBinary { 7718 static final long serialVersionUID = 20031030L; 7719 7720 private static @Prototype BitwiseXorLong_xyz proto = new @Prototype BitwiseXorLong_xyz (); 7721 7722 /** Returns the prototype invariant for BitwiseXorLong_xyz */ 7723 public static @Prototype BitwiseXorLong_xyz get_proto() { 7724 return proto; 7725 } 7726 7727 @Override 7728 protected BitwiseXorLong_xyz instantiate_dyn(@Prototype BitwiseXorLong_xyz this, PptSlice slice) { 7729 return new BitwiseXorLong_xyz (slice); 7730 } 7731 7732 private BitwiseXorLong_xyz (PptSlice slice) { 7733 super(slice); 7734 } 7735 7736 public @Prototype BitwiseXorLong_xyz () { 7737 super(); 7738 } 7739 7740 private static String[] method_name = new String[] {"", " ^ ", ""}; 7741 7742 @Override 7743 public String[] get_method_name(@GuardSatisfied BitwiseXorLong_xyz this) { 7744 return method_name; 7745 } 7746 7747 private static int function_id = -1; 7748 7749 @Override 7750 public int get_function_id() { 7751 return function_id; 7752 } 7753 7754 @Override 7755 public void set_function_id(int function_id) { 7756 assert BitwiseXorLong_xyz.function_id == -1; 7757 BitwiseXorLong_xyz.function_id = function_id; 7758 } 7759 7760 private static int var_order = 1; 7761 7762 @Override 7763 public int get_var_order(@GuardSatisfied BitwiseXorLong_xyz this) { 7764 return var_order; 7765 } 7766 7767 @Pure 7768 @Override 7769 public boolean is_symmetric() { 7770 7771 return true; 7772 } 7773 7774 @Override 7775 7776 public long func(long y, long z) { 7777 7778 return (y ^ z); 7779 } 7780 7781 @Override 7782 public InvariantStatus check_modified(long x, long y, 7783 long z, int count) { 7784 return check_ordered(x, y, z, count); 7785 } 7786 7787 @Override 7788 public InvariantStatus add_modified(long x, long y, 7789 long z, int count) { 7790 if (Debug.logDetail()) { 7791 log("result=%s, arg1=%s, arg2=%s", x, y, z); 7792 } 7793 return add_ordered(x, y, z, count); 7794 } 7795 7796 @Pure 7797 @Override 7798 public boolean isBitwiseXor() { 7799 return true; 7800 } 7801 7802 /** Returns a list of non-instantiating suppressions for this invariant. */ 7803 @Pure 7804 @Override 7805 public @Nullable NISuppressionSet get_ni_suppressions() { 7806 if (NIS.dkconfig_enabled && dkconfig_enabled) { 7807 return suppressions; 7808 } else { 7809 return null; 7810 } 7811 } 7812 7813 /** definition of this invariant (the suppressee) */ 7814 private static NISuppressee suppressee = new NISuppressee(BitwiseXorLong_xyz.class, 3); 7815 7816 // suppressor definitions (used below) 7817 private static NISuppressor result_eq_arg1 = 7818 new NISuppressor(0, 1, IntEqual.class); 7819 private static NISuppressor result_eq_arg2 = 7820 new NISuppressor(0, 2, IntEqual.class); 7821 private static NISuppressor arg1_eq_arg2 = 7822 new NISuppressor(1, 2, IntEqual.class); 7823 7824 private static NISuppressor result_lt_arg1 = 7825 new NISuppressor(0, 1, IntLessThan.class); 7826 private static NISuppressor result_lt_arg2 = 7827 new NISuppressor(0, 2, IntLessThan.class); 7828 private static NISuppressor arg1_lt_arg2 = 7829 new NISuppressor(1, 2, IntLessThan.class); 7830 private static NISuppressor arg2_lt_arg1 = 7831 new NISuppressor(2, 1, IntLessThan.class); 7832 7833 private static NISuppressor result_le_arg1 = 7834 new NISuppressor(0, 1, IntLessEqual.class); 7835 private static NISuppressor result_le_arg2 = 7836 new NISuppressor(0, 2, IntLessEqual.class); 7837 private static NISuppressor arg1_le_arg2 = 7838 new NISuppressor(1, 2, IntLessEqual.class); 7839 private static NISuppressor arg2_le_arg1 = 7840 new NISuppressor(2, 1, IntLessEqual.class); 7841 7842 private static NISuppressor result_track0_arg1 = 7843 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 7844 private static NISuppressor result_track0_arg2 = 7845 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 7846 private static NISuppressor arg1_track0_arg2 = 7847 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 7848 private static NISuppressor arg1_track0_result = 7849 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 7850 private static NISuppressor arg2_track0_result = 7851 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 7852 private static NISuppressor arg2_track0_arg1 = 7853 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 7854 7855 private static NISuppressor result_eq_1 = 7856 new NISuppressor(0, RangeInt.EqualOne.class); 7857 private static NISuppressor arg1_eq_1 = 7858 new NISuppressor(1, RangeInt.EqualOne.class); 7859 private static NISuppressor arg2_eq_1 = 7860 new NISuppressor(2, RangeInt.EqualOne.class); 7861 7862 private static NISuppressor result_eq_0 = 7863 new NISuppressor(0, RangeInt.EqualZero.class); 7864 private static NISuppressor arg1_eq_0 = 7865 new NISuppressor(1, RangeInt.EqualZero.class); 7866 private static NISuppressor arg2_eq_0 = 7867 new NISuppressor(2, RangeInt.EqualZero.class); 7868 7869 private static NISuppressor result_ne_0 = 7870 new NISuppressor(0, NonZero.class); 7871 private static NISuppressor arg1_ne_0 = 7872 new NISuppressor(1, NonZero.class); 7873 private static NISuppressor arg2_ne_0 = 7874 new NISuppressor(2, NonZero.class); 7875 7876 private static NISuppressor result_ge_0 = 7877 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 7878 private static NISuppressor arg1_ge_0 = 7879 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 7880 private static NISuppressor arg2_ge_0 = 7881 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 7882 7883 private static NISuppressor result_ge_64 = 7884 new NISuppressor(0, RangeInt.GreaterEqual64.class); 7885 private static NISuppressor arg1_ge_64 = 7886 new NISuppressor(1, RangeInt.GreaterEqual64.class); 7887 private static NISuppressor arg2_ge_64 = 7888 new NISuppressor(2, RangeInt.GreaterEqual64.class); 7889 7890 private static NISuppressor result_boolean = 7891 new NISuppressor(0, RangeInt.BooleanVal.class); 7892 private static NISuppressor arg1_boolean = 7893 new NISuppressor(1, RangeInt.BooleanVal.class); 7894 private static NISuppressor arg2_boolean = 7895 new NISuppressor(2, RangeInt.BooleanVal.class); 7896 7897 private static NISuppressor result_even = 7898 new NISuppressor(0, RangeInt.Even.class); 7899 private static NISuppressor arg1_even = 7900 new NISuppressor(1, RangeInt.Even.class); 7901 private static NISuppressor arg2_even = 7902 new NISuppressor(2, RangeInt.Even.class); 7903 7904 private static NISuppressor result_power2 = 7905 new NISuppressor(0, RangeInt.PowerOfTwo.class); 7906 private static NISuppressor arg1_power2 = 7907 new NISuppressor(1, RangeInt.PowerOfTwo.class); 7908 private static NISuppressor arg2_power2 = 7909 new NISuppressor(2, RangeInt.PowerOfTwo.class); 7910 7911 private static NISuppressor result_and0_arg1 = 7912 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 7913 private static NISuppressor result_and0_arg2 = 7914 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 7915 private static NISuppressor arg1_and0_arg2 = 7916 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 7917 7918 // The arguments to bitwise subset are backwards from what one 7919 // might expect. The second argument is a subset of the first 7920 // argument 7921 private static NISuppressor arg1_bw_subset_arg2 = 7922 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 7923 private static NISuppressor arg2_bw_subset_arg1 = 7924 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 7925 7926 private static NISuppressor result_shift0_arg1 = 7927 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 7928 private static NISuppressor result_shift0_arg2 = 7929 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 7930 private static NISuppressor arg1_shift0_arg2 = 7931 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 7932 7933 private static NISuppressor arg2_divides_arg1 = 7934 new NISuppressor(1, 2, NumericInt.Divides.class); 7935 private static NISuppressor arg1_divides_arg2 = 7936 new NISuppressor(2, 1, NumericInt.Divides.class); 7937 7938 private static NISuppressor arg2_valid_shift = 7939 new NISuppressor(2, RangeInt.Bound0_63.class); 7940 7941 private static NISuppressionSet suppressions = 7942 new NISuppressionSet( 7943 new NISuppression[] { 7944 7945 // (r == 0) && (y == z) ==> r = y ^ z 7946 new NISuppression(result_eq_0, arg1_eq_arg2, suppressee), 7947 7948 // (r == y) && (z == 0) ==> r = y ^ z 7949 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 7950 7951 // (r == z) && (y == 0) ==> r = y ^ z 7952 new NISuppression(result_eq_arg2, arg1_eq_0, suppressee), 7953 7954 }); 7955 7956 // Create a suppression factory for functionBinary 7957 7958} 7959 7960/** 7961 * Represents the invariant {@code y = BitwiseXor(x, z)} over three long 7962 * scalars. 7963 */ 7964public static class BitwiseXorLong_yxz extends FunctionBinary { 7965 static final long serialVersionUID = 20031030L; 7966 7967 private static @Prototype BitwiseXorLong_yxz proto = new @Prototype BitwiseXorLong_yxz (); 7968 7969 /** Returns the prototype invariant for BitwiseXorLong_yxz */ 7970 public static @Prototype BitwiseXorLong_yxz get_proto() { 7971 return proto; 7972 } 7973 7974 @Override 7975 protected BitwiseXorLong_yxz instantiate_dyn(@Prototype BitwiseXorLong_yxz this, PptSlice slice) { 7976 return new BitwiseXorLong_yxz (slice); 7977 } 7978 7979 private BitwiseXorLong_yxz (PptSlice slice) { 7980 super(slice); 7981 } 7982 7983 public @Prototype BitwiseXorLong_yxz () { 7984 super(); 7985 } 7986 7987 private static String[] method_name = new String[] {"", " ^ ", ""}; 7988 7989 @Override 7990 public String[] get_method_name(@GuardSatisfied BitwiseXorLong_yxz this) { 7991 return method_name; 7992 } 7993 7994 private static int function_id = -1; 7995 7996 @Override 7997 public int get_function_id() { 7998 return function_id; 7999 } 8000 8001 @Override 8002 public void set_function_id(int function_id) { 8003 assert BitwiseXorLong_yxz.function_id == -1; 8004 BitwiseXorLong_yxz.function_id = function_id; 8005 } 8006 8007 private static int var_order = 2; 8008 8009 @Override 8010 public int get_var_order(@GuardSatisfied BitwiseXorLong_yxz this) { 8011 return var_order; 8012 } 8013 8014 @Pure 8015 @Override 8016 public boolean is_symmetric() { 8017 8018 return true; 8019 } 8020 8021 @Override 8022 8023 public long func(long x, long z) { 8024 8025 return (x ^ z); 8026 } 8027 8028 @Override 8029 public InvariantStatus check_modified(long x, long y, 8030 long z, int count) { 8031 return check_ordered(y, x, z, count); 8032 } 8033 8034 @Override 8035 public InvariantStatus add_modified(long x, long y, 8036 long z, int count) { 8037 if (Debug.logDetail()) { 8038 log("result=%s, arg1=%s, arg2=%s", y, x, z); 8039 } 8040 return add_ordered(y, x, z, count); 8041 } 8042 8043 @Pure 8044 @Override 8045 public boolean isBitwiseXor() { 8046 return true; 8047 } 8048 8049 /** Returns a list of non-instantiating suppressions for this invariant. */ 8050 @Pure 8051 @Override 8052 public @Nullable NISuppressionSet get_ni_suppressions() { 8053 if (NIS.dkconfig_enabled && dkconfig_enabled) { 8054 return suppressions; 8055 } else { 8056 return null; 8057 } 8058 } 8059 8060 /** definition of this invariant (the suppressee) */ 8061 private static NISuppressee suppressee = new NISuppressee(BitwiseXorLong_yxz.class, 3); 8062 8063 // suppressor definitions (used below) 8064 private static NISuppressor result_eq_arg1 = 8065 new NISuppressor(1, 0, IntEqual.class); 8066 private static NISuppressor result_eq_arg2 = 8067 new NISuppressor(1, 2, IntEqual.class); 8068 private static NISuppressor arg1_eq_arg2 = 8069 new NISuppressor(0, 2, IntEqual.class); 8070 8071 private static NISuppressor result_lt_arg1 = 8072 new NISuppressor(1, 0, IntLessThan.class); 8073 private static NISuppressor result_lt_arg2 = 8074 new NISuppressor(1, 2, IntLessThan.class); 8075 private static NISuppressor arg1_lt_arg2 = 8076 new NISuppressor(0, 2, IntLessThan.class); 8077 private static NISuppressor arg2_lt_arg1 = 8078 new NISuppressor(2, 0, IntLessThan.class); 8079 8080 private static NISuppressor result_le_arg1 = 8081 new NISuppressor(1, 0, IntLessEqual.class); 8082 private static NISuppressor result_le_arg2 = 8083 new NISuppressor(1, 2, IntLessEqual.class); 8084 private static NISuppressor arg1_le_arg2 = 8085 new NISuppressor(0, 2, IntLessEqual.class); 8086 private static NISuppressor arg2_le_arg1 = 8087 new NISuppressor(2, 0, IntLessEqual.class); 8088 8089 private static NISuppressor result_track0_arg1 = 8090 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 8091 private static NISuppressor result_track0_arg2 = 8092 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 8093 private static NISuppressor arg1_track0_arg2 = 8094 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 8095 private static NISuppressor arg1_track0_result = 8096 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 8097 private static NISuppressor arg2_track0_result = 8098 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 8099 private static NISuppressor arg2_track0_arg1 = 8100 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 8101 8102 private static NISuppressor result_eq_1 = 8103 new NISuppressor(1, RangeInt.EqualOne.class); 8104 private static NISuppressor arg1_eq_1 = 8105 new NISuppressor(0, RangeInt.EqualOne.class); 8106 private static NISuppressor arg2_eq_1 = 8107 new NISuppressor(2, RangeInt.EqualOne.class); 8108 8109 private static NISuppressor result_eq_0 = 8110 new NISuppressor(1, RangeInt.EqualZero.class); 8111 private static NISuppressor arg1_eq_0 = 8112 new NISuppressor(0, RangeInt.EqualZero.class); 8113 private static NISuppressor arg2_eq_0 = 8114 new NISuppressor(2, RangeInt.EqualZero.class); 8115 8116 private static NISuppressor result_ne_0 = 8117 new NISuppressor(1, NonZero.class); 8118 private static NISuppressor arg1_ne_0 = 8119 new NISuppressor(0, NonZero.class); 8120 private static NISuppressor arg2_ne_0 = 8121 new NISuppressor(2, NonZero.class); 8122 8123 private static NISuppressor result_ge_0 = 8124 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 8125 private static NISuppressor arg1_ge_0 = 8126 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 8127 private static NISuppressor arg2_ge_0 = 8128 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 8129 8130 private static NISuppressor result_ge_64 = 8131 new NISuppressor(1, RangeInt.GreaterEqual64.class); 8132 private static NISuppressor arg1_ge_64 = 8133 new NISuppressor(0, RangeInt.GreaterEqual64.class); 8134 private static NISuppressor arg2_ge_64 = 8135 new NISuppressor(2, RangeInt.GreaterEqual64.class); 8136 8137 private static NISuppressor result_boolean = 8138 new NISuppressor(1, RangeInt.BooleanVal.class); 8139 private static NISuppressor arg1_boolean = 8140 new NISuppressor(0, RangeInt.BooleanVal.class); 8141 private static NISuppressor arg2_boolean = 8142 new NISuppressor(2, RangeInt.BooleanVal.class); 8143 8144 private static NISuppressor result_even = 8145 new NISuppressor(1, RangeInt.Even.class); 8146 private static NISuppressor arg1_even = 8147 new NISuppressor(0, RangeInt.Even.class); 8148 private static NISuppressor arg2_even = 8149 new NISuppressor(2, RangeInt.Even.class); 8150 8151 private static NISuppressor result_power2 = 8152 new NISuppressor(1, RangeInt.PowerOfTwo.class); 8153 private static NISuppressor arg1_power2 = 8154 new NISuppressor(0, RangeInt.PowerOfTwo.class); 8155 private static NISuppressor arg2_power2 = 8156 new NISuppressor(2, RangeInt.PowerOfTwo.class); 8157 8158 private static NISuppressor result_and0_arg1 = 8159 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 8160 private static NISuppressor result_and0_arg2 = 8161 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 8162 private static NISuppressor arg1_and0_arg2 = 8163 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 8164 8165 // The arguments to bitwise subset are backwards from what one 8166 // might expect. The second argument is a subset of the first 8167 // argument 8168 private static NISuppressor arg1_bw_subset_arg2 = 8169 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 8170 private static NISuppressor arg2_bw_subset_arg1 = 8171 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 8172 8173 private static NISuppressor result_shift0_arg1 = 8174 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 8175 private static NISuppressor result_shift0_arg2 = 8176 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 8177 private static NISuppressor arg1_shift0_arg2 = 8178 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 8179 8180 private static NISuppressor arg2_divides_arg1 = 8181 new NISuppressor(0, 2, NumericInt.Divides.class); 8182 private static NISuppressor arg1_divides_arg2 = 8183 new NISuppressor(2, 0, NumericInt.Divides.class); 8184 8185 private static NISuppressor arg2_valid_shift = 8186 new NISuppressor(2, RangeInt.Bound0_63.class); 8187 8188 private static NISuppressionSet suppressions = 8189 new NISuppressionSet( 8190 new NISuppression[] { 8191 8192 // (r == 0) && (x == z) ==> r = x ^ z 8193 new NISuppression(result_eq_0, arg1_eq_arg2, suppressee), 8194 8195 // (r == x) && (z == 0) ==> r = x ^ z 8196 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 8197 8198 // (r == z) && (x == 0) ==> r = x ^ z 8199 new NISuppression(result_eq_arg2, arg1_eq_0, suppressee), 8200 8201 }); 8202 8203 // Create a suppression factory for functionBinary 8204 8205} 8206 8207/** 8208 * Represents the invariant {@code z = BitwiseXor(x, y)} over three long 8209 * scalars. 8210 */ 8211public static class BitwiseXorLong_zxy extends FunctionBinary { 8212 static final long serialVersionUID = 20031030L; 8213 8214 private static @Prototype BitwiseXorLong_zxy proto = new @Prototype BitwiseXorLong_zxy (); 8215 8216 /** Returns the prototype invariant for BitwiseXorLong_zxy */ 8217 public static @Prototype BitwiseXorLong_zxy get_proto() { 8218 return proto; 8219 } 8220 8221 @Override 8222 protected BitwiseXorLong_zxy instantiate_dyn(@Prototype BitwiseXorLong_zxy this, PptSlice slice) { 8223 return new BitwiseXorLong_zxy (slice); 8224 } 8225 8226 private BitwiseXorLong_zxy (PptSlice slice) { 8227 super(slice); 8228 } 8229 8230 public @Prototype BitwiseXorLong_zxy () { 8231 super(); 8232 } 8233 8234 private static String[] method_name = new String[] {"", " ^ ", ""}; 8235 8236 @Override 8237 public String[] get_method_name(@GuardSatisfied BitwiseXorLong_zxy this) { 8238 return method_name; 8239 } 8240 8241 private static int function_id = -1; 8242 8243 @Override 8244 public int get_function_id() { 8245 return function_id; 8246 } 8247 8248 @Override 8249 public void set_function_id(int function_id) { 8250 assert BitwiseXorLong_zxy.function_id == -1; 8251 BitwiseXorLong_zxy.function_id = function_id; 8252 } 8253 8254 private static int var_order = 3; 8255 8256 @Override 8257 public int get_var_order(@GuardSatisfied BitwiseXorLong_zxy this) { 8258 return var_order; 8259 } 8260 8261 @Pure 8262 @Override 8263 public boolean is_symmetric() { 8264 8265 return true; 8266 } 8267 8268 @Override 8269 8270 public long func(long x, long y) { 8271 8272 return (x ^ y); 8273 } 8274 8275 @Override 8276 public InvariantStatus check_modified(long x, long y, 8277 long z, int count) { 8278 return check_ordered(z, x, y, count); 8279 } 8280 8281 @Override 8282 public InvariantStatus add_modified(long x, long y, 8283 long z, int count) { 8284 if (Debug.logDetail()) { 8285 log("result=%s, arg1=%s, arg2=%s", z, x, y); 8286 } 8287 return add_ordered(z, x, y, count); 8288 } 8289 8290 @Pure 8291 @Override 8292 public boolean isBitwiseXor() { 8293 return true; 8294 } 8295 8296 /** Returns a list of non-instantiating suppressions for this invariant. */ 8297 @Pure 8298 @Override 8299 public @Nullable NISuppressionSet get_ni_suppressions() { 8300 if (NIS.dkconfig_enabled && dkconfig_enabled) { 8301 return suppressions; 8302 } else { 8303 return null; 8304 } 8305 } 8306 8307 /** definition of this invariant (the suppressee) */ 8308 private static NISuppressee suppressee = new NISuppressee(BitwiseXorLong_zxy.class, 3); 8309 8310 // suppressor definitions (used below) 8311 private static NISuppressor result_eq_arg1 = 8312 new NISuppressor(2, 0, IntEqual.class); 8313 private static NISuppressor result_eq_arg2 = 8314 new NISuppressor(2, 1, IntEqual.class); 8315 private static NISuppressor arg1_eq_arg2 = 8316 new NISuppressor(0, 1, IntEqual.class); 8317 8318 private static NISuppressor result_lt_arg1 = 8319 new NISuppressor(2, 0, IntLessThan.class); 8320 private static NISuppressor result_lt_arg2 = 8321 new NISuppressor(2, 1, IntLessThan.class); 8322 private static NISuppressor arg1_lt_arg2 = 8323 new NISuppressor(0, 1, IntLessThan.class); 8324 private static NISuppressor arg2_lt_arg1 = 8325 new NISuppressor(1, 0, IntLessThan.class); 8326 8327 private static NISuppressor result_le_arg1 = 8328 new NISuppressor(2, 0, IntLessEqual.class); 8329 private static NISuppressor result_le_arg2 = 8330 new NISuppressor(2, 1, IntLessEqual.class); 8331 private static NISuppressor arg1_le_arg2 = 8332 new NISuppressor(0, 1, IntLessEqual.class); 8333 private static NISuppressor arg2_le_arg1 = 8334 new NISuppressor(1, 0, IntLessEqual.class); 8335 8336 private static NISuppressor result_track0_arg1 = 8337 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 8338 private static NISuppressor result_track0_arg2 = 8339 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 8340 private static NISuppressor arg1_track0_arg2 = 8341 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 8342 private static NISuppressor arg1_track0_result = 8343 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 8344 private static NISuppressor arg2_track0_result = 8345 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 8346 private static NISuppressor arg2_track0_arg1 = 8347 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 8348 8349 private static NISuppressor result_eq_1 = 8350 new NISuppressor(2, RangeInt.EqualOne.class); 8351 private static NISuppressor arg1_eq_1 = 8352 new NISuppressor(0, RangeInt.EqualOne.class); 8353 private static NISuppressor arg2_eq_1 = 8354 new NISuppressor(1, RangeInt.EqualOne.class); 8355 8356 private static NISuppressor result_eq_0 = 8357 new NISuppressor(2, RangeInt.EqualZero.class); 8358 private static NISuppressor arg1_eq_0 = 8359 new NISuppressor(0, RangeInt.EqualZero.class); 8360 private static NISuppressor arg2_eq_0 = 8361 new NISuppressor(1, RangeInt.EqualZero.class); 8362 8363 private static NISuppressor result_ne_0 = 8364 new NISuppressor(2, NonZero.class); 8365 private static NISuppressor arg1_ne_0 = 8366 new NISuppressor(0, NonZero.class); 8367 private static NISuppressor arg2_ne_0 = 8368 new NISuppressor(1, NonZero.class); 8369 8370 private static NISuppressor result_ge_0 = 8371 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 8372 private static NISuppressor arg1_ge_0 = 8373 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 8374 private static NISuppressor arg2_ge_0 = 8375 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 8376 8377 private static NISuppressor result_ge_64 = 8378 new NISuppressor(2, RangeInt.GreaterEqual64.class); 8379 private static NISuppressor arg1_ge_64 = 8380 new NISuppressor(0, RangeInt.GreaterEqual64.class); 8381 private static NISuppressor arg2_ge_64 = 8382 new NISuppressor(1, RangeInt.GreaterEqual64.class); 8383 8384 private static NISuppressor result_boolean = 8385 new NISuppressor(2, RangeInt.BooleanVal.class); 8386 private static NISuppressor arg1_boolean = 8387 new NISuppressor(0, RangeInt.BooleanVal.class); 8388 private static NISuppressor arg2_boolean = 8389 new NISuppressor(1, RangeInt.BooleanVal.class); 8390 8391 private static NISuppressor result_even = 8392 new NISuppressor(2, RangeInt.Even.class); 8393 private static NISuppressor arg1_even = 8394 new NISuppressor(0, RangeInt.Even.class); 8395 private static NISuppressor arg2_even = 8396 new NISuppressor(1, RangeInt.Even.class); 8397 8398 private static NISuppressor result_power2 = 8399 new NISuppressor(2, RangeInt.PowerOfTwo.class); 8400 private static NISuppressor arg1_power2 = 8401 new NISuppressor(0, RangeInt.PowerOfTwo.class); 8402 private static NISuppressor arg2_power2 = 8403 new NISuppressor(1, RangeInt.PowerOfTwo.class); 8404 8405 private static NISuppressor result_and0_arg1 = 8406 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 8407 private static NISuppressor result_and0_arg2 = 8408 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 8409 private static NISuppressor arg1_and0_arg2 = 8410 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 8411 8412 // The arguments to bitwise subset are backwards from what one 8413 // might expect. The second argument is a subset of the first 8414 // argument 8415 private static NISuppressor arg1_bw_subset_arg2 = 8416 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 8417 private static NISuppressor arg2_bw_subset_arg1 = 8418 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 8419 8420 private static NISuppressor result_shift0_arg1 = 8421 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 8422 private static NISuppressor result_shift0_arg2 = 8423 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 8424 private static NISuppressor arg1_shift0_arg2 = 8425 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 8426 8427 private static NISuppressor arg2_divides_arg1 = 8428 new NISuppressor(0, 1, NumericInt.Divides.class); 8429 private static NISuppressor arg1_divides_arg2 = 8430 new NISuppressor(1, 0, NumericInt.Divides.class); 8431 8432 private static NISuppressor arg2_valid_shift = 8433 new NISuppressor(1, RangeInt.Bound0_63.class); 8434 8435 private static NISuppressionSet suppressions = 8436 new NISuppressionSet( 8437 new NISuppression[] { 8438 8439 // (r == 0) && (x == y) ==> r = x ^ y 8440 new NISuppression(result_eq_0, arg1_eq_arg2, suppressee), 8441 8442 // (r == x) && (y == 0) ==> r = x ^ y 8443 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 8444 8445 // (r == y) && (x == 0) ==> r = x ^ y 8446 new NISuppression(result_eq_arg2, arg1_eq_0, suppressee), 8447 8448 }); 8449 8450 // Create a suppression factory for functionBinary 8451 8452} 8453 8454 // #define METHOD_NAME {"", " ^ ", ""} 8455 8456 // default is that it is not this function, overriden in the subclass 8457 @Pure 8458 public boolean isLogicalXor() { 8459 return false; 8460 } 8461 8462/** 8463 * Represents the invariant {@code x = LogicalXor(y, z)} over three long 8464 * scalars. For logical operations, Daikon treats 0 as false and all other values as true. 8465 */ 8466public static class LogicalXorLong_xyz extends FunctionBinary { 8467 static final long serialVersionUID = 20031030L; 8468 8469 private static @Prototype LogicalXorLong_xyz proto = new @Prototype LogicalXorLong_xyz (); 8470 8471 /** Returns the prototype invariant for LogicalXorLong_xyz */ 8472 public static @Prototype LogicalXorLong_xyz get_proto() { 8473 return proto; 8474 } 8475 8476 @Override 8477 protected LogicalXorLong_xyz instantiate_dyn(@Prototype LogicalXorLong_xyz this, PptSlice slice) { 8478 return new LogicalXorLong_xyz (slice); 8479 } 8480 8481 private LogicalXorLong_xyz (PptSlice slice) { 8482 super(slice); 8483 } 8484 8485 public @Prototype LogicalXorLong_xyz () { 8486 super(); 8487 } 8488 8489 private static String[] method_name = new String[] {"org.plumelib.util.MathPlume.logicalXor(", ", ", ")"}; 8490 8491 @Override 8492 public String[] get_method_name(@GuardSatisfied LogicalXorLong_xyz this) { 8493 return method_name; 8494 } 8495 8496 private static int function_id = -1; 8497 8498 @Override 8499 public int get_function_id() { 8500 return function_id; 8501 } 8502 8503 @Override 8504 public void set_function_id(int function_id) { 8505 assert LogicalXorLong_xyz.function_id == -1; 8506 LogicalXorLong_xyz.function_id = function_id; 8507 } 8508 8509 private static int var_order = 1; 8510 8511 @Override 8512 public int get_var_order(@GuardSatisfied LogicalXorLong_xyz this) { 8513 return var_order; 8514 } 8515 8516 @Pure 8517 @Override 8518 public boolean is_symmetric() { 8519 8520 return true; 8521 } 8522 8523 @Override 8524 8525 public long func(long y, long z) { 8526 8527 if ((y < 0) || (y > 1)) { 8528 throw new ArithmeticException("arg1 (" + y + ") is not boolean "); 8529 } 8530 if ((z < 0) || (z > 1)) { 8531 throw new ArithmeticException("arg2 (" + z + ") is not boolean "); 8532 } 8533 8534 return (((y != 0) ^ ( z != 0)) ? 1 : 0); 8535 } 8536 8537 @Override 8538 public InvariantStatus check_modified(long x, long y, 8539 long z, int count) { 8540 return check_ordered(x, y, z, count); 8541 } 8542 8543 @Override 8544 public InvariantStatus add_modified(long x, long y, 8545 long z, int count) { 8546 if (Debug.logDetail()) { 8547 log("result=%s, arg1=%s, arg2=%s", x, y, z); 8548 } 8549 return add_ordered(x, y, z, count); 8550 } 8551 8552 @Pure 8553 @Override 8554 public boolean isLogicalXor() { 8555 return true; 8556 } 8557 8558 /** Returns a list of non-instantiating suppressions for this invariant. */ 8559 @Pure 8560 @Override 8561 public @Nullable NISuppressionSet get_ni_suppressions() { 8562 if (NIS.dkconfig_enabled && dkconfig_enabled) { 8563 return suppressions; 8564 } else { 8565 return null; 8566 } 8567 } 8568 8569 /** definition of this invariant (the suppressee) */ 8570 private static NISuppressee suppressee = new NISuppressee(LogicalXorLong_xyz.class, 3); 8571 8572 // suppressor definitions (used below) 8573 private static NISuppressor result_eq_arg1 = 8574 new NISuppressor(0, 1, IntEqual.class); 8575 private static NISuppressor result_eq_arg2 = 8576 new NISuppressor(0, 2, IntEqual.class); 8577 private static NISuppressor arg1_eq_arg2 = 8578 new NISuppressor(1, 2, IntEqual.class); 8579 8580 private static NISuppressor result_lt_arg1 = 8581 new NISuppressor(0, 1, IntLessThan.class); 8582 private static NISuppressor result_lt_arg2 = 8583 new NISuppressor(0, 2, IntLessThan.class); 8584 private static NISuppressor arg1_lt_arg2 = 8585 new NISuppressor(1, 2, IntLessThan.class); 8586 private static NISuppressor arg2_lt_arg1 = 8587 new NISuppressor(2, 1, IntLessThan.class); 8588 8589 private static NISuppressor result_le_arg1 = 8590 new NISuppressor(0, 1, IntLessEqual.class); 8591 private static NISuppressor result_le_arg2 = 8592 new NISuppressor(0, 2, IntLessEqual.class); 8593 private static NISuppressor arg1_le_arg2 = 8594 new NISuppressor(1, 2, IntLessEqual.class); 8595 private static NISuppressor arg2_le_arg1 = 8596 new NISuppressor(2, 1, IntLessEqual.class); 8597 8598 private static NISuppressor result_track0_arg1 = 8599 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 8600 private static NISuppressor result_track0_arg2 = 8601 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 8602 private static NISuppressor arg1_track0_arg2 = 8603 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 8604 private static NISuppressor arg1_track0_result = 8605 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 8606 private static NISuppressor arg2_track0_result = 8607 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 8608 private static NISuppressor arg2_track0_arg1 = 8609 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 8610 8611 private static NISuppressor result_eq_1 = 8612 new NISuppressor(0, RangeInt.EqualOne.class); 8613 private static NISuppressor arg1_eq_1 = 8614 new NISuppressor(1, RangeInt.EqualOne.class); 8615 private static NISuppressor arg2_eq_1 = 8616 new NISuppressor(2, RangeInt.EqualOne.class); 8617 8618 private static NISuppressor result_eq_0 = 8619 new NISuppressor(0, RangeInt.EqualZero.class); 8620 private static NISuppressor arg1_eq_0 = 8621 new NISuppressor(1, RangeInt.EqualZero.class); 8622 private static NISuppressor arg2_eq_0 = 8623 new NISuppressor(2, RangeInt.EqualZero.class); 8624 8625 private static NISuppressor result_ne_0 = 8626 new NISuppressor(0, NonZero.class); 8627 private static NISuppressor arg1_ne_0 = 8628 new NISuppressor(1, NonZero.class); 8629 private static NISuppressor arg2_ne_0 = 8630 new NISuppressor(2, NonZero.class); 8631 8632 private static NISuppressor result_ge_0 = 8633 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 8634 private static NISuppressor arg1_ge_0 = 8635 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 8636 private static NISuppressor arg2_ge_0 = 8637 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 8638 8639 private static NISuppressor result_ge_64 = 8640 new NISuppressor(0, RangeInt.GreaterEqual64.class); 8641 private static NISuppressor arg1_ge_64 = 8642 new NISuppressor(1, RangeInt.GreaterEqual64.class); 8643 private static NISuppressor arg2_ge_64 = 8644 new NISuppressor(2, RangeInt.GreaterEqual64.class); 8645 8646 private static NISuppressor result_boolean = 8647 new NISuppressor(0, RangeInt.BooleanVal.class); 8648 private static NISuppressor arg1_boolean = 8649 new NISuppressor(1, RangeInt.BooleanVal.class); 8650 private static NISuppressor arg2_boolean = 8651 new NISuppressor(2, RangeInt.BooleanVal.class); 8652 8653 private static NISuppressor result_even = 8654 new NISuppressor(0, RangeInt.Even.class); 8655 private static NISuppressor arg1_even = 8656 new NISuppressor(1, RangeInt.Even.class); 8657 private static NISuppressor arg2_even = 8658 new NISuppressor(2, RangeInt.Even.class); 8659 8660 private static NISuppressor result_power2 = 8661 new NISuppressor(0, RangeInt.PowerOfTwo.class); 8662 private static NISuppressor arg1_power2 = 8663 new NISuppressor(1, RangeInt.PowerOfTwo.class); 8664 private static NISuppressor arg2_power2 = 8665 new NISuppressor(2, RangeInt.PowerOfTwo.class); 8666 8667 private static NISuppressor result_and0_arg1 = 8668 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 8669 private static NISuppressor result_and0_arg2 = 8670 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 8671 private static NISuppressor arg1_and0_arg2 = 8672 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 8673 8674 // The arguments to bitwise subset are backwards from what one 8675 // might expect. The second argument is a subset of the first 8676 // argument 8677 private static NISuppressor arg1_bw_subset_arg2 = 8678 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 8679 private static NISuppressor arg2_bw_subset_arg1 = 8680 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 8681 8682 private static NISuppressor result_shift0_arg1 = 8683 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 8684 private static NISuppressor result_shift0_arg2 = 8685 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 8686 private static NISuppressor arg1_shift0_arg2 = 8687 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 8688 8689 private static NISuppressor arg2_divides_arg1 = 8690 new NISuppressor(1, 2, NumericInt.Divides.class); 8691 private static NISuppressor arg1_divides_arg2 = 8692 new NISuppressor(2, 1, NumericInt.Divides.class); 8693 8694 private static NISuppressor arg2_valid_shift = 8695 new NISuppressor(2, RangeInt.Bound0_63.class); 8696 8697 private static NISuppressionSet suppressions = 8698 new NISuppressionSet( 8699 new NISuppression[] { 8700 8701 // (r == 0) && (y == z) && (y boolean) ==> r = y ^ z 8702 new NISuppression(arg1_eq_arg2, arg1_boolean, result_eq_0, 8703 suppressee), 8704 8705 // (r == y) && (z == 0) && (x boolean) ==> r = y ^ z 8706 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_0, 8707 suppressee), 8708 8709 // (r == z) && (y == 0) && (x boolean)==> r = y ^ z 8710 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_0, 8711 suppressee), 8712 8713 }); 8714 8715 // Create a suppression factory for functionBinary 8716 8717} 8718 8719/** 8720 * Represents the invariant {@code y = LogicalXor(x, z)} over three long 8721 * scalars. For logical operations, Daikon treats 0 as false and all other values as true. 8722 */ 8723public static class LogicalXorLong_yxz extends FunctionBinary { 8724 static final long serialVersionUID = 20031030L; 8725 8726 private static @Prototype LogicalXorLong_yxz proto = new @Prototype LogicalXorLong_yxz (); 8727 8728 /** Returns the prototype invariant for LogicalXorLong_yxz */ 8729 public static @Prototype LogicalXorLong_yxz get_proto() { 8730 return proto; 8731 } 8732 8733 @Override 8734 protected LogicalXorLong_yxz instantiate_dyn(@Prototype LogicalXorLong_yxz this, PptSlice slice) { 8735 return new LogicalXorLong_yxz (slice); 8736 } 8737 8738 private LogicalXorLong_yxz (PptSlice slice) { 8739 super(slice); 8740 } 8741 8742 public @Prototype LogicalXorLong_yxz () { 8743 super(); 8744 } 8745 8746 private static String[] method_name = new String[] {"org.plumelib.util.MathPlume.logicalXor(", ", ", ")"}; 8747 8748 @Override 8749 public String[] get_method_name(@GuardSatisfied LogicalXorLong_yxz this) { 8750 return method_name; 8751 } 8752 8753 private static int function_id = -1; 8754 8755 @Override 8756 public int get_function_id() { 8757 return function_id; 8758 } 8759 8760 @Override 8761 public void set_function_id(int function_id) { 8762 assert LogicalXorLong_yxz.function_id == -1; 8763 LogicalXorLong_yxz.function_id = function_id; 8764 } 8765 8766 private static int var_order = 2; 8767 8768 @Override 8769 public int get_var_order(@GuardSatisfied LogicalXorLong_yxz this) { 8770 return var_order; 8771 } 8772 8773 @Pure 8774 @Override 8775 public boolean is_symmetric() { 8776 8777 return true; 8778 } 8779 8780 @Override 8781 8782 public long func(long x, long z) { 8783 8784 if ((x < 0) || (x > 1)) { 8785 throw new ArithmeticException("arg1 (" + x + ") is not boolean "); 8786 } 8787 if ((z < 0) || (z > 1)) { 8788 throw new ArithmeticException("arg2 (" + z + ") is not boolean "); 8789 } 8790 8791 return (((x != 0) ^ ( z != 0)) ? 1 : 0); 8792 } 8793 8794 @Override 8795 public InvariantStatus check_modified(long x, long y, 8796 long z, int count) { 8797 return check_ordered(y, x, z, count); 8798 } 8799 8800 @Override 8801 public InvariantStatus add_modified(long x, long y, 8802 long z, int count) { 8803 if (Debug.logDetail()) { 8804 log("result=%s, arg1=%s, arg2=%s", y, x, z); 8805 } 8806 return add_ordered(y, x, z, count); 8807 } 8808 8809 @Pure 8810 @Override 8811 public boolean isLogicalXor() { 8812 return true; 8813 } 8814 8815 /** Returns a list of non-instantiating suppressions for this invariant. */ 8816 @Pure 8817 @Override 8818 public @Nullable NISuppressionSet get_ni_suppressions() { 8819 if (NIS.dkconfig_enabled && dkconfig_enabled) { 8820 return suppressions; 8821 } else { 8822 return null; 8823 } 8824 } 8825 8826 /** definition of this invariant (the suppressee) */ 8827 private static NISuppressee suppressee = new NISuppressee(LogicalXorLong_yxz.class, 3); 8828 8829 // suppressor definitions (used below) 8830 private static NISuppressor result_eq_arg1 = 8831 new NISuppressor(1, 0, IntEqual.class); 8832 private static NISuppressor result_eq_arg2 = 8833 new NISuppressor(1, 2, IntEqual.class); 8834 private static NISuppressor arg1_eq_arg2 = 8835 new NISuppressor(0, 2, IntEqual.class); 8836 8837 private static NISuppressor result_lt_arg1 = 8838 new NISuppressor(1, 0, IntLessThan.class); 8839 private static NISuppressor result_lt_arg2 = 8840 new NISuppressor(1, 2, IntLessThan.class); 8841 private static NISuppressor arg1_lt_arg2 = 8842 new NISuppressor(0, 2, IntLessThan.class); 8843 private static NISuppressor arg2_lt_arg1 = 8844 new NISuppressor(2, 0, IntLessThan.class); 8845 8846 private static NISuppressor result_le_arg1 = 8847 new NISuppressor(1, 0, IntLessEqual.class); 8848 private static NISuppressor result_le_arg2 = 8849 new NISuppressor(1, 2, IntLessEqual.class); 8850 private static NISuppressor arg1_le_arg2 = 8851 new NISuppressor(0, 2, IntLessEqual.class); 8852 private static NISuppressor arg2_le_arg1 = 8853 new NISuppressor(2, 0, IntLessEqual.class); 8854 8855 private static NISuppressor result_track0_arg1 = 8856 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 8857 private static NISuppressor result_track0_arg2 = 8858 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 8859 private static NISuppressor arg1_track0_arg2 = 8860 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 8861 private static NISuppressor arg1_track0_result = 8862 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 8863 private static NISuppressor arg2_track0_result = 8864 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 8865 private static NISuppressor arg2_track0_arg1 = 8866 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 8867 8868 private static NISuppressor result_eq_1 = 8869 new NISuppressor(1, RangeInt.EqualOne.class); 8870 private static NISuppressor arg1_eq_1 = 8871 new NISuppressor(0, RangeInt.EqualOne.class); 8872 private static NISuppressor arg2_eq_1 = 8873 new NISuppressor(2, RangeInt.EqualOne.class); 8874 8875 private static NISuppressor result_eq_0 = 8876 new NISuppressor(1, RangeInt.EqualZero.class); 8877 private static NISuppressor arg1_eq_0 = 8878 new NISuppressor(0, RangeInt.EqualZero.class); 8879 private static NISuppressor arg2_eq_0 = 8880 new NISuppressor(2, RangeInt.EqualZero.class); 8881 8882 private static NISuppressor result_ne_0 = 8883 new NISuppressor(1, NonZero.class); 8884 private static NISuppressor arg1_ne_0 = 8885 new NISuppressor(0, NonZero.class); 8886 private static NISuppressor arg2_ne_0 = 8887 new NISuppressor(2, NonZero.class); 8888 8889 private static NISuppressor result_ge_0 = 8890 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 8891 private static NISuppressor arg1_ge_0 = 8892 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 8893 private static NISuppressor arg2_ge_0 = 8894 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 8895 8896 private static NISuppressor result_ge_64 = 8897 new NISuppressor(1, RangeInt.GreaterEqual64.class); 8898 private static NISuppressor arg1_ge_64 = 8899 new NISuppressor(0, RangeInt.GreaterEqual64.class); 8900 private static NISuppressor arg2_ge_64 = 8901 new NISuppressor(2, RangeInt.GreaterEqual64.class); 8902 8903 private static NISuppressor result_boolean = 8904 new NISuppressor(1, RangeInt.BooleanVal.class); 8905 private static NISuppressor arg1_boolean = 8906 new NISuppressor(0, RangeInt.BooleanVal.class); 8907 private static NISuppressor arg2_boolean = 8908 new NISuppressor(2, RangeInt.BooleanVal.class); 8909 8910 private static NISuppressor result_even = 8911 new NISuppressor(1, RangeInt.Even.class); 8912 private static NISuppressor arg1_even = 8913 new NISuppressor(0, RangeInt.Even.class); 8914 private static NISuppressor arg2_even = 8915 new NISuppressor(2, RangeInt.Even.class); 8916 8917 private static NISuppressor result_power2 = 8918 new NISuppressor(1, RangeInt.PowerOfTwo.class); 8919 private static NISuppressor arg1_power2 = 8920 new NISuppressor(0, RangeInt.PowerOfTwo.class); 8921 private static NISuppressor arg2_power2 = 8922 new NISuppressor(2, RangeInt.PowerOfTwo.class); 8923 8924 private static NISuppressor result_and0_arg1 = 8925 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 8926 private static NISuppressor result_and0_arg2 = 8927 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 8928 private static NISuppressor arg1_and0_arg2 = 8929 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 8930 8931 // The arguments to bitwise subset are backwards from what one 8932 // might expect. The second argument is a subset of the first 8933 // argument 8934 private static NISuppressor arg1_bw_subset_arg2 = 8935 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 8936 private static NISuppressor arg2_bw_subset_arg1 = 8937 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 8938 8939 private static NISuppressor result_shift0_arg1 = 8940 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 8941 private static NISuppressor result_shift0_arg2 = 8942 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 8943 private static NISuppressor arg1_shift0_arg2 = 8944 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 8945 8946 private static NISuppressor arg2_divides_arg1 = 8947 new NISuppressor(0, 2, NumericInt.Divides.class); 8948 private static NISuppressor arg1_divides_arg2 = 8949 new NISuppressor(2, 0, NumericInt.Divides.class); 8950 8951 private static NISuppressor arg2_valid_shift = 8952 new NISuppressor(2, RangeInt.Bound0_63.class); 8953 8954 private static NISuppressionSet suppressions = 8955 new NISuppressionSet( 8956 new NISuppression[] { 8957 8958 // (r == 0) && (x == z) && (x boolean) ==> r = x ^ z 8959 new NISuppression(arg1_eq_arg2, arg1_boolean, result_eq_0, 8960 suppressee), 8961 8962 // (r == x) && (z == 0) && (y boolean) ==> r = x ^ z 8963 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_0, 8964 suppressee), 8965 8966 // (r == z) && (x == 0) && (y boolean)==> r = x ^ z 8967 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_0, 8968 suppressee), 8969 8970 }); 8971 8972 // Create a suppression factory for functionBinary 8973 8974} 8975 8976/** 8977 * Represents the invariant {@code z = LogicalXor(x, y)} over three long 8978 * scalars. For logical operations, Daikon treats 0 as false and all other values as true. 8979 */ 8980public static class LogicalXorLong_zxy extends FunctionBinary { 8981 static final long serialVersionUID = 20031030L; 8982 8983 private static @Prototype LogicalXorLong_zxy proto = new @Prototype LogicalXorLong_zxy (); 8984 8985 /** Returns the prototype invariant for LogicalXorLong_zxy */ 8986 public static @Prototype LogicalXorLong_zxy get_proto() { 8987 return proto; 8988 } 8989 8990 @Override 8991 protected LogicalXorLong_zxy instantiate_dyn(@Prototype LogicalXorLong_zxy this, PptSlice slice) { 8992 return new LogicalXorLong_zxy (slice); 8993 } 8994 8995 private LogicalXorLong_zxy (PptSlice slice) { 8996 super(slice); 8997 } 8998 8999 public @Prototype LogicalXorLong_zxy () { 9000 super(); 9001 } 9002 9003 private static String[] method_name = new String[] {"org.plumelib.util.MathPlume.logicalXor(", ", ", ")"}; 9004 9005 @Override 9006 public String[] get_method_name(@GuardSatisfied LogicalXorLong_zxy this) { 9007 return method_name; 9008 } 9009 9010 private static int function_id = -1; 9011 9012 @Override 9013 public int get_function_id() { 9014 return function_id; 9015 } 9016 9017 @Override 9018 public void set_function_id(int function_id) { 9019 assert LogicalXorLong_zxy.function_id == -1; 9020 LogicalXorLong_zxy.function_id = function_id; 9021 } 9022 9023 private static int var_order = 3; 9024 9025 @Override 9026 public int get_var_order(@GuardSatisfied LogicalXorLong_zxy this) { 9027 return var_order; 9028 } 9029 9030 @Pure 9031 @Override 9032 public boolean is_symmetric() { 9033 9034 return true; 9035 } 9036 9037 @Override 9038 9039 public long func(long x, long y) { 9040 9041 if ((x < 0) || (x > 1)) { 9042 throw new ArithmeticException("arg1 (" + x + ") is not boolean "); 9043 } 9044 if ((y < 0) || (y > 1)) { 9045 throw new ArithmeticException("arg2 (" + y + ") is not boolean "); 9046 } 9047 9048 return (((x != 0) ^ ( y != 0)) ? 1 : 0); 9049 } 9050 9051 @Override 9052 public InvariantStatus check_modified(long x, long y, 9053 long z, int count) { 9054 return check_ordered(z, x, y, count); 9055 } 9056 9057 @Override 9058 public InvariantStatus add_modified(long x, long y, 9059 long z, int count) { 9060 if (Debug.logDetail()) { 9061 log("result=%s, arg1=%s, arg2=%s", z, x, y); 9062 } 9063 return add_ordered(z, x, y, count); 9064 } 9065 9066 @Pure 9067 @Override 9068 public boolean isLogicalXor() { 9069 return true; 9070 } 9071 9072 /** Returns a list of non-instantiating suppressions for this invariant. */ 9073 @Pure 9074 @Override 9075 public @Nullable NISuppressionSet get_ni_suppressions() { 9076 if (NIS.dkconfig_enabled && dkconfig_enabled) { 9077 return suppressions; 9078 } else { 9079 return null; 9080 } 9081 } 9082 9083 /** definition of this invariant (the suppressee) */ 9084 private static NISuppressee suppressee = new NISuppressee(LogicalXorLong_zxy.class, 3); 9085 9086 // suppressor definitions (used below) 9087 private static NISuppressor result_eq_arg1 = 9088 new NISuppressor(2, 0, IntEqual.class); 9089 private static NISuppressor result_eq_arg2 = 9090 new NISuppressor(2, 1, IntEqual.class); 9091 private static NISuppressor arg1_eq_arg2 = 9092 new NISuppressor(0, 1, IntEqual.class); 9093 9094 private static NISuppressor result_lt_arg1 = 9095 new NISuppressor(2, 0, IntLessThan.class); 9096 private static NISuppressor result_lt_arg2 = 9097 new NISuppressor(2, 1, IntLessThan.class); 9098 private static NISuppressor arg1_lt_arg2 = 9099 new NISuppressor(0, 1, IntLessThan.class); 9100 private static NISuppressor arg2_lt_arg1 = 9101 new NISuppressor(1, 0, IntLessThan.class); 9102 9103 private static NISuppressor result_le_arg1 = 9104 new NISuppressor(2, 0, IntLessEqual.class); 9105 private static NISuppressor result_le_arg2 = 9106 new NISuppressor(2, 1, IntLessEqual.class); 9107 private static NISuppressor arg1_le_arg2 = 9108 new NISuppressor(0, 1, IntLessEqual.class); 9109 private static NISuppressor arg2_le_arg1 = 9110 new NISuppressor(1, 0, IntLessEqual.class); 9111 9112 private static NISuppressor result_track0_arg1 = 9113 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 9114 private static NISuppressor result_track0_arg2 = 9115 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 9116 private static NISuppressor arg1_track0_arg2 = 9117 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 9118 private static NISuppressor arg1_track0_result = 9119 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 9120 private static NISuppressor arg2_track0_result = 9121 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 9122 private static NISuppressor arg2_track0_arg1 = 9123 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 9124 9125 private static NISuppressor result_eq_1 = 9126 new NISuppressor(2, RangeInt.EqualOne.class); 9127 private static NISuppressor arg1_eq_1 = 9128 new NISuppressor(0, RangeInt.EqualOne.class); 9129 private static NISuppressor arg2_eq_1 = 9130 new NISuppressor(1, RangeInt.EqualOne.class); 9131 9132 private static NISuppressor result_eq_0 = 9133 new NISuppressor(2, RangeInt.EqualZero.class); 9134 private static NISuppressor arg1_eq_0 = 9135 new NISuppressor(0, RangeInt.EqualZero.class); 9136 private static NISuppressor arg2_eq_0 = 9137 new NISuppressor(1, RangeInt.EqualZero.class); 9138 9139 private static NISuppressor result_ne_0 = 9140 new NISuppressor(2, NonZero.class); 9141 private static NISuppressor arg1_ne_0 = 9142 new NISuppressor(0, NonZero.class); 9143 private static NISuppressor arg2_ne_0 = 9144 new NISuppressor(1, NonZero.class); 9145 9146 private static NISuppressor result_ge_0 = 9147 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 9148 private static NISuppressor arg1_ge_0 = 9149 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 9150 private static NISuppressor arg2_ge_0 = 9151 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 9152 9153 private static NISuppressor result_ge_64 = 9154 new NISuppressor(2, RangeInt.GreaterEqual64.class); 9155 private static NISuppressor arg1_ge_64 = 9156 new NISuppressor(0, RangeInt.GreaterEqual64.class); 9157 private static NISuppressor arg2_ge_64 = 9158 new NISuppressor(1, RangeInt.GreaterEqual64.class); 9159 9160 private static NISuppressor result_boolean = 9161 new NISuppressor(2, RangeInt.BooleanVal.class); 9162 private static NISuppressor arg1_boolean = 9163 new NISuppressor(0, RangeInt.BooleanVal.class); 9164 private static NISuppressor arg2_boolean = 9165 new NISuppressor(1, RangeInt.BooleanVal.class); 9166 9167 private static NISuppressor result_even = 9168 new NISuppressor(2, RangeInt.Even.class); 9169 private static NISuppressor arg1_even = 9170 new NISuppressor(0, RangeInt.Even.class); 9171 private static NISuppressor arg2_even = 9172 new NISuppressor(1, RangeInt.Even.class); 9173 9174 private static NISuppressor result_power2 = 9175 new NISuppressor(2, RangeInt.PowerOfTwo.class); 9176 private static NISuppressor arg1_power2 = 9177 new NISuppressor(0, RangeInt.PowerOfTwo.class); 9178 private static NISuppressor arg2_power2 = 9179 new NISuppressor(1, RangeInt.PowerOfTwo.class); 9180 9181 private static NISuppressor result_and0_arg1 = 9182 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 9183 private static NISuppressor result_and0_arg2 = 9184 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 9185 private static NISuppressor arg1_and0_arg2 = 9186 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 9187 9188 // The arguments to bitwise subset are backwards from what one 9189 // might expect. The second argument is a subset of the first 9190 // argument 9191 private static NISuppressor arg1_bw_subset_arg2 = 9192 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 9193 private static NISuppressor arg2_bw_subset_arg1 = 9194 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 9195 9196 private static NISuppressor result_shift0_arg1 = 9197 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 9198 private static NISuppressor result_shift0_arg2 = 9199 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 9200 private static NISuppressor arg1_shift0_arg2 = 9201 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 9202 9203 private static NISuppressor arg2_divides_arg1 = 9204 new NISuppressor(0, 1, NumericInt.Divides.class); 9205 private static NISuppressor arg1_divides_arg2 = 9206 new NISuppressor(1, 0, NumericInt.Divides.class); 9207 9208 private static NISuppressor arg2_valid_shift = 9209 new NISuppressor(1, RangeInt.Bound0_63.class); 9210 9211 private static NISuppressionSet suppressions = 9212 new NISuppressionSet( 9213 new NISuppression[] { 9214 9215 // (r == 0) && (x == y) && (x boolean) ==> r = x ^ y 9216 new NISuppression(arg1_eq_arg2, arg1_boolean, result_eq_0, 9217 suppressee), 9218 9219 // (r == x) && (y == 0) && (z boolean) ==> r = x ^ y 9220 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_0, 9221 suppressee), 9222 9223 // (r == y) && (x == 0) && (z boolean)==> r = x ^ y 9224 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_0, 9225 suppressee), 9226 9227 }); 9228 9229 // Create a suppression factory for functionBinary 9230 9231} 9232 9233 // #define EQUALITY_SUPPRESS 1 9234 9235 // default is that it is not this function, overriden in the subclass 9236 @Pure 9237 public boolean isBitwiseOr() { 9238 return false; 9239 } 9240 9241/** 9242 * Represents the invariant {@code x = BitwiseOr(y, z)} over three long 9243 * scalars. 9244 */ 9245public static class BitwiseOrLong_xyz extends FunctionBinary { 9246 static final long serialVersionUID = 20031030L; 9247 9248 private static @Prototype BitwiseOrLong_xyz proto = new @Prototype BitwiseOrLong_xyz (); 9249 9250 /** Returns the prototype invariant for BitwiseOrLong_xyz */ 9251 public static @Prototype BitwiseOrLong_xyz get_proto() { 9252 return proto; 9253 } 9254 9255 @Override 9256 protected BitwiseOrLong_xyz instantiate_dyn(@Prototype BitwiseOrLong_xyz this, PptSlice slice) { 9257 return new BitwiseOrLong_xyz (slice); 9258 } 9259 9260 private BitwiseOrLong_xyz (PptSlice slice) { 9261 super(slice); 9262 } 9263 9264 public @Prototype BitwiseOrLong_xyz () { 9265 super(); 9266 } 9267 9268 private static String[] method_name = new String[] {"", " | ", ""}; 9269 9270 @Override 9271 public String[] get_method_name(@GuardSatisfied BitwiseOrLong_xyz this) { 9272 return method_name; 9273 } 9274 9275 private static int function_id = -1; 9276 9277 @Override 9278 public int get_function_id() { 9279 return function_id; 9280 } 9281 9282 @Override 9283 public void set_function_id(int function_id) { 9284 assert BitwiseOrLong_xyz.function_id == -1; 9285 BitwiseOrLong_xyz.function_id = function_id; 9286 } 9287 9288 private static int var_order = 1; 9289 9290 @Override 9291 public int get_var_order(@GuardSatisfied BitwiseOrLong_xyz this) { 9292 return var_order; 9293 } 9294 9295 @Pure 9296 @Override 9297 public boolean is_symmetric() { 9298 9299 return true; 9300 } 9301 9302 @Override 9303 9304 public long func(long y, long z) { 9305 9306 return (y | z); 9307 } 9308 9309 @Override 9310 public InvariantStatus check_modified(long x, long y, 9311 long z, int count) { 9312 return check_ordered(x, y, z, count); 9313 } 9314 9315 @Override 9316 public InvariantStatus add_modified(long x, long y, 9317 long z, int count) { 9318 if (Debug.logDetail()) { 9319 log("result=%s, arg1=%s, arg2=%s", x, y, z); 9320 } 9321 return add_ordered(x, y, z, count); 9322 } 9323 9324 @Pure 9325 @Override 9326 public boolean isBitwiseOr() { 9327 return true; 9328 } 9329 9330 /** Returns a list of non-instantiating suppressions for this invariant. */ 9331 @Pure 9332 @Override 9333 public @Nullable NISuppressionSet get_ni_suppressions() { 9334 if (NIS.dkconfig_enabled && dkconfig_enabled) { 9335 return suppressions; 9336 } else { 9337 return null; 9338 } 9339 } 9340 9341 /** definition of this invariant (the suppressee) */ 9342 private static NISuppressee suppressee = new NISuppressee(BitwiseOrLong_xyz.class, 3); 9343 9344 // suppressor definitions (used below) 9345 private static NISuppressor result_eq_arg1 = 9346 new NISuppressor(0, 1, IntEqual.class); 9347 private static NISuppressor result_eq_arg2 = 9348 new NISuppressor(0, 2, IntEqual.class); 9349 private static NISuppressor arg1_eq_arg2 = 9350 new NISuppressor(1, 2, IntEqual.class); 9351 9352 private static NISuppressor result_lt_arg1 = 9353 new NISuppressor(0, 1, IntLessThan.class); 9354 private static NISuppressor result_lt_arg2 = 9355 new NISuppressor(0, 2, IntLessThan.class); 9356 private static NISuppressor arg1_lt_arg2 = 9357 new NISuppressor(1, 2, IntLessThan.class); 9358 private static NISuppressor arg2_lt_arg1 = 9359 new NISuppressor(2, 1, IntLessThan.class); 9360 9361 private static NISuppressor result_le_arg1 = 9362 new NISuppressor(0, 1, IntLessEqual.class); 9363 private static NISuppressor result_le_arg2 = 9364 new NISuppressor(0, 2, IntLessEqual.class); 9365 private static NISuppressor arg1_le_arg2 = 9366 new NISuppressor(1, 2, IntLessEqual.class); 9367 private static NISuppressor arg2_le_arg1 = 9368 new NISuppressor(2, 1, IntLessEqual.class); 9369 9370 private static NISuppressor result_track0_arg1 = 9371 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 9372 private static NISuppressor result_track0_arg2 = 9373 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 9374 private static NISuppressor arg1_track0_arg2 = 9375 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 9376 private static NISuppressor arg1_track0_result = 9377 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 9378 private static NISuppressor arg2_track0_result = 9379 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 9380 private static NISuppressor arg2_track0_arg1 = 9381 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 9382 9383 private static NISuppressor result_eq_1 = 9384 new NISuppressor(0, RangeInt.EqualOne.class); 9385 private static NISuppressor arg1_eq_1 = 9386 new NISuppressor(1, RangeInt.EqualOne.class); 9387 private static NISuppressor arg2_eq_1 = 9388 new NISuppressor(2, RangeInt.EqualOne.class); 9389 9390 private static NISuppressor result_eq_0 = 9391 new NISuppressor(0, RangeInt.EqualZero.class); 9392 private static NISuppressor arg1_eq_0 = 9393 new NISuppressor(1, RangeInt.EqualZero.class); 9394 private static NISuppressor arg2_eq_0 = 9395 new NISuppressor(2, RangeInt.EqualZero.class); 9396 9397 private static NISuppressor result_ne_0 = 9398 new NISuppressor(0, NonZero.class); 9399 private static NISuppressor arg1_ne_0 = 9400 new NISuppressor(1, NonZero.class); 9401 private static NISuppressor arg2_ne_0 = 9402 new NISuppressor(2, NonZero.class); 9403 9404 private static NISuppressor result_ge_0 = 9405 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 9406 private static NISuppressor arg1_ge_0 = 9407 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 9408 private static NISuppressor arg2_ge_0 = 9409 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 9410 9411 private static NISuppressor result_ge_64 = 9412 new NISuppressor(0, RangeInt.GreaterEqual64.class); 9413 private static NISuppressor arg1_ge_64 = 9414 new NISuppressor(1, RangeInt.GreaterEqual64.class); 9415 private static NISuppressor arg2_ge_64 = 9416 new NISuppressor(2, RangeInt.GreaterEqual64.class); 9417 9418 private static NISuppressor result_boolean = 9419 new NISuppressor(0, RangeInt.BooleanVal.class); 9420 private static NISuppressor arg1_boolean = 9421 new NISuppressor(1, RangeInt.BooleanVal.class); 9422 private static NISuppressor arg2_boolean = 9423 new NISuppressor(2, RangeInt.BooleanVal.class); 9424 9425 private static NISuppressor result_even = 9426 new NISuppressor(0, RangeInt.Even.class); 9427 private static NISuppressor arg1_even = 9428 new NISuppressor(1, RangeInt.Even.class); 9429 private static NISuppressor arg2_even = 9430 new NISuppressor(2, RangeInt.Even.class); 9431 9432 private static NISuppressor result_power2 = 9433 new NISuppressor(0, RangeInt.PowerOfTwo.class); 9434 private static NISuppressor arg1_power2 = 9435 new NISuppressor(1, RangeInt.PowerOfTwo.class); 9436 private static NISuppressor arg2_power2 = 9437 new NISuppressor(2, RangeInt.PowerOfTwo.class); 9438 9439 private static NISuppressor result_and0_arg1 = 9440 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 9441 private static NISuppressor result_and0_arg2 = 9442 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 9443 private static NISuppressor arg1_and0_arg2 = 9444 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 9445 9446 // The arguments to bitwise subset are backwards from what one 9447 // might expect. The second argument is a subset of the first 9448 // argument 9449 private static NISuppressor arg1_bw_subset_arg2 = 9450 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 9451 private static NISuppressor arg2_bw_subset_arg1 = 9452 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 9453 9454 private static NISuppressor result_shift0_arg1 = 9455 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 9456 private static NISuppressor result_shift0_arg2 = 9457 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 9458 private static NISuppressor arg1_shift0_arg2 = 9459 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 9460 9461 private static NISuppressor arg2_divides_arg1 = 9462 new NISuppressor(1, 2, NumericInt.Divides.class); 9463 private static NISuppressor arg1_divides_arg2 = 9464 new NISuppressor(2, 1, NumericInt.Divides.class); 9465 9466 private static NISuppressor arg2_valid_shift = 9467 new NISuppressor(2, RangeInt.Bound0_63.class); 9468 9469 private static NISuppressionSet suppressions = 9470 new NISuppressionSet( 9471 new NISuppression[] { 9472 9473 // (r == y) && (z bitwise subset y) 9474 new NISuppression(result_eq_arg1, arg2_bw_subset_arg1, suppressee), 9475 9476 // (r == z) && (y bitwise subset z) 9477 new NISuppression(result_eq_arg2, arg1_bw_subset_arg2, suppressee), 9478 9479 // All of the below are subsummed by the two above 9480 // (r == y) && (y == z) ==> r = y | z 9481 // new NISuppression (result_eq_arg1, arg1_eq_arg2, suppressee), 9482 9483 // (r == y) && (z == 0) ==> r = y | z 9484 // new NISuppression (result_eq_arg1, arg2_eq_0, suppressee), 9485 9486 // (r == z) && (y == 0) ==> r = y | z 9487 // new NISuppression (result_eq_arg2, arg1_eq_0, suppressee), 9488 9489 // (r == 1) && (y == 1) && (z boolean) 9490 // new NISuppression (result_eq_1, arg1_eq_1, arg2_boolean, suppressee), 9491 9492 // (r == 1) && (z == 1) && (y boolean) 9493 // new NISuppression (result_eq_1, arg2_eq_1, arg1_boolean, suppressee), 9494 9495 }); 9496 9497 // Create a suppression factory for functionBinary 9498 9499} 9500 9501/** 9502 * Represents the invariant {@code y = BitwiseOr(x, z)} over three long 9503 * scalars. 9504 */ 9505public static class BitwiseOrLong_yxz extends FunctionBinary { 9506 static final long serialVersionUID = 20031030L; 9507 9508 private static @Prototype BitwiseOrLong_yxz proto = new @Prototype BitwiseOrLong_yxz (); 9509 9510 /** Returns the prototype invariant for BitwiseOrLong_yxz */ 9511 public static @Prototype BitwiseOrLong_yxz get_proto() { 9512 return proto; 9513 } 9514 9515 @Override 9516 protected BitwiseOrLong_yxz instantiate_dyn(@Prototype BitwiseOrLong_yxz this, PptSlice slice) { 9517 return new BitwiseOrLong_yxz (slice); 9518 } 9519 9520 private BitwiseOrLong_yxz (PptSlice slice) { 9521 super(slice); 9522 } 9523 9524 public @Prototype BitwiseOrLong_yxz () { 9525 super(); 9526 } 9527 9528 private static String[] method_name = new String[] {"", " | ", ""}; 9529 9530 @Override 9531 public String[] get_method_name(@GuardSatisfied BitwiseOrLong_yxz this) { 9532 return method_name; 9533 } 9534 9535 private static int function_id = -1; 9536 9537 @Override 9538 public int get_function_id() { 9539 return function_id; 9540 } 9541 9542 @Override 9543 public void set_function_id(int function_id) { 9544 assert BitwiseOrLong_yxz.function_id == -1; 9545 BitwiseOrLong_yxz.function_id = function_id; 9546 } 9547 9548 private static int var_order = 2; 9549 9550 @Override 9551 public int get_var_order(@GuardSatisfied BitwiseOrLong_yxz this) { 9552 return var_order; 9553 } 9554 9555 @Pure 9556 @Override 9557 public boolean is_symmetric() { 9558 9559 return true; 9560 } 9561 9562 @Override 9563 9564 public long func(long x, long z) { 9565 9566 return (x | z); 9567 } 9568 9569 @Override 9570 public InvariantStatus check_modified(long x, long y, 9571 long z, int count) { 9572 return check_ordered(y, x, z, count); 9573 } 9574 9575 @Override 9576 public InvariantStatus add_modified(long x, long y, 9577 long z, int count) { 9578 if (Debug.logDetail()) { 9579 log("result=%s, arg1=%s, arg2=%s", y, x, z); 9580 } 9581 return add_ordered(y, x, z, count); 9582 } 9583 9584 @Pure 9585 @Override 9586 public boolean isBitwiseOr() { 9587 return true; 9588 } 9589 9590 /** Returns a list of non-instantiating suppressions for this invariant. */ 9591 @Pure 9592 @Override 9593 public @Nullable NISuppressionSet get_ni_suppressions() { 9594 if (NIS.dkconfig_enabled && dkconfig_enabled) { 9595 return suppressions; 9596 } else { 9597 return null; 9598 } 9599 } 9600 9601 /** definition of this invariant (the suppressee) */ 9602 private static NISuppressee suppressee = new NISuppressee(BitwiseOrLong_yxz.class, 3); 9603 9604 // suppressor definitions (used below) 9605 private static NISuppressor result_eq_arg1 = 9606 new NISuppressor(1, 0, IntEqual.class); 9607 private static NISuppressor result_eq_arg2 = 9608 new NISuppressor(1, 2, IntEqual.class); 9609 private static NISuppressor arg1_eq_arg2 = 9610 new NISuppressor(0, 2, IntEqual.class); 9611 9612 private static NISuppressor result_lt_arg1 = 9613 new NISuppressor(1, 0, IntLessThan.class); 9614 private static NISuppressor result_lt_arg2 = 9615 new NISuppressor(1, 2, IntLessThan.class); 9616 private static NISuppressor arg1_lt_arg2 = 9617 new NISuppressor(0, 2, IntLessThan.class); 9618 private static NISuppressor arg2_lt_arg1 = 9619 new NISuppressor(2, 0, IntLessThan.class); 9620 9621 private static NISuppressor result_le_arg1 = 9622 new NISuppressor(1, 0, IntLessEqual.class); 9623 private static NISuppressor result_le_arg2 = 9624 new NISuppressor(1, 2, IntLessEqual.class); 9625 private static NISuppressor arg1_le_arg2 = 9626 new NISuppressor(0, 2, IntLessEqual.class); 9627 private static NISuppressor arg2_le_arg1 = 9628 new NISuppressor(2, 0, IntLessEqual.class); 9629 9630 private static NISuppressor result_track0_arg1 = 9631 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 9632 private static NISuppressor result_track0_arg2 = 9633 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 9634 private static NISuppressor arg1_track0_arg2 = 9635 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 9636 private static NISuppressor arg1_track0_result = 9637 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 9638 private static NISuppressor arg2_track0_result = 9639 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 9640 private static NISuppressor arg2_track0_arg1 = 9641 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 9642 9643 private static NISuppressor result_eq_1 = 9644 new NISuppressor(1, RangeInt.EqualOne.class); 9645 private static NISuppressor arg1_eq_1 = 9646 new NISuppressor(0, RangeInt.EqualOne.class); 9647 private static NISuppressor arg2_eq_1 = 9648 new NISuppressor(2, RangeInt.EqualOne.class); 9649 9650 private static NISuppressor result_eq_0 = 9651 new NISuppressor(1, RangeInt.EqualZero.class); 9652 private static NISuppressor arg1_eq_0 = 9653 new NISuppressor(0, RangeInt.EqualZero.class); 9654 private static NISuppressor arg2_eq_0 = 9655 new NISuppressor(2, RangeInt.EqualZero.class); 9656 9657 private static NISuppressor result_ne_0 = 9658 new NISuppressor(1, NonZero.class); 9659 private static NISuppressor arg1_ne_0 = 9660 new NISuppressor(0, NonZero.class); 9661 private static NISuppressor arg2_ne_0 = 9662 new NISuppressor(2, NonZero.class); 9663 9664 private static NISuppressor result_ge_0 = 9665 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 9666 private static NISuppressor arg1_ge_0 = 9667 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 9668 private static NISuppressor arg2_ge_0 = 9669 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 9670 9671 private static NISuppressor result_ge_64 = 9672 new NISuppressor(1, RangeInt.GreaterEqual64.class); 9673 private static NISuppressor arg1_ge_64 = 9674 new NISuppressor(0, RangeInt.GreaterEqual64.class); 9675 private static NISuppressor arg2_ge_64 = 9676 new NISuppressor(2, RangeInt.GreaterEqual64.class); 9677 9678 private static NISuppressor result_boolean = 9679 new NISuppressor(1, RangeInt.BooleanVal.class); 9680 private static NISuppressor arg1_boolean = 9681 new NISuppressor(0, RangeInt.BooleanVal.class); 9682 private static NISuppressor arg2_boolean = 9683 new NISuppressor(2, RangeInt.BooleanVal.class); 9684 9685 private static NISuppressor result_even = 9686 new NISuppressor(1, RangeInt.Even.class); 9687 private static NISuppressor arg1_even = 9688 new NISuppressor(0, RangeInt.Even.class); 9689 private static NISuppressor arg2_even = 9690 new NISuppressor(2, RangeInt.Even.class); 9691 9692 private static NISuppressor result_power2 = 9693 new NISuppressor(1, RangeInt.PowerOfTwo.class); 9694 private static NISuppressor arg1_power2 = 9695 new NISuppressor(0, RangeInt.PowerOfTwo.class); 9696 private static NISuppressor arg2_power2 = 9697 new NISuppressor(2, RangeInt.PowerOfTwo.class); 9698 9699 private static NISuppressor result_and0_arg1 = 9700 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 9701 private static NISuppressor result_and0_arg2 = 9702 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 9703 private static NISuppressor arg1_and0_arg2 = 9704 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 9705 9706 // The arguments to bitwise subset are backwards from what one 9707 // might expect. The second argument is a subset of the first 9708 // argument 9709 private static NISuppressor arg1_bw_subset_arg2 = 9710 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 9711 private static NISuppressor arg2_bw_subset_arg1 = 9712 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 9713 9714 private static NISuppressor result_shift0_arg1 = 9715 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 9716 private static NISuppressor result_shift0_arg2 = 9717 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 9718 private static NISuppressor arg1_shift0_arg2 = 9719 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 9720 9721 private static NISuppressor arg2_divides_arg1 = 9722 new NISuppressor(0, 2, NumericInt.Divides.class); 9723 private static NISuppressor arg1_divides_arg2 = 9724 new NISuppressor(2, 0, NumericInt.Divides.class); 9725 9726 private static NISuppressor arg2_valid_shift = 9727 new NISuppressor(2, RangeInt.Bound0_63.class); 9728 9729 private static NISuppressionSet suppressions = 9730 new NISuppressionSet( 9731 new NISuppression[] { 9732 9733 // (r == x) && (z bitwise subset x) 9734 new NISuppression(result_eq_arg1, arg2_bw_subset_arg1, suppressee), 9735 9736 // (r == z) && (x bitwise subset z) 9737 new NISuppression(result_eq_arg2, arg1_bw_subset_arg2, suppressee), 9738 9739 // All of the below are subsummed by the two above 9740 // (r == x) && (x == z) ==> r = x | z 9741 // new NISuppression (result_eq_arg1, arg1_eq_arg2, suppressee), 9742 9743 // (r == x) && (z == 0) ==> r = x | z 9744 // new NISuppression (result_eq_arg1, arg2_eq_0, suppressee), 9745 9746 // (r == z) && (x == 0) ==> r = x | z 9747 // new NISuppression (result_eq_arg2, arg1_eq_0, suppressee), 9748 9749 // (r == 1) && (x == 1) && (z boolean) 9750 // new NISuppression (result_eq_1, arg1_eq_1, arg2_boolean, suppressee), 9751 9752 // (r == 1) && (z == 1) && (x boolean) 9753 // new NISuppression (result_eq_1, arg2_eq_1, arg1_boolean, suppressee), 9754 9755 }); 9756 9757 // Create a suppression factory for functionBinary 9758 9759} 9760 9761/** 9762 * Represents the invariant {@code z = BitwiseOr(x, y)} over three long 9763 * scalars. 9764 */ 9765public static class BitwiseOrLong_zxy extends FunctionBinary { 9766 static final long serialVersionUID = 20031030L; 9767 9768 private static @Prototype BitwiseOrLong_zxy proto = new @Prototype BitwiseOrLong_zxy (); 9769 9770 /** Returns the prototype invariant for BitwiseOrLong_zxy */ 9771 public static @Prototype BitwiseOrLong_zxy get_proto() { 9772 return proto; 9773 } 9774 9775 @Override 9776 protected BitwiseOrLong_zxy instantiate_dyn(@Prototype BitwiseOrLong_zxy this, PptSlice slice) { 9777 return new BitwiseOrLong_zxy (slice); 9778 } 9779 9780 private BitwiseOrLong_zxy (PptSlice slice) { 9781 super(slice); 9782 } 9783 9784 public @Prototype BitwiseOrLong_zxy () { 9785 super(); 9786 } 9787 9788 private static String[] method_name = new String[] {"", " | ", ""}; 9789 9790 @Override 9791 public String[] get_method_name(@GuardSatisfied BitwiseOrLong_zxy this) { 9792 return method_name; 9793 } 9794 9795 private static int function_id = -1; 9796 9797 @Override 9798 public int get_function_id() { 9799 return function_id; 9800 } 9801 9802 @Override 9803 public void set_function_id(int function_id) { 9804 assert BitwiseOrLong_zxy.function_id == -1; 9805 BitwiseOrLong_zxy.function_id = function_id; 9806 } 9807 9808 private static int var_order = 3; 9809 9810 @Override 9811 public int get_var_order(@GuardSatisfied BitwiseOrLong_zxy this) { 9812 return var_order; 9813 } 9814 9815 @Pure 9816 @Override 9817 public boolean is_symmetric() { 9818 9819 return true; 9820 } 9821 9822 @Override 9823 9824 public long func(long x, long y) { 9825 9826 return (x | y); 9827 } 9828 9829 @Override 9830 public InvariantStatus check_modified(long x, long y, 9831 long z, int count) { 9832 return check_ordered(z, x, y, count); 9833 } 9834 9835 @Override 9836 public InvariantStatus add_modified(long x, long y, 9837 long z, int count) { 9838 if (Debug.logDetail()) { 9839 log("result=%s, arg1=%s, arg2=%s", z, x, y); 9840 } 9841 return add_ordered(z, x, y, count); 9842 } 9843 9844 @Pure 9845 @Override 9846 public boolean isBitwiseOr() { 9847 return true; 9848 } 9849 9850 /** Returns a list of non-instantiating suppressions for this invariant. */ 9851 @Pure 9852 @Override 9853 public @Nullable NISuppressionSet get_ni_suppressions() { 9854 if (NIS.dkconfig_enabled && dkconfig_enabled) { 9855 return suppressions; 9856 } else { 9857 return null; 9858 } 9859 } 9860 9861 /** definition of this invariant (the suppressee) */ 9862 private static NISuppressee suppressee = new NISuppressee(BitwiseOrLong_zxy.class, 3); 9863 9864 // suppressor definitions (used below) 9865 private static NISuppressor result_eq_arg1 = 9866 new NISuppressor(2, 0, IntEqual.class); 9867 private static NISuppressor result_eq_arg2 = 9868 new NISuppressor(2, 1, IntEqual.class); 9869 private static NISuppressor arg1_eq_arg2 = 9870 new NISuppressor(0, 1, IntEqual.class); 9871 9872 private static NISuppressor result_lt_arg1 = 9873 new NISuppressor(2, 0, IntLessThan.class); 9874 private static NISuppressor result_lt_arg2 = 9875 new NISuppressor(2, 1, IntLessThan.class); 9876 private static NISuppressor arg1_lt_arg2 = 9877 new NISuppressor(0, 1, IntLessThan.class); 9878 private static NISuppressor arg2_lt_arg1 = 9879 new NISuppressor(1, 0, IntLessThan.class); 9880 9881 private static NISuppressor result_le_arg1 = 9882 new NISuppressor(2, 0, IntLessEqual.class); 9883 private static NISuppressor result_le_arg2 = 9884 new NISuppressor(2, 1, IntLessEqual.class); 9885 private static NISuppressor arg1_le_arg2 = 9886 new NISuppressor(0, 1, IntLessEqual.class); 9887 private static NISuppressor arg2_le_arg1 = 9888 new NISuppressor(1, 0, IntLessEqual.class); 9889 9890 private static NISuppressor result_track0_arg1 = 9891 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 9892 private static NISuppressor result_track0_arg2 = 9893 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 9894 private static NISuppressor arg1_track0_arg2 = 9895 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 9896 private static NISuppressor arg1_track0_result = 9897 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 9898 private static NISuppressor arg2_track0_result = 9899 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 9900 private static NISuppressor arg2_track0_arg1 = 9901 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 9902 9903 private static NISuppressor result_eq_1 = 9904 new NISuppressor(2, RangeInt.EqualOne.class); 9905 private static NISuppressor arg1_eq_1 = 9906 new NISuppressor(0, RangeInt.EqualOne.class); 9907 private static NISuppressor arg2_eq_1 = 9908 new NISuppressor(1, RangeInt.EqualOne.class); 9909 9910 private static NISuppressor result_eq_0 = 9911 new NISuppressor(2, RangeInt.EqualZero.class); 9912 private static NISuppressor arg1_eq_0 = 9913 new NISuppressor(0, RangeInt.EqualZero.class); 9914 private static NISuppressor arg2_eq_0 = 9915 new NISuppressor(1, RangeInt.EqualZero.class); 9916 9917 private static NISuppressor result_ne_0 = 9918 new NISuppressor(2, NonZero.class); 9919 private static NISuppressor arg1_ne_0 = 9920 new NISuppressor(0, NonZero.class); 9921 private static NISuppressor arg2_ne_0 = 9922 new NISuppressor(1, NonZero.class); 9923 9924 private static NISuppressor result_ge_0 = 9925 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 9926 private static NISuppressor arg1_ge_0 = 9927 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 9928 private static NISuppressor arg2_ge_0 = 9929 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 9930 9931 private static NISuppressor result_ge_64 = 9932 new NISuppressor(2, RangeInt.GreaterEqual64.class); 9933 private static NISuppressor arg1_ge_64 = 9934 new NISuppressor(0, RangeInt.GreaterEqual64.class); 9935 private static NISuppressor arg2_ge_64 = 9936 new NISuppressor(1, RangeInt.GreaterEqual64.class); 9937 9938 private static NISuppressor result_boolean = 9939 new NISuppressor(2, RangeInt.BooleanVal.class); 9940 private static NISuppressor arg1_boolean = 9941 new NISuppressor(0, RangeInt.BooleanVal.class); 9942 private static NISuppressor arg2_boolean = 9943 new NISuppressor(1, RangeInt.BooleanVal.class); 9944 9945 private static NISuppressor result_even = 9946 new NISuppressor(2, RangeInt.Even.class); 9947 private static NISuppressor arg1_even = 9948 new NISuppressor(0, RangeInt.Even.class); 9949 private static NISuppressor arg2_even = 9950 new NISuppressor(1, RangeInt.Even.class); 9951 9952 private static NISuppressor result_power2 = 9953 new NISuppressor(2, RangeInt.PowerOfTwo.class); 9954 private static NISuppressor arg1_power2 = 9955 new NISuppressor(0, RangeInt.PowerOfTwo.class); 9956 private static NISuppressor arg2_power2 = 9957 new NISuppressor(1, RangeInt.PowerOfTwo.class); 9958 9959 private static NISuppressor result_and0_arg1 = 9960 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 9961 private static NISuppressor result_and0_arg2 = 9962 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 9963 private static NISuppressor arg1_and0_arg2 = 9964 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 9965 9966 // The arguments to bitwise subset are backwards from what one 9967 // might expect. The second argument is a subset of the first 9968 // argument 9969 private static NISuppressor arg1_bw_subset_arg2 = 9970 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 9971 private static NISuppressor arg2_bw_subset_arg1 = 9972 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 9973 9974 private static NISuppressor result_shift0_arg1 = 9975 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 9976 private static NISuppressor result_shift0_arg2 = 9977 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 9978 private static NISuppressor arg1_shift0_arg2 = 9979 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 9980 9981 private static NISuppressor arg2_divides_arg1 = 9982 new NISuppressor(0, 1, NumericInt.Divides.class); 9983 private static NISuppressor arg1_divides_arg2 = 9984 new NISuppressor(1, 0, NumericInt.Divides.class); 9985 9986 private static NISuppressor arg2_valid_shift = 9987 new NISuppressor(1, RangeInt.Bound0_63.class); 9988 9989 private static NISuppressionSet suppressions = 9990 new NISuppressionSet( 9991 new NISuppression[] { 9992 9993 // (r == x) && (y bitwise subset x) 9994 new NISuppression(result_eq_arg1, arg2_bw_subset_arg1, suppressee), 9995 9996 // (r == y) && (x bitwise subset y) 9997 new NISuppression(result_eq_arg2, arg1_bw_subset_arg2, suppressee), 9998 9999 // All of the below are subsummed by the two above 10000 // (r == x) && (x == y) ==> r = x | y 10001 // new NISuppression (result_eq_arg1, arg1_eq_arg2, suppressee), 10002 10003 // (r == x) && (y == 0) ==> r = x | y 10004 // new NISuppression (result_eq_arg1, arg2_eq_0, suppressee), 10005 10006 // (r == y) && (x == 0) ==> r = x | y 10007 // new NISuppression (result_eq_arg2, arg1_eq_0, suppressee), 10008 10009 // (r == 1) && (x == 1) && (y boolean) 10010 // new NISuppression (result_eq_1, arg1_eq_1, arg2_boolean, suppressee), 10011 10012 // (r == 1) && (y == 1) && (x boolean) 10013 // new NISuppression (result_eq_1, arg2_eq_1, arg1_boolean, suppressee), 10014 10015 }); 10016 10017 // Create a suppression factory for functionBinary 10018 10019} 10020 10021 // default is that it is not this function, overriden in the subclass 10022 @Pure 10023 public boolean isLogicalOr() { 10024 return false; 10025 } 10026 10027/** 10028 * Represents the invariant {@code x = LogicalOr(y, z)} over three long 10029 * scalars. For logical operations, Daikon treats 0 as false and all other values as true. 10030 */ 10031public static class LogicalOrLong_xyz extends FunctionBinary { 10032 static final long serialVersionUID = 20031030L; 10033 10034 private static @Prototype LogicalOrLong_xyz proto = new @Prototype LogicalOrLong_xyz (); 10035 10036 /** Returns the prototype invariant for LogicalOrLong_xyz */ 10037 public static @Prototype LogicalOrLong_xyz get_proto() { 10038 return proto; 10039 } 10040 10041 @Override 10042 protected LogicalOrLong_xyz instantiate_dyn(@Prototype LogicalOrLong_xyz this, PptSlice slice) { 10043 return new LogicalOrLong_xyz (slice); 10044 } 10045 10046 private LogicalOrLong_xyz (PptSlice slice) { 10047 super(slice); 10048 } 10049 10050 public @Prototype LogicalOrLong_xyz () { 10051 super(); 10052 } 10053 10054 private static String[] method_name = new String[] {"", " || ", ""}; 10055 10056 @Override 10057 public String[] get_method_name(@GuardSatisfied LogicalOrLong_xyz this) { 10058 return method_name; 10059 } 10060 10061 private static int function_id = -1; 10062 10063 @Override 10064 public int get_function_id() { 10065 return function_id; 10066 } 10067 10068 @Override 10069 public void set_function_id(int function_id) { 10070 assert LogicalOrLong_xyz.function_id == -1; 10071 LogicalOrLong_xyz.function_id = function_id; 10072 } 10073 10074 private static int var_order = 1; 10075 10076 @Override 10077 public int get_var_order(@GuardSatisfied LogicalOrLong_xyz this) { 10078 return var_order; 10079 } 10080 10081 @Pure 10082 @Override 10083 public boolean is_symmetric() { 10084 10085 return true; 10086 } 10087 10088 @Override 10089 10090 public long func(long y, long z) { 10091 10092 if ((y < 0) || (y > 1)) { 10093 throw new ArithmeticException("arg1 (" + y + ") is not boolean "); 10094 } 10095 if ((z < 0) || (z > 1)) { 10096 throw new ArithmeticException("arg2 (" + z + ") is not boolean "); 10097 } 10098 10099 return (((y != 0) || ( z != 0)) ? 1 : 0); 10100 } 10101 10102 @Override 10103 public InvariantStatus check_modified(long x, long y, 10104 long z, int count) { 10105 return check_ordered(x, y, z, count); 10106 } 10107 10108 @Override 10109 public InvariantStatus add_modified(long x, long y, 10110 long z, int count) { 10111 if (Debug.logDetail()) { 10112 log("result=%s, arg1=%s, arg2=%s", x, y, z); 10113 } 10114 return add_ordered(x, y, z, count); 10115 } 10116 10117 @Pure 10118 @Override 10119 public boolean isLogicalOr() { 10120 return true; 10121 } 10122 10123 /** Returns a list of non-instantiating suppressions for this invariant. */ 10124 @Pure 10125 @Override 10126 public @Nullable NISuppressionSet get_ni_suppressions() { 10127 if (NIS.dkconfig_enabled && dkconfig_enabled) { 10128 return suppressions; 10129 } else { 10130 return null; 10131 } 10132 } 10133 10134 /** definition of this invariant (the suppressee) */ 10135 private static NISuppressee suppressee = new NISuppressee(LogicalOrLong_xyz.class, 3); 10136 10137 // suppressor definitions (used below) 10138 private static NISuppressor result_eq_arg1 = 10139 new NISuppressor(0, 1, IntEqual.class); 10140 private static NISuppressor result_eq_arg2 = 10141 new NISuppressor(0, 2, IntEqual.class); 10142 private static NISuppressor arg1_eq_arg2 = 10143 new NISuppressor(1, 2, IntEqual.class); 10144 10145 private static NISuppressor result_lt_arg1 = 10146 new NISuppressor(0, 1, IntLessThan.class); 10147 private static NISuppressor result_lt_arg2 = 10148 new NISuppressor(0, 2, IntLessThan.class); 10149 private static NISuppressor arg1_lt_arg2 = 10150 new NISuppressor(1, 2, IntLessThan.class); 10151 private static NISuppressor arg2_lt_arg1 = 10152 new NISuppressor(2, 1, IntLessThan.class); 10153 10154 private static NISuppressor result_le_arg1 = 10155 new NISuppressor(0, 1, IntLessEqual.class); 10156 private static NISuppressor result_le_arg2 = 10157 new NISuppressor(0, 2, IntLessEqual.class); 10158 private static NISuppressor arg1_le_arg2 = 10159 new NISuppressor(1, 2, IntLessEqual.class); 10160 private static NISuppressor arg2_le_arg1 = 10161 new NISuppressor(2, 1, IntLessEqual.class); 10162 10163 private static NISuppressor result_track0_arg1 = 10164 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 10165 private static NISuppressor result_track0_arg2 = 10166 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 10167 private static NISuppressor arg1_track0_arg2 = 10168 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 10169 private static NISuppressor arg1_track0_result = 10170 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 10171 private static NISuppressor arg2_track0_result = 10172 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 10173 private static NISuppressor arg2_track0_arg1 = 10174 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 10175 10176 private static NISuppressor result_eq_1 = 10177 new NISuppressor(0, RangeInt.EqualOne.class); 10178 private static NISuppressor arg1_eq_1 = 10179 new NISuppressor(1, RangeInt.EqualOne.class); 10180 private static NISuppressor arg2_eq_1 = 10181 new NISuppressor(2, RangeInt.EqualOne.class); 10182 10183 private static NISuppressor result_eq_0 = 10184 new NISuppressor(0, RangeInt.EqualZero.class); 10185 private static NISuppressor arg1_eq_0 = 10186 new NISuppressor(1, RangeInt.EqualZero.class); 10187 private static NISuppressor arg2_eq_0 = 10188 new NISuppressor(2, RangeInt.EqualZero.class); 10189 10190 private static NISuppressor result_ne_0 = 10191 new NISuppressor(0, NonZero.class); 10192 private static NISuppressor arg1_ne_0 = 10193 new NISuppressor(1, NonZero.class); 10194 private static NISuppressor arg2_ne_0 = 10195 new NISuppressor(2, NonZero.class); 10196 10197 private static NISuppressor result_ge_0 = 10198 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 10199 private static NISuppressor arg1_ge_0 = 10200 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 10201 private static NISuppressor arg2_ge_0 = 10202 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 10203 10204 private static NISuppressor result_ge_64 = 10205 new NISuppressor(0, RangeInt.GreaterEqual64.class); 10206 private static NISuppressor arg1_ge_64 = 10207 new NISuppressor(1, RangeInt.GreaterEqual64.class); 10208 private static NISuppressor arg2_ge_64 = 10209 new NISuppressor(2, RangeInt.GreaterEqual64.class); 10210 10211 private static NISuppressor result_boolean = 10212 new NISuppressor(0, RangeInt.BooleanVal.class); 10213 private static NISuppressor arg1_boolean = 10214 new NISuppressor(1, RangeInt.BooleanVal.class); 10215 private static NISuppressor arg2_boolean = 10216 new NISuppressor(2, RangeInt.BooleanVal.class); 10217 10218 private static NISuppressor result_even = 10219 new NISuppressor(0, RangeInt.Even.class); 10220 private static NISuppressor arg1_even = 10221 new NISuppressor(1, RangeInt.Even.class); 10222 private static NISuppressor arg2_even = 10223 new NISuppressor(2, RangeInt.Even.class); 10224 10225 private static NISuppressor result_power2 = 10226 new NISuppressor(0, RangeInt.PowerOfTwo.class); 10227 private static NISuppressor arg1_power2 = 10228 new NISuppressor(1, RangeInt.PowerOfTwo.class); 10229 private static NISuppressor arg2_power2 = 10230 new NISuppressor(2, RangeInt.PowerOfTwo.class); 10231 10232 private static NISuppressor result_and0_arg1 = 10233 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 10234 private static NISuppressor result_and0_arg2 = 10235 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 10236 private static NISuppressor arg1_and0_arg2 = 10237 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 10238 10239 // The arguments to bitwise subset are backwards from what one 10240 // might expect. The second argument is a subset of the first 10241 // argument 10242 private static NISuppressor arg1_bw_subset_arg2 = 10243 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 10244 private static NISuppressor arg2_bw_subset_arg1 = 10245 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 10246 10247 private static NISuppressor result_shift0_arg1 = 10248 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 10249 private static NISuppressor result_shift0_arg2 = 10250 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 10251 private static NISuppressor arg1_shift0_arg2 = 10252 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 10253 10254 private static NISuppressor arg2_divides_arg1 = 10255 new NISuppressor(1, 2, NumericInt.Divides.class); 10256 private static NISuppressor arg1_divides_arg2 = 10257 new NISuppressor(2, 1, NumericInt.Divides.class); 10258 10259 private static NISuppressor arg2_valid_shift = 10260 new NISuppressor(2, RangeInt.Bound0_63.class); 10261 10262 private static NISuppressionSet suppressions = 10263 new NISuppressionSet( 10264 new NISuppression[] { 10265 10266 // Note that 10267 // x == y && y == z does NOT imply x == z because of possibly 10268 // missing values. For example: 10269 // 10270 // Sample X Y Z 10271 // 1 1 1 missing 10272 // 2 0 missing 1 10273 // 3 missing 0 0 10274 // 10275 // The best solution seems to be to include all three 10276 // equalities for the suppression 10277 10278 // (r == y) && (y == z) && (r == z) && (r is boolean) 10279 // ==> r = y | z 10280 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 10281 result_boolean, suppressee), 10282 10283 // (r == y) && (z == 0) && (r is boolean) ==> r = y | z 10284 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_0, 10285 suppressee), 10286 10287 // (r == z) && (y == 0) && (r is boolean) ==> r = y | z 10288 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_0, 10289 suppressee), 10290 10291 // (r == 1) && (y == 1) && (z boolean) 10292 new NISuppression(result_eq_1, arg1_eq_1, arg2_boolean, suppressee), 10293 10294 // (r == 1) && (z == 1) && (y boolean) 10295 new NISuppression(result_eq_1, arg2_eq_1, arg1_boolean, suppressee), 10296 10297 }); 10298 10299 // Create a suppression factory for functionBinary 10300 10301} 10302 10303/** 10304 * Represents the invariant {@code y = LogicalOr(x, z)} over three long 10305 * scalars. For logical operations, Daikon treats 0 as false and all other values as true. 10306 */ 10307public static class LogicalOrLong_yxz extends FunctionBinary { 10308 static final long serialVersionUID = 20031030L; 10309 10310 private static @Prototype LogicalOrLong_yxz proto = new @Prototype LogicalOrLong_yxz (); 10311 10312 /** Returns the prototype invariant for LogicalOrLong_yxz */ 10313 public static @Prototype LogicalOrLong_yxz get_proto() { 10314 return proto; 10315 } 10316 10317 @Override 10318 protected LogicalOrLong_yxz instantiate_dyn(@Prototype LogicalOrLong_yxz this, PptSlice slice) { 10319 return new LogicalOrLong_yxz (slice); 10320 } 10321 10322 private LogicalOrLong_yxz (PptSlice slice) { 10323 super(slice); 10324 } 10325 10326 public @Prototype LogicalOrLong_yxz () { 10327 super(); 10328 } 10329 10330 private static String[] method_name = new String[] {"", " || ", ""}; 10331 10332 @Override 10333 public String[] get_method_name(@GuardSatisfied LogicalOrLong_yxz this) { 10334 return method_name; 10335 } 10336 10337 private static int function_id = -1; 10338 10339 @Override 10340 public int get_function_id() { 10341 return function_id; 10342 } 10343 10344 @Override 10345 public void set_function_id(int function_id) { 10346 assert LogicalOrLong_yxz.function_id == -1; 10347 LogicalOrLong_yxz.function_id = function_id; 10348 } 10349 10350 private static int var_order = 2; 10351 10352 @Override 10353 public int get_var_order(@GuardSatisfied LogicalOrLong_yxz this) { 10354 return var_order; 10355 } 10356 10357 @Pure 10358 @Override 10359 public boolean is_symmetric() { 10360 10361 return true; 10362 } 10363 10364 @Override 10365 10366 public long func(long x, long z) { 10367 10368 if ((x < 0) || (x > 1)) { 10369 throw new ArithmeticException("arg1 (" + x + ") is not boolean "); 10370 } 10371 if ((z < 0) || (z > 1)) { 10372 throw new ArithmeticException("arg2 (" + z + ") is not boolean "); 10373 } 10374 10375 return (((x != 0) || ( z != 0)) ? 1 : 0); 10376 } 10377 10378 @Override 10379 public InvariantStatus check_modified(long x, long y, 10380 long z, int count) { 10381 return check_ordered(y, x, z, count); 10382 } 10383 10384 @Override 10385 public InvariantStatus add_modified(long x, long y, 10386 long z, int count) { 10387 if (Debug.logDetail()) { 10388 log("result=%s, arg1=%s, arg2=%s", y, x, z); 10389 } 10390 return add_ordered(y, x, z, count); 10391 } 10392 10393 @Pure 10394 @Override 10395 public boolean isLogicalOr() { 10396 return true; 10397 } 10398 10399 /** Returns a list of non-instantiating suppressions for this invariant. */ 10400 @Pure 10401 @Override 10402 public @Nullable NISuppressionSet get_ni_suppressions() { 10403 if (NIS.dkconfig_enabled && dkconfig_enabled) { 10404 return suppressions; 10405 } else { 10406 return null; 10407 } 10408 } 10409 10410 /** definition of this invariant (the suppressee) */ 10411 private static NISuppressee suppressee = new NISuppressee(LogicalOrLong_yxz.class, 3); 10412 10413 // suppressor definitions (used below) 10414 private static NISuppressor result_eq_arg1 = 10415 new NISuppressor(1, 0, IntEqual.class); 10416 private static NISuppressor result_eq_arg2 = 10417 new NISuppressor(1, 2, IntEqual.class); 10418 private static NISuppressor arg1_eq_arg2 = 10419 new NISuppressor(0, 2, IntEqual.class); 10420 10421 private static NISuppressor result_lt_arg1 = 10422 new NISuppressor(1, 0, IntLessThan.class); 10423 private static NISuppressor result_lt_arg2 = 10424 new NISuppressor(1, 2, IntLessThan.class); 10425 private static NISuppressor arg1_lt_arg2 = 10426 new NISuppressor(0, 2, IntLessThan.class); 10427 private static NISuppressor arg2_lt_arg1 = 10428 new NISuppressor(2, 0, IntLessThan.class); 10429 10430 private static NISuppressor result_le_arg1 = 10431 new NISuppressor(1, 0, IntLessEqual.class); 10432 private static NISuppressor result_le_arg2 = 10433 new NISuppressor(1, 2, IntLessEqual.class); 10434 private static NISuppressor arg1_le_arg2 = 10435 new NISuppressor(0, 2, IntLessEqual.class); 10436 private static NISuppressor arg2_le_arg1 = 10437 new NISuppressor(2, 0, IntLessEqual.class); 10438 10439 private static NISuppressor result_track0_arg1 = 10440 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 10441 private static NISuppressor result_track0_arg2 = 10442 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 10443 private static NISuppressor arg1_track0_arg2 = 10444 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 10445 private static NISuppressor arg1_track0_result = 10446 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 10447 private static NISuppressor arg2_track0_result = 10448 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 10449 private static NISuppressor arg2_track0_arg1 = 10450 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 10451 10452 private static NISuppressor result_eq_1 = 10453 new NISuppressor(1, RangeInt.EqualOne.class); 10454 private static NISuppressor arg1_eq_1 = 10455 new NISuppressor(0, RangeInt.EqualOne.class); 10456 private static NISuppressor arg2_eq_1 = 10457 new NISuppressor(2, RangeInt.EqualOne.class); 10458 10459 private static NISuppressor result_eq_0 = 10460 new NISuppressor(1, RangeInt.EqualZero.class); 10461 private static NISuppressor arg1_eq_0 = 10462 new NISuppressor(0, RangeInt.EqualZero.class); 10463 private static NISuppressor arg2_eq_0 = 10464 new NISuppressor(2, RangeInt.EqualZero.class); 10465 10466 private static NISuppressor result_ne_0 = 10467 new NISuppressor(1, NonZero.class); 10468 private static NISuppressor arg1_ne_0 = 10469 new NISuppressor(0, NonZero.class); 10470 private static NISuppressor arg2_ne_0 = 10471 new NISuppressor(2, NonZero.class); 10472 10473 private static NISuppressor result_ge_0 = 10474 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 10475 private static NISuppressor arg1_ge_0 = 10476 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 10477 private static NISuppressor arg2_ge_0 = 10478 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 10479 10480 private static NISuppressor result_ge_64 = 10481 new NISuppressor(1, RangeInt.GreaterEqual64.class); 10482 private static NISuppressor arg1_ge_64 = 10483 new NISuppressor(0, RangeInt.GreaterEqual64.class); 10484 private static NISuppressor arg2_ge_64 = 10485 new NISuppressor(2, RangeInt.GreaterEqual64.class); 10486 10487 private static NISuppressor result_boolean = 10488 new NISuppressor(1, RangeInt.BooleanVal.class); 10489 private static NISuppressor arg1_boolean = 10490 new NISuppressor(0, RangeInt.BooleanVal.class); 10491 private static NISuppressor arg2_boolean = 10492 new NISuppressor(2, RangeInt.BooleanVal.class); 10493 10494 private static NISuppressor result_even = 10495 new NISuppressor(1, RangeInt.Even.class); 10496 private static NISuppressor arg1_even = 10497 new NISuppressor(0, RangeInt.Even.class); 10498 private static NISuppressor arg2_even = 10499 new NISuppressor(2, RangeInt.Even.class); 10500 10501 private static NISuppressor result_power2 = 10502 new NISuppressor(1, RangeInt.PowerOfTwo.class); 10503 private static NISuppressor arg1_power2 = 10504 new NISuppressor(0, RangeInt.PowerOfTwo.class); 10505 private static NISuppressor arg2_power2 = 10506 new NISuppressor(2, RangeInt.PowerOfTwo.class); 10507 10508 private static NISuppressor result_and0_arg1 = 10509 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 10510 private static NISuppressor result_and0_arg2 = 10511 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 10512 private static NISuppressor arg1_and0_arg2 = 10513 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 10514 10515 // The arguments to bitwise subset are backwards from what one 10516 // might expect. The second argument is a subset of the first 10517 // argument 10518 private static NISuppressor arg1_bw_subset_arg2 = 10519 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 10520 private static NISuppressor arg2_bw_subset_arg1 = 10521 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 10522 10523 private static NISuppressor result_shift0_arg1 = 10524 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 10525 private static NISuppressor result_shift0_arg2 = 10526 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 10527 private static NISuppressor arg1_shift0_arg2 = 10528 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 10529 10530 private static NISuppressor arg2_divides_arg1 = 10531 new NISuppressor(0, 2, NumericInt.Divides.class); 10532 private static NISuppressor arg1_divides_arg2 = 10533 new NISuppressor(2, 0, NumericInt.Divides.class); 10534 10535 private static NISuppressor arg2_valid_shift = 10536 new NISuppressor(2, RangeInt.Bound0_63.class); 10537 10538 private static NISuppressionSet suppressions = 10539 new NISuppressionSet( 10540 new NISuppression[] { 10541 10542 // Note that 10543 // x == y && y == z does NOT imply x == z because of possibly 10544 // missing values. For example: 10545 // 10546 // Sample X Y Z 10547 // 1 1 1 missing 10548 // 2 0 missing 1 10549 // 3 missing 0 0 10550 // 10551 // The best solution seems to be to include all three 10552 // equalities for the suppression 10553 10554 // (r == x) && (x == z) && (r == z) && (r is boolean) 10555 // ==> r = x | z 10556 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 10557 result_boolean, suppressee), 10558 10559 // (r == x) && (z == 0) && (r is boolean) ==> r = x | z 10560 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_0, 10561 suppressee), 10562 10563 // (r == z) && (x == 0) && (r is boolean) ==> r = x | z 10564 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_0, 10565 suppressee), 10566 10567 // (r == 1) && (x == 1) && (z boolean) 10568 new NISuppression(result_eq_1, arg1_eq_1, arg2_boolean, suppressee), 10569 10570 // (r == 1) && (z == 1) && (x boolean) 10571 new NISuppression(result_eq_1, arg2_eq_1, arg1_boolean, suppressee), 10572 10573 }); 10574 10575 // Create a suppression factory for functionBinary 10576 10577} 10578 10579/** 10580 * Represents the invariant {@code z = LogicalOr(x, y)} over three long 10581 * scalars. For logical operations, Daikon treats 0 as false and all other values as true. 10582 */ 10583public static class LogicalOrLong_zxy extends FunctionBinary { 10584 static final long serialVersionUID = 20031030L; 10585 10586 private static @Prototype LogicalOrLong_zxy proto = new @Prototype LogicalOrLong_zxy (); 10587 10588 /** Returns the prototype invariant for LogicalOrLong_zxy */ 10589 public static @Prototype LogicalOrLong_zxy get_proto() { 10590 return proto; 10591 } 10592 10593 @Override 10594 protected LogicalOrLong_zxy instantiate_dyn(@Prototype LogicalOrLong_zxy this, PptSlice slice) { 10595 return new LogicalOrLong_zxy (slice); 10596 } 10597 10598 private LogicalOrLong_zxy (PptSlice slice) { 10599 super(slice); 10600 } 10601 10602 public @Prototype LogicalOrLong_zxy () { 10603 super(); 10604 } 10605 10606 private static String[] method_name = new String[] {"", " || ", ""}; 10607 10608 @Override 10609 public String[] get_method_name(@GuardSatisfied LogicalOrLong_zxy this) { 10610 return method_name; 10611 } 10612 10613 private static int function_id = -1; 10614 10615 @Override 10616 public int get_function_id() { 10617 return function_id; 10618 } 10619 10620 @Override 10621 public void set_function_id(int function_id) { 10622 assert LogicalOrLong_zxy.function_id == -1; 10623 LogicalOrLong_zxy.function_id = function_id; 10624 } 10625 10626 private static int var_order = 3; 10627 10628 @Override 10629 public int get_var_order(@GuardSatisfied LogicalOrLong_zxy this) { 10630 return var_order; 10631 } 10632 10633 @Pure 10634 @Override 10635 public boolean is_symmetric() { 10636 10637 return true; 10638 } 10639 10640 @Override 10641 10642 public long func(long x, long y) { 10643 10644 if ((x < 0) || (x > 1)) { 10645 throw new ArithmeticException("arg1 (" + x + ") is not boolean "); 10646 } 10647 if ((y < 0) || (y > 1)) { 10648 throw new ArithmeticException("arg2 (" + y + ") is not boolean "); 10649 } 10650 10651 return (((x != 0) || ( y != 0)) ? 1 : 0); 10652 } 10653 10654 @Override 10655 public InvariantStatus check_modified(long x, long y, 10656 long z, int count) { 10657 return check_ordered(z, x, y, count); 10658 } 10659 10660 @Override 10661 public InvariantStatus add_modified(long x, long y, 10662 long z, int count) { 10663 if (Debug.logDetail()) { 10664 log("result=%s, arg1=%s, arg2=%s", z, x, y); 10665 } 10666 return add_ordered(z, x, y, count); 10667 } 10668 10669 @Pure 10670 @Override 10671 public boolean isLogicalOr() { 10672 return true; 10673 } 10674 10675 /** Returns a list of non-instantiating suppressions for this invariant. */ 10676 @Pure 10677 @Override 10678 public @Nullable NISuppressionSet get_ni_suppressions() { 10679 if (NIS.dkconfig_enabled && dkconfig_enabled) { 10680 return suppressions; 10681 } else { 10682 return null; 10683 } 10684 } 10685 10686 /** definition of this invariant (the suppressee) */ 10687 private static NISuppressee suppressee = new NISuppressee(LogicalOrLong_zxy.class, 3); 10688 10689 // suppressor definitions (used below) 10690 private static NISuppressor result_eq_arg1 = 10691 new NISuppressor(2, 0, IntEqual.class); 10692 private static NISuppressor result_eq_arg2 = 10693 new NISuppressor(2, 1, IntEqual.class); 10694 private static NISuppressor arg1_eq_arg2 = 10695 new NISuppressor(0, 1, IntEqual.class); 10696 10697 private static NISuppressor result_lt_arg1 = 10698 new NISuppressor(2, 0, IntLessThan.class); 10699 private static NISuppressor result_lt_arg2 = 10700 new NISuppressor(2, 1, IntLessThan.class); 10701 private static NISuppressor arg1_lt_arg2 = 10702 new NISuppressor(0, 1, IntLessThan.class); 10703 private static NISuppressor arg2_lt_arg1 = 10704 new NISuppressor(1, 0, IntLessThan.class); 10705 10706 private static NISuppressor result_le_arg1 = 10707 new NISuppressor(2, 0, IntLessEqual.class); 10708 private static NISuppressor result_le_arg2 = 10709 new NISuppressor(2, 1, IntLessEqual.class); 10710 private static NISuppressor arg1_le_arg2 = 10711 new NISuppressor(0, 1, IntLessEqual.class); 10712 private static NISuppressor arg2_le_arg1 = 10713 new NISuppressor(1, 0, IntLessEqual.class); 10714 10715 private static NISuppressor result_track0_arg1 = 10716 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 10717 private static NISuppressor result_track0_arg2 = 10718 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 10719 private static NISuppressor arg1_track0_arg2 = 10720 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 10721 private static NISuppressor arg1_track0_result = 10722 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 10723 private static NISuppressor arg2_track0_result = 10724 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 10725 private static NISuppressor arg2_track0_arg1 = 10726 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 10727 10728 private static NISuppressor result_eq_1 = 10729 new NISuppressor(2, RangeInt.EqualOne.class); 10730 private static NISuppressor arg1_eq_1 = 10731 new NISuppressor(0, RangeInt.EqualOne.class); 10732 private static NISuppressor arg2_eq_1 = 10733 new NISuppressor(1, RangeInt.EqualOne.class); 10734 10735 private static NISuppressor result_eq_0 = 10736 new NISuppressor(2, RangeInt.EqualZero.class); 10737 private static NISuppressor arg1_eq_0 = 10738 new NISuppressor(0, RangeInt.EqualZero.class); 10739 private static NISuppressor arg2_eq_0 = 10740 new NISuppressor(1, RangeInt.EqualZero.class); 10741 10742 private static NISuppressor result_ne_0 = 10743 new NISuppressor(2, NonZero.class); 10744 private static NISuppressor arg1_ne_0 = 10745 new NISuppressor(0, NonZero.class); 10746 private static NISuppressor arg2_ne_0 = 10747 new NISuppressor(1, NonZero.class); 10748 10749 private static NISuppressor result_ge_0 = 10750 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 10751 private static NISuppressor arg1_ge_0 = 10752 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 10753 private static NISuppressor arg2_ge_0 = 10754 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 10755 10756 private static NISuppressor result_ge_64 = 10757 new NISuppressor(2, RangeInt.GreaterEqual64.class); 10758 private static NISuppressor arg1_ge_64 = 10759 new NISuppressor(0, RangeInt.GreaterEqual64.class); 10760 private static NISuppressor arg2_ge_64 = 10761 new NISuppressor(1, RangeInt.GreaterEqual64.class); 10762 10763 private static NISuppressor result_boolean = 10764 new NISuppressor(2, RangeInt.BooleanVal.class); 10765 private static NISuppressor arg1_boolean = 10766 new NISuppressor(0, RangeInt.BooleanVal.class); 10767 private static NISuppressor arg2_boolean = 10768 new NISuppressor(1, RangeInt.BooleanVal.class); 10769 10770 private static NISuppressor result_even = 10771 new NISuppressor(2, RangeInt.Even.class); 10772 private static NISuppressor arg1_even = 10773 new NISuppressor(0, RangeInt.Even.class); 10774 private static NISuppressor arg2_even = 10775 new NISuppressor(1, RangeInt.Even.class); 10776 10777 private static NISuppressor result_power2 = 10778 new NISuppressor(2, RangeInt.PowerOfTwo.class); 10779 private static NISuppressor arg1_power2 = 10780 new NISuppressor(0, RangeInt.PowerOfTwo.class); 10781 private static NISuppressor arg2_power2 = 10782 new NISuppressor(1, RangeInt.PowerOfTwo.class); 10783 10784 private static NISuppressor result_and0_arg1 = 10785 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 10786 private static NISuppressor result_and0_arg2 = 10787 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 10788 private static NISuppressor arg1_and0_arg2 = 10789 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 10790 10791 // The arguments to bitwise subset are backwards from what one 10792 // might expect. The second argument is a subset of the first 10793 // argument 10794 private static NISuppressor arg1_bw_subset_arg2 = 10795 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 10796 private static NISuppressor arg2_bw_subset_arg1 = 10797 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 10798 10799 private static NISuppressor result_shift0_arg1 = 10800 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 10801 private static NISuppressor result_shift0_arg2 = 10802 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 10803 private static NISuppressor arg1_shift0_arg2 = 10804 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 10805 10806 private static NISuppressor arg2_divides_arg1 = 10807 new NISuppressor(0, 1, NumericInt.Divides.class); 10808 private static NISuppressor arg1_divides_arg2 = 10809 new NISuppressor(1, 0, NumericInt.Divides.class); 10810 10811 private static NISuppressor arg2_valid_shift = 10812 new NISuppressor(1, RangeInt.Bound0_63.class); 10813 10814 private static NISuppressionSet suppressions = 10815 new NISuppressionSet( 10816 new NISuppression[] { 10817 10818 // Note that 10819 // x == y && y == z does NOT imply x == z because of possibly 10820 // missing values. For example: 10821 // 10822 // Sample X Y Z 10823 // 1 1 1 missing 10824 // 2 0 missing 1 10825 // 3 missing 0 0 10826 // 10827 // The best solution seems to be to include all three 10828 // equalities for the suppression 10829 10830 // (r == x) && (x == y) && (r == y) && (r is boolean) 10831 // ==> r = x | y 10832 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 10833 result_boolean, suppressee), 10834 10835 // (r == x) && (y == 0) && (r is boolean) ==> r = x | y 10836 new NISuppression(result_eq_arg1, result_boolean, arg2_eq_0, 10837 suppressee), 10838 10839 // (r == y) && (x == 0) && (r is boolean) ==> r = x | y 10840 new NISuppression(result_eq_arg2, result_boolean, arg1_eq_0, 10841 suppressee), 10842 10843 // (r == 1) && (x == 1) && (y boolean) 10844 new NISuppression(result_eq_1, arg1_eq_1, arg2_boolean, suppressee), 10845 10846 // (r == 1) && (y == 1) && (x boolean) 10847 new NISuppression(result_eq_1, arg2_eq_1, arg1_boolean, suppressee), 10848 10849 }); 10850 10851 // Create a suppression factory for functionBinary 10852 10853} 10854 10855 // #define EQUALITY_SUPPRESS 1 10856 10857 // default is that it is not this function, overriden in the subclass 10858 @Pure 10859 public boolean isGcd() { 10860 return false; 10861 } 10862 10863/** 10864 * Represents the invariant {@code x = Gcd(y, z)} over three long 10865 * scalars. 10866 */ 10867public static class GcdLong_xyz extends FunctionBinary { 10868 static final long serialVersionUID = 20031030L; 10869 10870 private static @Prototype GcdLong_xyz proto = new @Prototype GcdLong_xyz (); 10871 10872 /** Returns the prototype invariant for GcdLong_xyz */ 10873 public static @Prototype GcdLong_xyz get_proto() { 10874 return proto; 10875 } 10876 10877 @Override 10878 protected GcdLong_xyz instantiate_dyn(@Prototype GcdLong_xyz this, PptSlice slice) { 10879 return new GcdLong_xyz (slice); 10880 } 10881 10882 private GcdLong_xyz (PptSlice slice) { 10883 super(slice); 10884 } 10885 10886 public @Prototype GcdLong_xyz () { 10887 super(); 10888 } 10889 10890 private static String[] method_name = new String[] {"org.plumelib.util.MathPlume.gcd(", ", ", ")"}; 10891 10892 @Override 10893 public String[] get_method_name(@GuardSatisfied GcdLong_xyz this) { 10894 return method_name; 10895 } 10896 10897 private static int function_id = -1; 10898 10899 @Override 10900 public int get_function_id() { 10901 return function_id; 10902 } 10903 10904 @Override 10905 public void set_function_id(int function_id) { 10906 assert GcdLong_xyz.function_id == -1; 10907 GcdLong_xyz.function_id = function_id; 10908 } 10909 10910 private static int var_order = 1; 10911 10912 @Override 10913 public int get_var_order(@GuardSatisfied GcdLong_xyz this) { 10914 return var_order; 10915 } 10916 10917 @Pure 10918 @Override 10919 public boolean is_symmetric() { 10920 10921 return true; 10922 } 10923 10924 @Override 10925 10926 public long func(long y, long z) { 10927 10928 return MathPlume.gcd(y, z); 10929 } 10930 10931 @Override 10932 public InvariantStatus check_modified(long x, long y, 10933 long z, int count) { 10934 return check_ordered(x, y, z, count); 10935 } 10936 10937 @Override 10938 public InvariantStatus add_modified(long x, long y, 10939 long z, int count) { 10940 if (Debug.logDetail()) { 10941 log("result=%s, arg1=%s, arg2=%s", x, y, z); 10942 } 10943 return add_ordered(x, y, z, count); 10944 } 10945 10946 @Pure 10947 @Override 10948 public boolean isGcd() { 10949 return true; 10950 } 10951 10952 /** Returns a list of non-instantiating suppressions for this invariant. */ 10953 @Pure 10954 @Override 10955 public @Nullable NISuppressionSet get_ni_suppressions() { 10956 if (NIS.dkconfig_enabled && dkconfig_enabled) { 10957 return suppressions; 10958 } else { 10959 return null; 10960 } 10961 } 10962 10963 /** definition of this invariant (the suppressee) */ 10964 private static NISuppressee suppressee = new NISuppressee(GcdLong_xyz.class, 3); 10965 10966 // suppressor definitions (used below) 10967 private static NISuppressor result_eq_arg1 = 10968 new NISuppressor(0, 1, IntEqual.class); 10969 private static NISuppressor result_eq_arg2 = 10970 new NISuppressor(0, 2, IntEqual.class); 10971 private static NISuppressor arg1_eq_arg2 = 10972 new NISuppressor(1, 2, IntEqual.class); 10973 10974 private static NISuppressor result_lt_arg1 = 10975 new NISuppressor(0, 1, IntLessThan.class); 10976 private static NISuppressor result_lt_arg2 = 10977 new NISuppressor(0, 2, IntLessThan.class); 10978 private static NISuppressor arg1_lt_arg2 = 10979 new NISuppressor(1, 2, IntLessThan.class); 10980 private static NISuppressor arg2_lt_arg1 = 10981 new NISuppressor(2, 1, IntLessThan.class); 10982 10983 private static NISuppressor result_le_arg1 = 10984 new NISuppressor(0, 1, IntLessEqual.class); 10985 private static NISuppressor result_le_arg2 = 10986 new NISuppressor(0, 2, IntLessEqual.class); 10987 private static NISuppressor arg1_le_arg2 = 10988 new NISuppressor(1, 2, IntLessEqual.class); 10989 private static NISuppressor arg2_le_arg1 = 10990 new NISuppressor(2, 1, IntLessEqual.class); 10991 10992 private static NISuppressor result_track0_arg1 = 10993 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 10994 private static NISuppressor result_track0_arg2 = 10995 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 10996 private static NISuppressor arg1_track0_arg2 = 10997 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 10998 private static NISuppressor arg1_track0_result = 10999 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 11000 private static NISuppressor arg2_track0_result = 11001 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 11002 private static NISuppressor arg2_track0_arg1 = 11003 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 11004 11005 private static NISuppressor result_eq_1 = 11006 new NISuppressor(0, RangeInt.EqualOne.class); 11007 private static NISuppressor arg1_eq_1 = 11008 new NISuppressor(1, RangeInt.EqualOne.class); 11009 private static NISuppressor arg2_eq_1 = 11010 new NISuppressor(2, RangeInt.EqualOne.class); 11011 11012 private static NISuppressor result_eq_0 = 11013 new NISuppressor(0, RangeInt.EqualZero.class); 11014 private static NISuppressor arg1_eq_0 = 11015 new NISuppressor(1, RangeInt.EqualZero.class); 11016 private static NISuppressor arg2_eq_0 = 11017 new NISuppressor(2, RangeInt.EqualZero.class); 11018 11019 private static NISuppressor result_ne_0 = 11020 new NISuppressor(0, NonZero.class); 11021 private static NISuppressor arg1_ne_0 = 11022 new NISuppressor(1, NonZero.class); 11023 private static NISuppressor arg2_ne_0 = 11024 new NISuppressor(2, NonZero.class); 11025 11026 private static NISuppressor result_ge_0 = 11027 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 11028 private static NISuppressor arg1_ge_0 = 11029 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 11030 private static NISuppressor arg2_ge_0 = 11031 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 11032 11033 private static NISuppressor result_ge_64 = 11034 new NISuppressor(0, RangeInt.GreaterEqual64.class); 11035 private static NISuppressor arg1_ge_64 = 11036 new NISuppressor(1, RangeInt.GreaterEqual64.class); 11037 private static NISuppressor arg2_ge_64 = 11038 new NISuppressor(2, RangeInt.GreaterEqual64.class); 11039 11040 private static NISuppressor result_boolean = 11041 new NISuppressor(0, RangeInt.BooleanVal.class); 11042 private static NISuppressor arg1_boolean = 11043 new NISuppressor(1, RangeInt.BooleanVal.class); 11044 private static NISuppressor arg2_boolean = 11045 new NISuppressor(2, RangeInt.BooleanVal.class); 11046 11047 private static NISuppressor result_even = 11048 new NISuppressor(0, RangeInt.Even.class); 11049 private static NISuppressor arg1_even = 11050 new NISuppressor(1, RangeInt.Even.class); 11051 private static NISuppressor arg2_even = 11052 new NISuppressor(2, RangeInt.Even.class); 11053 11054 private static NISuppressor result_power2 = 11055 new NISuppressor(0, RangeInt.PowerOfTwo.class); 11056 private static NISuppressor arg1_power2 = 11057 new NISuppressor(1, RangeInt.PowerOfTwo.class); 11058 private static NISuppressor arg2_power2 = 11059 new NISuppressor(2, RangeInt.PowerOfTwo.class); 11060 11061 private static NISuppressor result_and0_arg1 = 11062 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 11063 private static NISuppressor result_and0_arg2 = 11064 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 11065 private static NISuppressor arg1_and0_arg2 = 11066 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 11067 11068 // The arguments to bitwise subset are backwards from what one 11069 // might expect. The second argument is a subset of the first 11070 // argument 11071 private static NISuppressor arg1_bw_subset_arg2 = 11072 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 11073 private static NISuppressor arg2_bw_subset_arg1 = 11074 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 11075 11076 private static NISuppressor result_shift0_arg1 = 11077 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 11078 private static NISuppressor result_shift0_arg2 = 11079 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 11080 private static NISuppressor arg1_shift0_arg2 = 11081 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 11082 11083 private static NISuppressor arg2_divides_arg1 = 11084 new NISuppressor(1, 2, NumericInt.Divides.class); 11085 private static NISuppressor arg1_divides_arg2 = 11086 new NISuppressor(2, 1, NumericInt.Divides.class); 11087 11088 private static NISuppressor arg2_valid_shift = 11089 new NISuppressor(2, RangeInt.Bound0_63.class); 11090 11091 // gcd (0, y) == y 11092 // gcd (0, 0) == 0 11093 // gcd (1, y) == 1 11094 11095 private static NISuppressionSet suppressions = 11096 new NISuppressionSet( 11097 new NISuppression[] { 11098 11099 // (r == y) && (y == z) && (r == z) && (r >= 0) 11100 // ==> r = Gcd (y, z) 11101 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 11102 result_ge_0, suppressee), 11103 11104 // (r == y) && (z == 0) && (r >= 0) ==> r = gcd (y, z) 11105 new NISuppression(result_eq_arg1, result_ge_0, arg2_eq_0, suppressee), 11106 11107 // (r == z) && (y == 0) && (r >= 0) ==> r = gcd (y, z) 11108 new NISuppression(result_eq_arg2, result_ge_0, arg1_eq_0, suppressee), 11109 11110 // (r == 1) && (z == 1) ==> r = gcd (y, art2) 11111 new NISuppression(result_eq_1, arg2_eq_1, suppressee), 11112 11113 // (r == 1) && (y == 1) ==> r = gcd (y, art2) 11114 new NISuppression(result_eq_1, arg1_eq_1, suppressee), 11115 11116 // (r == y) && (y divides z) && (r >= 0) 11117 new NISuppression(result_eq_arg1, arg1_divides_arg2, result_ge_0, suppressee), 11118 11119 // (r == z) && (z divides y) && (r >= 0) 11120 new NISuppression(result_eq_arg2, arg2_divides_arg1, result_ge_0, suppressee), 11121 11122 // (r == z) && (z boolean) && (z==0 ==> y==0) 11123 // 0 = gcd (y, 0) true when (y == 0) 11124 // 1 = gcd (y, 1) always true 11125 new NISuppression(result_eq_arg2, arg2_track0_arg1, arg2_boolean, 11126 suppressee), 11127 11128 // (r == y) && (y boolean) && (y==0 ==> z==0) 11129 // 0 = gcd (0, z), true if (z == 0) 11130 // 1 = gcd (1, z), always true 11131 new NISuppression(result_eq_arg1, arg1_boolean, arg1_track0_arg2, 11132 suppressee), 11133 11134 }); 11135 11136 // Create a suppression factory for functionBinary 11137 11138} 11139 11140/** 11141 * Represents the invariant {@code y = Gcd(x, z)} over three long 11142 * scalars. 11143 */ 11144public static class GcdLong_yxz extends FunctionBinary { 11145 static final long serialVersionUID = 20031030L; 11146 11147 private static @Prototype GcdLong_yxz proto = new @Prototype GcdLong_yxz (); 11148 11149 /** Returns the prototype invariant for GcdLong_yxz */ 11150 public static @Prototype GcdLong_yxz get_proto() { 11151 return proto; 11152 } 11153 11154 @Override 11155 protected GcdLong_yxz instantiate_dyn(@Prototype GcdLong_yxz this, PptSlice slice) { 11156 return new GcdLong_yxz (slice); 11157 } 11158 11159 private GcdLong_yxz (PptSlice slice) { 11160 super(slice); 11161 } 11162 11163 public @Prototype GcdLong_yxz () { 11164 super(); 11165 } 11166 11167 private static String[] method_name = new String[] {"org.plumelib.util.MathPlume.gcd(", ", ", ")"}; 11168 11169 @Override 11170 public String[] get_method_name(@GuardSatisfied GcdLong_yxz this) { 11171 return method_name; 11172 } 11173 11174 private static int function_id = -1; 11175 11176 @Override 11177 public int get_function_id() { 11178 return function_id; 11179 } 11180 11181 @Override 11182 public void set_function_id(int function_id) { 11183 assert GcdLong_yxz.function_id == -1; 11184 GcdLong_yxz.function_id = function_id; 11185 } 11186 11187 private static int var_order = 2; 11188 11189 @Override 11190 public int get_var_order(@GuardSatisfied GcdLong_yxz this) { 11191 return var_order; 11192 } 11193 11194 @Pure 11195 @Override 11196 public boolean is_symmetric() { 11197 11198 return true; 11199 } 11200 11201 @Override 11202 11203 public long func(long x, long z) { 11204 11205 return MathPlume.gcd(x, z); 11206 } 11207 11208 @Override 11209 public InvariantStatus check_modified(long x, long y, 11210 long z, int count) { 11211 return check_ordered(y, x, z, count); 11212 } 11213 11214 @Override 11215 public InvariantStatus add_modified(long x, long y, 11216 long z, int count) { 11217 if (Debug.logDetail()) { 11218 log("result=%s, arg1=%s, arg2=%s", y, x, z); 11219 } 11220 return add_ordered(y, x, z, count); 11221 } 11222 11223 @Pure 11224 @Override 11225 public boolean isGcd() { 11226 return true; 11227 } 11228 11229 /** Returns a list of non-instantiating suppressions for this invariant. */ 11230 @Pure 11231 @Override 11232 public @Nullable NISuppressionSet get_ni_suppressions() { 11233 if (NIS.dkconfig_enabled && dkconfig_enabled) { 11234 return suppressions; 11235 } else { 11236 return null; 11237 } 11238 } 11239 11240 /** definition of this invariant (the suppressee) */ 11241 private static NISuppressee suppressee = new NISuppressee(GcdLong_yxz.class, 3); 11242 11243 // suppressor definitions (used below) 11244 private static NISuppressor result_eq_arg1 = 11245 new NISuppressor(1, 0, IntEqual.class); 11246 private static NISuppressor result_eq_arg2 = 11247 new NISuppressor(1, 2, IntEqual.class); 11248 private static NISuppressor arg1_eq_arg2 = 11249 new NISuppressor(0, 2, IntEqual.class); 11250 11251 private static NISuppressor result_lt_arg1 = 11252 new NISuppressor(1, 0, IntLessThan.class); 11253 private static NISuppressor result_lt_arg2 = 11254 new NISuppressor(1, 2, IntLessThan.class); 11255 private static NISuppressor arg1_lt_arg2 = 11256 new NISuppressor(0, 2, IntLessThan.class); 11257 private static NISuppressor arg2_lt_arg1 = 11258 new NISuppressor(2, 0, IntLessThan.class); 11259 11260 private static NISuppressor result_le_arg1 = 11261 new NISuppressor(1, 0, IntLessEqual.class); 11262 private static NISuppressor result_le_arg2 = 11263 new NISuppressor(1, 2, IntLessEqual.class); 11264 private static NISuppressor arg1_le_arg2 = 11265 new NISuppressor(0, 2, IntLessEqual.class); 11266 private static NISuppressor arg2_le_arg1 = 11267 new NISuppressor(2, 0, IntLessEqual.class); 11268 11269 private static NISuppressor result_track0_arg1 = 11270 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 11271 private static NISuppressor result_track0_arg2 = 11272 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 11273 private static NISuppressor arg1_track0_arg2 = 11274 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 11275 private static NISuppressor arg1_track0_result = 11276 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 11277 private static NISuppressor arg2_track0_result = 11278 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 11279 private static NISuppressor arg2_track0_arg1 = 11280 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 11281 11282 private static NISuppressor result_eq_1 = 11283 new NISuppressor(1, RangeInt.EqualOne.class); 11284 private static NISuppressor arg1_eq_1 = 11285 new NISuppressor(0, RangeInt.EqualOne.class); 11286 private static NISuppressor arg2_eq_1 = 11287 new NISuppressor(2, RangeInt.EqualOne.class); 11288 11289 private static NISuppressor result_eq_0 = 11290 new NISuppressor(1, RangeInt.EqualZero.class); 11291 private static NISuppressor arg1_eq_0 = 11292 new NISuppressor(0, RangeInt.EqualZero.class); 11293 private static NISuppressor arg2_eq_0 = 11294 new NISuppressor(2, RangeInt.EqualZero.class); 11295 11296 private static NISuppressor result_ne_0 = 11297 new NISuppressor(1, NonZero.class); 11298 private static NISuppressor arg1_ne_0 = 11299 new NISuppressor(0, NonZero.class); 11300 private static NISuppressor arg2_ne_0 = 11301 new NISuppressor(2, NonZero.class); 11302 11303 private static NISuppressor result_ge_0 = 11304 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 11305 private static NISuppressor arg1_ge_0 = 11306 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 11307 private static NISuppressor arg2_ge_0 = 11308 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 11309 11310 private static NISuppressor result_ge_64 = 11311 new NISuppressor(1, RangeInt.GreaterEqual64.class); 11312 private static NISuppressor arg1_ge_64 = 11313 new NISuppressor(0, RangeInt.GreaterEqual64.class); 11314 private static NISuppressor arg2_ge_64 = 11315 new NISuppressor(2, RangeInt.GreaterEqual64.class); 11316 11317 private static NISuppressor result_boolean = 11318 new NISuppressor(1, RangeInt.BooleanVal.class); 11319 private static NISuppressor arg1_boolean = 11320 new NISuppressor(0, RangeInt.BooleanVal.class); 11321 private static NISuppressor arg2_boolean = 11322 new NISuppressor(2, RangeInt.BooleanVal.class); 11323 11324 private static NISuppressor result_even = 11325 new NISuppressor(1, RangeInt.Even.class); 11326 private static NISuppressor arg1_even = 11327 new NISuppressor(0, RangeInt.Even.class); 11328 private static NISuppressor arg2_even = 11329 new NISuppressor(2, RangeInt.Even.class); 11330 11331 private static NISuppressor result_power2 = 11332 new NISuppressor(1, RangeInt.PowerOfTwo.class); 11333 private static NISuppressor arg1_power2 = 11334 new NISuppressor(0, RangeInt.PowerOfTwo.class); 11335 private static NISuppressor arg2_power2 = 11336 new NISuppressor(2, RangeInt.PowerOfTwo.class); 11337 11338 private static NISuppressor result_and0_arg1 = 11339 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 11340 private static NISuppressor result_and0_arg2 = 11341 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 11342 private static NISuppressor arg1_and0_arg2 = 11343 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 11344 11345 // The arguments to bitwise subset are backwards from what one 11346 // might expect. The second argument is a subset of the first 11347 // argument 11348 private static NISuppressor arg1_bw_subset_arg2 = 11349 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 11350 private static NISuppressor arg2_bw_subset_arg1 = 11351 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 11352 11353 private static NISuppressor result_shift0_arg1 = 11354 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 11355 private static NISuppressor result_shift0_arg2 = 11356 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 11357 private static NISuppressor arg1_shift0_arg2 = 11358 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 11359 11360 private static NISuppressor arg2_divides_arg1 = 11361 new NISuppressor(0, 2, NumericInt.Divides.class); 11362 private static NISuppressor arg1_divides_arg2 = 11363 new NISuppressor(2, 0, NumericInt.Divides.class); 11364 11365 private static NISuppressor arg2_valid_shift = 11366 new NISuppressor(2, RangeInt.Bound0_63.class); 11367 11368 // gcd (0, y) == y 11369 // gcd (0, 0) == 0 11370 // gcd (1, y) == 1 11371 11372 private static NISuppressionSet suppressions = 11373 new NISuppressionSet( 11374 new NISuppression[] { 11375 11376 // (r == x) && (x == z) && (r == z) && (r >= 0) 11377 // ==> r = Gcd (x, z) 11378 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 11379 result_ge_0, suppressee), 11380 11381 // (r == x) && (z == 0) && (r >= 0) ==> r = gcd (x, z) 11382 new NISuppression(result_eq_arg1, result_ge_0, arg2_eq_0, suppressee), 11383 11384 // (r == z) && (x == 0) && (r >= 0) ==> r = gcd (x, z) 11385 new NISuppression(result_eq_arg2, result_ge_0, arg1_eq_0, suppressee), 11386 11387 // (r == 1) && (z == 1) ==> r = gcd (x, art2) 11388 new NISuppression(result_eq_1, arg2_eq_1, suppressee), 11389 11390 // (r == 1) && (x == 1) ==> r = gcd (x, art2) 11391 new NISuppression(result_eq_1, arg1_eq_1, suppressee), 11392 11393 // (r == x) && (x divides z) && (r >= 0) 11394 new NISuppression(result_eq_arg1, arg1_divides_arg2, result_ge_0, suppressee), 11395 11396 // (r == z) && (z divides x) && (r >= 0) 11397 new NISuppression(result_eq_arg2, arg2_divides_arg1, result_ge_0, suppressee), 11398 11399 // (r == z) && (z boolean) && (z==0 ==> x==0) 11400 // 0 = gcd (x, 0) true when (x == 0) 11401 // 1 = gcd (x, 1) always true 11402 new NISuppression(result_eq_arg2, arg2_track0_arg1, arg2_boolean, 11403 suppressee), 11404 11405 // (r == x) && (x boolean) && (x==0 ==> z==0) 11406 // 0 = gcd (0, z), true if (z == 0) 11407 // 1 = gcd (1, z), always true 11408 new NISuppression(result_eq_arg1, arg1_boolean, arg1_track0_arg2, 11409 suppressee), 11410 11411 }); 11412 11413 // Create a suppression factory for functionBinary 11414 11415} 11416 11417/** 11418 * Represents the invariant {@code z = Gcd(x, y)} over three long 11419 * scalars. 11420 */ 11421public static class GcdLong_zxy extends FunctionBinary { 11422 static final long serialVersionUID = 20031030L; 11423 11424 private static @Prototype GcdLong_zxy proto = new @Prototype GcdLong_zxy (); 11425 11426 /** Returns the prototype invariant for GcdLong_zxy */ 11427 public static @Prototype GcdLong_zxy get_proto() { 11428 return proto; 11429 } 11430 11431 @Override 11432 protected GcdLong_zxy instantiate_dyn(@Prototype GcdLong_zxy this, PptSlice slice) { 11433 return new GcdLong_zxy (slice); 11434 } 11435 11436 private GcdLong_zxy (PptSlice slice) { 11437 super(slice); 11438 } 11439 11440 public @Prototype GcdLong_zxy () { 11441 super(); 11442 } 11443 11444 private static String[] method_name = new String[] {"org.plumelib.util.MathPlume.gcd(", ", ", ")"}; 11445 11446 @Override 11447 public String[] get_method_name(@GuardSatisfied GcdLong_zxy this) { 11448 return method_name; 11449 } 11450 11451 private static int function_id = -1; 11452 11453 @Override 11454 public int get_function_id() { 11455 return function_id; 11456 } 11457 11458 @Override 11459 public void set_function_id(int function_id) { 11460 assert GcdLong_zxy.function_id == -1; 11461 GcdLong_zxy.function_id = function_id; 11462 } 11463 11464 private static int var_order = 3; 11465 11466 @Override 11467 public int get_var_order(@GuardSatisfied GcdLong_zxy this) { 11468 return var_order; 11469 } 11470 11471 @Pure 11472 @Override 11473 public boolean is_symmetric() { 11474 11475 return true; 11476 } 11477 11478 @Override 11479 11480 public long func(long x, long y) { 11481 11482 return MathPlume.gcd(x, y); 11483 } 11484 11485 @Override 11486 public InvariantStatus check_modified(long x, long y, 11487 long z, int count) { 11488 return check_ordered(z, x, y, count); 11489 } 11490 11491 @Override 11492 public InvariantStatus add_modified(long x, long y, 11493 long z, int count) { 11494 if (Debug.logDetail()) { 11495 log("result=%s, arg1=%s, arg2=%s", z, x, y); 11496 } 11497 return add_ordered(z, x, y, count); 11498 } 11499 11500 @Pure 11501 @Override 11502 public boolean isGcd() { 11503 return true; 11504 } 11505 11506 /** Returns a list of non-instantiating suppressions for this invariant. */ 11507 @Pure 11508 @Override 11509 public @Nullable NISuppressionSet get_ni_suppressions() { 11510 if (NIS.dkconfig_enabled && dkconfig_enabled) { 11511 return suppressions; 11512 } else { 11513 return null; 11514 } 11515 } 11516 11517 /** definition of this invariant (the suppressee) */ 11518 private static NISuppressee suppressee = new NISuppressee(GcdLong_zxy.class, 3); 11519 11520 // suppressor definitions (used below) 11521 private static NISuppressor result_eq_arg1 = 11522 new NISuppressor(2, 0, IntEqual.class); 11523 private static NISuppressor result_eq_arg2 = 11524 new NISuppressor(2, 1, IntEqual.class); 11525 private static NISuppressor arg1_eq_arg2 = 11526 new NISuppressor(0, 1, IntEqual.class); 11527 11528 private static NISuppressor result_lt_arg1 = 11529 new NISuppressor(2, 0, IntLessThan.class); 11530 private static NISuppressor result_lt_arg2 = 11531 new NISuppressor(2, 1, IntLessThan.class); 11532 private static NISuppressor arg1_lt_arg2 = 11533 new NISuppressor(0, 1, IntLessThan.class); 11534 private static NISuppressor arg2_lt_arg1 = 11535 new NISuppressor(1, 0, IntLessThan.class); 11536 11537 private static NISuppressor result_le_arg1 = 11538 new NISuppressor(2, 0, IntLessEqual.class); 11539 private static NISuppressor result_le_arg2 = 11540 new NISuppressor(2, 1, IntLessEqual.class); 11541 private static NISuppressor arg1_le_arg2 = 11542 new NISuppressor(0, 1, IntLessEqual.class); 11543 private static NISuppressor arg2_le_arg1 = 11544 new NISuppressor(1, 0, IntLessEqual.class); 11545 11546 private static NISuppressor result_track0_arg1 = 11547 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 11548 private static NISuppressor result_track0_arg2 = 11549 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 11550 private static NISuppressor arg1_track0_arg2 = 11551 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 11552 private static NISuppressor arg1_track0_result = 11553 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 11554 private static NISuppressor arg2_track0_result = 11555 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 11556 private static NISuppressor arg2_track0_arg1 = 11557 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 11558 11559 private static NISuppressor result_eq_1 = 11560 new NISuppressor(2, RangeInt.EqualOne.class); 11561 private static NISuppressor arg1_eq_1 = 11562 new NISuppressor(0, RangeInt.EqualOne.class); 11563 private static NISuppressor arg2_eq_1 = 11564 new NISuppressor(1, RangeInt.EqualOne.class); 11565 11566 private static NISuppressor result_eq_0 = 11567 new NISuppressor(2, RangeInt.EqualZero.class); 11568 private static NISuppressor arg1_eq_0 = 11569 new NISuppressor(0, RangeInt.EqualZero.class); 11570 private static NISuppressor arg2_eq_0 = 11571 new NISuppressor(1, RangeInt.EqualZero.class); 11572 11573 private static NISuppressor result_ne_0 = 11574 new NISuppressor(2, NonZero.class); 11575 private static NISuppressor arg1_ne_0 = 11576 new NISuppressor(0, NonZero.class); 11577 private static NISuppressor arg2_ne_0 = 11578 new NISuppressor(1, NonZero.class); 11579 11580 private static NISuppressor result_ge_0 = 11581 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 11582 private static NISuppressor arg1_ge_0 = 11583 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 11584 private static NISuppressor arg2_ge_0 = 11585 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 11586 11587 private static NISuppressor result_ge_64 = 11588 new NISuppressor(2, RangeInt.GreaterEqual64.class); 11589 private static NISuppressor arg1_ge_64 = 11590 new NISuppressor(0, RangeInt.GreaterEqual64.class); 11591 private static NISuppressor arg2_ge_64 = 11592 new NISuppressor(1, RangeInt.GreaterEqual64.class); 11593 11594 private static NISuppressor result_boolean = 11595 new NISuppressor(2, RangeInt.BooleanVal.class); 11596 private static NISuppressor arg1_boolean = 11597 new NISuppressor(0, RangeInt.BooleanVal.class); 11598 private static NISuppressor arg2_boolean = 11599 new NISuppressor(1, RangeInt.BooleanVal.class); 11600 11601 private static NISuppressor result_even = 11602 new NISuppressor(2, RangeInt.Even.class); 11603 private static NISuppressor arg1_even = 11604 new NISuppressor(0, RangeInt.Even.class); 11605 private static NISuppressor arg2_even = 11606 new NISuppressor(1, RangeInt.Even.class); 11607 11608 private static NISuppressor result_power2 = 11609 new NISuppressor(2, RangeInt.PowerOfTwo.class); 11610 private static NISuppressor arg1_power2 = 11611 new NISuppressor(0, RangeInt.PowerOfTwo.class); 11612 private static NISuppressor arg2_power2 = 11613 new NISuppressor(1, RangeInt.PowerOfTwo.class); 11614 11615 private static NISuppressor result_and0_arg1 = 11616 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 11617 private static NISuppressor result_and0_arg2 = 11618 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 11619 private static NISuppressor arg1_and0_arg2 = 11620 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 11621 11622 // The arguments to bitwise subset are backwards from what one 11623 // might expect. The second argument is a subset of the first 11624 // argument 11625 private static NISuppressor arg1_bw_subset_arg2 = 11626 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 11627 private static NISuppressor arg2_bw_subset_arg1 = 11628 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 11629 11630 private static NISuppressor result_shift0_arg1 = 11631 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 11632 private static NISuppressor result_shift0_arg2 = 11633 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 11634 private static NISuppressor arg1_shift0_arg2 = 11635 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 11636 11637 private static NISuppressor arg2_divides_arg1 = 11638 new NISuppressor(0, 1, NumericInt.Divides.class); 11639 private static NISuppressor arg1_divides_arg2 = 11640 new NISuppressor(1, 0, NumericInt.Divides.class); 11641 11642 private static NISuppressor arg2_valid_shift = 11643 new NISuppressor(1, RangeInt.Bound0_63.class); 11644 11645 // gcd (0, y) == y 11646 // gcd (0, 0) == 0 11647 // gcd (1, y) == 1 11648 11649 private static NISuppressionSet suppressions = 11650 new NISuppressionSet( 11651 new NISuppression[] { 11652 11653 // (r == x) && (x == y) && (r == y) && (r >= 0) 11654 // ==> r = Gcd (x, y) 11655 new NISuppression(result_eq_arg1, arg1_eq_arg2, result_eq_arg2, 11656 result_ge_0, suppressee), 11657 11658 // (r == x) && (y == 0) && (r >= 0) ==> r = gcd (x, y) 11659 new NISuppression(result_eq_arg1, result_ge_0, arg2_eq_0, suppressee), 11660 11661 // (r == y) && (x == 0) && (r >= 0) ==> r = gcd (x, y) 11662 new NISuppression(result_eq_arg2, result_ge_0, arg1_eq_0, suppressee), 11663 11664 // (r == 1) && (y == 1) ==> r = gcd (x, art2) 11665 new NISuppression(result_eq_1, arg2_eq_1, suppressee), 11666 11667 // (r == 1) && (x == 1) ==> r = gcd (x, art2) 11668 new NISuppression(result_eq_1, arg1_eq_1, suppressee), 11669 11670 // (r == x) && (x divides y) && (r >= 0) 11671 new NISuppression(result_eq_arg1, arg1_divides_arg2, result_ge_0, suppressee), 11672 11673 // (r == y) && (y divides x) && (r >= 0) 11674 new NISuppression(result_eq_arg2, arg2_divides_arg1, result_ge_0, suppressee), 11675 11676 // (r == y) && (y boolean) && (y==0 ==> x==0) 11677 // 0 = gcd (x, 0) true when (x == 0) 11678 // 1 = gcd (x, 1) always true 11679 new NISuppression(result_eq_arg2, arg2_track0_arg1, arg2_boolean, 11680 suppressee), 11681 11682 // (r == x) && (x boolean) && (x==0 ==> y==0) 11683 // 0 = gcd (0, y), true if (y == 0) 11684 // 1 = gcd (1, y), always true 11685 new NISuppression(result_eq_arg1, arg1_boolean, arg1_track0_arg2, 11686 suppressee), 11687 11688 }); 11689 11690 // Create a suppression factory for functionBinary 11691 11692} 11693 11694 // default is that it is not this function, overriden in the subclass 11695 @Pure 11696 public boolean isMod() { 11697 return false; 11698 } 11699 11700/** 11701 * Represents the invariant {@code x = Mod(y, z)} over three long 11702 * scalars. 11703 */ 11704public static class ModLong_xyz extends FunctionBinary { 11705 static final long serialVersionUID = 20031030L; 11706 11707 private static @Prototype ModLong_xyz proto = new @Prototype ModLong_xyz (); 11708 11709 /** Returns the prototype invariant for ModLong_xyz */ 11710 public static @Prototype ModLong_xyz get_proto() { 11711 return proto; 11712 } 11713 11714 @Override 11715 protected ModLong_xyz instantiate_dyn(@Prototype ModLong_xyz this, PptSlice slice) { 11716 return new ModLong_xyz (slice); 11717 } 11718 11719 private ModLong_xyz (PptSlice slice) { 11720 super(slice); 11721 } 11722 11723 public @Prototype ModLong_xyz () { 11724 super(); 11725 } 11726 11727 private static String[] method_name = new String[] {"", " % ", ""}; 11728 11729 @Override 11730 public String[] get_method_name(@GuardSatisfied ModLong_xyz this) { 11731 return method_name; 11732 } 11733 11734 private static int function_id = -1; 11735 11736 @Override 11737 public int get_function_id() { 11738 return function_id; 11739 } 11740 11741 @Override 11742 public void set_function_id(int function_id) { 11743 assert ModLong_xyz.function_id == -1; 11744 ModLong_xyz.function_id = function_id; 11745 } 11746 11747 private static int var_order = 1; 11748 11749 @Override 11750 public int get_var_order(@GuardSatisfied ModLong_xyz this) { 11751 return var_order; 11752 } 11753 11754 @Pure 11755 @Override 11756 public boolean is_symmetric() { 11757 11758 return false; 11759 } 11760 11761 @Override 11762 11763 public long func(long y, long z) { 11764 11765 return (y % z); 11766 } 11767 11768 @Override 11769 public InvariantStatus check_modified(long x, long y, 11770 long z, int count) { 11771 return check_ordered(x, y, z, count); 11772 } 11773 11774 @Override 11775 public InvariantStatus add_modified(long x, long y, 11776 long z, int count) { 11777 if (Debug.logDetail()) { 11778 log("result=%s, arg1=%s, arg2=%s", x, y, z); 11779 } 11780 return add_ordered(x, y, z, count); 11781 } 11782 11783 @Pure 11784 @Override 11785 public boolean isMod() { 11786 return true; 11787 } 11788 11789 /** Returns a list of non-instantiating suppressions for this invariant. */ 11790 @Pure 11791 @Override 11792 public @Nullable NISuppressionSet get_ni_suppressions() { 11793 if (NIS.dkconfig_enabled && dkconfig_enabled) { 11794 return suppressions; 11795 } else { 11796 return null; 11797 } 11798 } 11799 11800 /** definition of this invariant (the suppressee) */ 11801 private static NISuppressee suppressee = new NISuppressee(ModLong_xyz.class, 3); 11802 11803 // suppressor definitions (used below) 11804 private static NISuppressor result_eq_arg1 = 11805 new NISuppressor(0, 1, IntEqual.class); 11806 private static NISuppressor result_eq_arg2 = 11807 new NISuppressor(0, 2, IntEqual.class); 11808 private static NISuppressor arg1_eq_arg2 = 11809 new NISuppressor(1, 2, IntEqual.class); 11810 11811 private static NISuppressor result_lt_arg1 = 11812 new NISuppressor(0, 1, IntLessThan.class); 11813 private static NISuppressor result_lt_arg2 = 11814 new NISuppressor(0, 2, IntLessThan.class); 11815 private static NISuppressor arg1_lt_arg2 = 11816 new NISuppressor(1, 2, IntLessThan.class); 11817 private static NISuppressor arg2_lt_arg1 = 11818 new NISuppressor(2, 1, IntLessThan.class); 11819 11820 private static NISuppressor result_le_arg1 = 11821 new NISuppressor(0, 1, IntLessEqual.class); 11822 private static NISuppressor result_le_arg2 = 11823 new NISuppressor(0, 2, IntLessEqual.class); 11824 private static NISuppressor arg1_le_arg2 = 11825 new NISuppressor(1, 2, IntLessEqual.class); 11826 private static NISuppressor arg2_le_arg1 = 11827 new NISuppressor(2, 1, IntLessEqual.class); 11828 11829 private static NISuppressor result_track0_arg1 = 11830 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 11831 private static NISuppressor result_track0_arg2 = 11832 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 11833 private static NISuppressor arg1_track0_arg2 = 11834 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 11835 private static NISuppressor arg1_track0_result = 11836 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 11837 private static NISuppressor arg2_track0_result = 11838 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 11839 private static NISuppressor arg2_track0_arg1 = 11840 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 11841 11842 private static NISuppressor result_eq_1 = 11843 new NISuppressor(0, RangeInt.EqualOne.class); 11844 private static NISuppressor arg1_eq_1 = 11845 new NISuppressor(1, RangeInt.EqualOne.class); 11846 private static NISuppressor arg2_eq_1 = 11847 new NISuppressor(2, RangeInt.EqualOne.class); 11848 11849 private static NISuppressor result_eq_0 = 11850 new NISuppressor(0, RangeInt.EqualZero.class); 11851 private static NISuppressor arg1_eq_0 = 11852 new NISuppressor(1, RangeInt.EqualZero.class); 11853 private static NISuppressor arg2_eq_0 = 11854 new NISuppressor(2, RangeInt.EqualZero.class); 11855 11856 private static NISuppressor result_ne_0 = 11857 new NISuppressor(0, NonZero.class); 11858 private static NISuppressor arg1_ne_0 = 11859 new NISuppressor(1, NonZero.class); 11860 private static NISuppressor arg2_ne_0 = 11861 new NISuppressor(2, NonZero.class); 11862 11863 private static NISuppressor result_ge_0 = 11864 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 11865 private static NISuppressor arg1_ge_0 = 11866 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 11867 private static NISuppressor arg2_ge_0 = 11868 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 11869 11870 private static NISuppressor result_ge_64 = 11871 new NISuppressor(0, RangeInt.GreaterEqual64.class); 11872 private static NISuppressor arg1_ge_64 = 11873 new NISuppressor(1, RangeInt.GreaterEqual64.class); 11874 private static NISuppressor arg2_ge_64 = 11875 new NISuppressor(2, RangeInt.GreaterEqual64.class); 11876 11877 private static NISuppressor result_boolean = 11878 new NISuppressor(0, RangeInt.BooleanVal.class); 11879 private static NISuppressor arg1_boolean = 11880 new NISuppressor(1, RangeInt.BooleanVal.class); 11881 private static NISuppressor arg2_boolean = 11882 new NISuppressor(2, RangeInt.BooleanVal.class); 11883 11884 private static NISuppressor result_even = 11885 new NISuppressor(0, RangeInt.Even.class); 11886 private static NISuppressor arg1_even = 11887 new NISuppressor(1, RangeInt.Even.class); 11888 private static NISuppressor arg2_even = 11889 new NISuppressor(2, RangeInt.Even.class); 11890 11891 private static NISuppressor result_power2 = 11892 new NISuppressor(0, RangeInt.PowerOfTwo.class); 11893 private static NISuppressor arg1_power2 = 11894 new NISuppressor(1, RangeInt.PowerOfTwo.class); 11895 private static NISuppressor arg2_power2 = 11896 new NISuppressor(2, RangeInt.PowerOfTwo.class); 11897 11898 private static NISuppressor result_and0_arg1 = 11899 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 11900 private static NISuppressor result_and0_arg2 = 11901 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 11902 private static NISuppressor arg1_and0_arg2 = 11903 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 11904 11905 // The arguments to bitwise subset are backwards from what one 11906 // might expect. The second argument is a subset of the first 11907 // argument 11908 private static NISuppressor arg1_bw_subset_arg2 = 11909 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 11910 private static NISuppressor arg2_bw_subset_arg1 = 11911 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 11912 11913 private static NISuppressor result_shift0_arg1 = 11914 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 11915 private static NISuppressor result_shift0_arg2 = 11916 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 11917 private static NISuppressor arg1_shift0_arg2 = 11918 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 11919 11920 private static NISuppressor arg2_divides_arg1 = 11921 new NISuppressor(1, 2, NumericInt.Divides.class); 11922 private static NISuppressor arg1_divides_arg2 = 11923 new NISuppressor(2, 1, NumericInt.Divides.class); 11924 11925 private static NISuppressor arg2_valid_shift = 11926 new NISuppressor(2, RangeInt.Bound0_63.class); 11927 11928 private static NISuppressionSet suppressions = 11929 new NISuppressionSet( 11930 new NISuppression[] { 11931 // anything mod 0 is undefined 11932 // (r == y) && (y < z) && (z != 0) && (r >= 0) ==> r = y % z 11933 new NISuppression(result_eq_arg1, arg1_lt_arg2, arg2_ne_0, result_ge_0, suppressee), 11934 11935 // (r == 0) && ((y % z) == 0) 11936 new NISuppression(result_eq_0, arg2_divides_arg1, suppressee), 11937 11938 // These are unnecessary as the divides invariant handles these 11939 // nicely. 11940 // (r == 0) && (z == 1) ==> r = y % z 11941 // new NISuppression (result_eq_0, arg2_eq_1, suppressee), 11942 11943 // (r == 0) && (y == z) 11944 // new NISuppression (result_eq_0, arg1_eq_arg2, suppressee), 11945 }); 11946 11947 // Create a suppression factory for functionBinary 11948 11949} 11950 11951/** 11952 * Represents the invariant {@code y = Mod(x, z)} over three long 11953 * scalars. 11954 */ 11955public static class ModLong_yxz extends FunctionBinary { 11956 static final long serialVersionUID = 20031030L; 11957 11958 private static @Prototype ModLong_yxz proto = new @Prototype ModLong_yxz (); 11959 11960 /** Returns the prototype invariant for ModLong_yxz */ 11961 public static @Prototype ModLong_yxz get_proto() { 11962 return proto; 11963 } 11964 11965 @Override 11966 protected ModLong_yxz instantiate_dyn(@Prototype ModLong_yxz this, PptSlice slice) { 11967 return new ModLong_yxz (slice); 11968 } 11969 11970 private ModLong_yxz (PptSlice slice) { 11971 super(slice); 11972 } 11973 11974 public @Prototype ModLong_yxz () { 11975 super(); 11976 } 11977 11978 private static String[] method_name = new String[] {"", " % ", ""}; 11979 11980 @Override 11981 public String[] get_method_name(@GuardSatisfied ModLong_yxz this) { 11982 return method_name; 11983 } 11984 11985 private static int function_id = -1; 11986 11987 @Override 11988 public int get_function_id() { 11989 return function_id; 11990 } 11991 11992 @Override 11993 public void set_function_id(int function_id) { 11994 assert ModLong_yxz.function_id == -1; 11995 ModLong_yxz.function_id = function_id; 11996 } 11997 11998 private static int var_order = 2; 11999 12000 @Override 12001 public int get_var_order(@GuardSatisfied ModLong_yxz this) { 12002 return var_order; 12003 } 12004 12005 @Pure 12006 @Override 12007 public boolean is_symmetric() { 12008 12009 return false; 12010 } 12011 12012 @Override 12013 12014 public long func(long x, long z) { 12015 12016 return (x % z); 12017 } 12018 12019 @Override 12020 public InvariantStatus check_modified(long x, long y, 12021 long z, int count) { 12022 return check_ordered(y, x, z, count); 12023 } 12024 12025 @Override 12026 public InvariantStatus add_modified(long x, long y, 12027 long z, int count) { 12028 if (Debug.logDetail()) { 12029 log("result=%s, arg1=%s, arg2=%s", y, x, z); 12030 } 12031 return add_ordered(y, x, z, count); 12032 } 12033 12034 @Pure 12035 @Override 12036 public boolean isMod() { 12037 return true; 12038 } 12039 12040 /** Returns a list of non-instantiating suppressions for this invariant. */ 12041 @Pure 12042 @Override 12043 public @Nullable NISuppressionSet get_ni_suppressions() { 12044 if (NIS.dkconfig_enabled && dkconfig_enabled) { 12045 return suppressions; 12046 } else { 12047 return null; 12048 } 12049 } 12050 12051 /** definition of this invariant (the suppressee) */ 12052 private static NISuppressee suppressee = new NISuppressee(ModLong_yxz.class, 3); 12053 12054 // suppressor definitions (used below) 12055 private static NISuppressor result_eq_arg1 = 12056 new NISuppressor(1, 0, IntEqual.class); 12057 private static NISuppressor result_eq_arg2 = 12058 new NISuppressor(1, 2, IntEqual.class); 12059 private static NISuppressor arg1_eq_arg2 = 12060 new NISuppressor(0, 2, IntEqual.class); 12061 12062 private static NISuppressor result_lt_arg1 = 12063 new NISuppressor(1, 0, IntLessThan.class); 12064 private static NISuppressor result_lt_arg2 = 12065 new NISuppressor(1, 2, IntLessThan.class); 12066 private static NISuppressor arg1_lt_arg2 = 12067 new NISuppressor(0, 2, IntLessThan.class); 12068 private static NISuppressor arg2_lt_arg1 = 12069 new NISuppressor(2, 0, IntLessThan.class); 12070 12071 private static NISuppressor result_le_arg1 = 12072 new NISuppressor(1, 0, IntLessEqual.class); 12073 private static NISuppressor result_le_arg2 = 12074 new NISuppressor(1, 2, IntLessEqual.class); 12075 private static NISuppressor arg1_le_arg2 = 12076 new NISuppressor(0, 2, IntLessEqual.class); 12077 private static NISuppressor arg2_le_arg1 = 12078 new NISuppressor(2, 0, IntLessEqual.class); 12079 12080 private static NISuppressor result_track0_arg1 = 12081 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 12082 private static NISuppressor result_track0_arg2 = 12083 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 12084 private static NISuppressor arg1_track0_arg2 = 12085 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 12086 private static NISuppressor arg1_track0_result = 12087 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 12088 private static NISuppressor arg2_track0_result = 12089 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 12090 private static NISuppressor arg2_track0_arg1 = 12091 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 12092 12093 private static NISuppressor result_eq_1 = 12094 new NISuppressor(1, RangeInt.EqualOne.class); 12095 private static NISuppressor arg1_eq_1 = 12096 new NISuppressor(0, RangeInt.EqualOne.class); 12097 private static NISuppressor arg2_eq_1 = 12098 new NISuppressor(2, RangeInt.EqualOne.class); 12099 12100 private static NISuppressor result_eq_0 = 12101 new NISuppressor(1, RangeInt.EqualZero.class); 12102 private static NISuppressor arg1_eq_0 = 12103 new NISuppressor(0, RangeInt.EqualZero.class); 12104 private static NISuppressor arg2_eq_0 = 12105 new NISuppressor(2, RangeInt.EqualZero.class); 12106 12107 private static NISuppressor result_ne_0 = 12108 new NISuppressor(1, NonZero.class); 12109 private static NISuppressor arg1_ne_0 = 12110 new NISuppressor(0, NonZero.class); 12111 private static NISuppressor arg2_ne_0 = 12112 new NISuppressor(2, NonZero.class); 12113 12114 private static NISuppressor result_ge_0 = 12115 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 12116 private static NISuppressor arg1_ge_0 = 12117 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 12118 private static NISuppressor arg2_ge_0 = 12119 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 12120 12121 private static NISuppressor result_ge_64 = 12122 new NISuppressor(1, RangeInt.GreaterEqual64.class); 12123 private static NISuppressor arg1_ge_64 = 12124 new NISuppressor(0, RangeInt.GreaterEqual64.class); 12125 private static NISuppressor arg2_ge_64 = 12126 new NISuppressor(2, RangeInt.GreaterEqual64.class); 12127 12128 private static NISuppressor result_boolean = 12129 new NISuppressor(1, RangeInt.BooleanVal.class); 12130 private static NISuppressor arg1_boolean = 12131 new NISuppressor(0, RangeInt.BooleanVal.class); 12132 private static NISuppressor arg2_boolean = 12133 new NISuppressor(2, RangeInt.BooleanVal.class); 12134 12135 private static NISuppressor result_even = 12136 new NISuppressor(1, RangeInt.Even.class); 12137 private static NISuppressor arg1_even = 12138 new NISuppressor(0, RangeInt.Even.class); 12139 private static NISuppressor arg2_even = 12140 new NISuppressor(2, RangeInt.Even.class); 12141 12142 private static NISuppressor result_power2 = 12143 new NISuppressor(1, RangeInt.PowerOfTwo.class); 12144 private static NISuppressor arg1_power2 = 12145 new NISuppressor(0, RangeInt.PowerOfTwo.class); 12146 private static NISuppressor arg2_power2 = 12147 new NISuppressor(2, RangeInt.PowerOfTwo.class); 12148 12149 private static NISuppressor result_and0_arg1 = 12150 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 12151 private static NISuppressor result_and0_arg2 = 12152 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 12153 private static NISuppressor arg1_and0_arg2 = 12154 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 12155 12156 // The arguments to bitwise subset are backwards from what one 12157 // might expect. The second argument is a subset of the first 12158 // argument 12159 private static NISuppressor arg1_bw_subset_arg2 = 12160 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 12161 private static NISuppressor arg2_bw_subset_arg1 = 12162 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 12163 12164 private static NISuppressor result_shift0_arg1 = 12165 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 12166 private static NISuppressor result_shift0_arg2 = 12167 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 12168 private static NISuppressor arg1_shift0_arg2 = 12169 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 12170 12171 private static NISuppressor arg2_divides_arg1 = 12172 new NISuppressor(0, 2, NumericInt.Divides.class); 12173 private static NISuppressor arg1_divides_arg2 = 12174 new NISuppressor(2, 0, NumericInt.Divides.class); 12175 12176 private static NISuppressor arg2_valid_shift = 12177 new NISuppressor(2, RangeInt.Bound0_63.class); 12178 12179 private static NISuppressionSet suppressions = 12180 new NISuppressionSet( 12181 new NISuppression[] { 12182 // anything mod 0 is undefined 12183 // (r == x) && (x < z) && (z != 0) && (r >= 0) ==> r = x % z 12184 new NISuppression(result_eq_arg1, arg1_lt_arg2, arg2_ne_0, result_ge_0, suppressee), 12185 12186 // (r == 0) && ((x % z) == 0) 12187 new NISuppression(result_eq_0, arg2_divides_arg1, suppressee), 12188 12189 // These are unnecessary as the divides invariant handles these 12190 // nicely. 12191 // (r == 0) && (z == 1) ==> r = x % z 12192 // new NISuppression (result_eq_0, arg2_eq_1, suppressee), 12193 12194 // (r == 0) && (x == z) 12195 // new NISuppression (result_eq_0, arg1_eq_arg2, suppressee), 12196 }); 12197 12198 // Create a suppression factory for functionBinary 12199 12200} 12201 12202/** 12203 * Represents the invariant {@code z = Mod(x, y)} over three long 12204 * scalars. 12205 */ 12206public static class ModLong_zxy extends FunctionBinary { 12207 static final long serialVersionUID = 20031030L; 12208 12209 private static @Prototype ModLong_zxy proto = new @Prototype ModLong_zxy (); 12210 12211 /** Returns the prototype invariant for ModLong_zxy */ 12212 public static @Prototype ModLong_zxy get_proto() { 12213 return proto; 12214 } 12215 12216 @Override 12217 protected ModLong_zxy instantiate_dyn(@Prototype ModLong_zxy this, PptSlice slice) { 12218 return new ModLong_zxy (slice); 12219 } 12220 12221 private ModLong_zxy (PptSlice slice) { 12222 super(slice); 12223 } 12224 12225 public @Prototype ModLong_zxy () { 12226 super(); 12227 } 12228 12229 private static String[] method_name = new String[] {"", " % ", ""}; 12230 12231 @Override 12232 public String[] get_method_name(@GuardSatisfied ModLong_zxy this) { 12233 return method_name; 12234 } 12235 12236 private static int function_id = -1; 12237 12238 @Override 12239 public int get_function_id() { 12240 return function_id; 12241 } 12242 12243 @Override 12244 public void set_function_id(int function_id) { 12245 assert ModLong_zxy.function_id == -1; 12246 ModLong_zxy.function_id = function_id; 12247 } 12248 12249 private static int var_order = 3; 12250 12251 @Override 12252 public int get_var_order(@GuardSatisfied ModLong_zxy this) { 12253 return var_order; 12254 } 12255 12256 @Pure 12257 @Override 12258 public boolean is_symmetric() { 12259 12260 return false; 12261 } 12262 12263 @Override 12264 12265 public long func(long x, long y) { 12266 12267 return (x % y); 12268 } 12269 12270 @Override 12271 public InvariantStatus check_modified(long x, long y, 12272 long z, int count) { 12273 return check_ordered(z, x, y, count); 12274 } 12275 12276 @Override 12277 public InvariantStatus add_modified(long x, long y, 12278 long z, int count) { 12279 if (Debug.logDetail()) { 12280 log("result=%s, arg1=%s, arg2=%s", z, x, y); 12281 } 12282 return add_ordered(z, x, y, count); 12283 } 12284 12285 @Pure 12286 @Override 12287 public boolean isMod() { 12288 return true; 12289 } 12290 12291 /** Returns a list of non-instantiating suppressions for this invariant. */ 12292 @Pure 12293 @Override 12294 public @Nullable NISuppressionSet get_ni_suppressions() { 12295 if (NIS.dkconfig_enabled && dkconfig_enabled) { 12296 return suppressions; 12297 } else { 12298 return null; 12299 } 12300 } 12301 12302 /** definition of this invariant (the suppressee) */ 12303 private static NISuppressee suppressee = new NISuppressee(ModLong_zxy.class, 3); 12304 12305 // suppressor definitions (used below) 12306 private static NISuppressor result_eq_arg1 = 12307 new NISuppressor(2, 0, IntEqual.class); 12308 private static NISuppressor result_eq_arg2 = 12309 new NISuppressor(2, 1, IntEqual.class); 12310 private static NISuppressor arg1_eq_arg2 = 12311 new NISuppressor(0, 1, IntEqual.class); 12312 12313 private static NISuppressor result_lt_arg1 = 12314 new NISuppressor(2, 0, IntLessThan.class); 12315 private static NISuppressor result_lt_arg2 = 12316 new NISuppressor(2, 1, IntLessThan.class); 12317 private static NISuppressor arg1_lt_arg2 = 12318 new NISuppressor(0, 1, IntLessThan.class); 12319 private static NISuppressor arg2_lt_arg1 = 12320 new NISuppressor(1, 0, IntLessThan.class); 12321 12322 private static NISuppressor result_le_arg1 = 12323 new NISuppressor(2, 0, IntLessEqual.class); 12324 private static NISuppressor result_le_arg2 = 12325 new NISuppressor(2, 1, IntLessEqual.class); 12326 private static NISuppressor arg1_le_arg2 = 12327 new NISuppressor(0, 1, IntLessEqual.class); 12328 private static NISuppressor arg2_le_arg1 = 12329 new NISuppressor(1, 0, IntLessEqual.class); 12330 12331 private static NISuppressor result_track0_arg1 = 12332 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 12333 private static NISuppressor result_track0_arg2 = 12334 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 12335 private static NISuppressor arg1_track0_arg2 = 12336 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 12337 private static NISuppressor arg1_track0_result = 12338 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 12339 private static NISuppressor arg2_track0_result = 12340 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 12341 private static NISuppressor arg2_track0_arg1 = 12342 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 12343 12344 private static NISuppressor result_eq_1 = 12345 new NISuppressor(2, RangeInt.EqualOne.class); 12346 private static NISuppressor arg1_eq_1 = 12347 new NISuppressor(0, RangeInt.EqualOne.class); 12348 private static NISuppressor arg2_eq_1 = 12349 new NISuppressor(1, RangeInt.EqualOne.class); 12350 12351 private static NISuppressor result_eq_0 = 12352 new NISuppressor(2, RangeInt.EqualZero.class); 12353 private static NISuppressor arg1_eq_0 = 12354 new NISuppressor(0, RangeInt.EqualZero.class); 12355 private static NISuppressor arg2_eq_0 = 12356 new NISuppressor(1, RangeInt.EqualZero.class); 12357 12358 private static NISuppressor result_ne_0 = 12359 new NISuppressor(2, NonZero.class); 12360 private static NISuppressor arg1_ne_0 = 12361 new NISuppressor(0, NonZero.class); 12362 private static NISuppressor arg2_ne_0 = 12363 new NISuppressor(1, NonZero.class); 12364 12365 private static NISuppressor result_ge_0 = 12366 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 12367 private static NISuppressor arg1_ge_0 = 12368 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 12369 private static NISuppressor arg2_ge_0 = 12370 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 12371 12372 private static NISuppressor result_ge_64 = 12373 new NISuppressor(2, RangeInt.GreaterEqual64.class); 12374 private static NISuppressor arg1_ge_64 = 12375 new NISuppressor(0, RangeInt.GreaterEqual64.class); 12376 private static NISuppressor arg2_ge_64 = 12377 new NISuppressor(1, RangeInt.GreaterEqual64.class); 12378 12379 private static NISuppressor result_boolean = 12380 new NISuppressor(2, RangeInt.BooleanVal.class); 12381 private static NISuppressor arg1_boolean = 12382 new NISuppressor(0, RangeInt.BooleanVal.class); 12383 private static NISuppressor arg2_boolean = 12384 new NISuppressor(1, RangeInt.BooleanVal.class); 12385 12386 private static NISuppressor result_even = 12387 new NISuppressor(2, RangeInt.Even.class); 12388 private static NISuppressor arg1_even = 12389 new NISuppressor(0, RangeInt.Even.class); 12390 private static NISuppressor arg2_even = 12391 new NISuppressor(1, RangeInt.Even.class); 12392 12393 private static NISuppressor result_power2 = 12394 new NISuppressor(2, RangeInt.PowerOfTwo.class); 12395 private static NISuppressor arg1_power2 = 12396 new NISuppressor(0, RangeInt.PowerOfTwo.class); 12397 private static NISuppressor arg2_power2 = 12398 new NISuppressor(1, RangeInt.PowerOfTwo.class); 12399 12400 private static NISuppressor result_and0_arg1 = 12401 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 12402 private static NISuppressor result_and0_arg2 = 12403 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 12404 private static NISuppressor arg1_and0_arg2 = 12405 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 12406 12407 // The arguments to bitwise subset are backwards from what one 12408 // might expect. The second argument is a subset of the first 12409 // argument 12410 private static NISuppressor arg1_bw_subset_arg2 = 12411 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 12412 private static NISuppressor arg2_bw_subset_arg1 = 12413 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 12414 12415 private static NISuppressor result_shift0_arg1 = 12416 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 12417 private static NISuppressor result_shift0_arg2 = 12418 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 12419 private static NISuppressor arg1_shift0_arg2 = 12420 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 12421 12422 private static NISuppressor arg2_divides_arg1 = 12423 new NISuppressor(0, 1, NumericInt.Divides.class); 12424 private static NISuppressor arg1_divides_arg2 = 12425 new NISuppressor(1, 0, NumericInt.Divides.class); 12426 12427 private static NISuppressor arg2_valid_shift = 12428 new NISuppressor(1, RangeInt.Bound0_63.class); 12429 12430 private static NISuppressionSet suppressions = 12431 new NISuppressionSet( 12432 new NISuppression[] { 12433 // anything mod 0 is undefined 12434 // (r == x) && (x < y) && (y != 0) && (r >= 0) ==> r = x % y 12435 new NISuppression(result_eq_arg1, arg1_lt_arg2, arg2_ne_0, result_ge_0, suppressee), 12436 12437 // (r == 0) && ((x % y) == 0) 12438 new NISuppression(result_eq_0, arg2_divides_arg1, suppressee), 12439 12440 // These are unnecessary as the divides invariant handles these 12441 // nicely. 12442 // (r == 0) && (y == 1) ==> r = x % y 12443 // new NISuppression (result_eq_0, arg2_eq_1, suppressee), 12444 12445 // (r == 0) && (x == y) 12446 // new NISuppression (result_eq_0, arg1_eq_arg2, suppressee), 12447 }); 12448 12449 // Create a suppression factory for functionBinary 12450 12451} 12452 12453/** 12454 * Represents the invariant {@code x = Mod(z, y)} over three long 12455 * scalars. 12456 */ 12457public static class ModLong_xzy extends FunctionBinary { 12458 static final long serialVersionUID = 20031030L; 12459 12460 private static @Prototype ModLong_xzy proto = new @Prototype ModLong_xzy (); 12461 12462 /** Returns the prototype invariant for ModLong_xzy */ 12463 public static @Prototype ModLong_xzy get_proto() { 12464 return proto; 12465 } 12466 12467 @Override 12468 protected ModLong_xzy instantiate_dyn(@Prototype ModLong_xzy this, PptSlice slice) { 12469 return new ModLong_xzy (slice); 12470 } 12471 12472 private ModLong_xzy (PptSlice slice) { 12473 super(slice); 12474 } 12475 12476 public @Prototype ModLong_xzy () { 12477 super(); 12478 } 12479 12480 private static String[] method_name = new String[] {"", " % ", ""}; 12481 12482 @Override 12483 public String[] get_method_name(@GuardSatisfied ModLong_xzy this) { 12484 return method_name; 12485 } 12486 12487 private static int function_id = -1; 12488 12489 @Override 12490 public int get_function_id() { 12491 return function_id; 12492 } 12493 12494 @Override 12495 public void set_function_id(int function_id) { 12496 assert ModLong_xzy.function_id == -1; 12497 ModLong_xzy.function_id = function_id; 12498 } 12499 12500 private static int var_order = 4; 12501 12502 @Override 12503 public int get_var_order(@GuardSatisfied ModLong_xzy this) { 12504 return var_order; 12505 } 12506 12507 @Pure 12508 @Override 12509 public boolean is_symmetric() { 12510 12511 return false; 12512 } 12513 12514 @Override 12515 12516 public long func(long z, long y) { 12517 12518 return (z % y); 12519 } 12520 12521 @Override 12522 public InvariantStatus check_modified(long x, long y, 12523 long z, int count) { 12524 return check_ordered(x, z, y, count); 12525 } 12526 12527 @Override 12528 public InvariantStatus add_modified(long x, long y, 12529 long z, int count) { 12530 if (Debug.logDetail()) { 12531 log("result=%s, arg1=%s, arg2=%s", x, z, y); 12532 } 12533 return add_ordered(x, z, y, count); 12534 } 12535 12536 @Pure 12537 @Override 12538 public boolean isMod() { 12539 return true; 12540 } 12541 12542 /** Returns a list of non-instantiating suppressions for this invariant. */ 12543 @Pure 12544 @Override 12545 public @Nullable NISuppressionSet get_ni_suppressions() { 12546 if (NIS.dkconfig_enabled && dkconfig_enabled) { 12547 return suppressions; 12548 } else { 12549 return null; 12550 } 12551 } 12552 12553 /** definition of this invariant (the suppressee) */ 12554 private static NISuppressee suppressee = new NISuppressee(ModLong_xzy.class, 3); 12555 12556 // suppressor definitions (used below) 12557 private static NISuppressor result_eq_arg1 = 12558 new NISuppressor(0, 2, IntEqual.class); 12559 private static NISuppressor result_eq_arg2 = 12560 new NISuppressor(0, 1, IntEqual.class); 12561 private static NISuppressor arg1_eq_arg2 = 12562 new NISuppressor(2, 1, IntEqual.class); 12563 12564 private static NISuppressor result_lt_arg1 = 12565 new NISuppressor(0, 2, IntLessThan.class); 12566 private static NISuppressor result_lt_arg2 = 12567 new NISuppressor(0, 1, IntLessThan.class); 12568 private static NISuppressor arg1_lt_arg2 = 12569 new NISuppressor(2, 1, IntLessThan.class); 12570 private static NISuppressor arg2_lt_arg1 = 12571 new NISuppressor(1, 2, IntLessThan.class); 12572 12573 private static NISuppressor result_le_arg1 = 12574 new NISuppressor(0, 2, IntLessEqual.class); 12575 private static NISuppressor result_le_arg2 = 12576 new NISuppressor(0, 1, IntLessEqual.class); 12577 private static NISuppressor arg1_le_arg2 = 12578 new NISuppressor(2, 1, IntLessEqual.class); 12579 private static NISuppressor arg2_le_arg1 = 12580 new NISuppressor(1, 2, IntLessEqual.class); 12581 12582 private static NISuppressor result_track0_arg1 = 12583 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 12584 private static NISuppressor result_track0_arg2 = 12585 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 12586 private static NISuppressor arg1_track0_arg2 = 12587 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 12588 private static NISuppressor arg1_track0_result = 12589 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 12590 private static NISuppressor arg2_track0_result = 12591 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 12592 private static NISuppressor arg2_track0_arg1 = 12593 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 12594 12595 private static NISuppressor result_eq_1 = 12596 new NISuppressor(0, RangeInt.EqualOne.class); 12597 private static NISuppressor arg1_eq_1 = 12598 new NISuppressor(2, RangeInt.EqualOne.class); 12599 private static NISuppressor arg2_eq_1 = 12600 new NISuppressor(1, RangeInt.EqualOne.class); 12601 12602 private static NISuppressor result_eq_0 = 12603 new NISuppressor(0, RangeInt.EqualZero.class); 12604 private static NISuppressor arg1_eq_0 = 12605 new NISuppressor(2, RangeInt.EqualZero.class); 12606 private static NISuppressor arg2_eq_0 = 12607 new NISuppressor(1, RangeInt.EqualZero.class); 12608 12609 private static NISuppressor result_ne_0 = 12610 new NISuppressor(0, NonZero.class); 12611 private static NISuppressor arg1_ne_0 = 12612 new NISuppressor(2, NonZero.class); 12613 private static NISuppressor arg2_ne_0 = 12614 new NISuppressor(1, NonZero.class); 12615 12616 private static NISuppressor result_ge_0 = 12617 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 12618 private static NISuppressor arg1_ge_0 = 12619 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 12620 private static NISuppressor arg2_ge_0 = 12621 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 12622 12623 private static NISuppressor result_ge_64 = 12624 new NISuppressor(0, RangeInt.GreaterEqual64.class); 12625 private static NISuppressor arg1_ge_64 = 12626 new NISuppressor(2, RangeInt.GreaterEqual64.class); 12627 private static NISuppressor arg2_ge_64 = 12628 new NISuppressor(1, RangeInt.GreaterEqual64.class); 12629 12630 private static NISuppressor result_boolean = 12631 new NISuppressor(0, RangeInt.BooleanVal.class); 12632 private static NISuppressor arg1_boolean = 12633 new NISuppressor(2, RangeInt.BooleanVal.class); 12634 private static NISuppressor arg2_boolean = 12635 new NISuppressor(1, RangeInt.BooleanVal.class); 12636 12637 private static NISuppressor result_even = 12638 new NISuppressor(0, RangeInt.Even.class); 12639 private static NISuppressor arg1_even = 12640 new NISuppressor(2, RangeInt.Even.class); 12641 private static NISuppressor arg2_even = 12642 new NISuppressor(1, RangeInt.Even.class); 12643 12644 private static NISuppressor result_power2 = 12645 new NISuppressor(0, RangeInt.PowerOfTwo.class); 12646 private static NISuppressor arg1_power2 = 12647 new NISuppressor(2, RangeInt.PowerOfTwo.class); 12648 private static NISuppressor arg2_power2 = 12649 new NISuppressor(1, RangeInt.PowerOfTwo.class); 12650 12651 private static NISuppressor result_and0_arg1 = 12652 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 12653 private static NISuppressor result_and0_arg2 = 12654 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 12655 private static NISuppressor arg1_and0_arg2 = 12656 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 12657 12658 // The arguments to bitwise subset are backwards from what one 12659 // might expect. The second argument is a subset of the first 12660 // argument 12661 private static NISuppressor arg1_bw_subset_arg2 = 12662 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 12663 private static NISuppressor arg2_bw_subset_arg1 = 12664 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 12665 12666 private static NISuppressor result_shift0_arg1 = 12667 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 12668 private static NISuppressor result_shift0_arg2 = 12669 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 12670 private static NISuppressor arg1_shift0_arg2 = 12671 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 12672 12673 private static NISuppressor arg2_divides_arg1 = 12674 new NISuppressor(2, 1, NumericInt.Divides.class); 12675 private static NISuppressor arg1_divides_arg2 = 12676 new NISuppressor(1, 2, NumericInt.Divides.class); 12677 12678 private static NISuppressor arg2_valid_shift = 12679 new NISuppressor(1, RangeInt.Bound0_63.class); 12680 12681 private static NISuppressionSet suppressions = 12682 new NISuppressionSet( 12683 new NISuppression[] { 12684 // anything mod 0 is undefined 12685 // (r == z) && (z < y) && (y != 0) && (r >= 0) ==> r = z % y 12686 new NISuppression(result_eq_arg1, arg1_lt_arg2, arg2_ne_0, result_ge_0, suppressee), 12687 12688 // (r == 0) && ((z % y) == 0) 12689 new NISuppression(result_eq_0, arg2_divides_arg1, suppressee), 12690 12691 // These are unnecessary as the divides invariant handles these 12692 // nicely. 12693 // (r == 0) && (y == 1) ==> r = z % y 12694 // new NISuppression (result_eq_0, arg2_eq_1, suppressee), 12695 12696 // (r == 0) && (z == y) 12697 // new NISuppression (result_eq_0, arg1_eq_arg2, suppressee), 12698 }); 12699 12700 // Create a suppression factory for functionBinary 12701 12702} 12703 12704/** 12705 * Represents the invariant {@code y = Mod(z, x)} over three long 12706 * scalars. 12707 */ 12708public static class ModLong_yzx extends FunctionBinary { 12709 static final long serialVersionUID = 20031030L; 12710 12711 private static @Prototype ModLong_yzx proto = new @Prototype ModLong_yzx (); 12712 12713 /** Returns the prototype invariant for ModLong_yzx */ 12714 public static @Prototype ModLong_yzx get_proto() { 12715 return proto; 12716 } 12717 12718 @Override 12719 protected ModLong_yzx instantiate_dyn(@Prototype ModLong_yzx this, PptSlice slice) { 12720 return new ModLong_yzx (slice); 12721 } 12722 12723 private ModLong_yzx (PptSlice slice) { 12724 super(slice); 12725 } 12726 12727 public @Prototype ModLong_yzx () { 12728 super(); 12729 } 12730 12731 private static String[] method_name = new String[] {"", " % ", ""}; 12732 12733 @Override 12734 public String[] get_method_name(@GuardSatisfied ModLong_yzx this) { 12735 return method_name; 12736 } 12737 12738 private static int function_id = -1; 12739 12740 @Override 12741 public int get_function_id() { 12742 return function_id; 12743 } 12744 12745 @Override 12746 public void set_function_id(int function_id) { 12747 assert ModLong_yzx.function_id == -1; 12748 ModLong_yzx.function_id = function_id; 12749 } 12750 12751 private static int var_order = 5; 12752 12753 @Override 12754 public int get_var_order(@GuardSatisfied ModLong_yzx this) { 12755 return var_order; 12756 } 12757 12758 @Pure 12759 @Override 12760 public boolean is_symmetric() { 12761 12762 return false; 12763 } 12764 12765 @Override 12766 12767 public long func(long z, long x) { 12768 12769 return (z % x); 12770 } 12771 12772 @Override 12773 public InvariantStatus check_modified(long x, long y, 12774 long z, int count) { 12775 return check_ordered(y, z, x, count); 12776 } 12777 12778 @Override 12779 public InvariantStatus add_modified(long x, long y, 12780 long z, int count) { 12781 if (Debug.logDetail()) { 12782 log("result=%s, arg1=%s, arg2=%s", y, z, x); 12783 } 12784 return add_ordered(y, z, x, count); 12785 } 12786 12787 @Pure 12788 @Override 12789 public boolean isMod() { 12790 return true; 12791 } 12792 12793 /** Returns a list of non-instantiating suppressions for this invariant. */ 12794 @Pure 12795 @Override 12796 public @Nullable NISuppressionSet get_ni_suppressions() { 12797 if (NIS.dkconfig_enabled && dkconfig_enabled) { 12798 return suppressions; 12799 } else { 12800 return null; 12801 } 12802 } 12803 12804 /** definition of this invariant (the suppressee) */ 12805 private static NISuppressee suppressee = new NISuppressee(ModLong_yzx.class, 3); 12806 12807 // suppressor definitions (used below) 12808 private static NISuppressor result_eq_arg1 = 12809 new NISuppressor(1, 2, IntEqual.class); 12810 private static NISuppressor result_eq_arg2 = 12811 new NISuppressor(1, 0, IntEqual.class); 12812 private static NISuppressor arg1_eq_arg2 = 12813 new NISuppressor(2, 0, IntEqual.class); 12814 12815 private static NISuppressor result_lt_arg1 = 12816 new NISuppressor(1, 2, IntLessThan.class); 12817 private static NISuppressor result_lt_arg2 = 12818 new NISuppressor(1, 0, IntLessThan.class); 12819 private static NISuppressor arg1_lt_arg2 = 12820 new NISuppressor(2, 0, IntLessThan.class); 12821 private static NISuppressor arg2_lt_arg1 = 12822 new NISuppressor(0, 2, IntLessThan.class); 12823 12824 private static NISuppressor result_le_arg1 = 12825 new NISuppressor(1, 2, IntLessEqual.class); 12826 private static NISuppressor result_le_arg2 = 12827 new NISuppressor(1, 0, IntLessEqual.class); 12828 private static NISuppressor arg1_le_arg2 = 12829 new NISuppressor(2, 0, IntLessEqual.class); 12830 private static NISuppressor arg2_le_arg1 = 12831 new NISuppressor(0, 2, IntLessEqual.class); 12832 12833 private static NISuppressor result_track0_arg1 = 12834 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 12835 private static NISuppressor result_track0_arg2 = 12836 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 12837 private static NISuppressor arg1_track0_arg2 = 12838 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 12839 private static NISuppressor arg1_track0_result = 12840 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 12841 private static NISuppressor arg2_track0_result = 12842 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 12843 private static NISuppressor arg2_track0_arg1 = 12844 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 12845 12846 private static NISuppressor result_eq_1 = 12847 new NISuppressor(1, RangeInt.EqualOne.class); 12848 private static NISuppressor arg1_eq_1 = 12849 new NISuppressor(2, RangeInt.EqualOne.class); 12850 private static NISuppressor arg2_eq_1 = 12851 new NISuppressor(0, RangeInt.EqualOne.class); 12852 12853 private static NISuppressor result_eq_0 = 12854 new NISuppressor(1, RangeInt.EqualZero.class); 12855 private static NISuppressor arg1_eq_0 = 12856 new NISuppressor(2, RangeInt.EqualZero.class); 12857 private static NISuppressor arg2_eq_0 = 12858 new NISuppressor(0, RangeInt.EqualZero.class); 12859 12860 private static NISuppressor result_ne_0 = 12861 new NISuppressor(1, NonZero.class); 12862 private static NISuppressor arg1_ne_0 = 12863 new NISuppressor(2, NonZero.class); 12864 private static NISuppressor arg2_ne_0 = 12865 new NISuppressor(0, NonZero.class); 12866 12867 private static NISuppressor result_ge_0 = 12868 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 12869 private static NISuppressor arg1_ge_0 = 12870 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 12871 private static NISuppressor arg2_ge_0 = 12872 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 12873 12874 private static NISuppressor result_ge_64 = 12875 new NISuppressor(1, RangeInt.GreaterEqual64.class); 12876 private static NISuppressor arg1_ge_64 = 12877 new NISuppressor(2, RangeInt.GreaterEqual64.class); 12878 private static NISuppressor arg2_ge_64 = 12879 new NISuppressor(0, RangeInt.GreaterEqual64.class); 12880 12881 private static NISuppressor result_boolean = 12882 new NISuppressor(1, RangeInt.BooleanVal.class); 12883 private static NISuppressor arg1_boolean = 12884 new NISuppressor(2, RangeInt.BooleanVal.class); 12885 private static NISuppressor arg2_boolean = 12886 new NISuppressor(0, RangeInt.BooleanVal.class); 12887 12888 private static NISuppressor result_even = 12889 new NISuppressor(1, RangeInt.Even.class); 12890 private static NISuppressor arg1_even = 12891 new NISuppressor(2, RangeInt.Even.class); 12892 private static NISuppressor arg2_even = 12893 new NISuppressor(0, RangeInt.Even.class); 12894 12895 private static NISuppressor result_power2 = 12896 new NISuppressor(1, RangeInt.PowerOfTwo.class); 12897 private static NISuppressor arg1_power2 = 12898 new NISuppressor(2, RangeInt.PowerOfTwo.class); 12899 private static NISuppressor arg2_power2 = 12900 new NISuppressor(0, RangeInt.PowerOfTwo.class); 12901 12902 private static NISuppressor result_and0_arg1 = 12903 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 12904 private static NISuppressor result_and0_arg2 = 12905 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 12906 private static NISuppressor arg1_and0_arg2 = 12907 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 12908 12909 // The arguments to bitwise subset are backwards from what one 12910 // might expect. The second argument is a subset of the first 12911 // argument 12912 private static NISuppressor arg1_bw_subset_arg2 = 12913 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 12914 private static NISuppressor arg2_bw_subset_arg1 = 12915 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 12916 12917 private static NISuppressor result_shift0_arg1 = 12918 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 12919 private static NISuppressor result_shift0_arg2 = 12920 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 12921 private static NISuppressor arg1_shift0_arg2 = 12922 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 12923 12924 private static NISuppressor arg2_divides_arg1 = 12925 new NISuppressor(2, 0, NumericInt.Divides.class); 12926 private static NISuppressor arg1_divides_arg2 = 12927 new NISuppressor(0, 2, NumericInt.Divides.class); 12928 12929 private static NISuppressor arg2_valid_shift = 12930 new NISuppressor(0, RangeInt.Bound0_63.class); 12931 12932 private static NISuppressionSet suppressions = 12933 new NISuppressionSet( 12934 new NISuppression[] { 12935 // anything mod 0 is undefined 12936 // (r == z) && (z < x) && (x != 0) && (r >= 0) ==> r = z % x 12937 new NISuppression(result_eq_arg1, arg1_lt_arg2, arg2_ne_0, result_ge_0, suppressee), 12938 12939 // (r == 0) && ((z % x) == 0) 12940 new NISuppression(result_eq_0, arg2_divides_arg1, suppressee), 12941 12942 // These are unnecessary as the divides invariant handles these 12943 // nicely. 12944 // (r == 0) && (x == 1) ==> r = z % x 12945 // new NISuppression (result_eq_0, arg2_eq_1, suppressee), 12946 12947 // (r == 0) && (z == x) 12948 // new NISuppression (result_eq_0, arg1_eq_arg2, suppressee), 12949 }); 12950 12951 // Create a suppression factory for functionBinary 12952 12953} 12954 12955/** 12956 * Represents the invariant {@code z = Mod(y, x)} over three long 12957 * scalars. 12958 */ 12959public static class ModLong_zyx extends FunctionBinary { 12960 static final long serialVersionUID = 20031030L; 12961 12962 private static @Prototype ModLong_zyx proto = new @Prototype ModLong_zyx (); 12963 12964 /** Returns the prototype invariant for ModLong_zyx */ 12965 public static @Prototype ModLong_zyx get_proto() { 12966 return proto; 12967 } 12968 12969 @Override 12970 protected ModLong_zyx instantiate_dyn(@Prototype ModLong_zyx this, PptSlice slice) { 12971 return new ModLong_zyx (slice); 12972 } 12973 12974 private ModLong_zyx (PptSlice slice) { 12975 super(slice); 12976 } 12977 12978 public @Prototype ModLong_zyx () { 12979 super(); 12980 } 12981 12982 private static String[] method_name = new String[] {"", " % ", ""}; 12983 12984 @Override 12985 public String[] get_method_name(@GuardSatisfied ModLong_zyx this) { 12986 return method_name; 12987 } 12988 12989 private static int function_id = -1; 12990 12991 @Override 12992 public int get_function_id() { 12993 return function_id; 12994 } 12995 12996 @Override 12997 public void set_function_id(int function_id) { 12998 assert ModLong_zyx.function_id == -1; 12999 ModLong_zyx.function_id = function_id; 13000 } 13001 13002 private static int var_order = 6; 13003 13004 @Override 13005 public int get_var_order(@GuardSatisfied ModLong_zyx this) { 13006 return var_order; 13007 } 13008 13009 @Pure 13010 @Override 13011 public boolean is_symmetric() { 13012 13013 return false; 13014 } 13015 13016 @Override 13017 13018 public long func(long y, long x) { 13019 13020 return (y % x); 13021 } 13022 13023 @Override 13024 public InvariantStatus check_modified(long x, long y, 13025 long z, int count) { 13026 return check_ordered(z, y, x, count); 13027 } 13028 13029 @Override 13030 public InvariantStatus add_modified(long x, long y, 13031 long z, int count) { 13032 if (Debug.logDetail()) { 13033 log("result=%s, arg1=%s, arg2=%s", z, y, x); 13034 } 13035 return add_ordered(z, y, x, count); 13036 } 13037 13038 @Pure 13039 @Override 13040 public boolean isMod() { 13041 return true; 13042 } 13043 13044 /** Returns a list of non-instantiating suppressions for this invariant. */ 13045 @Pure 13046 @Override 13047 public @Nullable NISuppressionSet get_ni_suppressions() { 13048 if (NIS.dkconfig_enabled && dkconfig_enabled) { 13049 return suppressions; 13050 } else { 13051 return null; 13052 } 13053 } 13054 13055 /** definition of this invariant (the suppressee) */ 13056 private static NISuppressee suppressee = new NISuppressee(ModLong_zyx.class, 3); 13057 13058 // suppressor definitions (used below) 13059 private static NISuppressor result_eq_arg1 = 13060 new NISuppressor(2, 1, IntEqual.class); 13061 private static NISuppressor result_eq_arg2 = 13062 new NISuppressor(2, 0, IntEqual.class); 13063 private static NISuppressor arg1_eq_arg2 = 13064 new NISuppressor(1, 0, IntEqual.class); 13065 13066 private static NISuppressor result_lt_arg1 = 13067 new NISuppressor(2, 1, IntLessThan.class); 13068 private static NISuppressor result_lt_arg2 = 13069 new NISuppressor(2, 0, IntLessThan.class); 13070 private static NISuppressor arg1_lt_arg2 = 13071 new NISuppressor(1, 0, IntLessThan.class); 13072 private static NISuppressor arg2_lt_arg1 = 13073 new NISuppressor(0, 1, IntLessThan.class); 13074 13075 private static NISuppressor result_le_arg1 = 13076 new NISuppressor(2, 1, IntLessEqual.class); 13077 private static NISuppressor result_le_arg2 = 13078 new NISuppressor(2, 0, IntLessEqual.class); 13079 private static NISuppressor arg1_le_arg2 = 13080 new NISuppressor(1, 0, IntLessEqual.class); 13081 private static NISuppressor arg2_le_arg1 = 13082 new NISuppressor(0, 1, IntLessEqual.class); 13083 13084 private static NISuppressor result_track0_arg1 = 13085 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 13086 private static NISuppressor result_track0_arg2 = 13087 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 13088 private static NISuppressor arg1_track0_arg2 = 13089 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 13090 private static NISuppressor arg1_track0_result = 13091 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 13092 private static NISuppressor arg2_track0_result = 13093 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 13094 private static NISuppressor arg2_track0_arg1 = 13095 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 13096 13097 private static NISuppressor result_eq_1 = 13098 new NISuppressor(2, RangeInt.EqualOne.class); 13099 private static NISuppressor arg1_eq_1 = 13100 new NISuppressor(1, RangeInt.EqualOne.class); 13101 private static NISuppressor arg2_eq_1 = 13102 new NISuppressor(0, RangeInt.EqualOne.class); 13103 13104 private static NISuppressor result_eq_0 = 13105 new NISuppressor(2, RangeInt.EqualZero.class); 13106 private static NISuppressor arg1_eq_0 = 13107 new NISuppressor(1, RangeInt.EqualZero.class); 13108 private static NISuppressor arg2_eq_0 = 13109 new NISuppressor(0, RangeInt.EqualZero.class); 13110 13111 private static NISuppressor result_ne_0 = 13112 new NISuppressor(2, NonZero.class); 13113 private static NISuppressor arg1_ne_0 = 13114 new NISuppressor(1, NonZero.class); 13115 private static NISuppressor arg2_ne_0 = 13116 new NISuppressor(0, NonZero.class); 13117 13118 private static NISuppressor result_ge_0 = 13119 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 13120 private static NISuppressor arg1_ge_0 = 13121 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 13122 private static NISuppressor arg2_ge_0 = 13123 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 13124 13125 private static NISuppressor result_ge_64 = 13126 new NISuppressor(2, RangeInt.GreaterEqual64.class); 13127 private static NISuppressor arg1_ge_64 = 13128 new NISuppressor(1, RangeInt.GreaterEqual64.class); 13129 private static NISuppressor arg2_ge_64 = 13130 new NISuppressor(0, RangeInt.GreaterEqual64.class); 13131 13132 private static NISuppressor result_boolean = 13133 new NISuppressor(2, RangeInt.BooleanVal.class); 13134 private static NISuppressor arg1_boolean = 13135 new NISuppressor(1, RangeInt.BooleanVal.class); 13136 private static NISuppressor arg2_boolean = 13137 new NISuppressor(0, RangeInt.BooleanVal.class); 13138 13139 private static NISuppressor result_even = 13140 new NISuppressor(2, RangeInt.Even.class); 13141 private static NISuppressor arg1_even = 13142 new NISuppressor(1, RangeInt.Even.class); 13143 private static NISuppressor arg2_even = 13144 new NISuppressor(0, RangeInt.Even.class); 13145 13146 private static NISuppressor result_power2 = 13147 new NISuppressor(2, RangeInt.PowerOfTwo.class); 13148 private static NISuppressor arg1_power2 = 13149 new NISuppressor(1, RangeInt.PowerOfTwo.class); 13150 private static NISuppressor arg2_power2 = 13151 new NISuppressor(0, RangeInt.PowerOfTwo.class); 13152 13153 private static NISuppressor result_and0_arg1 = 13154 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 13155 private static NISuppressor result_and0_arg2 = 13156 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 13157 private static NISuppressor arg1_and0_arg2 = 13158 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 13159 13160 // The arguments to bitwise subset are backwards from what one 13161 // might expect. The second argument is a subset of the first 13162 // argument 13163 private static NISuppressor arg1_bw_subset_arg2 = 13164 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 13165 private static NISuppressor arg2_bw_subset_arg1 = 13166 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 13167 13168 private static NISuppressor result_shift0_arg1 = 13169 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 13170 private static NISuppressor result_shift0_arg2 = 13171 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 13172 private static NISuppressor arg1_shift0_arg2 = 13173 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 13174 13175 private static NISuppressor arg2_divides_arg1 = 13176 new NISuppressor(1, 0, NumericInt.Divides.class); 13177 private static NISuppressor arg1_divides_arg2 = 13178 new NISuppressor(0, 1, NumericInt.Divides.class); 13179 13180 private static NISuppressor arg2_valid_shift = 13181 new NISuppressor(0, RangeInt.Bound0_63.class); 13182 13183 private static NISuppressionSet suppressions = 13184 new NISuppressionSet( 13185 new NISuppression[] { 13186 // anything mod 0 is undefined 13187 // (r == y) && (y < x) && (x != 0) && (r >= 0) ==> r = y % x 13188 new NISuppression(result_eq_arg1, arg1_lt_arg2, arg2_ne_0, result_ge_0, suppressee), 13189 13190 // (r == 0) && ((y % x) == 0) 13191 new NISuppression(result_eq_0, arg2_divides_arg1, suppressee), 13192 13193 // These are unnecessary as the divides invariant handles these 13194 // nicely. 13195 // (r == 0) && (x == 1) ==> r = y % x 13196 // new NISuppression (result_eq_0, arg2_eq_1, suppressee), 13197 13198 // (r == 0) && (y == x) 13199 // new NISuppression (result_eq_0, arg1_eq_arg2, suppressee), 13200 }); 13201 13202 // Create a suppression factory for functionBinary 13203 13204} 13205 13206 // default is that it is not this function, overriden in the subclass 13207 @Pure 13208 public boolean isLshift() { 13209 return false; 13210 } 13211 13212/** 13213 * Represents the invariant {@code x = Lshift(y, z)} over three long 13214 * scalars. 13215 */ 13216public static class LshiftLong_xyz extends FunctionBinary { 13217 static final long serialVersionUID = 20031030L; 13218 13219 // z must be between arg2_bound[0] and arg2_bound[1] inclusive 13220 static int[] arg2_bound = {0, 63}; 13221 13222 private static @Prototype LshiftLong_xyz proto = new @Prototype LshiftLong_xyz (); 13223 13224 /** Returns the prototype invariant for LshiftLong_xyz */ 13225 public static @Prototype LshiftLong_xyz get_proto() { 13226 return proto; 13227 } 13228 13229 @Override 13230 protected LshiftLong_xyz instantiate_dyn(@Prototype LshiftLong_xyz this, PptSlice slice) { 13231 return new LshiftLong_xyz (slice); 13232 } 13233 13234 private LshiftLong_xyz (PptSlice slice) { 13235 super(slice); 13236 } 13237 13238 public @Prototype LshiftLong_xyz () { 13239 super(); 13240 } 13241 13242 private static String[] method_name = new String[] {"", " << ", ""}; 13243 13244 @Override 13245 public String[] get_method_name(@GuardSatisfied LshiftLong_xyz this) { 13246 return method_name; 13247 } 13248 13249 private static int function_id = -1; 13250 13251 @Override 13252 public int get_function_id() { 13253 return function_id; 13254 } 13255 13256 @Override 13257 public void set_function_id(int function_id) { 13258 assert LshiftLong_xyz.function_id == -1; 13259 LshiftLong_xyz.function_id = function_id; 13260 } 13261 13262 private static int var_order = 1; 13263 13264 @Override 13265 public int get_var_order(@GuardSatisfied LshiftLong_xyz this) { 13266 return var_order; 13267 } 13268 13269 @Pure 13270 @Override 13271 public boolean is_symmetric() { 13272 13273 return false; 13274 } 13275 13276 @Override 13277 13278 public long func(long y, long z) { 13279 13280 if ((z < arg2_bound[0]) || (z > arg2_bound[1])) { 13281 throw new ArithmeticException("arg2 (" + z + ") out of range " 13282 + arg2_bound[0] + ".." + arg2_bound[1]); 13283 } 13284 13285 return (y << z); 13286 } 13287 13288 @Override 13289 public InvariantStatus check_modified(long x, long y, 13290 long z, int count) { 13291 return check_ordered(x, y, z, count); 13292 } 13293 13294 @Override 13295 public InvariantStatus add_modified(long x, long y, 13296 long z, int count) { 13297 if (Debug.logDetail()) { 13298 log("result=%s, arg1=%s, arg2=%s", x, y, z); 13299 } 13300 return add_ordered(x, y, z, count); 13301 } 13302 13303 @Pure 13304 @Override 13305 public boolean isLshift() { 13306 return true; 13307 } 13308 13309 /** Returns a list of non-instantiating suppressions for this invariant. */ 13310 @Pure 13311 @Override 13312 public @Nullable NISuppressionSet get_ni_suppressions() { 13313 if (NIS.dkconfig_enabled && dkconfig_enabled) { 13314 return suppressions; 13315 } else { 13316 return null; 13317 } 13318 } 13319 13320 /** definition of this invariant (the suppressee) */ 13321 private static NISuppressee suppressee = new NISuppressee(LshiftLong_xyz.class, 3); 13322 13323 // suppressor definitions (used below) 13324 private static NISuppressor result_eq_arg1 = 13325 new NISuppressor(0, 1, IntEqual.class); 13326 private static NISuppressor result_eq_arg2 = 13327 new NISuppressor(0, 2, IntEqual.class); 13328 private static NISuppressor arg1_eq_arg2 = 13329 new NISuppressor(1, 2, IntEqual.class); 13330 13331 private static NISuppressor result_lt_arg1 = 13332 new NISuppressor(0, 1, IntLessThan.class); 13333 private static NISuppressor result_lt_arg2 = 13334 new NISuppressor(0, 2, IntLessThan.class); 13335 private static NISuppressor arg1_lt_arg2 = 13336 new NISuppressor(1, 2, IntLessThan.class); 13337 private static NISuppressor arg2_lt_arg1 = 13338 new NISuppressor(2, 1, IntLessThan.class); 13339 13340 private static NISuppressor result_le_arg1 = 13341 new NISuppressor(0, 1, IntLessEqual.class); 13342 private static NISuppressor result_le_arg2 = 13343 new NISuppressor(0, 2, IntLessEqual.class); 13344 private static NISuppressor arg1_le_arg2 = 13345 new NISuppressor(1, 2, IntLessEqual.class); 13346 private static NISuppressor arg2_le_arg1 = 13347 new NISuppressor(2, 1, IntLessEqual.class); 13348 13349 private static NISuppressor result_track0_arg1 = 13350 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 13351 private static NISuppressor result_track0_arg2 = 13352 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 13353 private static NISuppressor arg1_track0_arg2 = 13354 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 13355 private static NISuppressor arg1_track0_result = 13356 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 13357 private static NISuppressor arg2_track0_result = 13358 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 13359 private static NISuppressor arg2_track0_arg1 = 13360 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 13361 13362 private static NISuppressor result_eq_1 = 13363 new NISuppressor(0, RangeInt.EqualOne.class); 13364 private static NISuppressor arg1_eq_1 = 13365 new NISuppressor(1, RangeInt.EqualOne.class); 13366 private static NISuppressor arg2_eq_1 = 13367 new NISuppressor(2, RangeInt.EqualOne.class); 13368 13369 private static NISuppressor result_eq_0 = 13370 new NISuppressor(0, RangeInt.EqualZero.class); 13371 private static NISuppressor arg1_eq_0 = 13372 new NISuppressor(1, RangeInt.EqualZero.class); 13373 private static NISuppressor arg2_eq_0 = 13374 new NISuppressor(2, RangeInt.EqualZero.class); 13375 13376 private static NISuppressor result_ne_0 = 13377 new NISuppressor(0, NonZero.class); 13378 private static NISuppressor arg1_ne_0 = 13379 new NISuppressor(1, NonZero.class); 13380 private static NISuppressor arg2_ne_0 = 13381 new NISuppressor(2, NonZero.class); 13382 13383 private static NISuppressor result_ge_0 = 13384 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 13385 private static NISuppressor arg1_ge_0 = 13386 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 13387 private static NISuppressor arg2_ge_0 = 13388 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 13389 13390 private static NISuppressor result_ge_64 = 13391 new NISuppressor(0, RangeInt.GreaterEqual64.class); 13392 private static NISuppressor arg1_ge_64 = 13393 new NISuppressor(1, RangeInt.GreaterEqual64.class); 13394 private static NISuppressor arg2_ge_64 = 13395 new NISuppressor(2, RangeInt.GreaterEqual64.class); 13396 13397 private static NISuppressor result_boolean = 13398 new NISuppressor(0, RangeInt.BooleanVal.class); 13399 private static NISuppressor arg1_boolean = 13400 new NISuppressor(1, RangeInt.BooleanVal.class); 13401 private static NISuppressor arg2_boolean = 13402 new NISuppressor(2, RangeInt.BooleanVal.class); 13403 13404 private static NISuppressor result_even = 13405 new NISuppressor(0, RangeInt.Even.class); 13406 private static NISuppressor arg1_even = 13407 new NISuppressor(1, RangeInt.Even.class); 13408 private static NISuppressor arg2_even = 13409 new NISuppressor(2, RangeInt.Even.class); 13410 13411 private static NISuppressor result_power2 = 13412 new NISuppressor(0, RangeInt.PowerOfTwo.class); 13413 private static NISuppressor arg1_power2 = 13414 new NISuppressor(1, RangeInt.PowerOfTwo.class); 13415 private static NISuppressor arg2_power2 = 13416 new NISuppressor(2, RangeInt.PowerOfTwo.class); 13417 13418 private static NISuppressor result_and0_arg1 = 13419 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 13420 private static NISuppressor result_and0_arg2 = 13421 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 13422 private static NISuppressor arg1_and0_arg2 = 13423 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 13424 13425 // The arguments to bitwise subset are backwards from what one 13426 // might expect. The second argument is a subset of the first 13427 // argument 13428 private static NISuppressor arg1_bw_subset_arg2 = 13429 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 13430 private static NISuppressor arg2_bw_subset_arg1 = 13431 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 13432 13433 private static NISuppressor result_shift0_arg1 = 13434 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 13435 private static NISuppressor result_shift0_arg2 = 13436 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 13437 private static NISuppressor arg1_shift0_arg2 = 13438 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 13439 13440 private static NISuppressor arg2_divides_arg1 = 13441 new NISuppressor(1, 2, NumericInt.Divides.class); 13442 private static NISuppressor arg1_divides_arg2 = 13443 new NISuppressor(2, 1, NumericInt.Divides.class); 13444 13445 private static NISuppressor arg2_valid_shift = 13446 new NISuppressor(2, RangeInt.Bound0_63.class); 13447 13448 private static NISuppressionSet suppressions = 13449 new NISuppressionSet( 13450 new NISuppression[] { 13451 13452 // (r == y) && (z == 0) ==> r = y << z 13453 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 13454 13455 // (r == 0) && (y == 0) && (0 <= z <= 63) ==> r = y << z 13456 new NISuppression(result_eq_0, arg1_eq_0, arg2_valid_shift, 13457 suppressee), 13458 13459 }); 13460 13461 // Create a suppression factory for functionBinary 13462 13463} 13464 13465/** 13466 * Represents the invariant {@code y = Lshift(x, z)} over three long 13467 * scalars. 13468 */ 13469public static class LshiftLong_yxz extends FunctionBinary { 13470 static final long serialVersionUID = 20031030L; 13471 13472 // z must be between arg2_bound[0] and arg2_bound[1] inclusive 13473 static int[] arg2_bound = {0, 63}; 13474 13475 private static @Prototype LshiftLong_yxz proto = new @Prototype LshiftLong_yxz (); 13476 13477 /** Returns the prototype invariant for LshiftLong_yxz */ 13478 public static @Prototype LshiftLong_yxz get_proto() { 13479 return proto; 13480 } 13481 13482 @Override 13483 protected LshiftLong_yxz instantiate_dyn(@Prototype LshiftLong_yxz this, PptSlice slice) { 13484 return new LshiftLong_yxz (slice); 13485 } 13486 13487 private LshiftLong_yxz (PptSlice slice) { 13488 super(slice); 13489 } 13490 13491 public @Prototype LshiftLong_yxz () { 13492 super(); 13493 } 13494 13495 private static String[] method_name = new String[] {"", " << ", ""}; 13496 13497 @Override 13498 public String[] get_method_name(@GuardSatisfied LshiftLong_yxz this) { 13499 return method_name; 13500 } 13501 13502 private static int function_id = -1; 13503 13504 @Override 13505 public int get_function_id() { 13506 return function_id; 13507 } 13508 13509 @Override 13510 public void set_function_id(int function_id) { 13511 assert LshiftLong_yxz.function_id == -1; 13512 LshiftLong_yxz.function_id = function_id; 13513 } 13514 13515 private static int var_order = 2; 13516 13517 @Override 13518 public int get_var_order(@GuardSatisfied LshiftLong_yxz this) { 13519 return var_order; 13520 } 13521 13522 @Pure 13523 @Override 13524 public boolean is_symmetric() { 13525 13526 return false; 13527 } 13528 13529 @Override 13530 13531 public long func(long x, long z) { 13532 13533 if ((z < arg2_bound[0]) || (z > arg2_bound[1])) { 13534 throw new ArithmeticException("arg2 (" + z + ") out of range " 13535 + arg2_bound[0] + ".." + arg2_bound[1]); 13536 } 13537 13538 return (x << z); 13539 } 13540 13541 @Override 13542 public InvariantStatus check_modified(long x, long y, 13543 long z, int count) { 13544 return check_ordered(y, x, z, count); 13545 } 13546 13547 @Override 13548 public InvariantStatus add_modified(long x, long y, 13549 long z, int count) { 13550 if (Debug.logDetail()) { 13551 log("result=%s, arg1=%s, arg2=%s", y, x, z); 13552 } 13553 return add_ordered(y, x, z, count); 13554 } 13555 13556 @Pure 13557 @Override 13558 public boolean isLshift() { 13559 return true; 13560 } 13561 13562 /** Returns a list of non-instantiating suppressions for this invariant. */ 13563 @Pure 13564 @Override 13565 public @Nullable NISuppressionSet get_ni_suppressions() { 13566 if (NIS.dkconfig_enabled && dkconfig_enabled) { 13567 return suppressions; 13568 } else { 13569 return null; 13570 } 13571 } 13572 13573 /** definition of this invariant (the suppressee) */ 13574 private static NISuppressee suppressee = new NISuppressee(LshiftLong_yxz.class, 3); 13575 13576 // suppressor definitions (used below) 13577 private static NISuppressor result_eq_arg1 = 13578 new NISuppressor(1, 0, IntEqual.class); 13579 private static NISuppressor result_eq_arg2 = 13580 new NISuppressor(1, 2, IntEqual.class); 13581 private static NISuppressor arg1_eq_arg2 = 13582 new NISuppressor(0, 2, IntEqual.class); 13583 13584 private static NISuppressor result_lt_arg1 = 13585 new NISuppressor(1, 0, IntLessThan.class); 13586 private static NISuppressor result_lt_arg2 = 13587 new NISuppressor(1, 2, IntLessThan.class); 13588 private static NISuppressor arg1_lt_arg2 = 13589 new NISuppressor(0, 2, IntLessThan.class); 13590 private static NISuppressor arg2_lt_arg1 = 13591 new NISuppressor(2, 0, IntLessThan.class); 13592 13593 private static NISuppressor result_le_arg1 = 13594 new NISuppressor(1, 0, IntLessEqual.class); 13595 private static NISuppressor result_le_arg2 = 13596 new NISuppressor(1, 2, IntLessEqual.class); 13597 private static NISuppressor arg1_le_arg2 = 13598 new NISuppressor(0, 2, IntLessEqual.class); 13599 private static NISuppressor arg2_le_arg1 = 13600 new NISuppressor(2, 0, IntLessEqual.class); 13601 13602 private static NISuppressor result_track0_arg1 = 13603 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 13604 private static NISuppressor result_track0_arg2 = 13605 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 13606 private static NISuppressor arg1_track0_arg2 = 13607 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 13608 private static NISuppressor arg1_track0_result = 13609 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 13610 private static NISuppressor arg2_track0_result = 13611 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 13612 private static NISuppressor arg2_track0_arg1 = 13613 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 13614 13615 private static NISuppressor result_eq_1 = 13616 new NISuppressor(1, RangeInt.EqualOne.class); 13617 private static NISuppressor arg1_eq_1 = 13618 new NISuppressor(0, RangeInt.EqualOne.class); 13619 private static NISuppressor arg2_eq_1 = 13620 new NISuppressor(2, RangeInt.EqualOne.class); 13621 13622 private static NISuppressor result_eq_0 = 13623 new NISuppressor(1, RangeInt.EqualZero.class); 13624 private static NISuppressor arg1_eq_0 = 13625 new NISuppressor(0, RangeInt.EqualZero.class); 13626 private static NISuppressor arg2_eq_0 = 13627 new NISuppressor(2, RangeInt.EqualZero.class); 13628 13629 private static NISuppressor result_ne_0 = 13630 new NISuppressor(1, NonZero.class); 13631 private static NISuppressor arg1_ne_0 = 13632 new NISuppressor(0, NonZero.class); 13633 private static NISuppressor arg2_ne_0 = 13634 new NISuppressor(2, NonZero.class); 13635 13636 private static NISuppressor result_ge_0 = 13637 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 13638 private static NISuppressor arg1_ge_0 = 13639 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 13640 private static NISuppressor arg2_ge_0 = 13641 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 13642 13643 private static NISuppressor result_ge_64 = 13644 new NISuppressor(1, RangeInt.GreaterEqual64.class); 13645 private static NISuppressor arg1_ge_64 = 13646 new NISuppressor(0, RangeInt.GreaterEqual64.class); 13647 private static NISuppressor arg2_ge_64 = 13648 new NISuppressor(2, RangeInt.GreaterEqual64.class); 13649 13650 private static NISuppressor result_boolean = 13651 new NISuppressor(1, RangeInt.BooleanVal.class); 13652 private static NISuppressor arg1_boolean = 13653 new NISuppressor(0, RangeInt.BooleanVal.class); 13654 private static NISuppressor arg2_boolean = 13655 new NISuppressor(2, RangeInt.BooleanVal.class); 13656 13657 private static NISuppressor result_even = 13658 new NISuppressor(1, RangeInt.Even.class); 13659 private static NISuppressor arg1_even = 13660 new NISuppressor(0, RangeInt.Even.class); 13661 private static NISuppressor arg2_even = 13662 new NISuppressor(2, RangeInt.Even.class); 13663 13664 private static NISuppressor result_power2 = 13665 new NISuppressor(1, RangeInt.PowerOfTwo.class); 13666 private static NISuppressor arg1_power2 = 13667 new NISuppressor(0, RangeInt.PowerOfTwo.class); 13668 private static NISuppressor arg2_power2 = 13669 new NISuppressor(2, RangeInt.PowerOfTwo.class); 13670 13671 private static NISuppressor result_and0_arg1 = 13672 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 13673 private static NISuppressor result_and0_arg2 = 13674 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 13675 private static NISuppressor arg1_and0_arg2 = 13676 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 13677 13678 // The arguments to bitwise subset are backwards from what one 13679 // might expect. The second argument is a subset of the first 13680 // argument 13681 private static NISuppressor arg1_bw_subset_arg2 = 13682 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 13683 private static NISuppressor arg2_bw_subset_arg1 = 13684 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 13685 13686 private static NISuppressor result_shift0_arg1 = 13687 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 13688 private static NISuppressor result_shift0_arg2 = 13689 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 13690 private static NISuppressor arg1_shift0_arg2 = 13691 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 13692 13693 private static NISuppressor arg2_divides_arg1 = 13694 new NISuppressor(0, 2, NumericInt.Divides.class); 13695 private static NISuppressor arg1_divides_arg2 = 13696 new NISuppressor(2, 0, NumericInt.Divides.class); 13697 13698 private static NISuppressor arg2_valid_shift = 13699 new NISuppressor(2, RangeInt.Bound0_63.class); 13700 13701 private static NISuppressionSet suppressions = 13702 new NISuppressionSet( 13703 new NISuppression[] { 13704 13705 // (r == x) && (z == 0) ==> r = x << z 13706 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 13707 13708 // (r == 0) && (x == 0) && (0 <= z <= 63) ==> r = x << z 13709 new NISuppression(result_eq_0, arg1_eq_0, arg2_valid_shift, 13710 suppressee), 13711 13712 }); 13713 13714 // Create a suppression factory for functionBinary 13715 13716} 13717 13718/** 13719 * Represents the invariant {@code z = Lshift(x, y)} over three long 13720 * scalars. 13721 */ 13722public static class LshiftLong_zxy extends FunctionBinary { 13723 static final long serialVersionUID = 20031030L; 13724 13725 // y must be between arg2_bound[0] and arg2_bound[1] inclusive 13726 static int[] arg2_bound = {0, 63}; 13727 13728 private static @Prototype LshiftLong_zxy proto = new @Prototype LshiftLong_zxy (); 13729 13730 /** Returns the prototype invariant for LshiftLong_zxy */ 13731 public static @Prototype LshiftLong_zxy get_proto() { 13732 return proto; 13733 } 13734 13735 @Override 13736 protected LshiftLong_zxy instantiate_dyn(@Prototype LshiftLong_zxy this, PptSlice slice) { 13737 return new LshiftLong_zxy (slice); 13738 } 13739 13740 private LshiftLong_zxy (PptSlice slice) { 13741 super(slice); 13742 } 13743 13744 public @Prototype LshiftLong_zxy () { 13745 super(); 13746 } 13747 13748 private static String[] method_name = new String[] {"", " << ", ""}; 13749 13750 @Override 13751 public String[] get_method_name(@GuardSatisfied LshiftLong_zxy this) { 13752 return method_name; 13753 } 13754 13755 private static int function_id = -1; 13756 13757 @Override 13758 public int get_function_id() { 13759 return function_id; 13760 } 13761 13762 @Override 13763 public void set_function_id(int function_id) { 13764 assert LshiftLong_zxy.function_id == -1; 13765 LshiftLong_zxy.function_id = function_id; 13766 } 13767 13768 private static int var_order = 3; 13769 13770 @Override 13771 public int get_var_order(@GuardSatisfied LshiftLong_zxy this) { 13772 return var_order; 13773 } 13774 13775 @Pure 13776 @Override 13777 public boolean is_symmetric() { 13778 13779 return false; 13780 } 13781 13782 @Override 13783 13784 public long func(long x, long y) { 13785 13786 if ((y < arg2_bound[0]) || (y > arg2_bound[1])) { 13787 throw new ArithmeticException("arg2 (" + y + ") out of range " 13788 + arg2_bound[0] + ".." + arg2_bound[1]); 13789 } 13790 13791 return (x << y); 13792 } 13793 13794 @Override 13795 public InvariantStatus check_modified(long x, long y, 13796 long z, int count) { 13797 return check_ordered(z, x, y, count); 13798 } 13799 13800 @Override 13801 public InvariantStatus add_modified(long x, long y, 13802 long z, int count) { 13803 if (Debug.logDetail()) { 13804 log("result=%s, arg1=%s, arg2=%s", z, x, y); 13805 } 13806 return add_ordered(z, x, y, count); 13807 } 13808 13809 @Pure 13810 @Override 13811 public boolean isLshift() { 13812 return true; 13813 } 13814 13815 /** Returns a list of non-instantiating suppressions for this invariant. */ 13816 @Pure 13817 @Override 13818 public @Nullable NISuppressionSet get_ni_suppressions() { 13819 if (NIS.dkconfig_enabled && dkconfig_enabled) { 13820 return suppressions; 13821 } else { 13822 return null; 13823 } 13824 } 13825 13826 /** definition of this invariant (the suppressee) */ 13827 private static NISuppressee suppressee = new NISuppressee(LshiftLong_zxy.class, 3); 13828 13829 // suppressor definitions (used below) 13830 private static NISuppressor result_eq_arg1 = 13831 new NISuppressor(2, 0, IntEqual.class); 13832 private static NISuppressor result_eq_arg2 = 13833 new NISuppressor(2, 1, IntEqual.class); 13834 private static NISuppressor arg1_eq_arg2 = 13835 new NISuppressor(0, 1, IntEqual.class); 13836 13837 private static NISuppressor result_lt_arg1 = 13838 new NISuppressor(2, 0, IntLessThan.class); 13839 private static NISuppressor result_lt_arg2 = 13840 new NISuppressor(2, 1, IntLessThan.class); 13841 private static NISuppressor arg1_lt_arg2 = 13842 new NISuppressor(0, 1, IntLessThan.class); 13843 private static NISuppressor arg2_lt_arg1 = 13844 new NISuppressor(1, 0, IntLessThan.class); 13845 13846 private static NISuppressor result_le_arg1 = 13847 new NISuppressor(2, 0, IntLessEqual.class); 13848 private static NISuppressor result_le_arg2 = 13849 new NISuppressor(2, 1, IntLessEqual.class); 13850 private static NISuppressor arg1_le_arg2 = 13851 new NISuppressor(0, 1, IntLessEqual.class); 13852 private static NISuppressor arg2_le_arg1 = 13853 new NISuppressor(1, 0, IntLessEqual.class); 13854 13855 private static NISuppressor result_track0_arg1 = 13856 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 13857 private static NISuppressor result_track0_arg2 = 13858 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 13859 private static NISuppressor arg1_track0_arg2 = 13860 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 13861 private static NISuppressor arg1_track0_result = 13862 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 13863 private static NISuppressor arg2_track0_result = 13864 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 13865 private static NISuppressor arg2_track0_arg1 = 13866 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 13867 13868 private static NISuppressor result_eq_1 = 13869 new NISuppressor(2, RangeInt.EqualOne.class); 13870 private static NISuppressor arg1_eq_1 = 13871 new NISuppressor(0, RangeInt.EqualOne.class); 13872 private static NISuppressor arg2_eq_1 = 13873 new NISuppressor(1, RangeInt.EqualOne.class); 13874 13875 private static NISuppressor result_eq_0 = 13876 new NISuppressor(2, RangeInt.EqualZero.class); 13877 private static NISuppressor arg1_eq_0 = 13878 new NISuppressor(0, RangeInt.EqualZero.class); 13879 private static NISuppressor arg2_eq_0 = 13880 new NISuppressor(1, RangeInt.EqualZero.class); 13881 13882 private static NISuppressor result_ne_0 = 13883 new NISuppressor(2, NonZero.class); 13884 private static NISuppressor arg1_ne_0 = 13885 new NISuppressor(0, NonZero.class); 13886 private static NISuppressor arg2_ne_0 = 13887 new NISuppressor(1, NonZero.class); 13888 13889 private static NISuppressor result_ge_0 = 13890 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 13891 private static NISuppressor arg1_ge_0 = 13892 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 13893 private static NISuppressor arg2_ge_0 = 13894 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 13895 13896 private static NISuppressor result_ge_64 = 13897 new NISuppressor(2, RangeInt.GreaterEqual64.class); 13898 private static NISuppressor arg1_ge_64 = 13899 new NISuppressor(0, RangeInt.GreaterEqual64.class); 13900 private static NISuppressor arg2_ge_64 = 13901 new NISuppressor(1, RangeInt.GreaterEqual64.class); 13902 13903 private static NISuppressor result_boolean = 13904 new NISuppressor(2, RangeInt.BooleanVal.class); 13905 private static NISuppressor arg1_boolean = 13906 new NISuppressor(0, RangeInt.BooleanVal.class); 13907 private static NISuppressor arg2_boolean = 13908 new NISuppressor(1, RangeInt.BooleanVal.class); 13909 13910 private static NISuppressor result_even = 13911 new NISuppressor(2, RangeInt.Even.class); 13912 private static NISuppressor arg1_even = 13913 new NISuppressor(0, RangeInt.Even.class); 13914 private static NISuppressor arg2_even = 13915 new NISuppressor(1, RangeInt.Even.class); 13916 13917 private static NISuppressor result_power2 = 13918 new NISuppressor(2, RangeInt.PowerOfTwo.class); 13919 private static NISuppressor arg1_power2 = 13920 new NISuppressor(0, RangeInt.PowerOfTwo.class); 13921 private static NISuppressor arg2_power2 = 13922 new NISuppressor(1, RangeInt.PowerOfTwo.class); 13923 13924 private static NISuppressor result_and0_arg1 = 13925 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 13926 private static NISuppressor result_and0_arg2 = 13927 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 13928 private static NISuppressor arg1_and0_arg2 = 13929 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 13930 13931 // The arguments to bitwise subset are backwards from what one 13932 // might expect. The second argument is a subset of the first 13933 // argument 13934 private static NISuppressor arg1_bw_subset_arg2 = 13935 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 13936 private static NISuppressor arg2_bw_subset_arg1 = 13937 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 13938 13939 private static NISuppressor result_shift0_arg1 = 13940 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 13941 private static NISuppressor result_shift0_arg2 = 13942 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 13943 private static NISuppressor arg1_shift0_arg2 = 13944 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 13945 13946 private static NISuppressor arg2_divides_arg1 = 13947 new NISuppressor(0, 1, NumericInt.Divides.class); 13948 private static NISuppressor arg1_divides_arg2 = 13949 new NISuppressor(1, 0, NumericInt.Divides.class); 13950 13951 private static NISuppressor arg2_valid_shift = 13952 new NISuppressor(1, RangeInt.Bound0_63.class); 13953 13954 private static NISuppressionSet suppressions = 13955 new NISuppressionSet( 13956 new NISuppression[] { 13957 13958 // (r == x) && (y == 0) ==> r = x << y 13959 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 13960 13961 // (r == 0) && (x == 0) && (0 <= y <= 63) ==> r = x << y 13962 new NISuppression(result_eq_0, arg1_eq_0, arg2_valid_shift, 13963 suppressee), 13964 13965 }); 13966 13967 // Create a suppression factory for functionBinary 13968 13969} 13970 13971/** 13972 * Represents the invariant {@code x = Lshift(z, y)} over three long 13973 * scalars. 13974 */ 13975public static class LshiftLong_xzy extends FunctionBinary { 13976 static final long serialVersionUID = 20031030L; 13977 13978 // y must be between arg2_bound[0] and arg2_bound[1] inclusive 13979 static int[] arg2_bound = {0, 63}; 13980 13981 private static @Prototype LshiftLong_xzy proto = new @Prototype LshiftLong_xzy (); 13982 13983 /** Returns the prototype invariant for LshiftLong_xzy */ 13984 public static @Prototype LshiftLong_xzy get_proto() { 13985 return proto; 13986 } 13987 13988 @Override 13989 protected LshiftLong_xzy instantiate_dyn(@Prototype LshiftLong_xzy this, PptSlice slice) { 13990 return new LshiftLong_xzy (slice); 13991 } 13992 13993 private LshiftLong_xzy (PptSlice slice) { 13994 super(slice); 13995 } 13996 13997 public @Prototype LshiftLong_xzy () { 13998 super(); 13999 } 14000 14001 private static String[] method_name = new String[] {"", " << ", ""}; 14002 14003 @Override 14004 public String[] get_method_name(@GuardSatisfied LshiftLong_xzy this) { 14005 return method_name; 14006 } 14007 14008 private static int function_id = -1; 14009 14010 @Override 14011 public int get_function_id() { 14012 return function_id; 14013 } 14014 14015 @Override 14016 public void set_function_id(int function_id) { 14017 assert LshiftLong_xzy.function_id == -1; 14018 LshiftLong_xzy.function_id = function_id; 14019 } 14020 14021 private static int var_order = 4; 14022 14023 @Override 14024 public int get_var_order(@GuardSatisfied LshiftLong_xzy this) { 14025 return var_order; 14026 } 14027 14028 @Pure 14029 @Override 14030 public boolean is_symmetric() { 14031 14032 return false; 14033 } 14034 14035 @Override 14036 14037 public long func(long z, long y) { 14038 14039 if ((y < arg2_bound[0]) || (y > arg2_bound[1])) { 14040 throw new ArithmeticException("arg2 (" + y + ") out of range " 14041 + arg2_bound[0] + ".." + arg2_bound[1]); 14042 } 14043 14044 return (z << y); 14045 } 14046 14047 @Override 14048 public InvariantStatus check_modified(long x, long y, 14049 long z, int count) { 14050 return check_ordered(x, z, y, count); 14051 } 14052 14053 @Override 14054 public InvariantStatus add_modified(long x, long y, 14055 long z, int count) { 14056 if (Debug.logDetail()) { 14057 log("result=%s, arg1=%s, arg2=%s", x, z, y); 14058 } 14059 return add_ordered(x, z, y, count); 14060 } 14061 14062 @Pure 14063 @Override 14064 public boolean isLshift() { 14065 return true; 14066 } 14067 14068 /** Returns a list of non-instantiating suppressions for this invariant. */ 14069 @Pure 14070 @Override 14071 public @Nullable NISuppressionSet get_ni_suppressions() { 14072 if (NIS.dkconfig_enabled && dkconfig_enabled) { 14073 return suppressions; 14074 } else { 14075 return null; 14076 } 14077 } 14078 14079 /** definition of this invariant (the suppressee) */ 14080 private static NISuppressee suppressee = new NISuppressee(LshiftLong_xzy.class, 3); 14081 14082 // suppressor definitions (used below) 14083 private static NISuppressor result_eq_arg1 = 14084 new NISuppressor(0, 2, IntEqual.class); 14085 private static NISuppressor result_eq_arg2 = 14086 new NISuppressor(0, 1, IntEqual.class); 14087 private static NISuppressor arg1_eq_arg2 = 14088 new NISuppressor(2, 1, IntEqual.class); 14089 14090 private static NISuppressor result_lt_arg1 = 14091 new NISuppressor(0, 2, IntLessThan.class); 14092 private static NISuppressor result_lt_arg2 = 14093 new NISuppressor(0, 1, IntLessThan.class); 14094 private static NISuppressor arg1_lt_arg2 = 14095 new NISuppressor(2, 1, IntLessThan.class); 14096 private static NISuppressor arg2_lt_arg1 = 14097 new NISuppressor(1, 2, IntLessThan.class); 14098 14099 private static NISuppressor result_le_arg1 = 14100 new NISuppressor(0, 2, IntLessEqual.class); 14101 private static NISuppressor result_le_arg2 = 14102 new NISuppressor(0, 1, IntLessEqual.class); 14103 private static NISuppressor arg1_le_arg2 = 14104 new NISuppressor(2, 1, IntLessEqual.class); 14105 private static NISuppressor arg2_le_arg1 = 14106 new NISuppressor(1, 2, IntLessEqual.class); 14107 14108 private static NISuppressor result_track0_arg1 = 14109 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 14110 private static NISuppressor result_track0_arg2 = 14111 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 14112 private static NISuppressor arg1_track0_arg2 = 14113 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 14114 private static NISuppressor arg1_track0_result = 14115 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 14116 private static NISuppressor arg2_track0_result = 14117 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 14118 private static NISuppressor arg2_track0_arg1 = 14119 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 14120 14121 private static NISuppressor result_eq_1 = 14122 new NISuppressor(0, RangeInt.EqualOne.class); 14123 private static NISuppressor arg1_eq_1 = 14124 new NISuppressor(2, RangeInt.EqualOne.class); 14125 private static NISuppressor arg2_eq_1 = 14126 new NISuppressor(1, RangeInt.EqualOne.class); 14127 14128 private static NISuppressor result_eq_0 = 14129 new NISuppressor(0, RangeInt.EqualZero.class); 14130 private static NISuppressor arg1_eq_0 = 14131 new NISuppressor(2, RangeInt.EqualZero.class); 14132 private static NISuppressor arg2_eq_0 = 14133 new NISuppressor(1, RangeInt.EqualZero.class); 14134 14135 private static NISuppressor result_ne_0 = 14136 new NISuppressor(0, NonZero.class); 14137 private static NISuppressor arg1_ne_0 = 14138 new NISuppressor(2, NonZero.class); 14139 private static NISuppressor arg2_ne_0 = 14140 new NISuppressor(1, NonZero.class); 14141 14142 private static NISuppressor result_ge_0 = 14143 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 14144 private static NISuppressor arg1_ge_0 = 14145 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 14146 private static NISuppressor arg2_ge_0 = 14147 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 14148 14149 private static NISuppressor result_ge_64 = 14150 new NISuppressor(0, RangeInt.GreaterEqual64.class); 14151 private static NISuppressor arg1_ge_64 = 14152 new NISuppressor(2, RangeInt.GreaterEqual64.class); 14153 private static NISuppressor arg2_ge_64 = 14154 new NISuppressor(1, RangeInt.GreaterEqual64.class); 14155 14156 private static NISuppressor result_boolean = 14157 new NISuppressor(0, RangeInt.BooleanVal.class); 14158 private static NISuppressor arg1_boolean = 14159 new NISuppressor(2, RangeInt.BooleanVal.class); 14160 private static NISuppressor arg2_boolean = 14161 new NISuppressor(1, RangeInt.BooleanVal.class); 14162 14163 private static NISuppressor result_even = 14164 new NISuppressor(0, RangeInt.Even.class); 14165 private static NISuppressor arg1_even = 14166 new NISuppressor(2, RangeInt.Even.class); 14167 private static NISuppressor arg2_even = 14168 new NISuppressor(1, RangeInt.Even.class); 14169 14170 private static NISuppressor result_power2 = 14171 new NISuppressor(0, RangeInt.PowerOfTwo.class); 14172 private static NISuppressor arg1_power2 = 14173 new NISuppressor(2, RangeInt.PowerOfTwo.class); 14174 private static NISuppressor arg2_power2 = 14175 new NISuppressor(1, RangeInt.PowerOfTwo.class); 14176 14177 private static NISuppressor result_and0_arg1 = 14178 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 14179 private static NISuppressor result_and0_arg2 = 14180 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 14181 private static NISuppressor arg1_and0_arg2 = 14182 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 14183 14184 // The arguments to bitwise subset are backwards from what one 14185 // might expect. The second argument is a subset of the first 14186 // argument 14187 private static NISuppressor arg1_bw_subset_arg2 = 14188 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 14189 private static NISuppressor arg2_bw_subset_arg1 = 14190 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 14191 14192 private static NISuppressor result_shift0_arg1 = 14193 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 14194 private static NISuppressor result_shift0_arg2 = 14195 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 14196 private static NISuppressor arg1_shift0_arg2 = 14197 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 14198 14199 private static NISuppressor arg2_divides_arg1 = 14200 new NISuppressor(2, 1, NumericInt.Divides.class); 14201 private static NISuppressor arg1_divides_arg2 = 14202 new NISuppressor(1, 2, NumericInt.Divides.class); 14203 14204 private static NISuppressor arg2_valid_shift = 14205 new NISuppressor(1, RangeInt.Bound0_63.class); 14206 14207 private static NISuppressionSet suppressions = 14208 new NISuppressionSet( 14209 new NISuppression[] { 14210 14211 // (r == z) && (y == 0) ==> r = z << y 14212 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 14213 14214 // (r == 0) && (z == 0) && (0 <= y <= 63) ==> r = z << y 14215 new NISuppression(result_eq_0, arg1_eq_0, arg2_valid_shift, 14216 suppressee), 14217 14218 }); 14219 14220 // Create a suppression factory for functionBinary 14221 14222} 14223 14224/** 14225 * Represents the invariant {@code y = Lshift(z, x)} over three long 14226 * scalars. 14227 */ 14228public static class LshiftLong_yzx extends FunctionBinary { 14229 static final long serialVersionUID = 20031030L; 14230 14231 // x must be between arg2_bound[0] and arg2_bound[1] inclusive 14232 static int[] arg2_bound = {0, 63}; 14233 14234 private static @Prototype LshiftLong_yzx proto = new @Prototype LshiftLong_yzx (); 14235 14236 /** Returns the prototype invariant for LshiftLong_yzx */ 14237 public static @Prototype LshiftLong_yzx get_proto() { 14238 return proto; 14239 } 14240 14241 @Override 14242 protected LshiftLong_yzx instantiate_dyn(@Prototype LshiftLong_yzx this, PptSlice slice) { 14243 return new LshiftLong_yzx (slice); 14244 } 14245 14246 private LshiftLong_yzx (PptSlice slice) { 14247 super(slice); 14248 } 14249 14250 public @Prototype LshiftLong_yzx () { 14251 super(); 14252 } 14253 14254 private static String[] method_name = new String[] {"", " << ", ""}; 14255 14256 @Override 14257 public String[] get_method_name(@GuardSatisfied LshiftLong_yzx this) { 14258 return method_name; 14259 } 14260 14261 private static int function_id = -1; 14262 14263 @Override 14264 public int get_function_id() { 14265 return function_id; 14266 } 14267 14268 @Override 14269 public void set_function_id(int function_id) { 14270 assert LshiftLong_yzx.function_id == -1; 14271 LshiftLong_yzx.function_id = function_id; 14272 } 14273 14274 private static int var_order = 5; 14275 14276 @Override 14277 public int get_var_order(@GuardSatisfied LshiftLong_yzx this) { 14278 return var_order; 14279 } 14280 14281 @Pure 14282 @Override 14283 public boolean is_symmetric() { 14284 14285 return false; 14286 } 14287 14288 @Override 14289 14290 public long func(long z, long x) { 14291 14292 if ((x < arg2_bound[0]) || (x > arg2_bound[1])) { 14293 throw new ArithmeticException("arg2 (" + x + ") out of range " 14294 + arg2_bound[0] + ".." + arg2_bound[1]); 14295 } 14296 14297 return (z << x); 14298 } 14299 14300 @Override 14301 public InvariantStatus check_modified(long x, long y, 14302 long z, int count) { 14303 return check_ordered(y, z, x, count); 14304 } 14305 14306 @Override 14307 public InvariantStatus add_modified(long x, long y, 14308 long z, int count) { 14309 if (Debug.logDetail()) { 14310 log("result=%s, arg1=%s, arg2=%s", y, z, x); 14311 } 14312 return add_ordered(y, z, x, count); 14313 } 14314 14315 @Pure 14316 @Override 14317 public boolean isLshift() { 14318 return true; 14319 } 14320 14321 /** Returns a list of non-instantiating suppressions for this invariant. */ 14322 @Pure 14323 @Override 14324 public @Nullable NISuppressionSet get_ni_suppressions() { 14325 if (NIS.dkconfig_enabled && dkconfig_enabled) { 14326 return suppressions; 14327 } else { 14328 return null; 14329 } 14330 } 14331 14332 /** definition of this invariant (the suppressee) */ 14333 private static NISuppressee suppressee = new NISuppressee(LshiftLong_yzx.class, 3); 14334 14335 // suppressor definitions (used below) 14336 private static NISuppressor result_eq_arg1 = 14337 new NISuppressor(1, 2, IntEqual.class); 14338 private static NISuppressor result_eq_arg2 = 14339 new NISuppressor(1, 0, IntEqual.class); 14340 private static NISuppressor arg1_eq_arg2 = 14341 new NISuppressor(2, 0, IntEqual.class); 14342 14343 private static NISuppressor result_lt_arg1 = 14344 new NISuppressor(1, 2, IntLessThan.class); 14345 private static NISuppressor result_lt_arg2 = 14346 new NISuppressor(1, 0, IntLessThan.class); 14347 private static NISuppressor arg1_lt_arg2 = 14348 new NISuppressor(2, 0, IntLessThan.class); 14349 private static NISuppressor arg2_lt_arg1 = 14350 new NISuppressor(0, 2, IntLessThan.class); 14351 14352 private static NISuppressor result_le_arg1 = 14353 new NISuppressor(1, 2, IntLessEqual.class); 14354 private static NISuppressor result_le_arg2 = 14355 new NISuppressor(1, 0, IntLessEqual.class); 14356 private static NISuppressor arg1_le_arg2 = 14357 new NISuppressor(2, 0, IntLessEqual.class); 14358 private static NISuppressor arg2_le_arg1 = 14359 new NISuppressor(0, 2, IntLessEqual.class); 14360 14361 private static NISuppressor result_track0_arg1 = 14362 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 14363 private static NISuppressor result_track0_arg2 = 14364 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 14365 private static NISuppressor arg1_track0_arg2 = 14366 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 14367 private static NISuppressor arg1_track0_result = 14368 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 14369 private static NISuppressor arg2_track0_result = 14370 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 14371 private static NISuppressor arg2_track0_arg1 = 14372 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 14373 14374 private static NISuppressor result_eq_1 = 14375 new NISuppressor(1, RangeInt.EqualOne.class); 14376 private static NISuppressor arg1_eq_1 = 14377 new NISuppressor(2, RangeInt.EqualOne.class); 14378 private static NISuppressor arg2_eq_1 = 14379 new NISuppressor(0, RangeInt.EqualOne.class); 14380 14381 private static NISuppressor result_eq_0 = 14382 new NISuppressor(1, RangeInt.EqualZero.class); 14383 private static NISuppressor arg1_eq_0 = 14384 new NISuppressor(2, RangeInt.EqualZero.class); 14385 private static NISuppressor arg2_eq_0 = 14386 new NISuppressor(0, RangeInt.EqualZero.class); 14387 14388 private static NISuppressor result_ne_0 = 14389 new NISuppressor(1, NonZero.class); 14390 private static NISuppressor arg1_ne_0 = 14391 new NISuppressor(2, NonZero.class); 14392 private static NISuppressor arg2_ne_0 = 14393 new NISuppressor(0, NonZero.class); 14394 14395 private static NISuppressor result_ge_0 = 14396 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 14397 private static NISuppressor arg1_ge_0 = 14398 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 14399 private static NISuppressor arg2_ge_0 = 14400 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 14401 14402 private static NISuppressor result_ge_64 = 14403 new NISuppressor(1, RangeInt.GreaterEqual64.class); 14404 private static NISuppressor arg1_ge_64 = 14405 new NISuppressor(2, RangeInt.GreaterEqual64.class); 14406 private static NISuppressor arg2_ge_64 = 14407 new NISuppressor(0, RangeInt.GreaterEqual64.class); 14408 14409 private static NISuppressor result_boolean = 14410 new NISuppressor(1, RangeInt.BooleanVal.class); 14411 private static NISuppressor arg1_boolean = 14412 new NISuppressor(2, RangeInt.BooleanVal.class); 14413 private static NISuppressor arg2_boolean = 14414 new NISuppressor(0, RangeInt.BooleanVal.class); 14415 14416 private static NISuppressor result_even = 14417 new NISuppressor(1, RangeInt.Even.class); 14418 private static NISuppressor arg1_even = 14419 new NISuppressor(2, RangeInt.Even.class); 14420 private static NISuppressor arg2_even = 14421 new NISuppressor(0, RangeInt.Even.class); 14422 14423 private static NISuppressor result_power2 = 14424 new NISuppressor(1, RangeInt.PowerOfTwo.class); 14425 private static NISuppressor arg1_power2 = 14426 new NISuppressor(2, RangeInt.PowerOfTwo.class); 14427 private static NISuppressor arg2_power2 = 14428 new NISuppressor(0, RangeInt.PowerOfTwo.class); 14429 14430 private static NISuppressor result_and0_arg1 = 14431 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 14432 private static NISuppressor result_and0_arg2 = 14433 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 14434 private static NISuppressor arg1_and0_arg2 = 14435 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 14436 14437 // The arguments to bitwise subset are backwards from what one 14438 // might expect. The second argument is a subset of the first 14439 // argument 14440 private static NISuppressor arg1_bw_subset_arg2 = 14441 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 14442 private static NISuppressor arg2_bw_subset_arg1 = 14443 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 14444 14445 private static NISuppressor result_shift0_arg1 = 14446 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 14447 private static NISuppressor result_shift0_arg2 = 14448 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 14449 private static NISuppressor arg1_shift0_arg2 = 14450 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 14451 14452 private static NISuppressor arg2_divides_arg1 = 14453 new NISuppressor(2, 0, NumericInt.Divides.class); 14454 private static NISuppressor arg1_divides_arg2 = 14455 new NISuppressor(0, 2, NumericInt.Divides.class); 14456 14457 private static NISuppressor arg2_valid_shift = 14458 new NISuppressor(0, RangeInt.Bound0_63.class); 14459 14460 private static NISuppressionSet suppressions = 14461 new NISuppressionSet( 14462 new NISuppression[] { 14463 14464 // (r == z) && (x == 0) ==> r = z << x 14465 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 14466 14467 // (r == 0) && (z == 0) && (0 <= x <= 63) ==> r = z << x 14468 new NISuppression(result_eq_0, arg1_eq_0, arg2_valid_shift, 14469 suppressee), 14470 14471 }); 14472 14473 // Create a suppression factory for functionBinary 14474 14475} 14476 14477/** 14478 * Represents the invariant {@code z = Lshift(y, x)} over three long 14479 * scalars. 14480 */ 14481public static class LshiftLong_zyx extends FunctionBinary { 14482 static final long serialVersionUID = 20031030L; 14483 14484 // x must be between arg2_bound[0] and arg2_bound[1] inclusive 14485 static int[] arg2_bound = {0, 63}; 14486 14487 private static @Prototype LshiftLong_zyx proto = new @Prototype LshiftLong_zyx (); 14488 14489 /** Returns the prototype invariant for LshiftLong_zyx */ 14490 public static @Prototype LshiftLong_zyx get_proto() { 14491 return proto; 14492 } 14493 14494 @Override 14495 protected LshiftLong_zyx instantiate_dyn(@Prototype LshiftLong_zyx this, PptSlice slice) { 14496 return new LshiftLong_zyx (slice); 14497 } 14498 14499 private LshiftLong_zyx (PptSlice slice) { 14500 super(slice); 14501 } 14502 14503 public @Prototype LshiftLong_zyx () { 14504 super(); 14505 } 14506 14507 private static String[] method_name = new String[] {"", " << ", ""}; 14508 14509 @Override 14510 public String[] get_method_name(@GuardSatisfied LshiftLong_zyx this) { 14511 return method_name; 14512 } 14513 14514 private static int function_id = -1; 14515 14516 @Override 14517 public int get_function_id() { 14518 return function_id; 14519 } 14520 14521 @Override 14522 public void set_function_id(int function_id) { 14523 assert LshiftLong_zyx.function_id == -1; 14524 LshiftLong_zyx.function_id = function_id; 14525 } 14526 14527 private static int var_order = 6; 14528 14529 @Override 14530 public int get_var_order(@GuardSatisfied LshiftLong_zyx this) { 14531 return var_order; 14532 } 14533 14534 @Pure 14535 @Override 14536 public boolean is_symmetric() { 14537 14538 return false; 14539 } 14540 14541 @Override 14542 14543 public long func(long y, long x) { 14544 14545 if ((x < arg2_bound[0]) || (x > arg2_bound[1])) { 14546 throw new ArithmeticException("arg2 (" + x + ") out of range " 14547 + arg2_bound[0] + ".." + arg2_bound[1]); 14548 } 14549 14550 return (y << x); 14551 } 14552 14553 @Override 14554 public InvariantStatus check_modified(long x, long y, 14555 long z, int count) { 14556 return check_ordered(z, y, x, count); 14557 } 14558 14559 @Override 14560 public InvariantStatus add_modified(long x, long y, 14561 long z, int count) { 14562 if (Debug.logDetail()) { 14563 log("result=%s, arg1=%s, arg2=%s", z, y, x); 14564 } 14565 return add_ordered(z, y, x, count); 14566 } 14567 14568 @Pure 14569 @Override 14570 public boolean isLshift() { 14571 return true; 14572 } 14573 14574 /** Returns a list of non-instantiating suppressions for this invariant. */ 14575 @Pure 14576 @Override 14577 public @Nullable NISuppressionSet get_ni_suppressions() { 14578 if (NIS.dkconfig_enabled && dkconfig_enabled) { 14579 return suppressions; 14580 } else { 14581 return null; 14582 } 14583 } 14584 14585 /** definition of this invariant (the suppressee) */ 14586 private static NISuppressee suppressee = new NISuppressee(LshiftLong_zyx.class, 3); 14587 14588 // suppressor definitions (used below) 14589 private static NISuppressor result_eq_arg1 = 14590 new NISuppressor(2, 1, IntEqual.class); 14591 private static NISuppressor result_eq_arg2 = 14592 new NISuppressor(2, 0, IntEqual.class); 14593 private static NISuppressor arg1_eq_arg2 = 14594 new NISuppressor(1, 0, IntEqual.class); 14595 14596 private static NISuppressor result_lt_arg1 = 14597 new NISuppressor(2, 1, IntLessThan.class); 14598 private static NISuppressor result_lt_arg2 = 14599 new NISuppressor(2, 0, IntLessThan.class); 14600 private static NISuppressor arg1_lt_arg2 = 14601 new NISuppressor(1, 0, IntLessThan.class); 14602 private static NISuppressor arg2_lt_arg1 = 14603 new NISuppressor(0, 1, IntLessThan.class); 14604 14605 private static NISuppressor result_le_arg1 = 14606 new NISuppressor(2, 1, IntLessEqual.class); 14607 private static NISuppressor result_le_arg2 = 14608 new NISuppressor(2, 0, IntLessEqual.class); 14609 private static NISuppressor arg1_le_arg2 = 14610 new NISuppressor(1, 0, IntLessEqual.class); 14611 private static NISuppressor arg2_le_arg1 = 14612 new NISuppressor(0, 1, IntLessEqual.class); 14613 14614 private static NISuppressor result_track0_arg1 = 14615 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 14616 private static NISuppressor result_track0_arg2 = 14617 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 14618 private static NISuppressor arg1_track0_arg2 = 14619 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 14620 private static NISuppressor arg1_track0_result = 14621 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 14622 private static NISuppressor arg2_track0_result = 14623 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 14624 private static NISuppressor arg2_track0_arg1 = 14625 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 14626 14627 private static NISuppressor result_eq_1 = 14628 new NISuppressor(2, RangeInt.EqualOne.class); 14629 private static NISuppressor arg1_eq_1 = 14630 new NISuppressor(1, RangeInt.EqualOne.class); 14631 private static NISuppressor arg2_eq_1 = 14632 new NISuppressor(0, RangeInt.EqualOne.class); 14633 14634 private static NISuppressor result_eq_0 = 14635 new NISuppressor(2, RangeInt.EqualZero.class); 14636 private static NISuppressor arg1_eq_0 = 14637 new NISuppressor(1, RangeInt.EqualZero.class); 14638 private static NISuppressor arg2_eq_0 = 14639 new NISuppressor(0, RangeInt.EqualZero.class); 14640 14641 private static NISuppressor result_ne_0 = 14642 new NISuppressor(2, NonZero.class); 14643 private static NISuppressor arg1_ne_0 = 14644 new NISuppressor(1, NonZero.class); 14645 private static NISuppressor arg2_ne_0 = 14646 new NISuppressor(0, NonZero.class); 14647 14648 private static NISuppressor result_ge_0 = 14649 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 14650 private static NISuppressor arg1_ge_0 = 14651 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 14652 private static NISuppressor arg2_ge_0 = 14653 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 14654 14655 private static NISuppressor result_ge_64 = 14656 new NISuppressor(2, RangeInt.GreaterEqual64.class); 14657 private static NISuppressor arg1_ge_64 = 14658 new NISuppressor(1, RangeInt.GreaterEqual64.class); 14659 private static NISuppressor arg2_ge_64 = 14660 new NISuppressor(0, RangeInt.GreaterEqual64.class); 14661 14662 private static NISuppressor result_boolean = 14663 new NISuppressor(2, RangeInt.BooleanVal.class); 14664 private static NISuppressor arg1_boolean = 14665 new NISuppressor(1, RangeInt.BooleanVal.class); 14666 private static NISuppressor arg2_boolean = 14667 new NISuppressor(0, RangeInt.BooleanVal.class); 14668 14669 private static NISuppressor result_even = 14670 new NISuppressor(2, RangeInt.Even.class); 14671 private static NISuppressor arg1_even = 14672 new NISuppressor(1, RangeInt.Even.class); 14673 private static NISuppressor arg2_even = 14674 new NISuppressor(0, RangeInt.Even.class); 14675 14676 private static NISuppressor result_power2 = 14677 new NISuppressor(2, RangeInt.PowerOfTwo.class); 14678 private static NISuppressor arg1_power2 = 14679 new NISuppressor(1, RangeInt.PowerOfTwo.class); 14680 private static NISuppressor arg2_power2 = 14681 new NISuppressor(0, RangeInt.PowerOfTwo.class); 14682 14683 private static NISuppressor result_and0_arg1 = 14684 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 14685 private static NISuppressor result_and0_arg2 = 14686 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 14687 private static NISuppressor arg1_and0_arg2 = 14688 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 14689 14690 // The arguments to bitwise subset are backwards from what one 14691 // might expect. The second argument is a subset of the first 14692 // argument 14693 private static NISuppressor arg1_bw_subset_arg2 = 14694 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 14695 private static NISuppressor arg2_bw_subset_arg1 = 14696 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 14697 14698 private static NISuppressor result_shift0_arg1 = 14699 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 14700 private static NISuppressor result_shift0_arg2 = 14701 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 14702 private static NISuppressor arg1_shift0_arg2 = 14703 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 14704 14705 private static NISuppressor arg2_divides_arg1 = 14706 new NISuppressor(1, 0, NumericInt.Divides.class); 14707 private static NISuppressor arg1_divides_arg2 = 14708 new NISuppressor(0, 1, NumericInt.Divides.class); 14709 14710 private static NISuppressor arg2_valid_shift = 14711 new NISuppressor(0, RangeInt.Bound0_63.class); 14712 14713 private static NISuppressionSet suppressions = 14714 new NISuppressionSet( 14715 new NISuppression[] { 14716 14717 // (r == y) && (x == 0) ==> r = y << x 14718 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 14719 14720 // (r == 0) && (y == 0) && (0 <= x <= 63) ==> r = y << x 14721 new NISuppression(result_eq_0, arg1_eq_0, arg2_valid_shift, 14722 suppressee), 14723 14724 }); 14725 14726 // Create a suppression factory for functionBinary 14727 14728} 14729 14730 // default is that it is not this function, overriden in the subclass 14731 @Pure 14732 public boolean isRshiftSigned() { 14733 return false; 14734 } 14735 14736/** 14737 * Represents the invariant {@code x = RshiftSigned(y, z)} over three long 14738 * scalars. 14739 */ 14740public static class RshiftSignedLong_xyz extends FunctionBinary { 14741 static final long serialVersionUID = 20031030L; 14742 14743 // z must be between arg2_bound[0] and arg2_bound[1] inclusive 14744 static int[] arg2_bound = {0, 63}; 14745 14746 private static @Prototype RshiftSignedLong_xyz proto = new @Prototype RshiftSignedLong_xyz (); 14747 14748 /** Returns the prototype invariant for RshiftSignedLong_xyz */ 14749 public static @Prototype RshiftSignedLong_xyz get_proto() { 14750 return proto; 14751 } 14752 14753 @Override 14754 protected RshiftSignedLong_xyz instantiate_dyn(@Prototype RshiftSignedLong_xyz this, PptSlice slice) { 14755 return new RshiftSignedLong_xyz (slice); 14756 } 14757 14758 private RshiftSignedLong_xyz (PptSlice slice) { 14759 super(slice); 14760 } 14761 14762 public @Prototype RshiftSignedLong_xyz () { 14763 super(); 14764 } 14765 14766 private static String[] method_name = new String[] {"", " >> ", ""}; 14767 14768 @Override 14769 public String[] get_method_name(@GuardSatisfied RshiftSignedLong_xyz this) { 14770 return method_name; 14771 } 14772 14773 private static int function_id = -1; 14774 14775 @Override 14776 public int get_function_id() { 14777 return function_id; 14778 } 14779 14780 @Override 14781 public void set_function_id(int function_id) { 14782 assert RshiftSignedLong_xyz.function_id == -1; 14783 RshiftSignedLong_xyz.function_id = function_id; 14784 } 14785 14786 private static int var_order = 1; 14787 14788 @Override 14789 public int get_var_order(@GuardSatisfied RshiftSignedLong_xyz this) { 14790 return var_order; 14791 } 14792 14793 @Pure 14794 @Override 14795 public boolean is_symmetric() { 14796 14797 return false; 14798 } 14799 14800 @Override 14801 14802 public long func(long y, long z) { 14803 14804 if ((z < arg2_bound[0]) || (z > arg2_bound[1])) { 14805 throw new ArithmeticException("arg2 (" + z + ") out of range " 14806 + arg2_bound[0] + ".." + arg2_bound[1]); 14807 } 14808 14809 return (y >> z); 14810 } 14811 14812 @Override 14813 public InvariantStatus check_modified(long x, long y, 14814 long z, int count) { 14815 return check_ordered(x, y, z, count); 14816 } 14817 14818 @Override 14819 public InvariantStatus add_modified(long x, long y, 14820 long z, int count) { 14821 if (Debug.logDetail()) { 14822 log("result=%s, arg1=%s, arg2=%s", x, y, z); 14823 } 14824 return add_ordered(x, y, z, count); 14825 } 14826 14827 @Pure 14828 @Override 14829 public boolean isRshiftSigned() { 14830 return true; 14831 } 14832 14833 /** Returns a list of non-instantiating suppressions for this invariant. */ 14834 @Pure 14835 @Override 14836 public @Nullable NISuppressionSet get_ni_suppressions() { 14837 if (NIS.dkconfig_enabled && dkconfig_enabled) { 14838 return suppressions; 14839 } else { 14840 return null; 14841 } 14842 } 14843 14844 /** definition of this invariant (the suppressee) */ 14845 private static NISuppressee suppressee = new NISuppressee(RshiftSignedLong_xyz.class, 3); 14846 14847 // suppressor definitions (used below) 14848 private static NISuppressor result_eq_arg1 = 14849 new NISuppressor(0, 1, IntEqual.class); 14850 private static NISuppressor result_eq_arg2 = 14851 new NISuppressor(0, 2, IntEqual.class); 14852 private static NISuppressor arg1_eq_arg2 = 14853 new NISuppressor(1, 2, IntEqual.class); 14854 14855 private static NISuppressor result_lt_arg1 = 14856 new NISuppressor(0, 1, IntLessThan.class); 14857 private static NISuppressor result_lt_arg2 = 14858 new NISuppressor(0, 2, IntLessThan.class); 14859 private static NISuppressor arg1_lt_arg2 = 14860 new NISuppressor(1, 2, IntLessThan.class); 14861 private static NISuppressor arg2_lt_arg1 = 14862 new NISuppressor(2, 1, IntLessThan.class); 14863 14864 private static NISuppressor result_le_arg1 = 14865 new NISuppressor(0, 1, IntLessEqual.class); 14866 private static NISuppressor result_le_arg2 = 14867 new NISuppressor(0, 2, IntLessEqual.class); 14868 private static NISuppressor arg1_le_arg2 = 14869 new NISuppressor(1, 2, IntLessEqual.class); 14870 private static NISuppressor arg2_le_arg1 = 14871 new NISuppressor(2, 1, IntLessEqual.class); 14872 14873 private static NISuppressor result_track0_arg1 = 14874 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 14875 private static NISuppressor result_track0_arg2 = 14876 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 14877 private static NISuppressor arg1_track0_arg2 = 14878 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 14879 private static NISuppressor arg1_track0_result = 14880 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 14881 private static NISuppressor arg2_track0_result = 14882 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 14883 private static NISuppressor arg2_track0_arg1 = 14884 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 14885 14886 private static NISuppressor result_eq_1 = 14887 new NISuppressor(0, RangeInt.EqualOne.class); 14888 private static NISuppressor arg1_eq_1 = 14889 new NISuppressor(1, RangeInt.EqualOne.class); 14890 private static NISuppressor arg2_eq_1 = 14891 new NISuppressor(2, RangeInt.EqualOne.class); 14892 14893 private static NISuppressor result_eq_0 = 14894 new NISuppressor(0, RangeInt.EqualZero.class); 14895 private static NISuppressor arg1_eq_0 = 14896 new NISuppressor(1, RangeInt.EqualZero.class); 14897 private static NISuppressor arg2_eq_0 = 14898 new NISuppressor(2, RangeInt.EqualZero.class); 14899 14900 private static NISuppressor result_ne_0 = 14901 new NISuppressor(0, NonZero.class); 14902 private static NISuppressor arg1_ne_0 = 14903 new NISuppressor(1, NonZero.class); 14904 private static NISuppressor arg2_ne_0 = 14905 new NISuppressor(2, NonZero.class); 14906 14907 private static NISuppressor result_ge_0 = 14908 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 14909 private static NISuppressor arg1_ge_0 = 14910 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 14911 private static NISuppressor arg2_ge_0 = 14912 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 14913 14914 private static NISuppressor result_ge_64 = 14915 new NISuppressor(0, RangeInt.GreaterEqual64.class); 14916 private static NISuppressor arg1_ge_64 = 14917 new NISuppressor(1, RangeInt.GreaterEqual64.class); 14918 private static NISuppressor arg2_ge_64 = 14919 new NISuppressor(2, RangeInt.GreaterEqual64.class); 14920 14921 private static NISuppressor result_boolean = 14922 new NISuppressor(0, RangeInt.BooleanVal.class); 14923 private static NISuppressor arg1_boolean = 14924 new NISuppressor(1, RangeInt.BooleanVal.class); 14925 private static NISuppressor arg2_boolean = 14926 new NISuppressor(2, RangeInt.BooleanVal.class); 14927 14928 private static NISuppressor result_even = 14929 new NISuppressor(0, RangeInt.Even.class); 14930 private static NISuppressor arg1_even = 14931 new NISuppressor(1, RangeInt.Even.class); 14932 private static NISuppressor arg2_even = 14933 new NISuppressor(2, RangeInt.Even.class); 14934 14935 private static NISuppressor result_power2 = 14936 new NISuppressor(0, RangeInt.PowerOfTwo.class); 14937 private static NISuppressor arg1_power2 = 14938 new NISuppressor(1, RangeInt.PowerOfTwo.class); 14939 private static NISuppressor arg2_power2 = 14940 new NISuppressor(2, RangeInt.PowerOfTwo.class); 14941 14942 private static NISuppressor result_and0_arg1 = 14943 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 14944 private static NISuppressor result_and0_arg2 = 14945 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 14946 private static NISuppressor arg1_and0_arg2 = 14947 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 14948 14949 // The arguments to bitwise subset are backwards from what one 14950 // might expect. The second argument is a subset of the first 14951 // argument 14952 private static NISuppressor arg1_bw_subset_arg2 = 14953 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 14954 private static NISuppressor arg2_bw_subset_arg1 = 14955 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 14956 14957 private static NISuppressor result_shift0_arg1 = 14958 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 14959 private static NISuppressor result_shift0_arg2 = 14960 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 14961 private static NISuppressor arg1_shift0_arg2 = 14962 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 14963 14964 private static NISuppressor arg2_divides_arg1 = 14965 new NISuppressor(1, 2, NumericInt.Divides.class); 14966 private static NISuppressor arg1_divides_arg2 = 14967 new NISuppressor(2, 1, NumericInt.Divides.class); 14968 14969 private static NISuppressor arg2_valid_shift = 14970 new NISuppressor(2, RangeInt.Bound0_63.class); 14971 14972 private static NISuppressionSet suppressions = 14973 new NISuppressionSet( 14974 new NISuppression[] { 14975 14976 // (r == y) && (z == 0) ==> r = y >>> z 14977 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 14978 14979 // (r == 0) && (y == 0) && (0 <= z <= 63) ==> r = y >>> z 14980 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 14981 14982 // (r == 0) && ((y >> z) == 0) 14983 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 14984 14985 // (r == 0) && (z >= y) && (y >= 0) && (z valid shift) 14986 // This suppression really ought to have 2**z >= y, but we 14987 // don't have that invariant. This still might catch a lot of these. 14988 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 14989 // arg2_valid_shift, suppressee), 14990 }); 14991 14992 // Create a suppression factory for functionBinary 14993 14994} 14995 14996/** 14997 * Represents the invariant {@code y = RshiftSigned(x, z)} over three long 14998 * scalars. 14999 */ 15000public static class RshiftSignedLong_yxz extends FunctionBinary { 15001 static final long serialVersionUID = 20031030L; 15002 15003 // z must be between arg2_bound[0] and arg2_bound[1] inclusive 15004 static int[] arg2_bound = {0, 63}; 15005 15006 private static @Prototype RshiftSignedLong_yxz proto = new @Prototype RshiftSignedLong_yxz (); 15007 15008 /** Returns the prototype invariant for RshiftSignedLong_yxz */ 15009 public static @Prototype RshiftSignedLong_yxz get_proto() { 15010 return proto; 15011 } 15012 15013 @Override 15014 protected RshiftSignedLong_yxz instantiate_dyn(@Prototype RshiftSignedLong_yxz this, PptSlice slice) { 15015 return new RshiftSignedLong_yxz (slice); 15016 } 15017 15018 private RshiftSignedLong_yxz (PptSlice slice) { 15019 super(slice); 15020 } 15021 15022 public @Prototype RshiftSignedLong_yxz () { 15023 super(); 15024 } 15025 15026 private static String[] method_name = new String[] {"", " >> ", ""}; 15027 15028 @Override 15029 public String[] get_method_name(@GuardSatisfied RshiftSignedLong_yxz this) { 15030 return method_name; 15031 } 15032 15033 private static int function_id = -1; 15034 15035 @Override 15036 public int get_function_id() { 15037 return function_id; 15038 } 15039 15040 @Override 15041 public void set_function_id(int function_id) { 15042 assert RshiftSignedLong_yxz.function_id == -1; 15043 RshiftSignedLong_yxz.function_id = function_id; 15044 } 15045 15046 private static int var_order = 2; 15047 15048 @Override 15049 public int get_var_order(@GuardSatisfied RshiftSignedLong_yxz this) { 15050 return var_order; 15051 } 15052 15053 @Pure 15054 @Override 15055 public boolean is_symmetric() { 15056 15057 return false; 15058 } 15059 15060 @Override 15061 15062 public long func(long x, long z) { 15063 15064 if ((z < arg2_bound[0]) || (z > arg2_bound[1])) { 15065 throw new ArithmeticException("arg2 (" + z + ") out of range " 15066 + arg2_bound[0] + ".." + arg2_bound[1]); 15067 } 15068 15069 return (x >> z); 15070 } 15071 15072 @Override 15073 public InvariantStatus check_modified(long x, long y, 15074 long z, int count) { 15075 return check_ordered(y, x, z, count); 15076 } 15077 15078 @Override 15079 public InvariantStatus add_modified(long x, long y, 15080 long z, int count) { 15081 if (Debug.logDetail()) { 15082 log("result=%s, arg1=%s, arg2=%s", y, x, z); 15083 } 15084 return add_ordered(y, x, z, count); 15085 } 15086 15087 @Pure 15088 @Override 15089 public boolean isRshiftSigned() { 15090 return true; 15091 } 15092 15093 /** Returns a list of non-instantiating suppressions for this invariant. */ 15094 @Pure 15095 @Override 15096 public @Nullable NISuppressionSet get_ni_suppressions() { 15097 if (NIS.dkconfig_enabled && dkconfig_enabled) { 15098 return suppressions; 15099 } else { 15100 return null; 15101 } 15102 } 15103 15104 /** definition of this invariant (the suppressee) */ 15105 private static NISuppressee suppressee = new NISuppressee(RshiftSignedLong_yxz.class, 3); 15106 15107 // suppressor definitions (used below) 15108 private static NISuppressor result_eq_arg1 = 15109 new NISuppressor(1, 0, IntEqual.class); 15110 private static NISuppressor result_eq_arg2 = 15111 new NISuppressor(1, 2, IntEqual.class); 15112 private static NISuppressor arg1_eq_arg2 = 15113 new NISuppressor(0, 2, IntEqual.class); 15114 15115 private static NISuppressor result_lt_arg1 = 15116 new NISuppressor(1, 0, IntLessThan.class); 15117 private static NISuppressor result_lt_arg2 = 15118 new NISuppressor(1, 2, IntLessThan.class); 15119 private static NISuppressor arg1_lt_arg2 = 15120 new NISuppressor(0, 2, IntLessThan.class); 15121 private static NISuppressor arg2_lt_arg1 = 15122 new NISuppressor(2, 0, IntLessThan.class); 15123 15124 private static NISuppressor result_le_arg1 = 15125 new NISuppressor(1, 0, IntLessEqual.class); 15126 private static NISuppressor result_le_arg2 = 15127 new NISuppressor(1, 2, IntLessEqual.class); 15128 private static NISuppressor arg1_le_arg2 = 15129 new NISuppressor(0, 2, IntLessEqual.class); 15130 private static NISuppressor arg2_le_arg1 = 15131 new NISuppressor(2, 0, IntLessEqual.class); 15132 15133 private static NISuppressor result_track0_arg1 = 15134 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 15135 private static NISuppressor result_track0_arg2 = 15136 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 15137 private static NISuppressor arg1_track0_arg2 = 15138 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 15139 private static NISuppressor arg1_track0_result = 15140 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 15141 private static NISuppressor arg2_track0_result = 15142 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 15143 private static NISuppressor arg2_track0_arg1 = 15144 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 15145 15146 private static NISuppressor result_eq_1 = 15147 new NISuppressor(1, RangeInt.EqualOne.class); 15148 private static NISuppressor arg1_eq_1 = 15149 new NISuppressor(0, RangeInt.EqualOne.class); 15150 private static NISuppressor arg2_eq_1 = 15151 new NISuppressor(2, RangeInt.EqualOne.class); 15152 15153 private static NISuppressor result_eq_0 = 15154 new NISuppressor(1, RangeInt.EqualZero.class); 15155 private static NISuppressor arg1_eq_0 = 15156 new NISuppressor(0, RangeInt.EqualZero.class); 15157 private static NISuppressor arg2_eq_0 = 15158 new NISuppressor(2, RangeInt.EqualZero.class); 15159 15160 private static NISuppressor result_ne_0 = 15161 new NISuppressor(1, NonZero.class); 15162 private static NISuppressor arg1_ne_0 = 15163 new NISuppressor(0, NonZero.class); 15164 private static NISuppressor arg2_ne_0 = 15165 new NISuppressor(2, NonZero.class); 15166 15167 private static NISuppressor result_ge_0 = 15168 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 15169 private static NISuppressor arg1_ge_0 = 15170 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 15171 private static NISuppressor arg2_ge_0 = 15172 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 15173 15174 private static NISuppressor result_ge_64 = 15175 new NISuppressor(1, RangeInt.GreaterEqual64.class); 15176 private static NISuppressor arg1_ge_64 = 15177 new NISuppressor(0, RangeInt.GreaterEqual64.class); 15178 private static NISuppressor arg2_ge_64 = 15179 new NISuppressor(2, RangeInt.GreaterEqual64.class); 15180 15181 private static NISuppressor result_boolean = 15182 new NISuppressor(1, RangeInt.BooleanVal.class); 15183 private static NISuppressor arg1_boolean = 15184 new NISuppressor(0, RangeInt.BooleanVal.class); 15185 private static NISuppressor arg2_boolean = 15186 new NISuppressor(2, RangeInt.BooleanVal.class); 15187 15188 private static NISuppressor result_even = 15189 new NISuppressor(1, RangeInt.Even.class); 15190 private static NISuppressor arg1_even = 15191 new NISuppressor(0, RangeInt.Even.class); 15192 private static NISuppressor arg2_even = 15193 new NISuppressor(2, RangeInt.Even.class); 15194 15195 private static NISuppressor result_power2 = 15196 new NISuppressor(1, RangeInt.PowerOfTwo.class); 15197 private static NISuppressor arg1_power2 = 15198 new NISuppressor(0, RangeInt.PowerOfTwo.class); 15199 private static NISuppressor arg2_power2 = 15200 new NISuppressor(2, RangeInt.PowerOfTwo.class); 15201 15202 private static NISuppressor result_and0_arg1 = 15203 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 15204 private static NISuppressor result_and0_arg2 = 15205 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 15206 private static NISuppressor arg1_and0_arg2 = 15207 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 15208 15209 // The arguments to bitwise subset are backwards from what one 15210 // might expect. The second argument is a subset of the first 15211 // argument 15212 private static NISuppressor arg1_bw_subset_arg2 = 15213 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 15214 private static NISuppressor arg2_bw_subset_arg1 = 15215 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 15216 15217 private static NISuppressor result_shift0_arg1 = 15218 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 15219 private static NISuppressor result_shift0_arg2 = 15220 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 15221 private static NISuppressor arg1_shift0_arg2 = 15222 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 15223 15224 private static NISuppressor arg2_divides_arg1 = 15225 new NISuppressor(0, 2, NumericInt.Divides.class); 15226 private static NISuppressor arg1_divides_arg2 = 15227 new NISuppressor(2, 0, NumericInt.Divides.class); 15228 15229 private static NISuppressor arg2_valid_shift = 15230 new NISuppressor(2, RangeInt.Bound0_63.class); 15231 15232 private static NISuppressionSet suppressions = 15233 new NISuppressionSet( 15234 new NISuppression[] { 15235 15236 // (r == x) && (z == 0) ==> r = x >>> z 15237 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 15238 15239 // (r == 0) && (x == 0) && (0 <= z <= 63) ==> r = x >>> z 15240 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 15241 15242 // (r == 0) && ((x >> z) == 0) 15243 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 15244 15245 // (r == 0) && (z >= x) && (x >= 0) && (z valid shift) 15246 // This suppression really ought to have 2**z >= x, but we 15247 // don't have that invariant. This still might catch a lot of these. 15248 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 15249 // arg2_valid_shift, suppressee), 15250 }); 15251 15252 // Create a suppression factory for functionBinary 15253 15254} 15255 15256/** 15257 * Represents the invariant {@code z = RshiftSigned(x, y)} over three long 15258 * scalars. 15259 */ 15260public static class RshiftSignedLong_zxy extends FunctionBinary { 15261 static final long serialVersionUID = 20031030L; 15262 15263 // y must be between arg2_bound[0] and arg2_bound[1] inclusive 15264 static int[] arg2_bound = {0, 63}; 15265 15266 private static @Prototype RshiftSignedLong_zxy proto = new @Prototype RshiftSignedLong_zxy (); 15267 15268 /** Returns the prototype invariant for RshiftSignedLong_zxy */ 15269 public static @Prototype RshiftSignedLong_zxy get_proto() { 15270 return proto; 15271 } 15272 15273 @Override 15274 protected RshiftSignedLong_zxy instantiate_dyn(@Prototype RshiftSignedLong_zxy this, PptSlice slice) { 15275 return new RshiftSignedLong_zxy (slice); 15276 } 15277 15278 private RshiftSignedLong_zxy (PptSlice slice) { 15279 super(slice); 15280 } 15281 15282 public @Prototype RshiftSignedLong_zxy () { 15283 super(); 15284 } 15285 15286 private static String[] method_name = new String[] {"", " >> ", ""}; 15287 15288 @Override 15289 public String[] get_method_name(@GuardSatisfied RshiftSignedLong_zxy this) { 15290 return method_name; 15291 } 15292 15293 private static int function_id = -1; 15294 15295 @Override 15296 public int get_function_id() { 15297 return function_id; 15298 } 15299 15300 @Override 15301 public void set_function_id(int function_id) { 15302 assert RshiftSignedLong_zxy.function_id == -1; 15303 RshiftSignedLong_zxy.function_id = function_id; 15304 } 15305 15306 private static int var_order = 3; 15307 15308 @Override 15309 public int get_var_order(@GuardSatisfied RshiftSignedLong_zxy this) { 15310 return var_order; 15311 } 15312 15313 @Pure 15314 @Override 15315 public boolean is_symmetric() { 15316 15317 return false; 15318 } 15319 15320 @Override 15321 15322 public long func(long x, long y) { 15323 15324 if ((y < arg2_bound[0]) || (y > arg2_bound[1])) { 15325 throw new ArithmeticException("arg2 (" + y + ") out of range " 15326 + arg2_bound[0] + ".." + arg2_bound[1]); 15327 } 15328 15329 return (x >> y); 15330 } 15331 15332 @Override 15333 public InvariantStatus check_modified(long x, long y, 15334 long z, int count) { 15335 return check_ordered(z, x, y, count); 15336 } 15337 15338 @Override 15339 public InvariantStatus add_modified(long x, long y, 15340 long z, int count) { 15341 if (Debug.logDetail()) { 15342 log("result=%s, arg1=%s, arg2=%s", z, x, y); 15343 } 15344 return add_ordered(z, x, y, count); 15345 } 15346 15347 @Pure 15348 @Override 15349 public boolean isRshiftSigned() { 15350 return true; 15351 } 15352 15353 /** Returns a list of non-instantiating suppressions for this invariant. */ 15354 @Pure 15355 @Override 15356 public @Nullable NISuppressionSet get_ni_suppressions() { 15357 if (NIS.dkconfig_enabled && dkconfig_enabled) { 15358 return suppressions; 15359 } else { 15360 return null; 15361 } 15362 } 15363 15364 /** definition of this invariant (the suppressee) */ 15365 private static NISuppressee suppressee = new NISuppressee(RshiftSignedLong_zxy.class, 3); 15366 15367 // suppressor definitions (used below) 15368 private static NISuppressor result_eq_arg1 = 15369 new NISuppressor(2, 0, IntEqual.class); 15370 private static NISuppressor result_eq_arg2 = 15371 new NISuppressor(2, 1, IntEqual.class); 15372 private static NISuppressor arg1_eq_arg2 = 15373 new NISuppressor(0, 1, IntEqual.class); 15374 15375 private static NISuppressor result_lt_arg1 = 15376 new NISuppressor(2, 0, IntLessThan.class); 15377 private static NISuppressor result_lt_arg2 = 15378 new NISuppressor(2, 1, IntLessThan.class); 15379 private static NISuppressor arg1_lt_arg2 = 15380 new NISuppressor(0, 1, IntLessThan.class); 15381 private static NISuppressor arg2_lt_arg1 = 15382 new NISuppressor(1, 0, IntLessThan.class); 15383 15384 private static NISuppressor result_le_arg1 = 15385 new NISuppressor(2, 0, IntLessEqual.class); 15386 private static NISuppressor result_le_arg2 = 15387 new NISuppressor(2, 1, IntLessEqual.class); 15388 private static NISuppressor arg1_le_arg2 = 15389 new NISuppressor(0, 1, IntLessEqual.class); 15390 private static NISuppressor arg2_le_arg1 = 15391 new NISuppressor(1, 0, IntLessEqual.class); 15392 15393 private static NISuppressor result_track0_arg1 = 15394 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 15395 private static NISuppressor result_track0_arg2 = 15396 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 15397 private static NISuppressor arg1_track0_arg2 = 15398 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 15399 private static NISuppressor arg1_track0_result = 15400 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 15401 private static NISuppressor arg2_track0_result = 15402 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 15403 private static NISuppressor arg2_track0_arg1 = 15404 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 15405 15406 private static NISuppressor result_eq_1 = 15407 new NISuppressor(2, RangeInt.EqualOne.class); 15408 private static NISuppressor arg1_eq_1 = 15409 new NISuppressor(0, RangeInt.EqualOne.class); 15410 private static NISuppressor arg2_eq_1 = 15411 new NISuppressor(1, RangeInt.EqualOne.class); 15412 15413 private static NISuppressor result_eq_0 = 15414 new NISuppressor(2, RangeInt.EqualZero.class); 15415 private static NISuppressor arg1_eq_0 = 15416 new NISuppressor(0, RangeInt.EqualZero.class); 15417 private static NISuppressor arg2_eq_0 = 15418 new NISuppressor(1, RangeInt.EqualZero.class); 15419 15420 private static NISuppressor result_ne_0 = 15421 new NISuppressor(2, NonZero.class); 15422 private static NISuppressor arg1_ne_0 = 15423 new NISuppressor(0, NonZero.class); 15424 private static NISuppressor arg2_ne_0 = 15425 new NISuppressor(1, NonZero.class); 15426 15427 private static NISuppressor result_ge_0 = 15428 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 15429 private static NISuppressor arg1_ge_0 = 15430 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 15431 private static NISuppressor arg2_ge_0 = 15432 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 15433 15434 private static NISuppressor result_ge_64 = 15435 new NISuppressor(2, RangeInt.GreaterEqual64.class); 15436 private static NISuppressor arg1_ge_64 = 15437 new NISuppressor(0, RangeInt.GreaterEqual64.class); 15438 private static NISuppressor arg2_ge_64 = 15439 new NISuppressor(1, RangeInt.GreaterEqual64.class); 15440 15441 private static NISuppressor result_boolean = 15442 new NISuppressor(2, RangeInt.BooleanVal.class); 15443 private static NISuppressor arg1_boolean = 15444 new NISuppressor(0, RangeInt.BooleanVal.class); 15445 private static NISuppressor arg2_boolean = 15446 new NISuppressor(1, RangeInt.BooleanVal.class); 15447 15448 private static NISuppressor result_even = 15449 new NISuppressor(2, RangeInt.Even.class); 15450 private static NISuppressor arg1_even = 15451 new NISuppressor(0, RangeInt.Even.class); 15452 private static NISuppressor arg2_even = 15453 new NISuppressor(1, RangeInt.Even.class); 15454 15455 private static NISuppressor result_power2 = 15456 new NISuppressor(2, RangeInt.PowerOfTwo.class); 15457 private static NISuppressor arg1_power2 = 15458 new NISuppressor(0, RangeInt.PowerOfTwo.class); 15459 private static NISuppressor arg2_power2 = 15460 new NISuppressor(1, RangeInt.PowerOfTwo.class); 15461 15462 private static NISuppressor result_and0_arg1 = 15463 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 15464 private static NISuppressor result_and0_arg2 = 15465 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 15466 private static NISuppressor arg1_and0_arg2 = 15467 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 15468 15469 // The arguments to bitwise subset are backwards from what one 15470 // might expect. The second argument is a subset of the first 15471 // argument 15472 private static NISuppressor arg1_bw_subset_arg2 = 15473 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 15474 private static NISuppressor arg2_bw_subset_arg1 = 15475 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 15476 15477 private static NISuppressor result_shift0_arg1 = 15478 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 15479 private static NISuppressor result_shift0_arg2 = 15480 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 15481 private static NISuppressor arg1_shift0_arg2 = 15482 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 15483 15484 private static NISuppressor arg2_divides_arg1 = 15485 new NISuppressor(0, 1, NumericInt.Divides.class); 15486 private static NISuppressor arg1_divides_arg2 = 15487 new NISuppressor(1, 0, NumericInt.Divides.class); 15488 15489 private static NISuppressor arg2_valid_shift = 15490 new NISuppressor(1, RangeInt.Bound0_63.class); 15491 15492 private static NISuppressionSet suppressions = 15493 new NISuppressionSet( 15494 new NISuppression[] { 15495 15496 // (r == x) && (y == 0) ==> r = x >>> y 15497 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 15498 15499 // (r == 0) && (x == 0) && (0 <= y <= 63) ==> r = x >>> y 15500 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 15501 15502 // (r == 0) && ((x >> y) == 0) 15503 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 15504 15505 // (r == 0) && (y >= x) && (x >= 0) && (y valid shift) 15506 // This suppression really ought to have 2**y >= x, but we 15507 // don't have that invariant. This still might catch a lot of these. 15508 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 15509 // arg2_valid_shift, suppressee), 15510 }); 15511 15512 // Create a suppression factory for functionBinary 15513 15514} 15515 15516/** 15517 * Represents the invariant {@code x = RshiftSigned(z, y)} over three long 15518 * scalars. 15519 */ 15520public static class RshiftSignedLong_xzy extends FunctionBinary { 15521 static final long serialVersionUID = 20031030L; 15522 15523 // y must be between arg2_bound[0] and arg2_bound[1] inclusive 15524 static int[] arg2_bound = {0, 63}; 15525 15526 private static @Prototype RshiftSignedLong_xzy proto = new @Prototype RshiftSignedLong_xzy (); 15527 15528 /** Returns the prototype invariant for RshiftSignedLong_xzy */ 15529 public static @Prototype RshiftSignedLong_xzy get_proto() { 15530 return proto; 15531 } 15532 15533 @Override 15534 protected RshiftSignedLong_xzy instantiate_dyn(@Prototype RshiftSignedLong_xzy this, PptSlice slice) { 15535 return new RshiftSignedLong_xzy (slice); 15536 } 15537 15538 private RshiftSignedLong_xzy (PptSlice slice) { 15539 super(slice); 15540 } 15541 15542 public @Prototype RshiftSignedLong_xzy () { 15543 super(); 15544 } 15545 15546 private static String[] method_name = new String[] {"", " >> ", ""}; 15547 15548 @Override 15549 public String[] get_method_name(@GuardSatisfied RshiftSignedLong_xzy this) { 15550 return method_name; 15551 } 15552 15553 private static int function_id = -1; 15554 15555 @Override 15556 public int get_function_id() { 15557 return function_id; 15558 } 15559 15560 @Override 15561 public void set_function_id(int function_id) { 15562 assert RshiftSignedLong_xzy.function_id == -1; 15563 RshiftSignedLong_xzy.function_id = function_id; 15564 } 15565 15566 private static int var_order = 4; 15567 15568 @Override 15569 public int get_var_order(@GuardSatisfied RshiftSignedLong_xzy this) { 15570 return var_order; 15571 } 15572 15573 @Pure 15574 @Override 15575 public boolean is_symmetric() { 15576 15577 return false; 15578 } 15579 15580 @Override 15581 15582 public long func(long z, long y) { 15583 15584 if ((y < arg2_bound[0]) || (y > arg2_bound[1])) { 15585 throw new ArithmeticException("arg2 (" + y + ") out of range " 15586 + arg2_bound[0] + ".." + arg2_bound[1]); 15587 } 15588 15589 return (z >> y); 15590 } 15591 15592 @Override 15593 public InvariantStatus check_modified(long x, long y, 15594 long z, int count) { 15595 return check_ordered(x, z, y, count); 15596 } 15597 15598 @Override 15599 public InvariantStatus add_modified(long x, long y, 15600 long z, int count) { 15601 if (Debug.logDetail()) { 15602 log("result=%s, arg1=%s, arg2=%s", x, z, y); 15603 } 15604 return add_ordered(x, z, y, count); 15605 } 15606 15607 @Pure 15608 @Override 15609 public boolean isRshiftSigned() { 15610 return true; 15611 } 15612 15613 /** Returns a list of non-instantiating suppressions for this invariant. */ 15614 @Pure 15615 @Override 15616 public @Nullable NISuppressionSet get_ni_suppressions() { 15617 if (NIS.dkconfig_enabled && dkconfig_enabled) { 15618 return suppressions; 15619 } else { 15620 return null; 15621 } 15622 } 15623 15624 /** definition of this invariant (the suppressee) */ 15625 private static NISuppressee suppressee = new NISuppressee(RshiftSignedLong_xzy.class, 3); 15626 15627 // suppressor definitions (used below) 15628 private static NISuppressor result_eq_arg1 = 15629 new NISuppressor(0, 2, IntEqual.class); 15630 private static NISuppressor result_eq_arg2 = 15631 new NISuppressor(0, 1, IntEqual.class); 15632 private static NISuppressor arg1_eq_arg2 = 15633 new NISuppressor(2, 1, IntEqual.class); 15634 15635 private static NISuppressor result_lt_arg1 = 15636 new NISuppressor(0, 2, IntLessThan.class); 15637 private static NISuppressor result_lt_arg2 = 15638 new NISuppressor(0, 1, IntLessThan.class); 15639 private static NISuppressor arg1_lt_arg2 = 15640 new NISuppressor(2, 1, IntLessThan.class); 15641 private static NISuppressor arg2_lt_arg1 = 15642 new NISuppressor(1, 2, IntLessThan.class); 15643 15644 private static NISuppressor result_le_arg1 = 15645 new NISuppressor(0, 2, IntLessEqual.class); 15646 private static NISuppressor result_le_arg2 = 15647 new NISuppressor(0, 1, IntLessEqual.class); 15648 private static NISuppressor arg1_le_arg2 = 15649 new NISuppressor(2, 1, IntLessEqual.class); 15650 private static NISuppressor arg2_le_arg1 = 15651 new NISuppressor(1, 2, IntLessEqual.class); 15652 15653 private static NISuppressor result_track0_arg1 = 15654 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 15655 private static NISuppressor result_track0_arg2 = 15656 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 15657 private static NISuppressor arg1_track0_arg2 = 15658 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 15659 private static NISuppressor arg1_track0_result = 15660 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 15661 private static NISuppressor arg2_track0_result = 15662 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 15663 private static NISuppressor arg2_track0_arg1 = 15664 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 15665 15666 private static NISuppressor result_eq_1 = 15667 new NISuppressor(0, RangeInt.EqualOne.class); 15668 private static NISuppressor arg1_eq_1 = 15669 new NISuppressor(2, RangeInt.EqualOne.class); 15670 private static NISuppressor arg2_eq_1 = 15671 new NISuppressor(1, RangeInt.EqualOne.class); 15672 15673 private static NISuppressor result_eq_0 = 15674 new NISuppressor(0, RangeInt.EqualZero.class); 15675 private static NISuppressor arg1_eq_0 = 15676 new NISuppressor(2, RangeInt.EqualZero.class); 15677 private static NISuppressor arg2_eq_0 = 15678 new NISuppressor(1, RangeInt.EqualZero.class); 15679 15680 private static NISuppressor result_ne_0 = 15681 new NISuppressor(0, NonZero.class); 15682 private static NISuppressor arg1_ne_0 = 15683 new NISuppressor(2, NonZero.class); 15684 private static NISuppressor arg2_ne_0 = 15685 new NISuppressor(1, NonZero.class); 15686 15687 private static NISuppressor result_ge_0 = 15688 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 15689 private static NISuppressor arg1_ge_0 = 15690 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 15691 private static NISuppressor arg2_ge_0 = 15692 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 15693 15694 private static NISuppressor result_ge_64 = 15695 new NISuppressor(0, RangeInt.GreaterEqual64.class); 15696 private static NISuppressor arg1_ge_64 = 15697 new NISuppressor(2, RangeInt.GreaterEqual64.class); 15698 private static NISuppressor arg2_ge_64 = 15699 new NISuppressor(1, RangeInt.GreaterEqual64.class); 15700 15701 private static NISuppressor result_boolean = 15702 new NISuppressor(0, RangeInt.BooleanVal.class); 15703 private static NISuppressor arg1_boolean = 15704 new NISuppressor(2, RangeInt.BooleanVal.class); 15705 private static NISuppressor arg2_boolean = 15706 new NISuppressor(1, RangeInt.BooleanVal.class); 15707 15708 private static NISuppressor result_even = 15709 new NISuppressor(0, RangeInt.Even.class); 15710 private static NISuppressor arg1_even = 15711 new NISuppressor(2, RangeInt.Even.class); 15712 private static NISuppressor arg2_even = 15713 new NISuppressor(1, RangeInt.Even.class); 15714 15715 private static NISuppressor result_power2 = 15716 new NISuppressor(0, RangeInt.PowerOfTwo.class); 15717 private static NISuppressor arg1_power2 = 15718 new NISuppressor(2, RangeInt.PowerOfTwo.class); 15719 private static NISuppressor arg2_power2 = 15720 new NISuppressor(1, RangeInt.PowerOfTwo.class); 15721 15722 private static NISuppressor result_and0_arg1 = 15723 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 15724 private static NISuppressor result_and0_arg2 = 15725 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 15726 private static NISuppressor arg1_and0_arg2 = 15727 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 15728 15729 // The arguments to bitwise subset are backwards from what one 15730 // might expect. The second argument is a subset of the first 15731 // argument 15732 private static NISuppressor arg1_bw_subset_arg2 = 15733 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 15734 private static NISuppressor arg2_bw_subset_arg1 = 15735 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 15736 15737 private static NISuppressor result_shift0_arg1 = 15738 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 15739 private static NISuppressor result_shift0_arg2 = 15740 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 15741 private static NISuppressor arg1_shift0_arg2 = 15742 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 15743 15744 private static NISuppressor arg2_divides_arg1 = 15745 new NISuppressor(2, 1, NumericInt.Divides.class); 15746 private static NISuppressor arg1_divides_arg2 = 15747 new NISuppressor(1, 2, NumericInt.Divides.class); 15748 15749 private static NISuppressor arg2_valid_shift = 15750 new NISuppressor(1, RangeInt.Bound0_63.class); 15751 15752 private static NISuppressionSet suppressions = 15753 new NISuppressionSet( 15754 new NISuppression[] { 15755 15756 // (r == z) && (y == 0) ==> r = z >>> y 15757 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 15758 15759 // (r == 0) && (z == 0) && (0 <= y <= 63) ==> r = z >>> y 15760 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 15761 15762 // (r == 0) && ((z >> y) == 0) 15763 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 15764 15765 // (r == 0) && (y >= z) && (z >= 0) && (y valid shift) 15766 // This suppression really ought to have 2**y >= z, but we 15767 // don't have that invariant. This still might catch a lot of these. 15768 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 15769 // arg2_valid_shift, suppressee), 15770 }); 15771 15772 // Create a suppression factory for functionBinary 15773 15774} 15775 15776/** 15777 * Represents the invariant {@code y = RshiftSigned(z, x)} over three long 15778 * scalars. 15779 */ 15780public static class RshiftSignedLong_yzx extends FunctionBinary { 15781 static final long serialVersionUID = 20031030L; 15782 15783 // x must be between arg2_bound[0] and arg2_bound[1] inclusive 15784 static int[] arg2_bound = {0, 63}; 15785 15786 private static @Prototype RshiftSignedLong_yzx proto = new @Prototype RshiftSignedLong_yzx (); 15787 15788 /** Returns the prototype invariant for RshiftSignedLong_yzx */ 15789 public static @Prototype RshiftSignedLong_yzx get_proto() { 15790 return proto; 15791 } 15792 15793 @Override 15794 protected RshiftSignedLong_yzx instantiate_dyn(@Prototype RshiftSignedLong_yzx this, PptSlice slice) { 15795 return new RshiftSignedLong_yzx (slice); 15796 } 15797 15798 private RshiftSignedLong_yzx (PptSlice slice) { 15799 super(slice); 15800 } 15801 15802 public @Prototype RshiftSignedLong_yzx () { 15803 super(); 15804 } 15805 15806 private static String[] method_name = new String[] {"", " >> ", ""}; 15807 15808 @Override 15809 public String[] get_method_name(@GuardSatisfied RshiftSignedLong_yzx this) { 15810 return method_name; 15811 } 15812 15813 private static int function_id = -1; 15814 15815 @Override 15816 public int get_function_id() { 15817 return function_id; 15818 } 15819 15820 @Override 15821 public void set_function_id(int function_id) { 15822 assert RshiftSignedLong_yzx.function_id == -1; 15823 RshiftSignedLong_yzx.function_id = function_id; 15824 } 15825 15826 private static int var_order = 5; 15827 15828 @Override 15829 public int get_var_order(@GuardSatisfied RshiftSignedLong_yzx this) { 15830 return var_order; 15831 } 15832 15833 @Pure 15834 @Override 15835 public boolean is_symmetric() { 15836 15837 return false; 15838 } 15839 15840 @Override 15841 15842 public long func(long z, long x) { 15843 15844 if ((x < arg2_bound[0]) || (x > arg2_bound[1])) { 15845 throw new ArithmeticException("arg2 (" + x + ") out of range " 15846 + arg2_bound[0] + ".." + arg2_bound[1]); 15847 } 15848 15849 return (z >> x); 15850 } 15851 15852 @Override 15853 public InvariantStatus check_modified(long x, long y, 15854 long z, int count) { 15855 return check_ordered(y, z, x, count); 15856 } 15857 15858 @Override 15859 public InvariantStatus add_modified(long x, long y, 15860 long z, int count) { 15861 if (Debug.logDetail()) { 15862 log("result=%s, arg1=%s, arg2=%s", y, z, x); 15863 } 15864 return add_ordered(y, z, x, count); 15865 } 15866 15867 @Pure 15868 @Override 15869 public boolean isRshiftSigned() { 15870 return true; 15871 } 15872 15873 /** Returns a list of non-instantiating suppressions for this invariant. */ 15874 @Pure 15875 @Override 15876 public @Nullable NISuppressionSet get_ni_suppressions() { 15877 if (NIS.dkconfig_enabled && dkconfig_enabled) { 15878 return suppressions; 15879 } else { 15880 return null; 15881 } 15882 } 15883 15884 /** definition of this invariant (the suppressee) */ 15885 private static NISuppressee suppressee = new NISuppressee(RshiftSignedLong_yzx.class, 3); 15886 15887 // suppressor definitions (used below) 15888 private static NISuppressor result_eq_arg1 = 15889 new NISuppressor(1, 2, IntEqual.class); 15890 private static NISuppressor result_eq_arg2 = 15891 new NISuppressor(1, 0, IntEqual.class); 15892 private static NISuppressor arg1_eq_arg2 = 15893 new NISuppressor(2, 0, IntEqual.class); 15894 15895 private static NISuppressor result_lt_arg1 = 15896 new NISuppressor(1, 2, IntLessThan.class); 15897 private static NISuppressor result_lt_arg2 = 15898 new NISuppressor(1, 0, IntLessThan.class); 15899 private static NISuppressor arg1_lt_arg2 = 15900 new NISuppressor(2, 0, IntLessThan.class); 15901 private static NISuppressor arg2_lt_arg1 = 15902 new NISuppressor(0, 2, IntLessThan.class); 15903 15904 private static NISuppressor result_le_arg1 = 15905 new NISuppressor(1, 2, IntLessEqual.class); 15906 private static NISuppressor result_le_arg2 = 15907 new NISuppressor(1, 0, IntLessEqual.class); 15908 private static NISuppressor arg1_le_arg2 = 15909 new NISuppressor(2, 0, IntLessEqual.class); 15910 private static NISuppressor arg2_le_arg1 = 15911 new NISuppressor(0, 2, IntLessEqual.class); 15912 15913 private static NISuppressor result_track0_arg1 = 15914 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 15915 private static NISuppressor result_track0_arg2 = 15916 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 15917 private static NISuppressor arg1_track0_arg2 = 15918 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 15919 private static NISuppressor arg1_track0_result = 15920 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 15921 private static NISuppressor arg2_track0_result = 15922 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 15923 private static NISuppressor arg2_track0_arg1 = 15924 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 15925 15926 private static NISuppressor result_eq_1 = 15927 new NISuppressor(1, RangeInt.EqualOne.class); 15928 private static NISuppressor arg1_eq_1 = 15929 new NISuppressor(2, RangeInt.EqualOne.class); 15930 private static NISuppressor arg2_eq_1 = 15931 new NISuppressor(0, RangeInt.EqualOne.class); 15932 15933 private static NISuppressor result_eq_0 = 15934 new NISuppressor(1, RangeInt.EqualZero.class); 15935 private static NISuppressor arg1_eq_0 = 15936 new NISuppressor(2, RangeInt.EqualZero.class); 15937 private static NISuppressor arg2_eq_0 = 15938 new NISuppressor(0, RangeInt.EqualZero.class); 15939 15940 private static NISuppressor result_ne_0 = 15941 new NISuppressor(1, NonZero.class); 15942 private static NISuppressor arg1_ne_0 = 15943 new NISuppressor(2, NonZero.class); 15944 private static NISuppressor arg2_ne_0 = 15945 new NISuppressor(0, NonZero.class); 15946 15947 private static NISuppressor result_ge_0 = 15948 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 15949 private static NISuppressor arg1_ge_0 = 15950 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 15951 private static NISuppressor arg2_ge_0 = 15952 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 15953 15954 private static NISuppressor result_ge_64 = 15955 new NISuppressor(1, RangeInt.GreaterEqual64.class); 15956 private static NISuppressor arg1_ge_64 = 15957 new NISuppressor(2, RangeInt.GreaterEqual64.class); 15958 private static NISuppressor arg2_ge_64 = 15959 new NISuppressor(0, RangeInt.GreaterEqual64.class); 15960 15961 private static NISuppressor result_boolean = 15962 new NISuppressor(1, RangeInt.BooleanVal.class); 15963 private static NISuppressor arg1_boolean = 15964 new NISuppressor(2, RangeInt.BooleanVal.class); 15965 private static NISuppressor arg2_boolean = 15966 new NISuppressor(0, RangeInt.BooleanVal.class); 15967 15968 private static NISuppressor result_even = 15969 new NISuppressor(1, RangeInt.Even.class); 15970 private static NISuppressor arg1_even = 15971 new NISuppressor(2, RangeInt.Even.class); 15972 private static NISuppressor arg2_even = 15973 new NISuppressor(0, RangeInt.Even.class); 15974 15975 private static NISuppressor result_power2 = 15976 new NISuppressor(1, RangeInt.PowerOfTwo.class); 15977 private static NISuppressor arg1_power2 = 15978 new NISuppressor(2, RangeInt.PowerOfTwo.class); 15979 private static NISuppressor arg2_power2 = 15980 new NISuppressor(0, RangeInt.PowerOfTwo.class); 15981 15982 private static NISuppressor result_and0_arg1 = 15983 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 15984 private static NISuppressor result_and0_arg2 = 15985 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 15986 private static NISuppressor arg1_and0_arg2 = 15987 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 15988 15989 // The arguments to bitwise subset are backwards from what one 15990 // might expect. The second argument is a subset of the first 15991 // argument 15992 private static NISuppressor arg1_bw_subset_arg2 = 15993 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 15994 private static NISuppressor arg2_bw_subset_arg1 = 15995 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 15996 15997 private static NISuppressor result_shift0_arg1 = 15998 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 15999 private static NISuppressor result_shift0_arg2 = 16000 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 16001 private static NISuppressor arg1_shift0_arg2 = 16002 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 16003 16004 private static NISuppressor arg2_divides_arg1 = 16005 new NISuppressor(2, 0, NumericInt.Divides.class); 16006 private static NISuppressor arg1_divides_arg2 = 16007 new NISuppressor(0, 2, NumericInt.Divides.class); 16008 16009 private static NISuppressor arg2_valid_shift = 16010 new NISuppressor(0, RangeInt.Bound0_63.class); 16011 16012 private static NISuppressionSet suppressions = 16013 new NISuppressionSet( 16014 new NISuppression[] { 16015 16016 // (r == z) && (x == 0) ==> r = z >>> x 16017 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 16018 16019 // (r == 0) && (z == 0) && (0 <= x <= 63) ==> r = z >>> x 16020 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 16021 16022 // (r == 0) && ((z >> x) == 0) 16023 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 16024 16025 // (r == 0) && (x >= z) && (z >= 0) && (x valid shift) 16026 // This suppression really ought to have 2**x >= z, but we 16027 // don't have that invariant. This still might catch a lot of these. 16028 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 16029 // arg2_valid_shift, suppressee), 16030 }); 16031 16032 // Create a suppression factory for functionBinary 16033 16034} 16035 16036/** 16037 * Represents the invariant {@code z = RshiftSigned(y, x)} over three long 16038 * scalars. 16039 */ 16040public static class RshiftSignedLong_zyx extends FunctionBinary { 16041 static final long serialVersionUID = 20031030L; 16042 16043 // x must be between arg2_bound[0] and arg2_bound[1] inclusive 16044 static int[] arg2_bound = {0, 63}; 16045 16046 private static @Prototype RshiftSignedLong_zyx proto = new @Prototype RshiftSignedLong_zyx (); 16047 16048 /** Returns the prototype invariant for RshiftSignedLong_zyx */ 16049 public static @Prototype RshiftSignedLong_zyx get_proto() { 16050 return proto; 16051 } 16052 16053 @Override 16054 protected RshiftSignedLong_zyx instantiate_dyn(@Prototype RshiftSignedLong_zyx this, PptSlice slice) { 16055 return new RshiftSignedLong_zyx (slice); 16056 } 16057 16058 private RshiftSignedLong_zyx (PptSlice slice) { 16059 super(slice); 16060 } 16061 16062 public @Prototype RshiftSignedLong_zyx () { 16063 super(); 16064 } 16065 16066 private static String[] method_name = new String[] {"", " >> ", ""}; 16067 16068 @Override 16069 public String[] get_method_name(@GuardSatisfied RshiftSignedLong_zyx this) { 16070 return method_name; 16071 } 16072 16073 private static int function_id = -1; 16074 16075 @Override 16076 public int get_function_id() { 16077 return function_id; 16078 } 16079 16080 @Override 16081 public void set_function_id(int function_id) { 16082 assert RshiftSignedLong_zyx.function_id == -1; 16083 RshiftSignedLong_zyx.function_id = function_id; 16084 } 16085 16086 private static int var_order = 6; 16087 16088 @Override 16089 public int get_var_order(@GuardSatisfied RshiftSignedLong_zyx this) { 16090 return var_order; 16091 } 16092 16093 @Pure 16094 @Override 16095 public boolean is_symmetric() { 16096 16097 return false; 16098 } 16099 16100 @Override 16101 16102 public long func(long y, long x) { 16103 16104 if ((x < arg2_bound[0]) || (x > arg2_bound[1])) { 16105 throw new ArithmeticException("arg2 (" + x + ") out of range " 16106 + arg2_bound[0] + ".." + arg2_bound[1]); 16107 } 16108 16109 return (y >> x); 16110 } 16111 16112 @Override 16113 public InvariantStatus check_modified(long x, long y, 16114 long z, int count) { 16115 return check_ordered(z, y, x, count); 16116 } 16117 16118 @Override 16119 public InvariantStatus add_modified(long x, long y, 16120 long z, int count) { 16121 if (Debug.logDetail()) { 16122 log("result=%s, arg1=%s, arg2=%s", z, y, x); 16123 } 16124 return add_ordered(z, y, x, count); 16125 } 16126 16127 @Pure 16128 @Override 16129 public boolean isRshiftSigned() { 16130 return true; 16131 } 16132 16133 /** Returns a list of non-instantiating suppressions for this invariant. */ 16134 @Pure 16135 @Override 16136 public @Nullable NISuppressionSet get_ni_suppressions() { 16137 if (NIS.dkconfig_enabled && dkconfig_enabled) { 16138 return suppressions; 16139 } else { 16140 return null; 16141 } 16142 } 16143 16144 /** definition of this invariant (the suppressee) */ 16145 private static NISuppressee suppressee = new NISuppressee(RshiftSignedLong_zyx.class, 3); 16146 16147 // suppressor definitions (used below) 16148 private static NISuppressor result_eq_arg1 = 16149 new NISuppressor(2, 1, IntEqual.class); 16150 private static NISuppressor result_eq_arg2 = 16151 new NISuppressor(2, 0, IntEqual.class); 16152 private static NISuppressor arg1_eq_arg2 = 16153 new NISuppressor(1, 0, IntEqual.class); 16154 16155 private static NISuppressor result_lt_arg1 = 16156 new NISuppressor(2, 1, IntLessThan.class); 16157 private static NISuppressor result_lt_arg2 = 16158 new NISuppressor(2, 0, IntLessThan.class); 16159 private static NISuppressor arg1_lt_arg2 = 16160 new NISuppressor(1, 0, IntLessThan.class); 16161 private static NISuppressor arg2_lt_arg1 = 16162 new NISuppressor(0, 1, IntLessThan.class); 16163 16164 private static NISuppressor result_le_arg1 = 16165 new NISuppressor(2, 1, IntLessEqual.class); 16166 private static NISuppressor result_le_arg2 = 16167 new NISuppressor(2, 0, IntLessEqual.class); 16168 private static NISuppressor arg1_le_arg2 = 16169 new NISuppressor(1, 0, IntLessEqual.class); 16170 private static NISuppressor arg2_le_arg1 = 16171 new NISuppressor(0, 1, IntLessEqual.class); 16172 16173 private static NISuppressor result_track0_arg1 = 16174 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 16175 private static NISuppressor result_track0_arg2 = 16176 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 16177 private static NISuppressor arg1_track0_arg2 = 16178 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 16179 private static NISuppressor arg1_track0_result = 16180 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 16181 private static NISuppressor arg2_track0_result = 16182 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 16183 private static NISuppressor arg2_track0_arg1 = 16184 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 16185 16186 private static NISuppressor result_eq_1 = 16187 new NISuppressor(2, RangeInt.EqualOne.class); 16188 private static NISuppressor arg1_eq_1 = 16189 new NISuppressor(1, RangeInt.EqualOne.class); 16190 private static NISuppressor arg2_eq_1 = 16191 new NISuppressor(0, RangeInt.EqualOne.class); 16192 16193 private static NISuppressor result_eq_0 = 16194 new NISuppressor(2, RangeInt.EqualZero.class); 16195 private static NISuppressor arg1_eq_0 = 16196 new NISuppressor(1, RangeInt.EqualZero.class); 16197 private static NISuppressor arg2_eq_0 = 16198 new NISuppressor(0, RangeInt.EqualZero.class); 16199 16200 private static NISuppressor result_ne_0 = 16201 new NISuppressor(2, NonZero.class); 16202 private static NISuppressor arg1_ne_0 = 16203 new NISuppressor(1, NonZero.class); 16204 private static NISuppressor arg2_ne_0 = 16205 new NISuppressor(0, NonZero.class); 16206 16207 private static NISuppressor result_ge_0 = 16208 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 16209 private static NISuppressor arg1_ge_0 = 16210 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 16211 private static NISuppressor arg2_ge_0 = 16212 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 16213 16214 private static NISuppressor result_ge_64 = 16215 new NISuppressor(2, RangeInt.GreaterEqual64.class); 16216 private static NISuppressor arg1_ge_64 = 16217 new NISuppressor(1, RangeInt.GreaterEqual64.class); 16218 private static NISuppressor arg2_ge_64 = 16219 new NISuppressor(0, RangeInt.GreaterEqual64.class); 16220 16221 private static NISuppressor result_boolean = 16222 new NISuppressor(2, RangeInt.BooleanVal.class); 16223 private static NISuppressor arg1_boolean = 16224 new NISuppressor(1, RangeInt.BooleanVal.class); 16225 private static NISuppressor arg2_boolean = 16226 new NISuppressor(0, RangeInt.BooleanVal.class); 16227 16228 private static NISuppressor result_even = 16229 new NISuppressor(2, RangeInt.Even.class); 16230 private static NISuppressor arg1_even = 16231 new NISuppressor(1, RangeInt.Even.class); 16232 private static NISuppressor arg2_even = 16233 new NISuppressor(0, RangeInt.Even.class); 16234 16235 private static NISuppressor result_power2 = 16236 new NISuppressor(2, RangeInt.PowerOfTwo.class); 16237 private static NISuppressor arg1_power2 = 16238 new NISuppressor(1, RangeInt.PowerOfTwo.class); 16239 private static NISuppressor arg2_power2 = 16240 new NISuppressor(0, RangeInt.PowerOfTwo.class); 16241 16242 private static NISuppressor result_and0_arg1 = 16243 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 16244 private static NISuppressor result_and0_arg2 = 16245 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 16246 private static NISuppressor arg1_and0_arg2 = 16247 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 16248 16249 // The arguments to bitwise subset are backwards from what one 16250 // might expect. The second argument is a subset of the first 16251 // argument 16252 private static NISuppressor arg1_bw_subset_arg2 = 16253 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 16254 private static NISuppressor arg2_bw_subset_arg1 = 16255 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 16256 16257 private static NISuppressor result_shift0_arg1 = 16258 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 16259 private static NISuppressor result_shift0_arg2 = 16260 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 16261 private static NISuppressor arg1_shift0_arg2 = 16262 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 16263 16264 private static NISuppressor arg2_divides_arg1 = 16265 new NISuppressor(1, 0, NumericInt.Divides.class); 16266 private static NISuppressor arg1_divides_arg2 = 16267 new NISuppressor(0, 1, NumericInt.Divides.class); 16268 16269 private static NISuppressor arg2_valid_shift = 16270 new NISuppressor(0, RangeInt.Bound0_63.class); 16271 16272 private static NISuppressionSet suppressions = 16273 new NISuppressionSet( 16274 new NISuppression[] { 16275 16276 // (r == y) && (x == 0) ==> r = y >>> x 16277 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 16278 16279 // (r == 0) && (y == 0) && (0 <= x <= 63) ==> r = y >>> x 16280 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 16281 16282 // (r == 0) && ((y >> x) == 0) 16283 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 16284 16285 // (r == 0) && (x >= y) && (y >= 0) && (x valid shift) 16286 // This suppression really ought to have 2**x >= y, but we 16287 // don't have that invariant. This still might catch a lot of these. 16288 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 16289 // arg2_valid_shift, suppressee), 16290 }); 16291 16292 // Create a suppression factory for functionBinary 16293 16294} 16295 16296 // default is that it is not this function, overriden in the subclass 16297 @Pure 16298 public boolean isRshiftUnsigned() { 16299 return false; 16300 } 16301 16302/** 16303 * Represents the invariant {@code x = RshiftUnsigned(y, z)} over three long 16304 * scalars. 16305 */ 16306public static class RshiftUnsignedLong_xyz extends FunctionBinary { 16307 static final long serialVersionUID = 20031030L; 16308 16309 // z must be between arg2_bound[0] and arg2_bound[1] inclusive 16310 static int[] arg2_bound = {0, 63}; 16311 16312 private static @Prototype RshiftUnsignedLong_xyz proto = new @Prototype RshiftUnsignedLong_xyz (); 16313 16314 /** Returns the prototype invariant for RshiftUnsignedLong_xyz */ 16315 public static @Prototype RshiftUnsignedLong_xyz get_proto() { 16316 return proto; 16317 } 16318 16319 @Override 16320 protected RshiftUnsignedLong_xyz instantiate_dyn(@Prototype RshiftUnsignedLong_xyz this, PptSlice slice) { 16321 return new RshiftUnsignedLong_xyz (slice); 16322 } 16323 16324 private RshiftUnsignedLong_xyz (PptSlice slice) { 16325 super(slice); 16326 } 16327 16328 public @Prototype RshiftUnsignedLong_xyz () { 16329 super(); 16330 } 16331 16332 private static String[] method_name = new String[] {"", " >>> ", ""}; 16333 16334 @Override 16335 public String[] get_method_name(@GuardSatisfied RshiftUnsignedLong_xyz this) { 16336 return method_name; 16337 } 16338 16339 private static int function_id = -1; 16340 16341 @Override 16342 public int get_function_id() { 16343 return function_id; 16344 } 16345 16346 @Override 16347 public void set_function_id(int function_id) { 16348 assert RshiftUnsignedLong_xyz.function_id == -1; 16349 RshiftUnsignedLong_xyz.function_id = function_id; 16350 } 16351 16352 private static int var_order = 1; 16353 16354 @Override 16355 public int get_var_order(@GuardSatisfied RshiftUnsignedLong_xyz this) { 16356 return var_order; 16357 } 16358 16359 @Pure 16360 @Override 16361 public boolean is_symmetric() { 16362 16363 return false; 16364 } 16365 16366 @Override 16367 16368 @SuppressWarnings("signedness:shift.unsigned") // RshiftUnsigned treats y as unsigned, though we do not know how the program under test treats it 16369 16370 public long func(long y, long z) { 16371 16372 if ((z < arg2_bound[0]) || (z > arg2_bound[1])) { 16373 throw new ArithmeticException("arg2 (" + z + ") out of range " 16374 + arg2_bound[0] + ".." + arg2_bound[1]); 16375 } 16376 16377 return (y >>> z); 16378 } 16379 16380 @Override 16381 public InvariantStatus check_modified(long x, long y, 16382 long z, int count) { 16383 return check_ordered(x, y, z, count); 16384 } 16385 16386 @Override 16387 public InvariantStatus add_modified(long x, long y, 16388 long z, int count) { 16389 if (Debug.logDetail()) { 16390 log("result=%s, arg1=%s, arg2=%s", x, y, z); 16391 } 16392 return add_ordered(x, y, z, count); 16393 } 16394 16395 @Pure 16396 @Override 16397 public boolean isRshiftUnsigned() { 16398 return true; 16399 } 16400 16401 /** Returns a list of non-instantiating suppressions for this invariant. */ 16402 @Pure 16403 @Override 16404 public @Nullable NISuppressionSet get_ni_suppressions() { 16405 if (NIS.dkconfig_enabled && dkconfig_enabled) { 16406 return suppressions; 16407 } else { 16408 return null; 16409 } 16410 } 16411 16412 /** definition of this invariant (the suppressee) */ 16413 private static NISuppressee suppressee = new NISuppressee(RshiftUnsignedLong_xyz.class, 3); 16414 16415 // suppressor definitions (used below) 16416 private static NISuppressor result_eq_arg1 = 16417 new NISuppressor(0, 1, IntEqual.class); 16418 private static NISuppressor result_eq_arg2 = 16419 new NISuppressor(0, 2, IntEqual.class); 16420 private static NISuppressor arg1_eq_arg2 = 16421 new NISuppressor(1, 2, IntEqual.class); 16422 16423 private static NISuppressor result_lt_arg1 = 16424 new NISuppressor(0, 1, IntLessThan.class); 16425 private static NISuppressor result_lt_arg2 = 16426 new NISuppressor(0, 2, IntLessThan.class); 16427 private static NISuppressor arg1_lt_arg2 = 16428 new NISuppressor(1, 2, IntLessThan.class); 16429 private static NISuppressor arg2_lt_arg1 = 16430 new NISuppressor(2, 1, IntLessThan.class); 16431 16432 private static NISuppressor result_le_arg1 = 16433 new NISuppressor(0, 1, IntLessEqual.class); 16434 private static NISuppressor result_le_arg2 = 16435 new NISuppressor(0, 2, IntLessEqual.class); 16436 private static NISuppressor arg1_le_arg2 = 16437 new NISuppressor(1, 2, IntLessEqual.class); 16438 private static NISuppressor arg2_le_arg1 = 16439 new NISuppressor(2, 1, IntLessEqual.class); 16440 16441 private static NISuppressor result_track0_arg1 = 16442 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 16443 private static NISuppressor result_track0_arg2 = 16444 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 16445 private static NISuppressor arg1_track0_arg2 = 16446 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 16447 private static NISuppressor arg1_track0_result = 16448 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 16449 private static NISuppressor arg2_track0_result = 16450 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 16451 private static NISuppressor arg2_track0_arg1 = 16452 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 16453 16454 private static NISuppressor result_eq_1 = 16455 new NISuppressor(0, RangeInt.EqualOne.class); 16456 private static NISuppressor arg1_eq_1 = 16457 new NISuppressor(1, RangeInt.EqualOne.class); 16458 private static NISuppressor arg2_eq_1 = 16459 new NISuppressor(2, RangeInt.EqualOne.class); 16460 16461 private static NISuppressor result_eq_0 = 16462 new NISuppressor(0, RangeInt.EqualZero.class); 16463 private static NISuppressor arg1_eq_0 = 16464 new NISuppressor(1, RangeInt.EqualZero.class); 16465 private static NISuppressor arg2_eq_0 = 16466 new NISuppressor(2, RangeInt.EqualZero.class); 16467 16468 private static NISuppressor result_ne_0 = 16469 new NISuppressor(0, NonZero.class); 16470 private static NISuppressor arg1_ne_0 = 16471 new NISuppressor(1, NonZero.class); 16472 private static NISuppressor arg2_ne_0 = 16473 new NISuppressor(2, NonZero.class); 16474 16475 private static NISuppressor result_ge_0 = 16476 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 16477 private static NISuppressor arg1_ge_0 = 16478 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 16479 private static NISuppressor arg2_ge_0 = 16480 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 16481 16482 private static NISuppressor result_ge_64 = 16483 new NISuppressor(0, RangeInt.GreaterEqual64.class); 16484 private static NISuppressor arg1_ge_64 = 16485 new NISuppressor(1, RangeInt.GreaterEqual64.class); 16486 private static NISuppressor arg2_ge_64 = 16487 new NISuppressor(2, RangeInt.GreaterEqual64.class); 16488 16489 private static NISuppressor result_boolean = 16490 new NISuppressor(0, RangeInt.BooleanVal.class); 16491 private static NISuppressor arg1_boolean = 16492 new NISuppressor(1, RangeInt.BooleanVal.class); 16493 private static NISuppressor arg2_boolean = 16494 new NISuppressor(2, RangeInt.BooleanVal.class); 16495 16496 private static NISuppressor result_even = 16497 new NISuppressor(0, RangeInt.Even.class); 16498 private static NISuppressor arg1_even = 16499 new NISuppressor(1, RangeInt.Even.class); 16500 private static NISuppressor arg2_even = 16501 new NISuppressor(2, RangeInt.Even.class); 16502 16503 private static NISuppressor result_power2 = 16504 new NISuppressor(0, RangeInt.PowerOfTwo.class); 16505 private static NISuppressor arg1_power2 = 16506 new NISuppressor(1, RangeInt.PowerOfTwo.class); 16507 private static NISuppressor arg2_power2 = 16508 new NISuppressor(2, RangeInt.PowerOfTwo.class); 16509 16510 private static NISuppressor result_and0_arg1 = 16511 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 16512 private static NISuppressor result_and0_arg2 = 16513 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 16514 private static NISuppressor arg1_and0_arg2 = 16515 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 16516 16517 // The arguments to bitwise subset are backwards from what one 16518 // might expect. The second argument is a subset of the first 16519 // argument 16520 private static NISuppressor arg1_bw_subset_arg2 = 16521 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 16522 private static NISuppressor arg2_bw_subset_arg1 = 16523 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 16524 16525 private static NISuppressor result_shift0_arg1 = 16526 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 16527 private static NISuppressor result_shift0_arg2 = 16528 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 16529 private static NISuppressor arg1_shift0_arg2 = 16530 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 16531 16532 private static NISuppressor arg2_divides_arg1 = 16533 new NISuppressor(1, 2, NumericInt.Divides.class); 16534 private static NISuppressor arg1_divides_arg2 = 16535 new NISuppressor(2, 1, NumericInt.Divides.class); 16536 16537 private static NISuppressor arg2_valid_shift = 16538 new NISuppressor(2, RangeInt.Bound0_63.class); 16539 16540 private static NISuppressionSet suppressions = 16541 new NISuppressionSet( 16542 new NISuppression[] { 16543 16544 // (r == y) && (z == 0) ==> r = y >>> z 16545 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 16546 16547 // (r == 0) && (y == 0) && (z valid shift) ==> r = y >>> z 16548 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 16549 16550 // (r == 0) && ((y >> z) == 0) 16551 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 16552 16553 // (r == 0) && (z >= y) && (y >= 0) && (z valid shift) 16554 // This suppression really ought to have 2**z >= y, but we 16555 // don't have that suppression. This still might catch a lot of these. 16556 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 16557 // arg2_valid_shift, suppressee), 16558 }); 16559 16560 // Create a suppression factory for functionBinary 16561 16562} 16563 16564/** 16565 * Represents the invariant {@code y = RshiftUnsigned(x, z)} over three long 16566 * scalars. 16567 */ 16568public static class RshiftUnsignedLong_yxz extends FunctionBinary { 16569 static final long serialVersionUID = 20031030L; 16570 16571 // z must be between arg2_bound[0] and arg2_bound[1] inclusive 16572 static int[] arg2_bound = {0, 63}; 16573 16574 private static @Prototype RshiftUnsignedLong_yxz proto = new @Prototype RshiftUnsignedLong_yxz (); 16575 16576 /** Returns the prototype invariant for RshiftUnsignedLong_yxz */ 16577 public static @Prototype RshiftUnsignedLong_yxz get_proto() { 16578 return proto; 16579 } 16580 16581 @Override 16582 protected RshiftUnsignedLong_yxz instantiate_dyn(@Prototype RshiftUnsignedLong_yxz this, PptSlice slice) { 16583 return new RshiftUnsignedLong_yxz (slice); 16584 } 16585 16586 private RshiftUnsignedLong_yxz (PptSlice slice) { 16587 super(slice); 16588 } 16589 16590 public @Prototype RshiftUnsignedLong_yxz () { 16591 super(); 16592 } 16593 16594 private static String[] method_name = new String[] {"", " >>> ", ""}; 16595 16596 @Override 16597 public String[] get_method_name(@GuardSatisfied RshiftUnsignedLong_yxz this) { 16598 return method_name; 16599 } 16600 16601 private static int function_id = -1; 16602 16603 @Override 16604 public int get_function_id() { 16605 return function_id; 16606 } 16607 16608 @Override 16609 public void set_function_id(int function_id) { 16610 assert RshiftUnsignedLong_yxz.function_id == -1; 16611 RshiftUnsignedLong_yxz.function_id = function_id; 16612 } 16613 16614 private static int var_order = 2; 16615 16616 @Override 16617 public int get_var_order(@GuardSatisfied RshiftUnsignedLong_yxz this) { 16618 return var_order; 16619 } 16620 16621 @Pure 16622 @Override 16623 public boolean is_symmetric() { 16624 16625 return false; 16626 } 16627 16628 @Override 16629 16630 @SuppressWarnings("signedness:shift.unsigned") // RshiftUnsigned treats x as unsigned, though we do not know how the program under test treats it 16631 16632 public long func(long x, long z) { 16633 16634 if ((z < arg2_bound[0]) || (z > arg2_bound[1])) { 16635 throw new ArithmeticException("arg2 (" + z + ") out of range " 16636 + arg2_bound[0] + ".." + arg2_bound[1]); 16637 } 16638 16639 return (x >>> z); 16640 } 16641 16642 @Override 16643 public InvariantStatus check_modified(long x, long y, 16644 long z, int count) { 16645 return check_ordered(y, x, z, count); 16646 } 16647 16648 @Override 16649 public InvariantStatus add_modified(long x, long y, 16650 long z, int count) { 16651 if (Debug.logDetail()) { 16652 log("result=%s, arg1=%s, arg2=%s", y, x, z); 16653 } 16654 return add_ordered(y, x, z, count); 16655 } 16656 16657 @Pure 16658 @Override 16659 public boolean isRshiftUnsigned() { 16660 return true; 16661 } 16662 16663 /** Returns a list of non-instantiating suppressions for this invariant. */ 16664 @Pure 16665 @Override 16666 public @Nullable NISuppressionSet get_ni_suppressions() { 16667 if (NIS.dkconfig_enabled && dkconfig_enabled) { 16668 return suppressions; 16669 } else { 16670 return null; 16671 } 16672 } 16673 16674 /** definition of this invariant (the suppressee) */ 16675 private static NISuppressee suppressee = new NISuppressee(RshiftUnsignedLong_yxz.class, 3); 16676 16677 // suppressor definitions (used below) 16678 private static NISuppressor result_eq_arg1 = 16679 new NISuppressor(1, 0, IntEqual.class); 16680 private static NISuppressor result_eq_arg2 = 16681 new NISuppressor(1, 2, IntEqual.class); 16682 private static NISuppressor arg1_eq_arg2 = 16683 new NISuppressor(0, 2, IntEqual.class); 16684 16685 private static NISuppressor result_lt_arg1 = 16686 new NISuppressor(1, 0, IntLessThan.class); 16687 private static NISuppressor result_lt_arg2 = 16688 new NISuppressor(1, 2, IntLessThan.class); 16689 private static NISuppressor arg1_lt_arg2 = 16690 new NISuppressor(0, 2, IntLessThan.class); 16691 private static NISuppressor arg2_lt_arg1 = 16692 new NISuppressor(2, 0, IntLessThan.class); 16693 16694 private static NISuppressor result_le_arg1 = 16695 new NISuppressor(1, 0, IntLessEqual.class); 16696 private static NISuppressor result_le_arg2 = 16697 new NISuppressor(1, 2, IntLessEqual.class); 16698 private static NISuppressor arg1_le_arg2 = 16699 new NISuppressor(0, 2, IntLessEqual.class); 16700 private static NISuppressor arg2_le_arg1 = 16701 new NISuppressor(2, 0, IntLessEqual.class); 16702 16703 private static NISuppressor result_track0_arg1 = 16704 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 16705 private static NISuppressor result_track0_arg2 = 16706 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 16707 private static NISuppressor arg1_track0_arg2 = 16708 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 16709 private static NISuppressor arg1_track0_result = 16710 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 16711 private static NISuppressor arg2_track0_result = 16712 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 16713 private static NISuppressor arg2_track0_arg1 = 16714 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 16715 16716 private static NISuppressor result_eq_1 = 16717 new NISuppressor(1, RangeInt.EqualOne.class); 16718 private static NISuppressor arg1_eq_1 = 16719 new NISuppressor(0, RangeInt.EqualOne.class); 16720 private static NISuppressor arg2_eq_1 = 16721 new NISuppressor(2, RangeInt.EqualOne.class); 16722 16723 private static NISuppressor result_eq_0 = 16724 new NISuppressor(1, RangeInt.EqualZero.class); 16725 private static NISuppressor arg1_eq_0 = 16726 new NISuppressor(0, RangeInt.EqualZero.class); 16727 private static NISuppressor arg2_eq_0 = 16728 new NISuppressor(2, RangeInt.EqualZero.class); 16729 16730 private static NISuppressor result_ne_0 = 16731 new NISuppressor(1, NonZero.class); 16732 private static NISuppressor arg1_ne_0 = 16733 new NISuppressor(0, NonZero.class); 16734 private static NISuppressor arg2_ne_0 = 16735 new NISuppressor(2, NonZero.class); 16736 16737 private static NISuppressor result_ge_0 = 16738 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 16739 private static NISuppressor arg1_ge_0 = 16740 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 16741 private static NISuppressor arg2_ge_0 = 16742 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 16743 16744 private static NISuppressor result_ge_64 = 16745 new NISuppressor(1, RangeInt.GreaterEqual64.class); 16746 private static NISuppressor arg1_ge_64 = 16747 new NISuppressor(0, RangeInt.GreaterEqual64.class); 16748 private static NISuppressor arg2_ge_64 = 16749 new NISuppressor(2, RangeInt.GreaterEqual64.class); 16750 16751 private static NISuppressor result_boolean = 16752 new NISuppressor(1, RangeInt.BooleanVal.class); 16753 private static NISuppressor arg1_boolean = 16754 new NISuppressor(0, RangeInt.BooleanVal.class); 16755 private static NISuppressor arg2_boolean = 16756 new NISuppressor(2, RangeInt.BooleanVal.class); 16757 16758 private static NISuppressor result_even = 16759 new NISuppressor(1, RangeInt.Even.class); 16760 private static NISuppressor arg1_even = 16761 new NISuppressor(0, RangeInt.Even.class); 16762 private static NISuppressor arg2_even = 16763 new NISuppressor(2, RangeInt.Even.class); 16764 16765 private static NISuppressor result_power2 = 16766 new NISuppressor(1, RangeInt.PowerOfTwo.class); 16767 private static NISuppressor arg1_power2 = 16768 new NISuppressor(0, RangeInt.PowerOfTwo.class); 16769 private static NISuppressor arg2_power2 = 16770 new NISuppressor(2, RangeInt.PowerOfTwo.class); 16771 16772 private static NISuppressor result_and0_arg1 = 16773 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 16774 private static NISuppressor result_and0_arg2 = 16775 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 16776 private static NISuppressor arg1_and0_arg2 = 16777 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 16778 16779 // The arguments to bitwise subset are backwards from what one 16780 // might expect. The second argument is a subset of the first 16781 // argument 16782 private static NISuppressor arg1_bw_subset_arg2 = 16783 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 16784 private static NISuppressor arg2_bw_subset_arg1 = 16785 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 16786 16787 private static NISuppressor result_shift0_arg1 = 16788 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 16789 private static NISuppressor result_shift0_arg2 = 16790 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 16791 private static NISuppressor arg1_shift0_arg2 = 16792 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 16793 16794 private static NISuppressor arg2_divides_arg1 = 16795 new NISuppressor(0, 2, NumericInt.Divides.class); 16796 private static NISuppressor arg1_divides_arg2 = 16797 new NISuppressor(2, 0, NumericInt.Divides.class); 16798 16799 private static NISuppressor arg2_valid_shift = 16800 new NISuppressor(2, RangeInt.Bound0_63.class); 16801 16802 private static NISuppressionSet suppressions = 16803 new NISuppressionSet( 16804 new NISuppression[] { 16805 16806 // (r == x) && (z == 0) ==> r = x >>> z 16807 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 16808 16809 // (r == 0) && (x == 0) && (z valid shift) ==> r = x >>> z 16810 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 16811 16812 // (r == 0) && ((x >> z) == 0) 16813 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 16814 16815 // (r == 0) && (z >= x) && (x >= 0) && (z valid shift) 16816 // This suppression really ought to have 2**z >= x, but we 16817 // don't have that suppression. This still might catch a lot of these. 16818 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 16819 // arg2_valid_shift, suppressee), 16820 }); 16821 16822 // Create a suppression factory for functionBinary 16823 16824} 16825 16826/** 16827 * Represents the invariant {@code z = RshiftUnsigned(x, y)} over three long 16828 * scalars. 16829 */ 16830public static class RshiftUnsignedLong_zxy extends FunctionBinary { 16831 static final long serialVersionUID = 20031030L; 16832 16833 // y must be between arg2_bound[0] and arg2_bound[1] inclusive 16834 static int[] arg2_bound = {0, 63}; 16835 16836 private static @Prototype RshiftUnsignedLong_zxy proto = new @Prototype RshiftUnsignedLong_zxy (); 16837 16838 /** Returns the prototype invariant for RshiftUnsignedLong_zxy */ 16839 public static @Prototype RshiftUnsignedLong_zxy get_proto() { 16840 return proto; 16841 } 16842 16843 @Override 16844 protected RshiftUnsignedLong_zxy instantiate_dyn(@Prototype RshiftUnsignedLong_zxy this, PptSlice slice) { 16845 return new RshiftUnsignedLong_zxy (slice); 16846 } 16847 16848 private RshiftUnsignedLong_zxy (PptSlice slice) { 16849 super(slice); 16850 } 16851 16852 public @Prototype RshiftUnsignedLong_zxy () { 16853 super(); 16854 } 16855 16856 private static String[] method_name = new String[] {"", " >>> ", ""}; 16857 16858 @Override 16859 public String[] get_method_name(@GuardSatisfied RshiftUnsignedLong_zxy this) { 16860 return method_name; 16861 } 16862 16863 private static int function_id = -1; 16864 16865 @Override 16866 public int get_function_id() { 16867 return function_id; 16868 } 16869 16870 @Override 16871 public void set_function_id(int function_id) { 16872 assert RshiftUnsignedLong_zxy.function_id == -1; 16873 RshiftUnsignedLong_zxy.function_id = function_id; 16874 } 16875 16876 private static int var_order = 3; 16877 16878 @Override 16879 public int get_var_order(@GuardSatisfied RshiftUnsignedLong_zxy this) { 16880 return var_order; 16881 } 16882 16883 @Pure 16884 @Override 16885 public boolean is_symmetric() { 16886 16887 return false; 16888 } 16889 16890 @Override 16891 16892 @SuppressWarnings("signedness:shift.unsigned") // RshiftUnsigned treats x as unsigned, though we do not know how the program under test treats it 16893 16894 public long func(long x, long y) { 16895 16896 if ((y < arg2_bound[0]) || (y > arg2_bound[1])) { 16897 throw new ArithmeticException("arg2 (" + y + ") out of range " 16898 + arg2_bound[0] + ".." + arg2_bound[1]); 16899 } 16900 16901 return (x >>> y); 16902 } 16903 16904 @Override 16905 public InvariantStatus check_modified(long x, long y, 16906 long z, int count) { 16907 return check_ordered(z, x, y, count); 16908 } 16909 16910 @Override 16911 public InvariantStatus add_modified(long x, long y, 16912 long z, int count) { 16913 if (Debug.logDetail()) { 16914 log("result=%s, arg1=%s, arg2=%s", z, x, y); 16915 } 16916 return add_ordered(z, x, y, count); 16917 } 16918 16919 @Pure 16920 @Override 16921 public boolean isRshiftUnsigned() { 16922 return true; 16923 } 16924 16925 /** Returns a list of non-instantiating suppressions for this invariant. */ 16926 @Pure 16927 @Override 16928 public @Nullable NISuppressionSet get_ni_suppressions() { 16929 if (NIS.dkconfig_enabled && dkconfig_enabled) { 16930 return suppressions; 16931 } else { 16932 return null; 16933 } 16934 } 16935 16936 /** definition of this invariant (the suppressee) */ 16937 private static NISuppressee suppressee = new NISuppressee(RshiftUnsignedLong_zxy.class, 3); 16938 16939 // suppressor definitions (used below) 16940 private static NISuppressor result_eq_arg1 = 16941 new NISuppressor(2, 0, IntEqual.class); 16942 private static NISuppressor result_eq_arg2 = 16943 new NISuppressor(2, 1, IntEqual.class); 16944 private static NISuppressor arg1_eq_arg2 = 16945 new NISuppressor(0, 1, IntEqual.class); 16946 16947 private static NISuppressor result_lt_arg1 = 16948 new NISuppressor(2, 0, IntLessThan.class); 16949 private static NISuppressor result_lt_arg2 = 16950 new NISuppressor(2, 1, IntLessThan.class); 16951 private static NISuppressor arg1_lt_arg2 = 16952 new NISuppressor(0, 1, IntLessThan.class); 16953 private static NISuppressor arg2_lt_arg1 = 16954 new NISuppressor(1, 0, IntLessThan.class); 16955 16956 private static NISuppressor result_le_arg1 = 16957 new NISuppressor(2, 0, IntLessEqual.class); 16958 private static NISuppressor result_le_arg2 = 16959 new NISuppressor(2, 1, IntLessEqual.class); 16960 private static NISuppressor arg1_le_arg2 = 16961 new NISuppressor(0, 1, IntLessEqual.class); 16962 private static NISuppressor arg2_le_arg1 = 16963 new NISuppressor(1, 0, IntLessEqual.class); 16964 16965 private static NISuppressor result_track0_arg1 = 16966 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 16967 private static NISuppressor result_track0_arg2 = 16968 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 16969 private static NISuppressor arg1_track0_arg2 = 16970 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 16971 private static NISuppressor arg1_track0_result = 16972 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 16973 private static NISuppressor arg2_track0_result = 16974 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 16975 private static NISuppressor arg2_track0_arg1 = 16976 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 16977 16978 private static NISuppressor result_eq_1 = 16979 new NISuppressor(2, RangeInt.EqualOne.class); 16980 private static NISuppressor arg1_eq_1 = 16981 new NISuppressor(0, RangeInt.EqualOne.class); 16982 private static NISuppressor arg2_eq_1 = 16983 new NISuppressor(1, RangeInt.EqualOne.class); 16984 16985 private static NISuppressor result_eq_0 = 16986 new NISuppressor(2, RangeInt.EqualZero.class); 16987 private static NISuppressor arg1_eq_0 = 16988 new NISuppressor(0, RangeInt.EqualZero.class); 16989 private static NISuppressor arg2_eq_0 = 16990 new NISuppressor(1, RangeInt.EqualZero.class); 16991 16992 private static NISuppressor result_ne_0 = 16993 new NISuppressor(2, NonZero.class); 16994 private static NISuppressor arg1_ne_0 = 16995 new NISuppressor(0, NonZero.class); 16996 private static NISuppressor arg2_ne_0 = 16997 new NISuppressor(1, NonZero.class); 16998 16999 private static NISuppressor result_ge_0 = 17000 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 17001 private static NISuppressor arg1_ge_0 = 17002 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 17003 private static NISuppressor arg2_ge_0 = 17004 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 17005 17006 private static NISuppressor result_ge_64 = 17007 new NISuppressor(2, RangeInt.GreaterEqual64.class); 17008 private static NISuppressor arg1_ge_64 = 17009 new NISuppressor(0, RangeInt.GreaterEqual64.class); 17010 private static NISuppressor arg2_ge_64 = 17011 new NISuppressor(1, RangeInt.GreaterEqual64.class); 17012 17013 private static NISuppressor result_boolean = 17014 new NISuppressor(2, RangeInt.BooleanVal.class); 17015 private static NISuppressor arg1_boolean = 17016 new NISuppressor(0, RangeInt.BooleanVal.class); 17017 private static NISuppressor arg2_boolean = 17018 new NISuppressor(1, RangeInt.BooleanVal.class); 17019 17020 private static NISuppressor result_even = 17021 new NISuppressor(2, RangeInt.Even.class); 17022 private static NISuppressor arg1_even = 17023 new NISuppressor(0, RangeInt.Even.class); 17024 private static NISuppressor arg2_even = 17025 new NISuppressor(1, RangeInt.Even.class); 17026 17027 private static NISuppressor result_power2 = 17028 new NISuppressor(2, RangeInt.PowerOfTwo.class); 17029 private static NISuppressor arg1_power2 = 17030 new NISuppressor(0, RangeInt.PowerOfTwo.class); 17031 private static NISuppressor arg2_power2 = 17032 new NISuppressor(1, RangeInt.PowerOfTwo.class); 17033 17034 private static NISuppressor result_and0_arg1 = 17035 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 17036 private static NISuppressor result_and0_arg2 = 17037 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 17038 private static NISuppressor arg1_and0_arg2 = 17039 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 17040 17041 // The arguments to bitwise subset are backwards from what one 17042 // might expect. The second argument is a subset of the first 17043 // argument 17044 private static NISuppressor arg1_bw_subset_arg2 = 17045 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 17046 private static NISuppressor arg2_bw_subset_arg1 = 17047 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 17048 17049 private static NISuppressor result_shift0_arg1 = 17050 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 17051 private static NISuppressor result_shift0_arg2 = 17052 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 17053 private static NISuppressor arg1_shift0_arg2 = 17054 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 17055 17056 private static NISuppressor arg2_divides_arg1 = 17057 new NISuppressor(0, 1, NumericInt.Divides.class); 17058 private static NISuppressor arg1_divides_arg2 = 17059 new NISuppressor(1, 0, NumericInt.Divides.class); 17060 17061 private static NISuppressor arg2_valid_shift = 17062 new NISuppressor(1, RangeInt.Bound0_63.class); 17063 17064 private static NISuppressionSet suppressions = 17065 new NISuppressionSet( 17066 new NISuppression[] { 17067 17068 // (r == x) && (y == 0) ==> r = x >>> y 17069 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 17070 17071 // (r == 0) && (x == 0) && (y valid shift) ==> r = x >>> y 17072 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 17073 17074 // (r == 0) && ((x >> y) == 0) 17075 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 17076 17077 // (r == 0) && (y >= x) && (x >= 0) && (y valid shift) 17078 // This suppression really ought to have 2**y >= x, but we 17079 // don't have that suppression. This still might catch a lot of these. 17080 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 17081 // arg2_valid_shift, suppressee), 17082 }); 17083 17084 // Create a suppression factory for functionBinary 17085 17086} 17087 17088/** 17089 * Represents the invariant {@code x = RshiftUnsigned(z, y)} over three long 17090 * scalars. 17091 */ 17092public static class RshiftUnsignedLong_xzy extends FunctionBinary { 17093 static final long serialVersionUID = 20031030L; 17094 17095 // y must be between arg2_bound[0] and arg2_bound[1] inclusive 17096 static int[] arg2_bound = {0, 63}; 17097 17098 private static @Prototype RshiftUnsignedLong_xzy proto = new @Prototype RshiftUnsignedLong_xzy (); 17099 17100 /** Returns the prototype invariant for RshiftUnsignedLong_xzy */ 17101 public static @Prototype RshiftUnsignedLong_xzy get_proto() { 17102 return proto; 17103 } 17104 17105 @Override 17106 protected RshiftUnsignedLong_xzy instantiate_dyn(@Prototype RshiftUnsignedLong_xzy this, PptSlice slice) { 17107 return new RshiftUnsignedLong_xzy (slice); 17108 } 17109 17110 private RshiftUnsignedLong_xzy (PptSlice slice) { 17111 super(slice); 17112 } 17113 17114 public @Prototype RshiftUnsignedLong_xzy () { 17115 super(); 17116 } 17117 17118 private static String[] method_name = new String[] {"", " >>> ", ""}; 17119 17120 @Override 17121 public String[] get_method_name(@GuardSatisfied RshiftUnsignedLong_xzy this) { 17122 return method_name; 17123 } 17124 17125 private static int function_id = -1; 17126 17127 @Override 17128 public int get_function_id() { 17129 return function_id; 17130 } 17131 17132 @Override 17133 public void set_function_id(int function_id) { 17134 assert RshiftUnsignedLong_xzy.function_id == -1; 17135 RshiftUnsignedLong_xzy.function_id = function_id; 17136 } 17137 17138 private static int var_order = 4; 17139 17140 @Override 17141 public int get_var_order(@GuardSatisfied RshiftUnsignedLong_xzy this) { 17142 return var_order; 17143 } 17144 17145 @Pure 17146 @Override 17147 public boolean is_symmetric() { 17148 17149 return false; 17150 } 17151 17152 @Override 17153 17154 @SuppressWarnings("signedness:shift.unsigned") // RshiftUnsigned treats z as unsigned, though we do not know how the program under test treats it 17155 17156 public long func(long z, long y) { 17157 17158 if ((y < arg2_bound[0]) || (y > arg2_bound[1])) { 17159 throw new ArithmeticException("arg2 (" + y + ") out of range " 17160 + arg2_bound[0] + ".." + arg2_bound[1]); 17161 } 17162 17163 return (z >>> y); 17164 } 17165 17166 @Override 17167 public InvariantStatus check_modified(long x, long y, 17168 long z, int count) { 17169 return check_ordered(x, z, y, count); 17170 } 17171 17172 @Override 17173 public InvariantStatus add_modified(long x, long y, 17174 long z, int count) { 17175 if (Debug.logDetail()) { 17176 log("result=%s, arg1=%s, arg2=%s", x, z, y); 17177 } 17178 return add_ordered(x, z, y, count); 17179 } 17180 17181 @Pure 17182 @Override 17183 public boolean isRshiftUnsigned() { 17184 return true; 17185 } 17186 17187 /** Returns a list of non-instantiating suppressions for this invariant. */ 17188 @Pure 17189 @Override 17190 public @Nullable NISuppressionSet get_ni_suppressions() { 17191 if (NIS.dkconfig_enabled && dkconfig_enabled) { 17192 return suppressions; 17193 } else { 17194 return null; 17195 } 17196 } 17197 17198 /** definition of this invariant (the suppressee) */ 17199 private static NISuppressee suppressee = new NISuppressee(RshiftUnsignedLong_xzy.class, 3); 17200 17201 // suppressor definitions (used below) 17202 private static NISuppressor result_eq_arg1 = 17203 new NISuppressor(0, 2, IntEqual.class); 17204 private static NISuppressor result_eq_arg2 = 17205 new NISuppressor(0, 1, IntEqual.class); 17206 private static NISuppressor arg1_eq_arg2 = 17207 new NISuppressor(2, 1, IntEqual.class); 17208 17209 private static NISuppressor result_lt_arg1 = 17210 new NISuppressor(0, 2, IntLessThan.class); 17211 private static NISuppressor result_lt_arg2 = 17212 new NISuppressor(0, 1, IntLessThan.class); 17213 private static NISuppressor arg1_lt_arg2 = 17214 new NISuppressor(2, 1, IntLessThan.class); 17215 private static NISuppressor arg2_lt_arg1 = 17216 new NISuppressor(1, 2, IntLessThan.class); 17217 17218 private static NISuppressor result_le_arg1 = 17219 new NISuppressor(0, 2, IntLessEqual.class); 17220 private static NISuppressor result_le_arg2 = 17221 new NISuppressor(0, 1, IntLessEqual.class); 17222 private static NISuppressor arg1_le_arg2 = 17223 new NISuppressor(2, 1, IntLessEqual.class); 17224 private static NISuppressor arg2_le_arg1 = 17225 new NISuppressor(1, 2, IntLessEqual.class); 17226 17227 private static NISuppressor result_track0_arg1 = 17228 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 17229 private static NISuppressor result_track0_arg2 = 17230 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 17231 private static NISuppressor arg1_track0_arg2 = 17232 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 17233 private static NISuppressor arg1_track0_result = 17234 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 17235 private static NISuppressor arg2_track0_result = 17236 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 17237 private static NISuppressor arg2_track0_arg1 = 17238 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 17239 17240 private static NISuppressor result_eq_1 = 17241 new NISuppressor(0, RangeInt.EqualOne.class); 17242 private static NISuppressor arg1_eq_1 = 17243 new NISuppressor(2, RangeInt.EqualOne.class); 17244 private static NISuppressor arg2_eq_1 = 17245 new NISuppressor(1, RangeInt.EqualOne.class); 17246 17247 private static NISuppressor result_eq_0 = 17248 new NISuppressor(0, RangeInt.EqualZero.class); 17249 private static NISuppressor arg1_eq_0 = 17250 new NISuppressor(2, RangeInt.EqualZero.class); 17251 private static NISuppressor arg2_eq_0 = 17252 new NISuppressor(1, RangeInt.EqualZero.class); 17253 17254 private static NISuppressor result_ne_0 = 17255 new NISuppressor(0, NonZero.class); 17256 private static NISuppressor arg1_ne_0 = 17257 new NISuppressor(2, NonZero.class); 17258 private static NISuppressor arg2_ne_0 = 17259 new NISuppressor(1, NonZero.class); 17260 17261 private static NISuppressor result_ge_0 = 17262 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 17263 private static NISuppressor arg1_ge_0 = 17264 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 17265 private static NISuppressor arg2_ge_0 = 17266 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 17267 17268 private static NISuppressor result_ge_64 = 17269 new NISuppressor(0, RangeInt.GreaterEqual64.class); 17270 private static NISuppressor arg1_ge_64 = 17271 new NISuppressor(2, RangeInt.GreaterEqual64.class); 17272 private static NISuppressor arg2_ge_64 = 17273 new NISuppressor(1, RangeInt.GreaterEqual64.class); 17274 17275 private static NISuppressor result_boolean = 17276 new NISuppressor(0, RangeInt.BooleanVal.class); 17277 private static NISuppressor arg1_boolean = 17278 new NISuppressor(2, RangeInt.BooleanVal.class); 17279 private static NISuppressor arg2_boolean = 17280 new NISuppressor(1, RangeInt.BooleanVal.class); 17281 17282 private static NISuppressor result_even = 17283 new NISuppressor(0, RangeInt.Even.class); 17284 private static NISuppressor arg1_even = 17285 new NISuppressor(2, RangeInt.Even.class); 17286 private static NISuppressor arg2_even = 17287 new NISuppressor(1, RangeInt.Even.class); 17288 17289 private static NISuppressor result_power2 = 17290 new NISuppressor(0, RangeInt.PowerOfTwo.class); 17291 private static NISuppressor arg1_power2 = 17292 new NISuppressor(2, RangeInt.PowerOfTwo.class); 17293 private static NISuppressor arg2_power2 = 17294 new NISuppressor(1, RangeInt.PowerOfTwo.class); 17295 17296 private static NISuppressor result_and0_arg1 = 17297 new NISuppressor(0, 2, NumericInt.BitwiseAndZero.class); 17298 private static NISuppressor result_and0_arg2 = 17299 new NISuppressor(0, 1, NumericInt.BitwiseAndZero.class); 17300 private static NISuppressor arg1_and0_arg2 = 17301 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 17302 17303 // The arguments to bitwise subset are backwards from what one 17304 // might expect. The second argument is a subset of the first 17305 // argument 17306 private static NISuppressor arg1_bw_subset_arg2 = 17307 new NISuppressor(1, 2, NumericInt.BitwiseSubset.class); 17308 private static NISuppressor arg2_bw_subset_arg1 = 17309 new NISuppressor(2, 1, NumericInt.BitwiseSubset.class); 17310 17311 private static NISuppressor result_shift0_arg1 = 17312 new NISuppressor(0, 2, NumericInt.ShiftZero.class); 17313 private static NISuppressor result_shift0_arg2 = 17314 new NISuppressor(0, 1, NumericInt.ShiftZero.class); 17315 private static NISuppressor arg1_shift0_arg2 = 17316 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 17317 17318 private static NISuppressor arg2_divides_arg1 = 17319 new NISuppressor(2, 1, NumericInt.Divides.class); 17320 private static NISuppressor arg1_divides_arg2 = 17321 new NISuppressor(1, 2, NumericInt.Divides.class); 17322 17323 private static NISuppressor arg2_valid_shift = 17324 new NISuppressor(1, RangeInt.Bound0_63.class); 17325 17326 private static NISuppressionSet suppressions = 17327 new NISuppressionSet( 17328 new NISuppression[] { 17329 17330 // (r == z) && (y == 0) ==> r = z >>> y 17331 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 17332 17333 // (r == 0) && (z == 0) && (y valid shift) ==> r = z >>> y 17334 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 17335 17336 // (r == 0) && ((z >> y) == 0) 17337 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 17338 17339 // (r == 0) && (y >= z) && (z >= 0) && (y valid shift) 17340 // This suppression really ought to have 2**y >= z, but we 17341 // don't have that suppression. This still might catch a lot of these. 17342 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 17343 // arg2_valid_shift, suppressee), 17344 }); 17345 17346 // Create a suppression factory for functionBinary 17347 17348} 17349 17350/** 17351 * Represents the invariant {@code y = RshiftUnsigned(z, x)} over three long 17352 * scalars. 17353 */ 17354public static class RshiftUnsignedLong_yzx extends FunctionBinary { 17355 static final long serialVersionUID = 20031030L; 17356 17357 // x must be between arg2_bound[0] and arg2_bound[1] inclusive 17358 static int[] arg2_bound = {0, 63}; 17359 17360 private static @Prototype RshiftUnsignedLong_yzx proto = new @Prototype RshiftUnsignedLong_yzx (); 17361 17362 /** Returns the prototype invariant for RshiftUnsignedLong_yzx */ 17363 public static @Prototype RshiftUnsignedLong_yzx get_proto() { 17364 return proto; 17365 } 17366 17367 @Override 17368 protected RshiftUnsignedLong_yzx instantiate_dyn(@Prototype RshiftUnsignedLong_yzx this, PptSlice slice) { 17369 return new RshiftUnsignedLong_yzx (slice); 17370 } 17371 17372 private RshiftUnsignedLong_yzx (PptSlice slice) { 17373 super(slice); 17374 } 17375 17376 public @Prototype RshiftUnsignedLong_yzx () { 17377 super(); 17378 } 17379 17380 private static String[] method_name = new String[] {"", " >>> ", ""}; 17381 17382 @Override 17383 public String[] get_method_name(@GuardSatisfied RshiftUnsignedLong_yzx this) { 17384 return method_name; 17385 } 17386 17387 private static int function_id = -1; 17388 17389 @Override 17390 public int get_function_id() { 17391 return function_id; 17392 } 17393 17394 @Override 17395 public void set_function_id(int function_id) { 17396 assert RshiftUnsignedLong_yzx.function_id == -1; 17397 RshiftUnsignedLong_yzx.function_id = function_id; 17398 } 17399 17400 private static int var_order = 5; 17401 17402 @Override 17403 public int get_var_order(@GuardSatisfied RshiftUnsignedLong_yzx this) { 17404 return var_order; 17405 } 17406 17407 @Pure 17408 @Override 17409 public boolean is_symmetric() { 17410 17411 return false; 17412 } 17413 17414 @Override 17415 17416 @SuppressWarnings("signedness:shift.unsigned") // RshiftUnsigned treats z as unsigned, though we do not know how the program under test treats it 17417 17418 public long func(long z, long x) { 17419 17420 if ((x < arg2_bound[0]) || (x > arg2_bound[1])) { 17421 throw new ArithmeticException("arg2 (" + x + ") out of range " 17422 + arg2_bound[0] + ".." + arg2_bound[1]); 17423 } 17424 17425 return (z >>> x); 17426 } 17427 17428 @Override 17429 public InvariantStatus check_modified(long x, long y, 17430 long z, int count) { 17431 return check_ordered(y, z, x, count); 17432 } 17433 17434 @Override 17435 public InvariantStatus add_modified(long x, long y, 17436 long z, int count) { 17437 if (Debug.logDetail()) { 17438 log("result=%s, arg1=%s, arg2=%s", y, z, x); 17439 } 17440 return add_ordered(y, z, x, count); 17441 } 17442 17443 @Pure 17444 @Override 17445 public boolean isRshiftUnsigned() { 17446 return true; 17447 } 17448 17449 /** Returns a list of non-instantiating suppressions for this invariant. */ 17450 @Pure 17451 @Override 17452 public @Nullable NISuppressionSet get_ni_suppressions() { 17453 if (NIS.dkconfig_enabled && dkconfig_enabled) { 17454 return suppressions; 17455 } else { 17456 return null; 17457 } 17458 } 17459 17460 /** definition of this invariant (the suppressee) */ 17461 private static NISuppressee suppressee = new NISuppressee(RshiftUnsignedLong_yzx.class, 3); 17462 17463 // suppressor definitions (used below) 17464 private static NISuppressor result_eq_arg1 = 17465 new NISuppressor(1, 2, IntEqual.class); 17466 private static NISuppressor result_eq_arg2 = 17467 new NISuppressor(1, 0, IntEqual.class); 17468 private static NISuppressor arg1_eq_arg2 = 17469 new NISuppressor(2, 0, IntEqual.class); 17470 17471 private static NISuppressor result_lt_arg1 = 17472 new NISuppressor(1, 2, IntLessThan.class); 17473 private static NISuppressor result_lt_arg2 = 17474 new NISuppressor(1, 0, IntLessThan.class); 17475 private static NISuppressor arg1_lt_arg2 = 17476 new NISuppressor(2, 0, IntLessThan.class); 17477 private static NISuppressor arg2_lt_arg1 = 17478 new NISuppressor(0, 2, IntLessThan.class); 17479 17480 private static NISuppressor result_le_arg1 = 17481 new NISuppressor(1, 2, IntLessEqual.class); 17482 private static NISuppressor result_le_arg2 = 17483 new NISuppressor(1, 0, IntLessEqual.class); 17484 private static NISuppressor arg1_le_arg2 = 17485 new NISuppressor(2, 0, IntLessEqual.class); 17486 private static NISuppressor arg2_le_arg1 = 17487 new NISuppressor(0, 2, IntLessEqual.class); 17488 17489 private static NISuppressor result_track0_arg1 = 17490 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 17491 private static NISuppressor result_track0_arg2 = 17492 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 17493 private static NISuppressor arg1_track0_arg2 = 17494 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 17495 private static NISuppressor arg1_track0_result = 17496 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 17497 private static NISuppressor arg2_track0_result = 17498 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 17499 private static NISuppressor arg2_track0_arg1 = 17500 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 17501 17502 private static NISuppressor result_eq_1 = 17503 new NISuppressor(1, RangeInt.EqualOne.class); 17504 private static NISuppressor arg1_eq_1 = 17505 new NISuppressor(2, RangeInt.EqualOne.class); 17506 private static NISuppressor arg2_eq_1 = 17507 new NISuppressor(0, RangeInt.EqualOne.class); 17508 17509 private static NISuppressor result_eq_0 = 17510 new NISuppressor(1, RangeInt.EqualZero.class); 17511 private static NISuppressor arg1_eq_0 = 17512 new NISuppressor(2, RangeInt.EqualZero.class); 17513 private static NISuppressor arg2_eq_0 = 17514 new NISuppressor(0, RangeInt.EqualZero.class); 17515 17516 private static NISuppressor result_ne_0 = 17517 new NISuppressor(1, NonZero.class); 17518 private static NISuppressor arg1_ne_0 = 17519 new NISuppressor(2, NonZero.class); 17520 private static NISuppressor arg2_ne_0 = 17521 new NISuppressor(0, NonZero.class); 17522 17523 private static NISuppressor result_ge_0 = 17524 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 17525 private static NISuppressor arg1_ge_0 = 17526 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 17527 private static NISuppressor arg2_ge_0 = 17528 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 17529 17530 private static NISuppressor result_ge_64 = 17531 new NISuppressor(1, RangeInt.GreaterEqual64.class); 17532 private static NISuppressor arg1_ge_64 = 17533 new NISuppressor(2, RangeInt.GreaterEqual64.class); 17534 private static NISuppressor arg2_ge_64 = 17535 new NISuppressor(0, RangeInt.GreaterEqual64.class); 17536 17537 private static NISuppressor result_boolean = 17538 new NISuppressor(1, RangeInt.BooleanVal.class); 17539 private static NISuppressor arg1_boolean = 17540 new NISuppressor(2, RangeInt.BooleanVal.class); 17541 private static NISuppressor arg2_boolean = 17542 new NISuppressor(0, RangeInt.BooleanVal.class); 17543 17544 private static NISuppressor result_even = 17545 new NISuppressor(1, RangeInt.Even.class); 17546 private static NISuppressor arg1_even = 17547 new NISuppressor(2, RangeInt.Even.class); 17548 private static NISuppressor arg2_even = 17549 new NISuppressor(0, RangeInt.Even.class); 17550 17551 private static NISuppressor result_power2 = 17552 new NISuppressor(1, RangeInt.PowerOfTwo.class); 17553 private static NISuppressor arg1_power2 = 17554 new NISuppressor(2, RangeInt.PowerOfTwo.class); 17555 private static NISuppressor arg2_power2 = 17556 new NISuppressor(0, RangeInt.PowerOfTwo.class); 17557 17558 private static NISuppressor result_and0_arg1 = 17559 new NISuppressor(1, 2, NumericInt.BitwiseAndZero.class); 17560 private static NISuppressor result_and0_arg2 = 17561 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 17562 private static NISuppressor arg1_and0_arg2 = 17563 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 17564 17565 // The arguments to bitwise subset are backwards from what one 17566 // might expect. The second argument is a subset of the first 17567 // argument 17568 private static NISuppressor arg1_bw_subset_arg2 = 17569 new NISuppressor(0, 2, NumericInt.BitwiseSubset.class); 17570 private static NISuppressor arg2_bw_subset_arg1 = 17571 new NISuppressor(2, 0, NumericInt.BitwiseSubset.class); 17572 17573 private static NISuppressor result_shift0_arg1 = 17574 new NISuppressor(1, 2, NumericInt.ShiftZero.class); 17575 private static NISuppressor result_shift0_arg2 = 17576 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 17577 private static NISuppressor arg1_shift0_arg2 = 17578 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 17579 17580 private static NISuppressor arg2_divides_arg1 = 17581 new NISuppressor(2, 0, NumericInt.Divides.class); 17582 private static NISuppressor arg1_divides_arg2 = 17583 new NISuppressor(0, 2, NumericInt.Divides.class); 17584 17585 private static NISuppressor arg2_valid_shift = 17586 new NISuppressor(0, RangeInt.Bound0_63.class); 17587 17588 private static NISuppressionSet suppressions = 17589 new NISuppressionSet( 17590 new NISuppression[] { 17591 17592 // (r == z) && (x == 0) ==> r = z >>> x 17593 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 17594 17595 // (r == 0) && (z == 0) && (x valid shift) ==> r = z >>> x 17596 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 17597 17598 // (r == 0) && ((z >> x) == 0) 17599 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 17600 17601 // (r == 0) && (x >= z) && (z >= 0) && (x valid shift) 17602 // This suppression really ought to have 2**x >= z, but we 17603 // don't have that suppression. This still might catch a lot of these. 17604 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 17605 // arg2_valid_shift, suppressee), 17606 }); 17607 17608 // Create a suppression factory for functionBinary 17609 17610} 17611 17612/** 17613 * Represents the invariant {@code z = RshiftUnsigned(y, x)} over three long 17614 * scalars. 17615 */ 17616public static class RshiftUnsignedLong_zyx extends FunctionBinary { 17617 static final long serialVersionUID = 20031030L; 17618 17619 // x must be between arg2_bound[0] and arg2_bound[1] inclusive 17620 static int[] arg2_bound = {0, 63}; 17621 17622 private static @Prototype RshiftUnsignedLong_zyx proto = new @Prototype RshiftUnsignedLong_zyx (); 17623 17624 /** Returns the prototype invariant for RshiftUnsignedLong_zyx */ 17625 public static @Prototype RshiftUnsignedLong_zyx get_proto() { 17626 return proto; 17627 } 17628 17629 @Override 17630 protected RshiftUnsignedLong_zyx instantiate_dyn(@Prototype RshiftUnsignedLong_zyx this, PptSlice slice) { 17631 return new RshiftUnsignedLong_zyx (slice); 17632 } 17633 17634 private RshiftUnsignedLong_zyx (PptSlice slice) { 17635 super(slice); 17636 } 17637 17638 public @Prototype RshiftUnsignedLong_zyx () { 17639 super(); 17640 } 17641 17642 private static String[] method_name = new String[] {"", " >>> ", ""}; 17643 17644 @Override 17645 public String[] get_method_name(@GuardSatisfied RshiftUnsignedLong_zyx this) { 17646 return method_name; 17647 } 17648 17649 private static int function_id = -1; 17650 17651 @Override 17652 public int get_function_id() { 17653 return function_id; 17654 } 17655 17656 @Override 17657 public void set_function_id(int function_id) { 17658 assert RshiftUnsignedLong_zyx.function_id == -1; 17659 RshiftUnsignedLong_zyx.function_id = function_id; 17660 } 17661 17662 private static int var_order = 6; 17663 17664 @Override 17665 public int get_var_order(@GuardSatisfied RshiftUnsignedLong_zyx this) { 17666 return var_order; 17667 } 17668 17669 @Pure 17670 @Override 17671 public boolean is_symmetric() { 17672 17673 return false; 17674 } 17675 17676 @Override 17677 17678 @SuppressWarnings("signedness:shift.unsigned") // RshiftUnsigned treats y as unsigned, though we do not know how the program under test treats it 17679 17680 public long func(long y, long x) { 17681 17682 if ((x < arg2_bound[0]) || (x > arg2_bound[1])) { 17683 throw new ArithmeticException("arg2 (" + x + ") out of range " 17684 + arg2_bound[0] + ".." + arg2_bound[1]); 17685 } 17686 17687 return (y >>> x); 17688 } 17689 17690 @Override 17691 public InvariantStatus check_modified(long x, long y, 17692 long z, int count) { 17693 return check_ordered(z, y, x, count); 17694 } 17695 17696 @Override 17697 public InvariantStatus add_modified(long x, long y, 17698 long z, int count) { 17699 if (Debug.logDetail()) { 17700 log("result=%s, arg1=%s, arg2=%s", z, y, x); 17701 } 17702 return add_ordered(z, y, x, count); 17703 } 17704 17705 @Pure 17706 @Override 17707 public boolean isRshiftUnsigned() { 17708 return true; 17709 } 17710 17711 /** Returns a list of non-instantiating suppressions for this invariant. */ 17712 @Pure 17713 @Override 17714 public @Nullable NISuppressionSet get_ni_suppressions() { 17715 if (NIS.dkconfig_enabled && dkconfig_enabled) { 17716 return suppressions; 17717 } else { 17718 return null; 17719 } 17720 } 17721 17722 /** definition of this invariant (the suppressee) */ 17723 private static NISuppressee suppressee = new NISuppressee(RshiftUnsignedLong_zyx.class, 3); 17724 17725 // suppressor definitions (used below) 17726 private static NISuppressor result_eq_arg1 = 17727 new NISuppressor(2, 1, IntEqual.class); 17728 private static NISuppressor result_eq_arg2 = 17729 new NISuppressor(2, 0, IntEqual.class); 17730 private static NISuppressor arg1_eq_arg2 = 17731 new NISuppressor(1, 0, IntEqual.class); 17732 17733 private static NISuppressor result_lt_arg1 = 17734 new NISuppressor(2, 1, IntLessThan.class); 17735 private static NISuppressor result_lt_arg2 = 17736 new NISuppressor(2, 0, IntLessThan.class); 17737 private static NISuppressor arg1_lt_arg2 = 17738 new NISuppressor(1, 0, IntLessThan.class); 17739 private static NISuppressor arg2_lt_arg1 = 17740 new NISuppressor(0, 1, IntLessThan.class); 17741 17742 private static NISuppressor result_le_arg1 = 17743 new NISuppressor(2, 1, IntLessEqual.class); 17744 private static NISuppressor result_le_arg2 = 17745 new NISuppressor(2, 0, IntLessEqual.class); 17746 private static NISuppressor arg1_le_arg2 = 17747 new NISuppressor(1, 0, IntLessEqual.class); 17748 private static NISuppressor arg2_le_arg1 = 17749 new NISuppressor(0, 1, IntLessEqual.class); 17750 17751 private static NISuppressor result_track0_arg1 = 17752 new NISuppressor(2, 1, NumericInt.ZeroTrack.class); 17753 private static NISuppressor result_track0_arg2 = 17754 new NISuppressor(2, 0, NumericInt.ZeroTrack.class); 17755 private static NISuppressor arg1_track0_arg2 = 17756 new NISuppressor(1, 0, NumericInt.ZeroTrack.class); 17757 private static NISuppressor arg1_track0_result = 17758 new NISuppressor(1, 2, NumericInt.ZeroTrack.class); 17759 private static NISuppressor arg2_track0_result = 17760 new NISuppressor(0, 2, NumericInt.ZeroTrack.class); 17761 private static NISuppressor arg2_track0_arg1 = 17762 new NISuppressor(0, 1, NumericInt.ZeroTrack.class); 17763 17764 private static NISuppressor result_eq_1 = 17765 new NISuppressor(2, RangeInt.EqualOne.class); 17766 private static NISuppressor arg1_eq_1 = 17767 new NISuppressor(1, RangeInt.EqualOne.class); 17768 private static NISuppressor arg2_eq_1 = 17769 new NISuppressor(0, RangeInt.EqualOne.class); 17770 17771 private static NISuppressor result_eq_0 = 17772 new NISuppressor(2, RangeInt.EqualZero.class); 17773 private static NISuppressor arg1_eq_0 = 17774 new NISuppressor(1, RangeInt.EqualZero.class); 17775 private static NISuppressor arg2_eq_0 = 17776 new NISuppressor(0, RangeInt.EqualZero.class); 17777 17778 private static NISuppressor result_ne_0 = 17779 new NISuppressor(2, NonZero.class); 17780 private static NISuppressor arg1_ne_0 = 17781 new NISuppressor(1, NonZero.class); 17782 private static NISuppressor arg2_ne_0 = 17783 new NISuppressor(0, NonZero.class); 17784 17785 private static NISuppressor result_ge_0 = 17786 new NISuppressor(2, RangeInt.GreaterEqualZero.class); 17787 private static NISuppressor arg1_ge_0 = 17788 new NISuppressor(1, RangeInt.GreaterEqualZero.class); 17789 private static NISuppressor arg2_ge_0 = 17790 new NISuppressor(0, RangeInt.GreaterEqualZero.class); 17791 17792 private static NISuppressor result_ge_64 = 17793 new NISuppressor(2, RangeInt.GreaterEqual64.class); 17794 private static NISuppressor arg1_ge_64 = 17795 new NISuppressor(1, RangeInt.GreaterEqual64.class); 17796 private static NISuppressor arg2_ge_64 = 17797 new NISuppressor(0, RangeInt.GreaterEqual64.class); 17798 17799 private static NISuppressor result_boolean = 17800 new NISuppressor(2, RangeInt.BooleanVal.class); 17801 private static NISuppressor arg1_boolean = 17802 new NISuppressor(1, RangeInt.BooleanVal.class); 17803 private static NISuppressor arg2_boolean = 17804 new NISuppressor(0, RangeInt.BooleanVal.class); 17805 17806 private static NISuppressor result_even = 17807 new NISuppressor(2, RangeInt.Even.class); 17808 private static NISuppressor arg1_even = 17809 new NISuppressor(1, RangeInt.Even.class); 17810 private static NISuppressor arg2_even = 17811 new NISuppressor(0, RangeInt.Even.class); 17812 17813 private static NISuppressor result_power2 = 17814 new NISuppressor(2, RangeInt.PowerOfTwo.class); 17815 private static NISuppressor arg1_power2 = 17816 new NISuppressor(1, RangeInt.PowerOfTwo.class); 17817 private static NISuppressor arg2_power2 = 17818 new NISuppressor(0, RangeInt.PowerOfTwo.class); 17819 17820 private static NISuppressor result_and0_arg1 = 17821 new NISuppressor(2, 1, NumericInt.BitwiseAndZero.class); 17822 private static NISuppressor result_and0_arg2 = 17823 new NISuppressor(2, 0, NumericInt.BitwiseAndZero.class); 17824 private static NISuppressor arg1_and0_arg2 = 17825 new NISuppressor(1, 0, NumericInt.BitwiseAndZero.class); 17826 17827 // The arguments to bitwise subset are backwards from what one 17828 // might expect. The second argument is a subset of the first 17829 // argument 17830 private static NISuppressor arg1_bw_subset_arg2 = 17831 new NISuppressor(0, 1, NumericInt.BitwiseSubset.class); 17832 private static NISuppressor arg2_bw_subset_arg1 = 17833 new NISuppressor(1, 0, NumericInt.BitwiseSubset.class); 17834 17835 private static NISuppressor result_shift0_arg1 = 17836 new NISuppressor(2, 1, NumericInt.ShiftZero.class); 17837 private static NISuppressor result_shift0_arg2 = 17838 new NISuppressor(2, 0, NumericInt.ShiftZero.class); 17839 private static NISuppressor arg1_shift0_arg2 = 17840 new NISuppressor(1, 0, NumericInt.ShiftZero.class); 17841 17842 private static NISuppressor arg2_divides_arg1 = 17843 new NISuppressor(1, 0, NumericInt.Divides.class); 17844 private static NISuppressor arg1_divides_arg2 = 17845 new NISuppressor(0, 1, NumericInt.Divides.class); 17846 17847 private static NISuppressor arg2_valid_shift = 17848 new NISuppressor(0, RangeInt.Bound0_63.class); 17849 17850 private static NISuppressionSet suppressions = 17851 new NISuppressionSet( 17852 new NISuppression[] { 17853 17854 // (r == y) && (x == 0) ==> r = y >>> x 17855 new NISuppression(result_eq_arg1, arg2_eq_0, suppressee), 17856 17857 // (r == 0) && (y == 0) && (x valid shift) ==> r = y >>> x 17858 // new NISuppression (result_eq_0, arg1_eq_0, arg2_valid_shift, suppressee), 17859 17860 // (r == 0) && ((y >> x) == 0) 17861 new NISuppression(result_eq_0, arg1_shift0_arg2, suppressee), 17862 17863 // (r == 0) && (x >= y) && (y >= 0) && (x valid shift) 17864 // This suppression really ought to have 2**x >= y, but we 17865 // don't have that suppression. This still might catch a lot of these. 17866 // new NISuppression (result_eq_0, arg1_le_arg2, arg1_ge_0, 17867 // arg2_valid_shift, suppressee), 17868 }); 17869 17870 // Create a suppression factory for functionBinary 17871 17872} 17873 17874}