示例#1
0
文件: Memory.java 项目: vilay/check
 /**
  * Test whether a memory range is set to a given integer value
  *
  * @param start The address to start checking at
  * @param bytes The size of the region to check, in bytes
  * @param verbose If true, produce verbose output
  * @param value The value to which the memory should be set
  */
 private static boolean isSet(Address start, int bytes, boolean verbose, int value)
     /* Inlining this loop into the uninterruptible code can
      *  cause/encourage the GCP into moving a get_obj_tib into the
      * interruptible region where the tib is being installed via an
      * int_store
      */
     throws NoInlinePragma {
   if (Assert.VERIFY_ASSERTIONS) assertAligned(bytes);
   for (int i = 0; i < bytes; i += BYTES_IN_INT)
     if (start.loadInt(Offset.fromInt(i)) != value) {
       if (verbose) {
         Log.prependThreadId();
         Log.write("Memory range does not contain only value ");
         Log.writeln(value);
         Log.write("Non-zero range: ");
         Log.write(start);
         Log.write(" .. ");
         Log.writeln(start.add(bytes));
         Log.write("First bad value at ");
         Log.writeln(start.add(i));
         dumpMemory(start, 0, bytes);
       }
       return false;
     }
   return true;
 }
示例#2
0
文件: Memory.java 项目: vilay/check
 /**
  * Set a region of memory
  *
  * @param start The start of the region to be zeroed (must be 4-byte aligned)
  * @param bytes The number of bytes to be zeroed (must be 4-byte aligned)
  * @param value The value to which the integers in the region should be set
  */
 public static void set(Address start, int bytes, int value) throws InlinePragma {
   if (Assert.VERIFY_ASSERTIONS) {
     assertAligned(start);
     assertAligned(bytes);
   }
   Address end = start.add(bytes);
   for (Address addr = start; addr.LT(end); addr = addr.add(BYTES_IN_INT)) addr.store(value);
 }
示例#3
0
文件: Memory.java 项目: vilay/check
 /**
  * Zero a small region of memory
  *
  * @param start The start of the region to be zeroed (must be 4-byte aligned)
  * @param bytes The number of bytes to be zeroed (must be 4-byte aligned)
  */
 public static void zeroSmall(Address start, Extent bytes) throws InlinePragma {
   if (Assert.VERIFY_ASSERTIONS) {
     assertAligned(start);
     assertAligned(bytes);
   }
   Address end = start.add(bytes);
   for (Address addr = start; addr.LT(end); addr = addr.add(BYTES_IN_INT)) addr.store(0);
 }