1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-23 07:12:12 -07:00

Removing mpsitr.c, a relic of custom/cet, and merging its contents into mpsi.c. reponse to review <https://github.com/ravenbrook/mps/pull/214#issuecomment-1590952221>.

This commit is contained in:
Richard Brooksby 2023-06-16 09:33:58 +01:00
parent 467f110a42
commit 597422484c
5 changed files with 81 additions and 126 deletions

View file

@ -191,7 +191,6 @@ MPMCOMMON = \
meter.c \
mpm.c \
mpsi.c \
mpsitr.c \
nailboard.c \
policy.c \
pool.c \

View file

@ -147,7 +147,6 @@ MPMCOMMON=\
[meter] \
[mpm] \
[mpsi] \
[mpsitr] \
[nailboard] \
[policy] \
[pool] \

View file

@ -81,7 +81,6 @@
#include "vm.c"
#include "policy.c"
#include "trans.c"
#include "mpsitr.c"
/* Additional pool classes */

View file

@ -1,7 +1,7 @@
/* mpsi.c: MEMORY POOL SYSTEM C INTERFACE LAYER
*
* $Id$
* Copyright (c) 2001-2020 Ravenbrook Limited. See end of file for license.
* Copyright (c) 2001-2023 Ravenbrook Limited. See end of file for license.
* Portions copyright (c) 2002 Global Graphics Software.
*
* .purpose: This code bridges between the MPS interface to C,
@ -47,6 +47,7 @@
#include "mpm.h"
#include "mps.h"
#include "sac.h"
#include "trans.h"
#include <stdarg.h>
@ -2081,9 +2082,87 @@ void _mps_args_set_key(mps_arg_s args[MPS_ARGS_MAX], unsigned i,
}
/* Transforms */
mps_res_t mps_transform_create(mps_transform_t *mps_transform_o,
mps_arena_t arena)
{
Transform transform = NULL;
Res res;
AVER(mps_transform_o != NULL);
ArenaEnter(arena);
res = TransformCreate(&transform, arena);
ArenaLeave(arena);
if (res != ResOK)
return res;
*mps_transform_o = (mps_transform_t)transform;
return MPS_RES_OK;
}
mps_res_t mps_transform_add_oldnew(mps_transform_t transform,
mps_addr_t *mps_old_list,
mps_addr_t *mps_new_list,
size_t mps_count)
{
Ref *old_list = (Ref *)mps_old_list;
Ref *new_list = (Ref *)mps_new_list;
Count count = mps_count;
Arena arena;
Res res;
AVER(mps_old_list != NULL);
AVER(mps_new_list != NULL);
/* count: cannot check */
arena = TransformArena(transform);
ArenaEnter(arena);
res = TransformAddOldNew(transform, old_list, new_list, count);
ArenaLeave(arena);
return res;
}
mps_res_t mps_transform_apply(mps_bool_t *applied_o,
mps_transform_t transform)
{
Arena arena;
Res res;
AVER(applied_o != NULL);
arena = TransformArena(transform);
ArenaEnter(arena);
STACK_CONTEXT_BEGIN(arena) {
res = TransformApply(applied_o, transform);
} STACK_CONTEXT_END(arena);
ArenaLeave(arena);
return res;
}
void mps_transform_destroy(mps_transform_t transform)
{
Arena arena;
arena = TransformArena(transform);
ArenaEnter(arena);
TransformDestroy(transform);
ArenaLeave(arena);
}
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2020 Ravenbrook Limited <https://www.ravenbrook.com/>.
* Copyright (C) 2001-2023 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

View file

@ -1,121 +0,0 @@
/* mpsitr.c: MEMORY POOL SYSTEM C INTERFACE LAYER TO TRANSFORMS
*
* $Id$
* Copyright (c) 2011-2022 Ravenbrook Limited. See end of file for license.
*
* .purpose: This code bridges between the MPS interface to transforms in
* <code/mps.h> and the internal implementation of Transforms in <code/trans.c>.
*/
#include "mpm.h"
#include "mps.h"
#include "trans.h"
#include "ss.h"
SRCID(mpsitr, "$Id$");
mps_res_t mps_transform_create(mps_transform_t *mps_transform_o,
mps_arena_t arena)
{
Transform transform = NULL;
Res res;
AVER(mps_transform_o != NULL);
ArenaEnter(arena);
res = TransformCreate(&transform, arena);
ArenaLeave(arena);
if (res != ResOK)
return res;
*mps_transform_o = (mps_transform_t)transform;
return MPS_RES_OK;
}
mps_res_t mps_transform_add_oldnew(mps_transform_t transform,
mps_addr_t *mps_old_list,
mps_addr_t *mps_new_list,
size_t mps_count)
{
Ref *old_list = (Ref *)mps_old_list;
Ref *new_list = (Ref *)mps_new_list;
Count count = mps_count;
Arena arena;
Res res;
AVER(mps_old_list != NULL);
AVER(mps_new_list != NULL);
/* count: cannot check */
arena = TransformArena(transform);
ArenaEnter(arena);
res = TransformAddOldNew(transform, old_list, new_list, count);
ArenaLeave(arena);
return res;
}
mps_res_t mps_transform_apply(mps_bool_t *applied_o,
mps_transform_t transform)
{
Arena arena;
Res res;
AVER(applied_o != NULL);
arena = TransformArena(transform);
ArenaEnter(arena);
STACK_CONTEXT_BEGIN(arena) {
res = TransformApply(applied_o, transform);
} STACK_CONTEXT_END(arena);
ArenaLeave(arena);
return res;
}
void mps_transform_destroy(mps_transform_t transform)
{
Arena arena;
arena = TransformArena(transform);
ArenaEnter(arena);
TransformDestroy(transform);
ArenaLeave(arena);
}
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2011-2022 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.
*/