Armin Rigo avatar Armin Rigo committed bae6349 Draft

Add a test, which fails as expected.

Comments (0)

Files changed (2)

         struct tx_descriptor *d,
         gcptr G, gcptr R, gcptr R_Container, size_t offset)
 {
-  if (R != G && --d->readonly_updates < 0)
+  if (R != G && (--d->readonly_updates < 0 || 1))
     {
       d->readonly_updates = 148;   /* XXX tweak */
       // compress the chain

hack/stm/python/test_c2.py

 
 def test_demo3(INEVITABLE_MASK=0, CPUClass=CPU_C2,
                SPACE_SIZE=16, ACCESS=5, WRITE_FRAC=2,
-               READONLY_FRAC=0, LOOP=10, NUM_CPUS=3):
+               READONLY_FRAC=0, LOOP=10, NUM_CPUS=3,
+               DIRECT_WRITES=False):
 
     space = [prebuilt_object(value=0) for i in range(SPACE_SIZE)]
 
             if p & INEVITABLE_MASK == 1:
                 cpu.BecomeInevitable()
             index = p & (SPACE_SIZE-1)
-            ptr = cpu.DirectReadBarrier(space[index])
+            if DIRECT_WRITES:
+                ptr = cpu.WriteBarrier(space[index])
+            else:
+                ptr = cpu.DirectReadBarrier(space[index])
             res = cpu.read_field(ptr, 'value')
             p = (p * 1291 + (p >> 16) + res) & 2147483647
             if (i % WRITE_FRAC) == 0 and not readonly:
 def test_demo3_readonly_inevitable():
     test_demo3(INEVITABLE_MASK=7, READONLY_FRAC=2)
 
+def test_demo3_direct_writes():
+    test_demo3(INEVITABLE_MASK=7, DIRECT_WRITES=True)
+
 
 def test_demo5_single(CPUClass=CPU_C2, LOOP=10, NUM_CPUS=1):
     start = prebuilt_object(x=None, y=None)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.