aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/copy.c37
-rw-r--r--erts/emulator/beam/global.h25
2 files changed, 35 insertions, 27 deletions
diff --git a/erts/emulator/beam/copy.c b/erts/emulator/beam/copy.c
index 5bca3877b5..83ca527334 100644
--- a/erts/emulator/beam/copy.c
+++ b/erts/emulator/beam/copy.c
@@ -258,18 +258,19 @@ do { \
} \
} while(0)
-#define BITSTORE_GET(s) ({ \
- UWord result; \
- if (WSTK_CONCAT(s,_bitoffs) <= 0) { \
- WSTK_CONCAT(s,_buffer) = s.wstart[WSTK_CONCAT(s,_offset)]; \
- WSTK_CONCAT(s,_offset)++; \
- WSTK_CONCAT(s,_bitoffs) = 8*sizeof(UWord); \
- } \
- WSTK_CONCAT(s,_bitoffs) -= 2; \
- result = WSTK_CONCAT(s,_buffer) & 3; \
- WSTK_CONCAT(s,_buffer) >>= 2; \
- result; \
-})
+#define BITSTORE_FETCH(s,dst) \
+do { \
+ UWord result; \
+ if (WSTK_CONCAT(s,_bitoffs) <= 0) { \
+ WSTK_CONCAT(s,_buffer) = s.wstart[WSTK_CONCAT(s,_offset)]; \
+ WSTK_CONCAT(s,_offset)++; \
+ WSTK_CONCAT(s,_bitoffs) = 8*sizeof(UWord); \
+ } \
+ WSTK_CONCAT(s,_bitoffs) -= 2; \
+ result = WSTK_CONCAT(s,_buffer) & 3; \
+ WSTK_CONCAT(s,_buffer) >>= 2; \
+ (dst) = result; \
+} while(0)
#define BOXED_VISITED_MASK ((Eterm) 3)
#define BOXED_VISITED ((Eterm) 1)
@@ -476,7 +477,8 @@ cleanup:
/* if not already clean, clean it up */
if (primary_tag(tail) == TAG_PRIMARY_HEADER) {
if (primary_tag(head) == TAG_PRIMARY_HEADER) {
- Eterm saved = BITSTORE_GET(b);
+ Eterm saved;
+ BITSTORE_FETCH(b, saved);
CAR(ptr) = head = (head - TAG_PRIMARY_HEADER) | saved;
CDR(ptr) = tail = (tail - TAG_PRIMARY_HEADER) | TAG_PRIMARY_BOXED;
} else {
@@ -1396,10 +1398,11 @@ Uint copy_shared_perform(Eterm obj, Uint size, erts_shcopy_t *info,
/* if not already clean, clean it up and copy it */
if (primary_tag(tail) == TAG_PRIMARY_HEADER) {
if (primary_tag(head) == TAG_PRIMARY_HEADER) {
- Eterm saved = BITSTORE_GET(b);
- VERBOSE(DEBUG_SHCOPY, ("[pid=%T] unmangling L/B %p\n", mypid, ptr));
- CAR(ptr) = head = (head - TAG_PRIMARY_HEADER) + saved;
- CDR(ptr) = tail = (tail - TAG_PRIMARY_HEADER) + TAG_PRIMARY_BOXED;
+ Eterm saved;
+ BITSTORE_FETCH(b, saved);
+ VERBOSE(DEBUG_SHCOPY, ("[pid=%T] unmangling L/B %p\n", mypid, ptr));
+ CAR(ptr) = head = (head - TAG_PRIMARY_HEADER) + saved;
+ CDR(ptr) = tail = (tail - TAG_PRIMARY_HEADER) + TAG_PRIMARY_BOXED;
} else {
VERBOSE(DEBUG_SHCOPY, ("[pid=%T] unmangling L/L %p\n", mypid, ptr));
CDR(ptr) = tail = (tail - TAG_PRIMARY_HEADER) + TAG_PRIMARY_LIST;
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index 71d072fa7e..e9f7901a51 100644
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -873,7 +873,7 @@ typedef struct {
int possibly_empty;
Eterm* end;
ErtsAlcType_t alloc_type;
-}ErtsEQueue;
+} ErtsEQueue;
#define DEF_EQUEUE_SIZE (16)
@@ -918,15 +918,20 @@ do { \
#define EQUEUE_ISEMPTY(q) (q.back == q.front && q.possibly_empty)
-#define EQUEUE_GET(q) ({ \
- UWord x; \
- q.possibly_empty = 1; \
- x = *(q.front); \
- if (++(q.front) == q.end) { \
- q.front = q.start; \
- } \
- x; \
-})
+ERTS_GLB_INLINE Eterm erts_equeue_get(ErtsEQueue *q);
+
+#if ERTS_GLB_INLINE_INCL_FUNC_DEF
+ERTS_GLB_INLINE Eterm erts_equeue_get(ErtsEQueue *q) {
+ Eterm x;
+ q->possibly_empty = 1;
+ x = *(q->front);
+ if (++(q->front) == q->end) {
+ q->front = q->start;
+ }
+ return x;
+}
+#endif
+#define EQUEUE_GET(q) erts_equeue_get(&(q));
/* binary.c */