SF.net SVN: jikesrvm:[15755] rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic /unboxed/harness/MemoryPage.java

View: New views
1 Messages — Rating Filter:   Alert me  

SF.net SVN: jikesrvm:[15755] rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic /unboxed/harness/MemoryPage.java

by rgarner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Revision: 15755
          http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15755&view=rev
Author:   rgarner
Date:     2009-07-31 06:51:27 +0000 (Fri, 31 Jul 2009)

Log Message:
-----------
MMTk Harness: concurrency bug that shows up in Immix and related collectors.

Modified Paths:
--------------
    rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/harness/MemoryPage.java

Modified: rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/harness/MemoryPage.java
===================================================================
--- rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/harness/MemoryPage.java 2009-07-31 05:27:17 UTC (rev 15754)
+++ rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/harness/MemoryPage.java 2009-07-31 06:51:27 UTC (rev 15755)
@@ -142,7 +142,7 @@
   }
 
   @SuppressWarnings("cast")
-  public byte setByte(Address address, byte value) {
+  public synchronized byte setByte(Address address, byte value) {
     int shift = ((address.toInt()) & ~MemoryConstants.WORD_MASK) << MemoryConstants.LOG_BITS_IN_BYTE;
     int mask = 0x000000FF << shift;
     int newValue = (((int)value) << shift) & mask;
@@ -154,7 +154,7 @@
   }
 
   @SuppressWarnings("cast")
-  public char setChar(Address address, char value) {
+  public synchronized char setChar(Address address, char value) {
     int shift = ((address.toInt()) & ~MemoryConstants.WORD_MASK) << MemoryConstants.LOG_BITS_IN_BYTE;
     assert shift == 0 || shift == 16: "misaligned 2b access at "+address;
     int mask = 0x0000FFFF << shift;
@@ -166,7 +166,7 @@
     return (char)(oldValue >>> shift);
   }
 
-  public int setInt(Address address, int value) {
+  public synchronized int setInt(Address address, int value) {
     assert ((address.toInt()) % MemoryConstants.BYTES_IN_INT) == 0: "misaligned 4b access at "+address;
     int index = getIndex(address);
     int old = read(index);
@@ -174,7 +174,7 @@
     return old;
   }
 
-  public long setLong(Address address, long value) {
+  public synchronized long setLong(Address address, long value) {
     if (SimulatedMemory.ALIGN_CHECK_LONG) {
       assert ((address.toInt()) % MemoryConstants.BYTES_IN_LONG) == 0: "misaligned 8b access at "+address;
     }
@@ -207,10 +207,11 @@
   /**
    * Perform the actual read of memory.
    */
-  private int read(int index) {
+  private synchronized int read(int index) {
     int value = data[index];
     if (isWatched(index)) {
-      Trace.printf("%s = %08x%n", cellAddress(index), data[index]);
+      Trace.printf("%4d  load %s = %08x%n", Thread.currentThread().getId(),
+          cellAddress(index), value);
       //new Throwable().printStackTrace();
     }
     return value;
@@ -221,7 +222,8 @@
    */
   private void write(int index, int value) {
     if (isWatched(index)) {
-      Trace.printf("%s: %08x -> %08x%n", cellAddress(index), data[index], value);
+      Trace.printf("%4d store %s: %08x -> %08x%n", Thread.currentThread().getId(),
+          cellAddress(index), data[index], value);
       //new Throwable().printStackTrace();
     }
     data[index] = value;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-commits mailing list
Jikesrvm-commits@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-commits