Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

http://dev.clojure.org/jira/browse/CLJ-858

  • Loading branch information...
commit 63adf50c4bb6517ffdaed780b1a4077f328853dd 1 parent c0bb9ed
Kevin Downey authored

Showing 1 changed file with 88 additions and 0 deletions. Show diff stats Hide diff stats

  1. +88 0 patches/stm-rm-msecs-patch.diff
88 patches/stm-rm-msecs-patch.diff
... ... @@ -0,0 +1,88 @@
  1 +From 6ab721a455fe1122aff5676ce436f322644c3a0a Mon Sep 17 00:00:00 2001
  2 +From: Stefan Kamphausen <ska2342@googlemail.com>
  3 +Date: Fri, 9 Sep 2011 10:43:58 +0200
  4 +Subject: [PATCH] remove msecs from Ref.TVal
  5 +
  6 +---
  7 + src/jvm/clojure/lang/LockingTransaction.java | 6 ++----
  8 + src/jvm/clojure/lang/Ref.java | 9 +++------
  9 + 2 files changed, 5 insertions(+), 10 deletions(-)
  10 +
  11 +diff --git a/src/jvm/clojure/lang/LockingTransaction.java b/src/jvm/clojure/lang/LockingTransaction.java
  12 +index 44d2de6..c97c51e 100644
  13 +--- a/src/jvm/clojure/lang/LockingTransaction.java
  14 ++++ b/src/jvm/clojure/lang/LockingTransaction.java
  15 +@@ -305,7 +305,6 @@ Object run(Callable fn) throws Exception{
  16 +
  17 + //at this point, all values calced, all refs to be written locked
  18 + //no more client code to be called
  19 +- long msecs = System.currentTimeMillis();
  20 + long commitPoint = getCommitPoint();
  21 + for(Map.Entry<Ref, Object> e : vals.entrySet())
  22 + {
  23 +@@ -316,12 +315,12 @@ Object run(Callable fn) throws Exception{
  24 +
  25 + if(ref.tvals == null)
  26 + {
  27 +- ref.tvals = new Ref.TVal(newval, commitPoint, msecs);
  28 ++ ref.tvals = new Ref.TVal(newval, commitPoint);
  29 + }
  30 + else if((ref.faults.get() > 0 && hcount < ref.maxHistory)
  31 + || hcount < ref.minHistory)
  32 + {
  33 +- ref.tvals = new Ref.TVal(newval, commitPoint, msecs, ref.tvals);
  34 ++ ref.tvals = new Ref.TVal(newval, commitPoint, ref.tvals);
  35 + ref.faults.set(0);
  36 + }
  37 + else
  38 +@@ -329,7 +328,6 @@ Object run(Callable fn) throws Exception{
  39 + ref.tvals = ref.tvals.next;
  40 + ref.tvals.val = newval;
  41 + ref.tvals.point = commitPoint;
  42 +- ref.tvals.msecs = msecs;
  43 + }
  44 + if(ref.getWatches().count() > 0)
  45 + notify.add(new Notify(ref, oldval, newval));
  46 +diff --git a/src/jvm/clojure/lang/Ref.java b/src/jvm/clojure/lang/Ref.java
  47 +index 9206785..59eebc1 100644
  48 +--- a/src/jvm/clojure/lang/Ref.java
  49 ++++ b/src/jvm/clojure/lang/Ref.java
  50 +@@ -47,24 +47,21 @@ public Ref setMaxHistory(int maxHistory){
  51 + public static class TVal{
  52 + Object val;
  53 + long point;
  54 +- long msecs;
  55 + TVal prior;
  56 + TVal next;
  57 +
  58 +- TVal(Object val, long point, long msecs, TVal prior){
  59 ++ TVal(Object val, long point, TVal prior){
  60 + this.val = val;
  61 + this.point = point;
  62 +- this.msecs = msecs;
  63 + this.prior = prior;
  64 + this.next = prior.next;
  65 + this.prior.next = this;
  66 + this.next.prior = this;
  67 + }
  68 +
  69 +- TVal(Object val, long point, long msecs){
  70 ++ TVal(Object val, long point){
  71 + this.val = val;
  72 + this.point = point;
  73 +- this.msecs = msecs;
  74 + this.next = this;
  75 + this.prior = this;
  76 + }
  77 +@@ -92,7 +89,7 @@ public Ref(Object initVal,IPersistentMap meta) {
  78 + this.id = ids.getAndIncrement();
  79 + this.faults = new AtomicInteger();
  80 + this.lock = new ReentrantReadWriteLock();
  81 +- tvals = new TVal(initVal, 0, System.currentTimeMillis());
  82 ++ tvals = new TVal(initVal, 0);
  83 + }
  84 +
  85 + //the latest val
  86 +--
  87 +1.7.0.4
  88 +

0 comments on commit 63adf50

Please sign in to comment.
Something went wrong with that request. Please try again.