mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Remove mps_arena_expose, deprecated since release 1.111.0
Also remove mps_arena_unsafe_expose_remember_protection and mps_arena_unsafe_expose_restore_protection.
This commit is contained in:
parent
302c8d0b19
commit
93438da02d
18 changed files with 7 additions and 1076 deletions
|
|
@ -267,8 +267,6 @@ TEST_TARGETS=\
|
|||
btcv \
|
||||
bttest \
|
||||
djbench \
|
||||
exposet0 \
|
||||
expt825 \
|
||||
finalcv \
|
||||
finaltest \
|
||||
forktest \
|
||||
|
|
@ -489,12 +487,6 @@ $(PFM)/$(VARIETY)/bttest: $(PFM)/$(VARIETY)/bttest.o \
|
|||
$(PFM)/$(VARIETY)/djbench: $(PFM)/$(VARIETY)/djbench.o \
|
||||
$(TESTLIBOBJ) $(TESTTHROBJ)
|
||||
|
||||
$(PFM)/$(VARIETY)/exposet0: $(PFM)/$(VARIETY)/exposet0.o \
|
||||
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
||||
|
||||
$(PFM)/$(VARIETY)/expt825: $(PFM)/$(VARIETY)/expt825.o \
|
||||
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
||||
|
||||
$(PFM)/$(VARIETY)/finalcv: $(PFM)/$(VARIETY)/finalcv.o \
|
||||
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
||||
|
||||
|
|
|
|||
|
|
@ -225,12 +225,6 @@ $(PFM)\$(VARIETY)\cvmicv.exe: $(PFM)\$(VARIETY)\cvmicv.obj \
|
|||
$(PFM)\$(VARIETY)\djbench.exe: $(PFM)\$(VARIETY)\djbench.obj \
|
||||
$(TESTLIBOBJ) $(TESTTHROBJ)
|
||||
|
||||
$(PFM)\$(VARIETY)\exposet0.exe: $(PFM)\$(VARIETY)\exposet0.obj \
|
||||
$(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ)
|
||||
|
||||
$(PFM)\$(VARIETY)\expt825.exe: $(PFM)\$(VARIETY)\expt825.obj \
|
||||
$(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ)
|
||||
|
||||
$(PFM)\$(VARIETY)\finalcv.exe: $(PFM)\$(VARIETY)\finalcv.obj \
|
||||
$(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ)
|
||||
|
||||
|
|
|
|||
|
|
@ -73,8 +73,6 @@ TEST_TARGETS=\
|
|||
btcv.exe \
|
||||
bttest.exe \
|
||||
djbench.exe \
|
||||
exposet0.exe \
|
||||
expt825.exe \
|
||||
finalcv.exe \
|
||||
finaltest.exe \
|
||||
fotest.exe \
|
||||
|
|
|
|||
|
|
@ -627,10 +627,6 @@
|
|||
/* I count 4 function calls to scan, 10 to copy. */
|
||||
#define TraceCopyScanRATIO (1.5)
|
||||
|
||||
/* Chosen so that the RememberedSummaryBlockStruct packs nicely into
|
||||
pages */
|
||||
#define RememberedSummaryBLOCK 15
|
||||
|
||||
|
||||
/* Events
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,280 +0,0 @@
|
|||
/* exposet0.c: ARENA EXPOSE TEST
|
||||
*
|
||||
* $Id$
|
||||
* Copyright (c) 2001-2020 Ravenbrook Limited. See end of file for license.
|
||||
* Portions copyright (C) 2002 Global Graphics Software.
|
||||
*
|
||||
* The primary purpose of this test is to test that mps_arena_expose does
|
||||
* not protect any pages. This is only tested to any real extent on
|
||||
* Windows where an exception handler in test_stepper is used to catch any
|
||||
* would-be exceptions (there aren't any if the MPS is operating
|
||||
* correctly).
|
||||
*
|
||||
*/
|
||||
|
||||
#include "fmtdy.h"
|
||||
#include "fmtdytst.h"
|
||||
#include "testlib.h"
|
||||
#include "mpslib.h"
|
||||
#include "mpscamc.h"
|
||||
#include "mpsavm.h"
|
||||
#include "mpstd.h"
|
||||
#include "mps.h"
|
||||
|
||||
#include <stdio.h> /* fflush, printf, puts, stdout */
|
||||
|
||||
|
||||
/* These values have been tuned in the hope of getting one dynamic collection. */
|
||||
#define testArenaSIZE ((size_t)1000*1024)
|
||||
#define gen1SIZE ((size_t)150)
|
||||
#define gen2SIZE ((size_t)170)
|
||||
#define avLEN 3
|
||||
#define exactRootsCOUNT 180
|
||||
#define ambigRootsCOUNT 50
|
||||
#define genCOUNT 2
|
||||
#define collectionsCOUNT 37
|
||||
#define rampSIZE 9
|
||||
#define initTestFREQ 6000
|
||||
|
||||
/* testChain -- generation parameters for the test */
|
||||
|
||||
static mps_gen_param_s testChain[genCOUNT] = {
|
||||
{ gen1SIZE, 0.85 }, { gen2SIZE, 0.45 } };
|
||||
|
||||
|
||||
/* objNULL needs to be odd so that it's ignored in exactRoots. */
|
||||
#define objNULL ((mps_addr_t)MPS_WORD_CONST(0xDECEA5ED))
|
||||
|
||||
|
||||
static mps_pool_t pool_g;
|
||||
static mps_ap_t ap;
|
||||
static mps_addr_t exactRoots[exactRootsCOUNT];
|
||||
static mps_addr_t ambigRoots[ambigRootsCOUNT];
|
||||
|
||||
|
||||
/* report - report statistics from any terminated GCs */
|
||||
|
||||
static void report(mps_arena_t arena)
|
||||
{
|
||||
mps_message_t message;
|
||||
static int nCollections = 0;
|
||||
|
||||
while (mps_message_get(&message, arena, mps_message_type_gc())) {
|
||||
size_t live, condemned, not_condemned;
|
||||
|
||||
live = mps_message_gc_live_size(arena, message);
|
||||
condemned = mps_message_gc_condemned_size(arena, message);
|
||||
not_condemned = mps_message_gc_not_condemned_size(arena, message);
|
||||
|
||||
printf("\nCollection %d finished:\n", ++nCollections);
|
||||
printf("live %"PRIuLONGEST"\n", (ulongest_t)live);
|
||||
printf("condemned %"PRIuLONGEST"\n", (ulongest_t)condemned);
|
||||
printf("not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned);
|
||||
|
||||
mps_message_discard(arena, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* make -- create one new object */
|
||||
|
||||
static mps_addr_t make(void)
|
||||
{
|
||||
size_t length = rnd() % (2*avLEN);
|
||||
size_t size = (length+2) * sizeof(mps_word_t);
|
||||
mps_addr_t p;
|
||||
mps_res_t res;
|
||||
|
||||
do {
|
||||
MPS_RESERVE_BLOCK(res, p, ap, size);
|
||||
if (res)
|
||||
die(res, "MPS_RESERVE_BLOCK");
|
||||
res = dylan_init(p, size, exactRoots, exactRootsCOUNT);
|
||||
if (res)
|
||||
die(res, "dylan_init");
|
||||
} while(!mps_commit(ap, p, size));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/* test_stepper -- stepping function for walk */
|
||||
|
||||
static void test_stepper(mps_addr_t object, mps_fmt_t fmt, mps_pool_t pool,
|
||||
void *p, size_t s)
|
||||
{
|
||||
testlib_unused(fmt);
|
||||
testlib_unused(pool);
|
||||
testlib_unused(s);
|
||||
dylan_mutate(object);
|
||||
|
||||
(*(unsigned long *)p)++;
|
||||
}
|
||||
|
||||
|
||||
/* test -- the body of the test */
|
||||
|
||||
static void test(mps_arena_t arena)
|
||||
{
|
||||
mps_addr_t busy_init;
|
||||
mps_ap_t busy_ap;
|
||||
mps_chain_t chain;
|
||||
mps_fmt_t format;
|
||||
mps_root_t exactRoot, ambigRoot;
|
||||
mps_word_t collections;
|
||||
size_t i;
|
||||
unsigned long objs;
|
||||
|
||||
die(dylan_fmt(&format, arena), "fmt_create");
|
||||
die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");
|
||||
|
||||
die(mps_pool_create(&pool_g, arena, mps_class_amc(), format, chain),
|
||||
"pool_create(amc)");
|
||||
|
||||
die(mps_ap_create(&ap, pool_g, mps_rank_exact()), "BufferCreate");
|
||||
die(mps_ap_create(&busy_ap, pool_g, mps_rank_exact()), "BufferCreate 2");
|
||||
|
||||
for(i = 0; i < exactRootsCOUNT; ++i) {
|
||||
exactRoots[i] = objNULL;
|
||||
}
|
||||
for(i = 0; i < ambigRootsCOUNT; ++i) {
|
||||
ambigRoots[i] = rnd_addr();
|
||||
}
|
||||
|
||||
die(mps_root_create_table_masked(&exactRoot, arena,
|
||||
mps_rank_exact(), (mps_rm_t)0,
|
||||
&exactRoots[0], exactRootsCOUNT,
|
||||
(mps_word_t)1),
|
||||
"root_create_table(exact)");
|
||||
die(mps_root_create_table(&ambigRoot, arena,
|
||||
mps_rank_ambig(), (mps_rm_t)0,
|
||||
&ambigRoots[0], ambigRootsCOUNT),
|
||||
"root_create_table(ambig)");
|
||||
|
||||
/* create an ap, and leave it busy */
|
||||
die(mps_reserve(&busy_init, busy_ap, 64), "mps_reserve busy");
|
||||
|
||||
collections = 0;
|
||||
objs = 0;
|
||||
while (collections < collectionsCOUNT) {
|
||||
mps_word_t c;
|
||||
size_t r;
|
||||
|
||||
c = mps_collections(arena);
|
||||
|
||||
if (collections != c) {
|
||||
collections = c;
|
||||
printf("\nCollection %"PRIuLONGEST" started, %lu objects.\n",
|
||||
(ulongest_t)c, objs);
|
||||
|
||||
report(arena);
|
||||
for (i = 0; i < exactRootsCOUNT; ++i) {
|
||||
cdie(exactRoots[i] == objNULL
|
||||
|| (dylan_check(exactRoots[i])
|
||||
&& mps_arena_has_addr(arena, exactRoots[i])),
|
||||
"all roots check");
|
||||
}
|
||||
cdie(!mps_arena_has_addr(arena, NULL),
|
||||
"NULL in arena");
|
||||
|
||||
{
|
||||
unsigned long object_count = 0;
|
||||
mps_arena_expose(arena);
|
||||
mps_arena_formatted_objects_walk(arena, test_stepper, &object_count, 0);
|
||||
mps_arena_release(arena);
|
||||
printf("stepped on %lu objects.\n", object_count);
|
||||
}
|
||||
}
|
||||
|
||||
r = (size_t)rnd();
|
||||
if (r & 1) {
|
||||
i = (r >> 1) % exactRootsCOUNT;
|
||||
if (exactRoots[i] != objNULL) {
|
||||
cdie(dylan_check(exactRoots[i]), "dying root check");
|
||||
}
|
||||
exactRoots[i] = make();
|
||||
if (exactRoots[(exactRootsCOUNT-1) - i] != objNULL) {
|
||||
dylan_write(exactRoots[(exactRootsCOUNT-1) - i],
|
||||
exactRoots, exactRootsCOUNT);
|
||||
}
|
||||
} else {
|
||||
i = (r >> 1) % ambigRootsCOUNT;
|
||||
ambigRoots[(ambigRootsCOUNT-1) - i] = make();
|
||||
/* Create random interior pointers */
|
||||
ambigRoots[i] = (mps_addr_t)((char *)(ambigRoots[i/2]) + 1);
|
||||
}
|
||||
|
||||
if (r % initTestFREQ == 0) {
|
||||
*(int*)busy_init = -1; /* check that the buffer is still there */
|
||||
}
|
||||
|
||||
if (objs % 1024 == 0) {
|
||||
report(arena);
|
||||
putchar('.');
|
||||
(void)fflush(stdout);
|
||||
}
|
||||
|
||||
++objs;
|
||||
}
|
||||
|
||||
(void)mps_commit(busy_ap, busy_init, 64);
|
||||
mps_arena_park(arena);
|
||||
mps_ap_destroy(busy_ap);
|
||||
mps_ap_destroy(ap);
|
||||
mps_root_destroy(exactRoot);
|
||||
mps_root_destroy(ambigRoot);
|
||||
mps_pool_destroy(pool_g);
|
||||
mps_chain_destroy(chain);
|
||||
mps_fmt_destroy(format);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
mps_arena_t arena;
|
||||
mps_thr_t thread;
|
||||
|
||||
testlib_init(argc, argv);
|
||||
|
||||
die(mps_arena_create(&arena, mps_arena_class_vm(), 2*testArenaSIZE),
|
||||
"arena_create");
|
||||
mps_message_type_enable(arena, mps_message_type_gc());
|
||||
die(mps_arena_commit_limit_set(arena, 2*testArenaSIZE), "set limit");
|
||||
die(mps_thread_reg(&thread, arena), "thread_reg");
|
||||
test(arena);
|
||||
mps_thread_dereg(thread);
|
||||
report(arena);
|
||||
mps_arena_destroy(arena);
|
||||
|
||||
printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2020 Ravenbrook Limited <https://www.ravenbrook.com/>.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
|
@ -1,304 +0,0 @@
|
|||
/* expt825.c: Test for bug described in job000825
|
||||
*
|
||||
* $Id$
|
||||
* Copyright (c) 2001-2020 Ravenbrook Limited. See end of file for license.
|
||||
* Portions copyright (C) 2002 Global Graphics Software.
|
||||
*
|
||||
* DESIGN
|
||||
*
|
||||
* Just a copy of finaltest.c with the following modifcations:
|
||||
* maxtreeDEPTH is 2 rather than 12. This makes the test run and fail
|
||||
* much more quickly.
|
||||
*
|
||||
* After trees have been created and finalized, call
|
||||
* mps_arena_unsafe_expose_remember_protection / restore. If the bug
|
||||
* is present then this sequence will fail.
|
||||
*
|
||||
*
|
||||
* DEPENDENCIES
|
||||
*
|
||||
* This test uses the dylan object format, but the reliance on this
|
||||
* particular format is not great and could be removed.
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* This code was created by first copying <code/finalcv.c>
|
||||
* and then further by copying <code/finaltest.c>
|
||||
*/
|
||||
|
||||
#include "testlib.h"
|
||||
#include "mpslib.h"
|
||||
#include "mps.h"
|
||||
#include "mpscamc.h"
|
||||
#include "mpsavm.h"
|
||||
#include "fmtdy.h"
|
||||
#include "fmtdytst.h"
|
||||
#include "mpstd.h"
|
||||
|
||||
#include <stdio.h> /* printf, fflush, stdout */
|
||||
|
||||
|
||||
#define testArenaSIZE ((size_t)16<<20)
|
||||
#define rootCOUNT 20
|
||||
#define maxtreeDEPTH 2
|
||||
#define collectionCOUNT 10
|
||||
#define genCOUNT 2
|
||||
|
||||
/* testChain -- generation parameters for the test */
|
||||
|
||||
static mps_gen_param_s testChain[genCOUNT] = {
|
||||
{ 150, 0.85 }, { 170, 0.45 } };
|
||||
|
||||
|
||||
/* global object counter */
|
||||
|
||||
static mps_word_t object_count = 0;
|
||||
|
||||
static mps_word_t make_numbered_cons(mps_word_t car, mps_word_t cdr,
|
||||
mps_ap_t ap)
|
||||
{
|
||||
mps_word_t cons;
|
||||
die(make_dylan_vector(&cons, ap, 3), "make_dylan_vector");
|
||||
DYLAN_VECTOR_SLOT(cons, 0) = car;
|
||||
DYLAN_VECTOR_SLOT(cons, 1) = cdr;
|
||||
DYLAN_VECTOR_SLOT(cons, 2) = DYLAN_INT(object_count);
|
||||
++ object_count;
|
||||
return cons;
|
||||
}
|
||||
|
||||
static mps_word_t make_numbered_tree(mps_word_t depth,
|
||||
mps_ap_t ap)
|
||||
{
|
||||
mps_word_t left, right;
|
||||
if (depth < 2) {
|
||||
left = DYLAN_INT(object_count);
|
||||
right = DYLAN_INT(object_count);
|
||||
} else {
|
||||
left = make_numbered_tree(depth-1, ap);
|
||||
right = make_numbered_tree(depth-1, ap);
|
||||
}
|
||||
return make_numbered_cons(left, right, ap);
|
||||
}
|
||||
|
||||
static void register_numbered_tree(mps_word_t tree, mps_arena_t arena)
|
||||
{
|
||||
/* don't finalize ints */
|
||||
if ((tree & 1) == 0) {
|
||||
mps_addr_t addr = (void *)tree;
|
||||
die(mps_finalize(arena, &addr), "mps_finalize");
|
||||
register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 0), arena);
|
||||
register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 1), arena);
|
||||
}
|
||||
}
|
||||
|
||||
static mps_word_t make_indirect_cons(mps_word_t car, mps_word_t cdr,
|
||||
mps_ap_t ap)
|
||||
{
|
||||
mps_word_t cons, indirect;
|
||||
die(make_dylan_vector(&indirect, ap, 1), "make_dylan_vector");
|
||||
DYLAN_VECTOR_SLOT(indirect, 0) = DYLAN_INT(object_count);
|
||||
die(make_dylan_vector(&cons, ap, 3), "make_dylan_vector");
|
||||
DYLAN_VECTOR_SLOT(cons, 0) = car;
|
||||
DYLAN_VECTOR_SLOT(cons, 1) = cdr;
|
||||
DYLAN_VECTOR_SLOT(cons, 2) = indirect;
|
||||
++ object_count;
|
||||
return cons;
|
||||
}
|
||||
|
||||
static mps_word_t make_indirect_tree(mps_word_t depth,
|
||||
mps_ap_t ap)
|
||||
{
|
||||
mps_word_t left, right;
|
||||
if (depth < 2) {
|
||||
left = DYLAN_INT(object_count);
|
||||
right = DYLAN_INT(object_count);
|
||||
} else {
|
||||
left = make_indirect_tree(depth-1, ap);
|
||||
right = make_indirect_tree(depth-1, ap);
|
||||
}
|
||||
return make_indirect_cons(left, right, ap);
|
||||
}
|
||||
|
||||
static void register_indirect_tree(mps_word_t tree, mps_arena_t arena)
|
||||
{
|
||||
/* don't finalize ints */
|
||||
if ((tree & 1) == 0) {
|
||||
mps_addr_t indirect = (void *)DYLAN_VECTOR_SLOT(tree,2);
|
||||
die(mps_finalize(arena, &indirect), "mps_finalize");
|
||||
register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 0), arena);
|
||||
register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 1), arena);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void *root[rootCOUNT];
|
||||
|
||||
static void test(mps_arena_t arena)
|
||||
{
|
||||
mps_ap_t ap;
|
||||
mps_fmt_t fmt;
|
||||
mps_chain_t chain;
|
||||
mps_word_t finals;
|
||||
mps_pool_t amc;
|
||||
mps_root_t mps_root;
|
||||
mps_message_t message;
|
||||
size_t i;
|
||||
|
||||
die(mps_fmt_create_A(&fmt, arena, dylan_fmt_A()), "fmt_create\n");
|
||||
die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");
|
||||
die(mps_pool_create(&amc, arena, mps_class_amc(), fmt, chain),
|
||||
"pool_create amc\n");
|
||||
die(mps_root_create_table(&mps_root, arena, mps_rank_exact(), (mps_rm_t)0,
|
||||
root, (size_t)rootCOUNT),
|
||||
"root_create\n");
|
||||
die(mps_ap_create(&ap, amc, mps_rank_exact()), "ap_create\n");
|
||||
|
||||
mps_message_type_enable(arena, mps_message_type_finalization());
|
||||
|
||||
mps_arena_park(arena);
|
||||
|
||||
object_count = 0;
|
||||
|
||||
printf("Making some finalized trees of objects.\n");
|
||||
/* make some trees */
|
||||
for(i = 0; i < rootCOUNT; ++i) {
|
||||
root[i] = (void *)make_numbered_tree(maxtreeDEPTH, ap);
|
||||
register_numbered_tree((mps_word_t)root[i], arena);
|
||||
}
|
||||
|
||||
mps_arena_unsafe_expose_remember_protection(arena);
|
||||
mps_arena_unsafe_restore_protection(arena);
|
||||
|
||||
printf("Losing all pointers to the trees.\n");
|
||||
/* clean out the roots */
|
||||
for(i = 0; i < rootCOUNT; ++i) {
|
||||
root[i] = 0;
|
||||
}
|
||||
|
||||
finals = 0;
|
||||
|
||||
while ((finals < object_count) &&
|
||||
(mps_collections(arena) < collectionCOUNT)) {
|
||||
mps_word_t final_this_time = 0;
|
||||
printf("Collecting...");
|
||||
(void)fflush(stdout);
|
||||
die(mps_arena_collect(arena), "collect");
|
||||
printf(" Done.\n");
|
||||
while (mps_message_poll(arena)) {
|
||||
mps_word_t obj;
|
||||
mps_addr_t objaddr;
|
||||
cdie(mps_message_get(&message, arena,
|
||||
mps_message_type_finalization()),
|
||||
"get");
|
||||
mps_message_finalization_ref(&objaddr, arena, message);
|
||||
obj = (mps_word_t)objaddr;
|
||||
mps_message_discard(arena, message);
|
||||
++ final_this_time;
|
||||
testlib_unused(obj);
|
||||
}
|
||||
finals += final_this_time;
|
||||
printf("%"PRIuLONGEST" objects finalized: total %"PRIuLONGEST
|
||||
" of %"PRIuLONGEST"\n",
|
||||
(ulongest_t)final_this_time, (ulongest_t)finals,
|
||||
(ulongest_t)object_count);
|
||||
}
|
||||
|
||||
object_count = 0;
|
||||
|
||||
printf("Making some indirectly finalized trees of objects.\n");
|
||||
/* make some trees */
|
||||
for(i = 0; i < rootCOUNT; ++i) {
|
||||
root[i] = (void *)make_indirect_tree(maxtreeDEPTH, ap);
|
||||
register_indirect_tree((mps_word_t)root[i], arena);
|
||||
}
|
||||
|
||||
printf("Losing all pointers to the trees.\n");
|
||||
/* clean out the roots */
|
||||
for(i = 0; i < rootCOUNT; ++i) {
|
||||
root[i] = 0;
|
||||
}
|
||||
|
||||
finals = 0;
|
||||
|
||||
while ((finals < object_count) &&
|
||||
(mps_collections(arena) < collectionCOUNT)) {
|
||||
mps_word_t final_this_time = 0;
|
||||
printf("Collecting...");
|
||||
(void)fflush(stdout);
|
||||
die(mps_arena_collect(arena), "collect");
|
||||
printf(" Done.\n");
|
||||
while (mps_message_poll(arena)) {
|
||||
mps_word_t obj;
|
||||
mps_addr_t objaddr;
|
||||
cdie(mps_message_get(&message, arena,
|
||||
mps_message_type_finalization()),
|
||||
"get");
|
||||
mps_message_finalization_ref(&objaddr, arena, message);
|
||||
obj = (mps_word_t)objaddr;
|
||||
mps_message_discard(arena, message);
|
||||
++ final_this_time;
|
||||
testlib_unused(obj);
|
||||
}
|
||||
finals += final_this_time;
|
||||
printf("%"PRIuLONGEST" objects finalized: total %"PRIuLONGEST
|
||||
" of %"PRIuLONGEST"\n",
|
||||
(ulongest_t)final_this_time, (ulongest_t)finals,
|
||||
(ulongest_t)object_count);
|
||||
}
|
||||
|
||||
mps_arena_park(arena);
|
||||
mps_ap_destroy(ap);
|
||||
mps_root_destroy(mps_root);
|
||||
mps_pool_destroy(amc);
|
||||
mps_chain_destroy(chain);
|
||||
mps_fmt_destroy(fmt);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
mps_arena_t arena;
|
||||
mps_thr_t thread;
|
||||
|
||||
testlib_init(argc, argv);
|
||||
|
||||
die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE),
|
||||
"arena_create\n");
|
||||
die(mps_thread_reg(&thread, arena), "thread_reg\n");
|
||||
test(arena);
|
||||
mps_thread_dereg(thread);
|
||||
mps_arena_destroy(arena);
|
||||
|
||||
printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2020 Ravenbrook Limited <https://www.ravenbrook.com/>.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
|
@ -188,11 +188,6 @@ Bool GlobalsCheck(Globals arenaGlobals)
|
|||
CHECKL(BoolCheck(arenaGlobals->bufferLogging));
|
||||
CHECKD_NOSIG(Ring, &arenaGlobals->poolRing);
|
||||
CHECKD_NOSIG(Ring, &arenaGlobals->rootRing);
|
||||
CHECKD_NOSIG(Ring, &arenaGlobals->rememberedSummaryRing);
|
||||
CHECKL(arenaGlobals->rememberedSummaryIndex < RememberedSummaryBLOCK);
|
||||
/* <code/global.c#remembered.summary> RingIsSingle imples index == 0 */
|
||||
CHECKL(!RingIsSingle(&arenaGlobals->rememberedSummaryRing) ||
|
||||
arenaGlobals->rememberedSummaryIndex == 0);
|
||||
CHECKD_NOSIG(Ring, &arena->formatRing);
|
||||
CHECKD_NOSIG(Ring, &arena->messageRing);
|
||||
if (arena->enabledMessageTypes != NULL)
|
||||
|
|
@ -315,8 +310,6 @@ Res GlobalsInit(Globals arenaGlobals)
|
|||
arenaGlobals->systemPools = (Count)3;
|
||||
RingInit(&arenaGlobals->rootRing);
|
||||
arenaGlobals->rootSerial = (Serial)0;
|
||||
RingInit(&arenaGlobals->rememberedSummaryRing);
|
||||
arenaGlobals->rememberedSummaryIndex = 0;
|
||||
|
||||
RingInit(&arena->threadRing);
|
||||
RingInit(&arena->deadRing);
|
||||
|
|
@ -553,14 +546,6 @@ void GlobalsPrepareToDestroy(Globals arenaGlobals)
|
|||
}
|
||||
|
||||
|
||||
Ring GlobalsRememberedSummaryRing(Globals global)
|
||||
{
|
||||
AVERT(Globals, global);
|
||||
|
||||
return &global->rememberedSummaryRing;
|
||||
}
|
||||
|
||||
|
||||
/* ArenaEnter -- enter the state where you can look at the arena */
|
||||
|
||||
void ArenaEnter(Arena arena)
|
||||
|
|
|
|||
|
|
@ -473,7 +473,6 @@ extern void GlobalsFinish(Globals arena);
|
|||
extern Res GlobalsCompleteCreate(Globals arenaGlobals);
|
||||
extern void GlobalsPrepareToDestroy(Globals arenaGlobals);
|
||||
extern Res GlobalsDescribe(Globals arena, mps_lib_FILE *stream, Count depth);
|
||||
extern Ring GlobalsRememberedSummaryRing(Globals);
|
||||
extern void GlobalsArenaMap(void (*func)(Arena arena));
|
||||
extern void GlobalsClaimAll(void);
|
||||
extern void GlobalsReleaseAll(void);
|
||||
|
|
@ -525,8 +524,6 @@ extern void ArenaClamp(Globals globals);
|
|||
extern void ArenaRelease(Globals globals);
|
||||
extern void ArenaPark(Globals globals);
|
||||
extern void ArenaPostmortem(Globals globals);
|
||||
extern void ArenaExposeRemember(Globals globals, Bool remember);
|
||||
extern void ArenaRestoreProtection(Globals globals);
|
||||
extern Res ArenaStartCollect(Globals globals, TraceStartWhy why);
|
||||
extern Res ArenaCollect(Globals globals, TraceStartWhy why);
|
||||
extern Bool ArenaBusy(Arena arena);
|
||||
|
|
|
|||
|
|
@ -534,12 +534,6 @@ typedef struct GlobalsStruct {
|
|||
RingStruct rootRing; /* ring of roots attached to arena */
|
||||
Serial rootSerial; /* serial of next root */
|
||||
|
||||
/* remember summary <code/trace.c> */
|
||||
RingStruct rememberedSummaryRing;
|
||||
/* index into next free slot in block. 0 means that a new
|
||||
block should be allocated and appended. */
|
||||
Index rememberedSummaryIndex;
|
||||
|
||||
/* locus <code/locus.c> */
|
||||
Chain defaultChain; /* default chain for GC pool */
|
||||
} GlobalsStruct;
|
||||
|
|
|
|||
|
|
@ -436,9 +436,6 @@ extern void mps_arena_clamp(mps_arena_t);
|
|||
extern void mps_arena_release(mps_arena_t);
|
||||
extern void mps_arena_park(mps_arena_t);
|
||||
extern void mps_arena_postmortem(mps_arena_t);
|
||||
extern void mps_arena_expose(mps_arena_t);
|
||||
extern void mps_arena_unsafe_expose_remember_protection(mps_arena_t);
|
||||
extern void mps_arena_unsafe_restore_protection(mps_arena_t);
|
||||
extern mps_res_t mps_arena_start_collect(mps_arena_t);
|
||||
extern mps_res_t mps_arena_collect(mps_arena_t);
|
||||
extern mps_bool_t mps_arena_step(mps_arena_t, double, double);
|
||||
|
|
|
|||
|
|
@ -163,13 +163,11 @@
|
|||
2291A5C7175CAFCA001D4920 /* fmtno.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CACC156BE4C200753214 /* fmtno.c */; };
|
||||
2291A5C8175CAFCA001D4920 /* testlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 31EEAC9E156AB73400714D05 /* testlib.c */; };
|
||||
2291A5CB175CAFCA001D4920 /* libmps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31EEABFB156AAF9D00714D05 /* libmps.a */; };
|
||||
2291A5D2175CAFF8001D4920 /* expt825.c in Sources */ = {isa = PBXBuildFile; fileRef = 2291A5AB175CAA9B001D4920 /* expt825.c */; };
|
||||
2291A5D8175CB05F001D4920 /* fmtdy.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAC6156BE48D00753214 /* fmtdy.c */; };
|
||||
2291A5D9175CB05F001D4920 /* fmtdytst.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAC7156BE48D00753214 /* fmtdytst.c */; };
|
||||
2291A5DA175CB05F001D4920 /* fmtno.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CACC156BE4C200753214 /* fmtno.c */; };
|
||||
2291A5DB175CB05F001D4920 /* testlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 31EEAC9E156AB73400714D05 /* testlib.c */; };
|
||||
2291A5DD175CB05F001D4920 /* libmps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31EEABFB156AAF9D00714D05 /* libmps.a */; };
|
||||
2291A5E4175CB076001D4920 /* exposet0.c in Sources */ = {isa = PBXBuildFile; fileRef = 2291A5AA175CAA9B001D4920 /* exposet0.c */; };
|
||||
2291A5ED175CB5E2001D4920 /* landtest.c in Sources */ = {isa = PBXBuildFile; fileRef = 2291A5E9175CB4EC001D4920 /* landtest.c */; };
|
||||
22B2BC2E18B6434F00C33E63 /* mps.c in Sources */ = {isa = PBXBuildFile; fileRef = 31A47BA3156C1E130039B1C2 /* mps.c */; };
|
||||
22B2BC3718B6437C00C33E63 /* scheme-advanced.c in Sources */ = {isa = PBXBuildFile; fileRef = 22B2BC2B18B6434000C33E63 /* scheme-advanced.c */; };
|
||||
|
|
@ -484,20 +482,6 @@
|
|||
remoteGlobalIDString = 31EEABFA156AAF9D00714D05;
|
||||
remoteInfo = mps;
|
||||
};
|
||||
2291A5E5175CB207001D4920 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 2291A5D3175CB05F001D4920;
|
||||
remoteInfo = exposet0;
|
||||
};
|
||||
2291A5E7175CB20E001D4920 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 2291A5C1175CAFCA001D4920;
|
||||
remoteInfo = expt825;
|
||||
};
|
||||
229E228719EAB10D00E21417 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
|
||||
|
|
@ -1527,11 +1511,7 @@
|
|||
2265D71F20E5400F003019E8 /* eventpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = eventpy.c; sourceTree = SOURCE_ROOT; };
|
||||
2291A5A8175CAA51001D4920 /* poolmv2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = poolmv2.h; sourceTree = "<group>"; };
|
||||
2291A5A9175CAA9B001D4920 /* awlutth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = awlutth.c; sourceTree = "<group>"; };
|
||||
2291A5AA175CAA9B001D4920 /* exposet0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = exposet0.c; sourceTree = "<group>"; };
|
||||
2291A5AB175CAA9B001D4920 /* expt825.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = expt825.c; sourceTree = "<group>"; };
|
||||
2291A5BD175CAB2F001D4920 /* awlutth */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = awlutth; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2291A5D1175CAFCA001D4920 /* expt825 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = expt825; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2291A5E3175CB05F001D4920 /* exposet0 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = exposet0; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2291A5E9175CB4EC001D4920 /* landtest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = landtest.c; sourceTree = "<group>"; };
|
||||
2291A5EA175CB503001D4920 /* abq.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = abq.h; sourceTree = "<group>"; };
|
||||
2291A5EB175CB53E001D4920 /* range.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = range.c; sourceTree = "<group>"; };
|
||||
|
|
@ -2374,8 +2354,6 @@
|
|||
2291A5A9175CAA9B001D4920 /* awlutth.c */,
|
||||
3114A66C156E95EB001E0AA3 /* btcv.c */,
|
||||
3114A613156E944A001E0AA3 /* bttest.c */,
|
||||
2291A5AA175CAA9B001D4920 /* exposet0.c */,
|
||||
2291A5AB175CAA9B001D4920 /* expt825.c */,
|
||||
3114A5CD156E9369001E0AA3 /* finalcv.c */,
|
||||
3114A5E5156E93B9001E0AA3 /* finaltest.c */,
|
||||
3124CAC6156BE48D00753214 /* fmtdy.c */,
|
||||
|
|
@ -2493,8 +2471,6 @@
|
|||
2D604B9C16514B1A003AAF46 /* mpseventtxt */,
|
||||
22FA177516E8D6FC0098B23F /* amcssth */,
|
||||
2291A5BD175CAB2F001D4920 /* awlutth */,
|
||||
2291A5D1175CAFCA001D4920 /* expt825 */,
|
||||
2291A5E3175CB05F001D4920 /* exposet0 */,
|
||||
224CC799175E1821002FF81B /* fotest */,
|
||||
31FCAE0A17692403008C034C /* scheme */,
|
||||
318DA8CD1892B0F30089718C /* djbench */,
|
||||
|
|
@ -2799,42 +2775,6 @@
|
|||
productReference = 2291A5BD175CAB2F001D4920 /* awlutth */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
2291A5C1175CAFCA001D4920 /* expt825 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 2291A5CD175CAFCA001D4920 /* Build configuration list for PBXNativeTarget "expt825" */;
|
||||
buildPhases = (
|
||||
2291A5C4175CAFCA001D4920 /* Sources */,
|
||||
2291A5CA175CAFCA001D4920 /* Frameworks */,
|
||||
2291A5CC175CAFCA001D4920 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
2291A5C2175CAFCA001D4920 /* PBXTargetDependency */,
|
||||
);
|
||||
name = expt825;
|
||||
productName = finaltest;
|
||||
productReference = 2291A5D1175CAFCA001D4920 /* expt825 */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
2291A5D3175CB05F001D4920 /* exposet0 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 2291A5DF175CB05F001D4920 /* Build configuration list for PBXNativeTarget "exposet0" */;
|
||||
buildPhases = (
|
||||
2291A5D6175CB05F001D4920 /* Sources */,
|
||||
2291A5DC175CB05F001D4920 /* Frameworks */,
|
||||
2291A5DE175CB05F001D4920 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
2291A5D4175CB05F001D4920 /* PBXTargetDependency */,
|
||||
);
|
||||
name = exposet0;
|
||||
productName = finaltest;
|
||||
productReference = 2291A5E3175CB05F001D4920 /* exposet0 */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
22B2BC2C18B6434F00C33E63 /* scheme-advanced */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 22B2BC3218B6434F00C33E63 /* Build configuration list for PBXNativeTarget "scheme-advanced" */;
|
||||
|
|
@ -3644,8 +3584,6 @@
|
|||
3114A661156E95D9001E0AA3 /* btcv */,
|
||||
3114A604156E9430001E0AA3 /* bttest */,
|
||||
318DA8C31892B0F30089718C /* djbench */,
|
||||
2291A5D3175CB05F001D4920 /* exposet0 */,
|
||||
2291A5C1175CAFCA001D4920 /* expt825 */,
|
||||
3114A5BC156E9315001E0AA3 /* finalcv */,
|
||||
3114A5D5156E93A0001E0AA3 /* finaltest */,
|
||||
22EA3F3820D2B0D90065F5B6 /* forktest */,
|
||||
|
|
@ -3815,30 +3753,6 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
2291A5C4175CAFCA001D4920 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2291A5D2175CAFF8001D4920 /* expt825.c in Sources */,
|
||||
2291A5C5175CAFCA001D4920 /* fmtdy.c in Sources */,
|
||||
2291A5C6175CAFCA001D4920 /* fmtdytst.c in Sources */,
|
||||
2291A5C7175CAFCA001D4920 /* fmtno.c in Sources */,
|
||||
2291A5C8175CAFCA001D4920 /* testlib.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
2291A5D6175CB05F001D4920 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2291A5E4175CB076001D4920 /* exposet0.c in Sources */,
|
||||
2291A5D8175CB05F001D4920 /* fmtdy.c in Sources */,
|
||||
2291A5D9175CB05F001D4920 /* fmtdytst.c in Sources */,
|
||||
2291A5DA175CB05F001D4920 /* fmtno.c in Sources */,
|
||||
2291A5DB175CB05F001D4920 /* testlib.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
22B2BC2D18B6434F00C33E63 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
|
@ -4383,16 +4297,6 @@
|
|||
target = 31EEABFA156AAF9D00714D05 /* mps */;
|
||||
targetProxy = 2291A5D5175CB05F001D4920 /* PBXContainerItemProxy */;
|
||||
};
|
||||
2291A5E6175CB207001D4920 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 2291A5D3175CB05F001D4920 /* exposet0 */;
|
||||
targetProxy = 2291A5E5175CB207001D4920 /* PBXContainerItemProxy */;
|
||||
};
|
||||
2291A5E8175CB20E001D4920 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 2291A5C1175CAFCA001D4920 /* expt825 */;
|
||||
targetProxy = 2291A5E7175CB20E001D4920 /* PBXContainerItemProxy */;
|
||||
};
|
||||
229E228819EAB10D00E21417 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 223E795819EAB00B00DC26A6 /* sncss */;
|
||||
|
|
@ -6299,26 +6203,6 @@
|
|||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
2291A5CD175CAFCA001D4920 /* Build configuration list for PBXNativeTarget "expt825" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
2291A5CE175CAFCA001D4920 /* Debug */,
|
||||
2291A5CF175CAFCA001D4920 /* Release */,
|
||||
318DA8E61892C0D00089718C /* RASH */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
2291A5DF175CB05F001D4920 /* Build configuration list for PBXNativeTarget "exposet0" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
2291A5E0175CB05F001D4920 /* Debug */,
|
||||
2291A5E1175CB05F001D4920 /* Release */,
|
||||
318DA8E51892C0D00089718C /* RASH */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
22B2BC3218B6434F00C33E63 /* Build configuration list for PBXNativeTarget "scheme-advanced" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
|
|
|||
|
|
@ -292,29 +292,6 @@ void mps_arena_postmortem(mps_arena_t arena)
|
|||
}
|
||||
|
||||
|
||||
void mps_arena_expose(mps_arena_t arena)
|
||||
{
|
||||
ArenaEnter(arena);
|
||||
ArenaExposeRemember(ArenaGlobals(arena), FALSE);
|
||||
ArenaLeave(arena);
|
||||
}
|
||||
|
||||
/* Null implementations of remember and restore */
|
||||
void mps_arena_unsafe_expose_remember_protection(mps_arena_t arena)
|
||||
{
|
||||
ArenaEnter(arena);
|
||||
ArenaExposeRemember(ArenaGlobals(arena), TRUE);
|
||||
ArenaLeave(arena);
|
||||
}
|
||||
|
||||
void mps_arena_unsafe_restore_protection(mps_arena_t arena)
|
||||
{
|
||||
ArenaEnter(arena);
|
||||
ArenaRestoreProtection(ArenaGlobals(arena));
|
||||
ArenaLeave(arena);
|
||||
}
|
||||
|
||||
|
||||
mps_res_t mps_arena_start_collect(mps_arena_t arena)
|
||||
{
|
||||
Res res;
|
||||
|
|
|
|||
|
|
@ -490,19 +490,6 @@ static void test(mps_arena_t arena)
|
|||
mps_arena_clamp(arena);
|
||||
clamp_until = i + 10000;
|
||||
}
|
||||
if(collections % 6 == 0) {
|
||||
mps_arena_expose(arena);
|
||||
mps_arena_release(arena);
|
||||
}
|
||||
if(collections % 6 == 3) {
|
||||
mps_arena_unsafe_expose_remember_protection(arena);
|
||||
mps_arena_unsafe_restore_protection(arena);
|
||||
mps_arena_release(arena);
|
||||
}
|
||||
if(collections % 6 == 4) {
|
||||
mps_arena_unsafe_expose_remember_protection(arena);
|
||||
mps_arena_release(arena);
|
||||
}
|
||||
if(collections % 3 == 2) {
|
||||
mps_arena_park(arena);
|
||||
mps_arena_release(arena);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
* - TraceIdMessages. Pre-allocated messages for traceid.
|
||||
*
|
||||
* - ArenaRelease, ArenaClamp, ArenaPark.
|
||||
*
|
||||
* - ArenaExposeRemember and ArenaRestoreProtection.
|
||||
*/
|
||||
|
||||
#include "mpm.h"
|
||||
|
|
@ -514,10 +512,6 @@ void TraceIdMessagesDestroy(Arena arena, TraceId ti)
|
|||
*/
|
||||
|
||||
|
||||
/* Forward Declarations */
|
||||
static void arenaForgetProtection(Globals globals);
|
||||
|
||||
|
||||
/* ArenaClamp -- clamp the arena (no optional collection increments) */
|
||||
|
||||
void ArenaClamp(Globals globals)
|
||||
|
|
@ -533,7 +527,6 @@ void ArenaClamp(Globals globals)
|
|||
void ArenaRelease(Globals globals)
|
||||
{
|
||||
AVERT(Globals, globals);
|
||||
arenaForgetProtection(globals);
|
||||
globals->clamped = FALSE;
|
||||
ArenaPoll(globals);
|
||||
}
|
||||
|
|
@ -581,9 +574,7 @@ void ArenaPark(Globals globals)
|
|||
* corrupted.
|
||||
*
|
||||
* After calling this function memory may not be in a consistent
|
||||
* state, so it is not safe to continue running the MPS. If you need
|
||||
* to expose memory but continue running the MPS, use
|
||||
* ArenaExposeRemember instead.
|
||||
* state, so it is not safe to continue running the MPS.
|
||||
*/
|
||||
|
||||
static void arenaExpose(Arena arena)
|
||||
|
|
@ -667,167 +658,6 @@ Res ArenaCollect(Globals globals, TraceStartWhy why)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* -------- ExposeRemember and RestoreProtection -------- */
|
||||
|
||||
|
||||
/* Low level stuff for Expose / Remember / Restore */
|
||||
|
||||
typedef struct RememberedSummaryBlockStruct {
|
||||
RingStruct globalRing; /* link on globals->rememberedSummaryRing */
|
||||
struct SummaryPair {
|
||||
Addr base;
|
||||
RefSet summary;
|
||||
} the[RememberedSummaryBLOCK];
|
||||
} RememberedSummaryBlockStruct;
|
||||
|
||||
typedef struct RememberedSummaryBlockStruct *RememberedSummaryBlock;
|
||||
|
||||
static void rememberedSummaryBlockInit(struct RememberedSummaryBlockStruct *block)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
RingInit(&block->globalRing);
|
||||
for(i = 0; i < RememberedSummaryBLOCK; ++ i) {
|
||||
block->the[i].base = (Addr)0;
|
||||
block->the[i].summary = RefSetUNIV;
|
||||
}
|
||||
}
|
||||
|
||||
static Res arenaRememberSummaryOne(Globals global, Addr base, RefSet summary)
|
||||
{
|
||||
Arena arena;
|
||||
RememberedSummaryBlock block;
|
||||
|
||||
AVER(summary != RefSetUNIV);
|
||||
|
||||
arena = GlobalsArena(global);
|
||||
|
||||
if(global->rememberedSummaryIndex == 0) {
|
||||
void *p;
|
||||
RememberedSummaryBlock newBlock;
|
||||
int res;
|
||||
|
||||
res = ControlAlloc(&p, arena, sizeof *newBlock);
|
||||
if(res != ResOK) {
|
||||
return res;
|
||||
}
|
||||
newBlock = p;
|
||||
rememberedSummaryBlockInit(newBlock);
|
||||
RingAppend(GlobalsRememberedSummaryRing(global),
|
||||
&newBlock->globalRing);
|
||||
}
|
||||
block = RING_ELT(RememberedSummaryBlock, globalRing,
|
||||
RingPrev(GlobalsRememberedSummaryRing(global)));
|
||||
AVER(global->rememberedSummaryIndex < RememberedSummaryBLOCK);
|
||||
AVER(block->the[global->rememberedSummaryIndex].base == (Addr)0);
|
||||
AVER(block->the[global->rememberedSummaryIndex].summary == RefSetUNIV);
|
||||
block->the[global->rememberedSummaryIndex].base = base;
|
||||
block->the[global->rememberedSummaryIndex].summary = summary;
|
||||
++ global->rememberedSummaryIndex;
|
||||
if(global->rememberedSummaryIndex >= RememberedSummaryBLOCK) {
|
||||
AVER(global->rememberedSummaryIndex == RememberedSummaryBLOCK);
|
||||
global->rememberedSummaryIndex = 0;
|
||||
}
|
||||
|
||||
return ResOK;
|
||||
}
|
||||
|
||||
/* ArenaExposeRemember -- park arena and then lift all protection
|
||||
barriers. Parameter 'remember' specifies whether to remember the
|
||||
protection state or not (for later restoration with
|
||||
ArenaRestoreProtection).
|
||||
*/
|
||||
void ArenaExposeRemember(Globals globals, Bool remember)
|
||||
{
|
||||
Seg seg;
|
||||
Arena arena;
|
||||
|
||||
AVERT(Globals, globals);
|
||||
AVERT(Bool, remember);
|
||||
|
||||
ArenaPark(globals);
|
||||
|
||||
arena = GlobalsArena(globals);
|
||||
if(SegFirst(&seg, arena)) {
|
||||
Addr base;
|
||||
|
||||
do {
|
||||
base = SegBase(seg);
|
||||
if (IsA(GCSeg, seg)) {
|
||||
if(remember) {
|
||||
RefSet summary;
|
||||
|
||||
summary = SegSummary(seg);
|
||||
if(summary != RefSetUNIV) {
|
||||
Res res = arenaRememberSummaryOne(globals, base, summary);
|
||||
if(res != ResOK) {
|
||||
/* If we got an error then stop trying to remember any
|
||||
protections. */
|
||||
remember = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
SegSetSummary(seg, RefSetUNIV);
|
||||
AVER(SegSM(seg) == AccessSetEMPTY);
|
||||
}
|
||||
} while(SegNext(&seg, arena, seg));
|
||||
}
|
||||
}
|
||||
|
||||
void ArenaRestoreProtection(Globals globals)
|
||||
{
|
||||
Ring node, next;
|
||||
Arena arena;
|
||||
|
||||
arena = GlobalsArena(globals);
|
||||
|
||||
RING_FOR(node, GlobalsRememberedSummaryRing(globals), next) {
|
||||
RememberedSummaryBlock block =
|
||||
RING_ELT(RememberedSummaryBlock, globalRing, node);
|
||||
size_t i;
|
||||
|
||||
for(i = 0; i < RememberedSummaryBLOCK; ++ i) {
|
||||
Seg seg;
|
||||
Bool b;
|
||||
|
||||
if(block->the[i].base == (Addr)0) {
|
||||
AVER(block->the[i].summary == RefSetUNIV);
|
||||
continue;
|
||||
}
|
||||
b = SegOfAddr(&seg, arena, block->the[i].base);
|
||||
if(b && SegBase(seg) == block->the[i].base) {
|
||||
AVER(IsA(GCSeg, seg));
|
||||
SegSetSummary(seg, block->the[i].summary);
|
||||
} else {
|
||||
/* Either seg has gone or moved, both of which are */
|
||||
/* client errors. */
|
||||
NOTREACHED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
arenaForgetProtection(globals);
|
||||
}
|
||||
|
||||
static void arenaForgetProtection(Globals globals)
|
||||
{
|
||||
Ring node, next;
|
||||
Arena arena;
|
||||
|
||||
arena = GlobalsArena(globals);
|
||||
/* Setting this early means that we preserve the invariant
|
||||
<code/global.c#remembered.summary> */
|
||||
globals->rememberedSummaryIndex = 0;
|
||||
RING_FOR(node, GlobalsRememberedSummaryRing(globals), next) {
|
||||
RememberedSummaryBlock block =
|
||||
RING_ELT(RememberedSummaryBlock, globalRing, node);
|
||||
|
||||
RingRemove(node);
|
||||
ControlFree(arena, block, sizeof *block);
|
||||
}
|
||||
}
|
||||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2001-2020 Ravenbrook Limited <https://www.ravenbrook.com/>.
|
||||
|
|
|
|||
|
|
@ -334,8 +334,6 @@ awlut.c :ref:`pool-awl` unit test.
|
|||
awluthe.c :ref:`pool-awl` unit test (using in-band headers).
|
||||
awlutth.c :ref:`pool-awl` unit test (using multiple threads).
|
||||
btcv.c Bit table coverage test.
|
||||
exposet0.c :c:func:`mps_arena_expose` test.
|
||||
expt825.c Regression test for job000825_.
|
||||
finalcv.c :ref:`topic-finalization` coverage test.
|
||||
finaltest.c :ref:`topic-finalization` test.
|
||||
forktest.c :ref:`topic-thread-fork` test.
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ Interface changes
|
|||
needed to take any special precautions before calling functions in
|
||||
the MPS, since version 1.111.
|
||||
|
||||
#. The deprecated functions :c:func:`mps_arena_expose`,
|
||||
:c:func:`mps_arena_unsafe_expose_remember_protection` and
|
||||
:c:func:`mps_arena_unsafe_expose_restore_protection` have been
|
||||
removed. If you need access to protected memory for debugging a
|
||||
fatal error, use :c:func:`mps_arena_postmortem` instead.
|
||||
|
||||
#. The keyword argument ``MPS_KEY_SPARE_COMMIT_LIMIT`` to
|
||||
:c:func:`mps_arena_create_k`, and the functions
|
||||
:c:func:`mps_arena_spare_commit_limit` and
|
||||
|
|
|
|||
|
|
@ -845,121 +845,3 @@ Deprecated in version 1.111
|
|||
------------ -------------- -------------
|
||||
``read()`` ``0`` ``0``
|
||||
============ ============== =============
|
||||
|
||||
|
||||
.. c:function:: void mps_arena_expose(mps_arena_t arena)
|
||||
|
||||
.. deprecated::
|
||||
|
||||
If you need access to protected memory for debugging a fatal
|
||||
error, use :c:func:`mps_arena_postmortem` instead.
|
||||
|
||||
If you need access to protected memory and also need to
|
||||
continue running the MPS afterwards, :ref:`contact us
|
||||
<contact>`.
|
||||
|
||||
Ensure that the MPS is not protecting any :term:`page` in the
|
||||
:term:`arena` with a :term:`read barrier` or :term:`write
|
||||
barrier`.
|
||||
|
||||
``arena`` is the arena to expose.
|
||||
|
||||
This is expected to only be useful for debugging. The arena is
|
||||
left in the :term:`clamped state`.
|
||||
|
||||
Since barriers are used during a collection, calling this function
|
||||
has the same effect as calling :c:func:`mps_arena_park`: all
|
||||
collections are run to completion, and the arena is clamped so
|
||||
that no new collections begin. The MPS also uses barriers to
|
||||
maintain :term:`remembered sets`, so calling this
|
||||
function will effectively destroy the remembered sets and any
|
||||
optimization gains from them.
|
||||
|
||||
Calling this function is time-consuming: any active collections
|
||||
will be run to completion; and the next collection will have to
|
||||
recompute all the remembered sets by scanning the entire arena.
|
||||
|
||||
The recomputation of the remembered sets can be avoided by calling
|
||||
:c:func:`mps_arena_unsafe_expose_remember_protection` instead of
|
||||
:c:func:`mps_arena_expose`, and by calling
|
||||
:c:func:`mps_arena_unsafe_restore_protection` before calling
|
||||
:c:func:`mps_arena_release`. Those functions have unsafe aspects
|
||||
and place restrictions on what the :term:`client program` can do
|
||||
(basically no exposed data can be changed).
|
||||
|
||||
|
||||
.. c:function:: void mps_arena_unsafe_expose_remember_protection(mps_arena_t arena)
|
||||
|
||||
.. deprecated::
|
||||
|
||||
If you need access to protected memory for debugging,
|
||||
:ref:`contact us <contact>`.
|
||||
|
||||
Ensure that the MPS is not protecting any :term:`page` in the
|
||||
:term:`arena` with a :term:`read barrier` or :term:`write
|
||||
barrier`. In addition, request the MPS to remember some parts of its
|
||||
internal state so that they can be restored later.
|
||||
|
||||
``arena`` is the arena to expose.
|
||||
|
||||
This function is the same as :c:func:`mps_arena_expose`, but
|
||||
additionally causes the MPS to remember its protection state. The
|
||||
remembered protection state can optionally be restored later by
|
||||
calling the :c:func:`mps_arena_unsafe_restore_protection` function.
|
||||
This is an optimization that avoids the MPS having to recompute
|
||||
all the remembered sets by scanning the entire arena.
|
||||
|
||||
However, restoring the remembered protections is only safe if the
|
||||
contents of the exposed pages have not been changed; therefore
|
||||
this function should only be used if you do not intend to change
|
||||
the pages, and the remembered protection must only be restored if
|
||||
the pages have not been changed.
|
||||
|
||||
The MPS will only remember the protection state if resources
|
||||
(memory) are available. If memory is low then only some or
|
||||
possibly none of the protection state will be remembered, with a
|
||||
corresponding necessity to recompute it later. The MPS provides no
|
||||
mechanism for the :term:`client program` to determine whether the
|
||||
MPS has in fact remembered the protection state.
|
||||
|
||||
The remembered protection state, if any, is discarded after
|
||||
calling :c:func:`mps_arena_unsafe_restore_protection`, or as soon
|
||||
as the arena leaves the :term:`clamped state` by calling
|
||||
:c:func:`mps_arena_release`.
|
||||
|
||||
|
||||
.. c:function:: void mps_arena_unsafe_restore_protection(mps_arena_t arena)
|
||||
|
||||
.. deprecated::
|
||||
|
||||
If you need access to protected memory for debugging,
|
||||
:ref:`contact us <contact>`.
|
||||
|
||||
Restore the remembered protection state for an :term:`arena`.
|
||||
|
||||
``arena`` is the arena to restore the protection state for.
|
||||
|
||||
This function restores the protection state that the MPS has
|
||||
remembered when the :term:`client program` called
|
||||
:c:func:`mps_arena_unsafe_expose_remember_protection`. The purpose
|
||||
of remembering and restoring the protection state is to avoid the
|
||||
need for the MPS to recompute all the :term:`remembered sets` by
|
||||
scanning the entire arena, that occurs when
|
||||
:c:func:`mps_arena_expose` is used, and which causes the next
|
||||
:term:`garbage collection` to be slow.
|
||||
|
||||
The client program must not change the exposed data between the
|
||||
call to :c:func:`mps_arena_unsafe_expose_remember_protection` and
|
||||
:c:func:`mps_arena_unsafe_restore_protection`. If the client
|
||||
program has changed the exposed data then
|
||||
:c:func:`mps_arena_unsafe_restore_protection` must not be called:
|
||||
in this case simply call :c:func:`mps_arena_release`.
|
||||
|
||||
Calling this function does not release the arena from the clamped
|
||||
state: :c:func:`mps_arena_release` must be called to continue
|
||||
normal collections.
|
||||
|
||||
Calling this function causes the MPS to forget the remembered
|
||||
protection state; as a consequence the same remembered state
|
||||
cannot be restored more than once.
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ awlutth =T
|
|||
btcv
|
||||
bttest =N interactive
|
||||
djbench =N benchmark
|
||||
exposet0 =P
|
||||
expt825
|
||||
finalcv =P
|
||||
finaltest =P
|
||||
forktest =X
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue