aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/erl_process_dict.c20
-rw-r--r--erts/emulator/beam/erl_process_dict.h3
2 files changed, 10 insertions, 13 deletions
diff --git a/erts/emulator/beam/erl_process_dict.c b/erts/emulator/beam/erl_process_dict.c
index 0934183b6a..34c1f0c993 100644
--- a/erts/emulator/beam/erl_process_dict.c
+++ b/erts/emulator/beam/erl_process_dict.c
@@ -164,9 +164,9 @@ erts_dictionary_dump(int to, void *to_arg, ProcDict *pd)
/*PD_CHECK(pd);*/
if (pd == NULL)
return;
- erts_print(to, to_arg, "(size = %d, used = %d, homeSize = %d, "
+ erts_print(to, to_arg, "(size = %d, homeSize = %d, "
"splitPosition = %d, numElements = %d)\n",
- pd->size, pd->used, pd->homeSize,
+ pd->size, pd->homeSize,
pd->splitPosition, (unsigned int) pd->numElements);
for (i = 0; i < HASH_RANGE(pd); ++i) {
erts_print(to, to_arg, "%d: %T\n", i, ARRAY_GET(pd, i));
@@ -908,8 +908,8 @@ static void array_shrink(ProcDict **ppd, unsigned int need)
{
unsigned int siz = next_array_size(need);
- HDEBUGF(("array_shrink: size = %d, used = %d, need = %d",
- (*ppd)->size, (*ppd)->used, need));
+ HDEBUGF(("array_shrink: size = %d, need = %d",
+ (*ppd)->size, need));
if (siz >= (*ppd)->size)
return; /* Only shrink */
@@ -919,8 +919,6 @@ static void array_shrink(ProcDict **ppd, unsigned int need)
PD_SZ2BYTES(siz));
(*ppd)->size = siz;
- if ((*ppd)->size < (*ppd)->used)
- (*ppd)->used = (*ppd)->size;
}
@@ -936,7 +934,7 @@ static void ensure_array_size(ProcDict **ppdict, unsigned int size)
for (i = 0; i < siz; ++i)
pd->data[i] = NIL;
pd->size = siz;
- pd->homeSize = pd->splitPosition = pd->numElements = pd->used = 0;
+ pd->homeSize = pd->splitPosition = pd->numElements = 0;
*ppdict = pd;
} else if (size > pd->size) {
Uint osize = pd->size;
@@ -949,8 +947,6 @@ static void ensure_array_size(ProcDict **ppdict, unsigned int size)
pd->size = nsize;
*ppdict = pd;
}
- if (size > pd->used)
- pd->used = size;
}
/*
@@ -1029,12 +1025,14 @@ static unsigned int next_array_size(unsigned int need)
static void pd_check(ProcDict *pd)
{
unsigned int i;
+ unsigned int used;
Uint num;
if (pd == NULL)
return;
- ASSERT(pd->size >= pd->used);
+ used = HASH_RANGE(pd);
+ ASSERT(pd->size >= used);
ASSERT(HASH_RANGE(pd) <= MAX_HASH);
- for (i = 0, num = 0; i < pd->used; ++i) {
+ for (i = 0, num = 0; i < used; ++i) {
Eterm t = pd->data[i];
if (is_nil(t)) {
continue;
diff --git a/erts/emulator/beam/erl_process_dict.h b/erts/emulator/beam/erl_process_dict.h
index 3ad070d914..eb26a1ffcc 100644
--- a/erts/emulator/beam/erl_process_dict.h
+++ b/erts/emulator/beam/erl_process_dict.h
@@ -24,7 +24,6 @@
typedef struct proc_dict {
unsigned int size;
- unsigned int used;
unsigned int homeSize;
unsigned int splitPosition;
Uint numElements;
@@ -32,7 +31,7 @@ typedef struct proc_dict {
} ProcDict;
#define ERTS_PD_START(PD) ((PD)->data)
-#define ERTS_PD_SIZE(PD) ((PD)->used)
+#define ERTS_PD_SIZE(PD) ((PD)->homeSize + (PD)->splitPosition)
int erts_pd_set_initial_size(int size);
Uint erts_dicts_mem_size(struct process *p);