Author: Armin Rigo <[email protected]>
Branch: stm-thread-2
Changeset: r57108:eb306fa79cf5
Date: 2012-09-03 21:17 +0200
http://bitbucket.org/pypy/pypy/changeset/eb306fa79cf5/
Log: Update to arigo/2f5d4cc948b2.
diff --git a/pypy/translator/stm/src_stm/et.c b/pypy/translator/stm/src_stm/et.c
--- a/pypy/translator/stm/src_stm/et.c
+++ b/pypy/translator/stm/src_stm/et.c
@@ -73,14 +73,6 @@
/************************************************************/
-gcptr Allocate(size_t size, int gctid)
-{
- gcptr W = malloc(size);
- W->h_tid = gctid;
- W->h_revision = REV_INITIAL;
- return W;
-}
-
static inline void PossiblyUpdateChain(
struct tx_descriptor *d,
gcptr G, gcptr R, gcptr R_Container, size_t offset)
@@ -223,6 +215,7 @@
memcpy(L, R, size);
L->h_tid &= ~(GCFLAG_GLOBAL | GCFLAG_POSSIBLY_OUTDATED);
assert(L->h_tid & GCFLAG_NOT_WRITTEN);
+ L->h_tid |= GCFLAG_LOCAL_COPY;
L->h_revision = (revision_t)R; /* back-reference to the original */
g2l_insert(&d->global_to_local, R, L);
return L;
@@ -497,6 +490,8 @@
if (P->h_tid & GCFLAG_GLOBAL)
return 0;
P->h_tid |= GCFLAG_GLOBAL | GCFLAG_NOT_WRITTEN;
+ if ((P->h_tid & GCFLAG_LOCAL_COPY) == 0)
+ P->h_revision = 1;
return 1;
}
@@ -580,14 +575,14 @@
inline static gcptr GlobalizeForComparison(struct tx_descriptor *d, gcptr P)
{
- if (P == NULL)
- return NULL;
- else if (P->h_tid & GCFLAG_GLOBAL)
- return LatestGlobalRevision(d, P, NULL, 0);
- else if (P->h_revision != REV_INITIAL)
- return (gcptr)P->h_revision; // return the original global obj
- else
- return P; // local, allocated during this transaction
+ if (P != NULL && (P->h_tid & (GCFLAG_GLOBAL | GCFLAG_LOCAL_COPY)))
+ {
+ if (P->h_tid & GCFLAG_GLOBAL)
+ P = LatestGlobalRevision(d, P, NULL, 0);
+ else
+ P = (gcptr)P->h_revision; // return the original global obj
+ }
+ return P;
}
_Bool PtrEq(gcptr P1, gcptr P2)
diff --git a/pypy/translator/stm/src_stm/et.h b/pypy/translator/stm/src_stm/et.h
--- a/pypy/translator/stm/src_stm/et.h
+++ b/pypy/translator/stm/src_stm/et.h
@@ -23,6 +23,7 @@
GCFLAG_GLOBAL = _first_gcflag << 0,
GCFLAG_POSSIBLY_OUTDATED = _first_gcflag << 1,
GCFLAG_NOT_WRITTEN = _first_gcflag << 2,
+ GCFLAG_LOCAL_COPY = _first_gcflag << 3,
GCFLAG_PREBUILT = GCFLAG_GLOBAL|GCFLAG_NOT_WRITTEN,
REV_INITIAL = 1
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit