1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-26 15:10:50 -08:00

Don't check stuff that's just passed on

Copied from Perforce
 Change: 21867
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Pekka Pirinen 2001-05-17 19:42:59 +01:00
parent cfca0735ee
commit aa8331bea4

View file

@ -1,6 +1,6 @@
/* impl.c.mpsi: MEMORY POOL SYSTEM C INTERFACE LAYER
*
* $HopeName: MMsrc!mpsi.c(trunk.76) $
* $HopeName: MMsrc!mpsi.c(trunk.77) $
* Copyright (C) 2001 Harlequin Limited. All rights reserved.
*
* .purpose: This code bridges between the MPS interface to C,
@ -44,8 +44,7 @@
* interface is designed allows for the possibility of change.
*
* .naming: (rule.impl.guide) The exported identifiers do not follow the
* normal MPS naming conventions. See design.mps.interface.c.naming.
*/
* normal MPS naming conventions. See design.mps.interface.c.naming. */
#include "mpm.h"
#include "mps.h"
@ -53,7 +52,7 @@
#include "sac.h"
#include "chain.h"
SRCID(mpsi, "$HopeName: MMsrc!mpsi.c(trunk.76) $");
SRCID(mpsi, "$HopeName: MMsrc!mpsi.c(trunk.77) $");
/* mpsi_check -- check consistency of interface mappings
@ -66,8 +65,8 @@ SRCID(mpsi, "$HopeName: MMsrc!mpsi.c(trunk.76) $");
* .check.empty: Note that mpsi_check compiles away to almost nothing.
*
* .check.enum.cast: enum comparisons have to be cast to avoid a warning
* from the SunPro C compiler. See builder.sc.warn.enum.
*/
* from the SunPro C compiler. See builder.sc.warn.enum. */
static Bool mpsi_check(void)
{
/* .check.rc: Check that external and internal result codes match. */
@ -168,9 +167,8 @@ static Bool mpsi_check(void)
* Here a rank returning function is defined for all client visible
* ranks.
*
* .rank.final.not: RankFINAL does not have a corresponding function as it
* is only used internally.
*/
* .rank.final.not: RankFINAL does not have a corresponding function as
* it is only used internally. */
mps_rank_t mps_rank_ambig(void)
{
@ -417,18 +415,13 @@ mps_res_t mps_space_create(mps_space_t *mps_space_o)
#endif
/* mps_arena_destroy -- destroy an arena object
*
* .space.destroy: This function has no locking of the arena,
* and cannot have any, since it destroys the thing which contains
* the lock. In any case, any other thread which is using the
* arena at the time it is destroyed, will fall over.
*/
/* mps_arena_destroy -- destroy an arena object */
void mps_arena_destroy(mps_arena_t mps_arena)
{
Arena arena = (Arena)mps_arena;
ArenaEnter(arena);
AVERT(Arena, arena);
ArenaDestroy(arena);
}
@ -442,11 +435,11 @@ void mps_space_destroy(mps_space_t mps_space)
/* mps_fmt_create_A -- create an object format of variant A
*
* .fmt.create.A.purpose: This function converts an object format
* spec of variant "A" into an MPM Format object. See
* design.mps.interface.c.fmt.extend for justification of the
* way that the format structure is declared as "mps_fmt_A".
*/
* .fmt.create.A.purpose: This function converts an object format spec
* of variant "A" into an MPM Format object. See
* design.mps.interface.c.fmt.extend for justification of the way that
* the format structure is declared as "mps_fmt_A". */
mps_res_t mps_fmt_create_A(mps_fmt_t *mps_fmt_o,
mps_arena_t mps_arena,
mps_fmt_A_s *mps_fmt_A)
@ -562,8 +555,6 @@ void mps_fmt_destroy(mps_fmt_t mps_fmt)
ArenaEnter(arena);
AVERT(Format, format);
FormatDestroy(format);
ArenaLeave(arena);
@ -608,21 +599,19 @@ void mps_pool_destroy(mps_pool_t mps_pool)
{
Pool pool = (Pool)mps_pool;
Arena arena;
AVER(CHECKT(Pool, pool));
arena = PoolArena(pool);
ArenaEnter(arena);
AVERT(Pool, pool);
PoolDestroy(pool);
ArenaLeave(arena);
}
mps_res_t mps_alloc(mps_addr_t *p_o, mps_pool_t mps_pool,
size_t size, ...)
mps_res_t mps_alloc(mps_addr_t *p_o, mps_pool_t mps_pool, size_t size, ...)
{
Pool pool = (Pool)mps_pool;
Arena arena;
@ -645,7 +634,7 @@ mps_res_t mps_alloc(mps_addr_t *p_o, mps_pool_t mps_pool,
/* @@@@ There is currently no requirement for reservoirs to work */
/* with unbuffered allocation. */
res = PoolAlloc(&p, pool, size, /* withReservoirPermit */ FALSE);
res = PoolAlloc(&p, pool, size, FALSE);
ArenaLeave(arena);
@ -761,7 +750,6 @@ void mps_ap_destroy(mps_ap_t mps_ap)
ArenaEnter(arena);
AVERT(Buffer, buf);
BufferDestroy(buf);
ArenaLeave(arena);
@ -772,9 +760,8 @@ void mps_ap_destroy(mps_ap_t mps_ap)
*
* .reserve.call: mps_reserve does not call BufferReserve, but instead
* uses the in-line macro from impl.h.mps. This is so that it calls
* mps_ap_fill and thence ArenaPoll (.poll). The consistency checks
* are those which can be done outside the MPM. See also .commit.call.
*/
* mps_ap_fill and thence ArenaPoll (.poll). The consistency checks are
* those which can be done outside the MPM. See also .commit.call. */
mps_res_t (mps_reserve)(mps_addr_t *p_o, mps_ap_t mps_ap, size_t size)
{
@ -813,12 +800,11 @@ mps_res_t mps_reserve_with_reservoir_permit(mps_addr_t *p_o,
/* mps_commit -- commit initialized object, finishing allocation
*
* .commit.call: mps_commit does not call BufferCommit, but instead
* uses the in-line commit macro from impl.h.mps. This is so that it
* calls mps_ap_trip and thence ArenaPoll in future (.poll). The
* consistency checks here are the ones which can be done outside the
* MPM. See also .reserve.call.
*/
* .commit.call: mps_commit does not call BufferCommit, but instead uses
* the in-line commit macro from impl.h.mps. This is so that it calls
* mps_ap_trip and thence ArenaPoll in future (.poll). The consistency
* checks here are the ones which can be done outside the MPM. See also
* .reserve.call. */
mps_bool_t (mps_commit)(mps_ap_t mps_ap, mps_addr_t p, size_t size)
{
@ -837,14 +823,13 @@ mps_bool_t (mps_commit)(mps_ap_t mps_ap, mps_addr_t p, size_t size)
*
* These are candidates for being inlineable as macros.
* These functions are easier to maintain, so we'll avoid
* macros for now.
*/
* macros for now. */
/* mps_ap_frame_push -- push a new allocation frame
*
* See design.mps.alloc-frame.lw-frame.push
*/
* See design.mps.alloc-frame.lw-frame.push. */
mps_res_t (mps_ap_frame_push)(mps_frame_t *frame_o, mps_ap_t mps_ap)
{
AVER(frame_o != NULL);
@ -884,8 +869,7 @@ mps_res_t (mps_ap_frame_push)(mps_frame_t *frame_o, mps_ap_t mps_ap)
/* mps_ap_frame_pop -- push a new allocation frame
*
* See design.mps.alloc-frame.lw-frame.pop
*/
* See design.mps.alloc-frame.lw-frame.pop. */
mps_res_t (mps_ap_frame_pop)(mps_ap_t mps_ap, mps_frame_t frame)
{
@ -927,8 +911,7 @@ mps_res_t (mps_ap_frame_pop)(mps_ap_t mps_ap, mps_frame_t frame)
/* mps_ap_fill -- called by mps_reserve when an AP hasn't enough arena
*
* .ap.fill.internal: Note that mps_ap_fill should never be "called"
* directly by the client code. It is invoked by the mps_reserve macro.
*/
* directly by the client code. It is invoked by the mps_reserve macro. */
mps_res_t mps_ap_fill(mps_addr_t *p_o, mps_ap_t mps_ap, size_t size)
{
@ -950,7 +933,7 @@ mps_res_t mps_ap_fill(mps_addr_t *p_o, mps_ap_t mps_ap, size_t size)
AVER(size > 0);
AVER(SizeIsAligned(size, BufferPool(buf)->alignment));
res = BufferFill(&p, buf, size, /* withReservoirPermit */ FALSE);
res = BufferFill(&p, buf, size, FALSE);
ArenaLeave(arena);
@ -960,8 +943,7 @@ mps_res_t mps_ap_fill(mps_addr_t *p_o, mps_ap_t mps_ap, size_t size)
}
mps_res_t mps_ap_fill_with_reservoir_permit(mps_addr_t *p_o,
mps_ap_t mps_ap,
mps_res_t mps_ap_fill_with_reservoir_permit(mps_addr_t *p_o, mps_ap_t mps_ap,
size_t size)
{
Buffer buf = BufferOfAP((AP)mps_ap);
@ -982,7 +964,7 @@ mps_res_t mps_ap_fill_with_reservoir_permit(mps_addr_t *p_o,
AVER(size > 0);
AVER(SizeIsAligned(size, BufferPool(buf)->alignment));
res = BufferFill(&p, buf, size, /* withReservoirPermit */ TRUE);
res = BufferFill(&p, buf, size, TRUE);
ArenaLeave(arena);
@ -995,8 +977,8 @@ mps_res_t mps_ap_fill_with_reservoir_permit(mps_addr_t *p_o,
/* mps_ap_trip -- called by mps_commit when an AP is tripped
*
* .ap.trip.internal: Note that mps_ap_trip should never be "called"
* directly by the client code. It is invoked by the mps_commit macro.
*/
* directly by the client code. It is invoked by the mps_commit macro. */
mps_bool_t mps_ap_trip(mps_ap_t mps_ap, mps_addr_t p, size_t size)
{
Buffer buf = BufferOfAP((AP)mps_ap);
@ -1273,14 +1255,10 @@ mps_res_t mps_root_create_fmt(mps_root_t *mps_root_o, mps_arena_t mps_arena,
return MPS_RES_OK;
}
mps_res_t mps_root_create_reg(mps_root_t *mps_root_o,
mps_arena_t mps_arena,
mps_rank_t mps_rank,
mps_rm_t mps_rm,
mps_thr_t mps_thr,
mps_reg_scan_t mps_reg_scan,
void *reg_scan_p,
size_t mps_size)
mps_res_t mps_root_create_reg(mps_root_t *mps_root_o, mps_arena_t mps_arena,
mps_rank_t mps_rank, mps_rm_t mps_rm,
mps_thr_t mps_thr, mps_reg_scan_t mps_reg_scan,
void *reg_scan_p, size_t mps_size)
{
Arena arena = (Arena)mps_arena;
Rank rank = (Rank)mps_rank;
@ -1312,8 +1290,8 @@ mps_res_t mps_root_create_reg(mps_root_t *mps_root_o,
/* mps_stack_scan_ambig -- scan the thread state ambiguously
*
* See .reg-scan.
*/
* See .reg-scan. */
mps_res_t mps_stack_scan_ambig(mps_ss_t mps_ss,
mps_thr_t mps_thr, void *p, size_t s)
{
@ -1330,13 +1308,10 @@ void mps_root_destroy(mps_root_t mps_root)
Root root = (Root)mps_root;
Arena arena;
AVER(CHECKT(Root, root));
arena = RootArena(root);
ArenaEnter(arena);
AVERT(Root, root);
RootDestroy(root);
ArenaLeave(arena);
@ -1405,8 +1380,8 @@ void mps_ld_reset(mps_ld_t mps_ld, mps_arena_t mps_arena)
/* mps_ld_add -- add a reference to a location dependency
*
* See design.mps.interface.c.lock-free.
*/
* See design.mps.interface.c.lock-free. */
void mps_ld_add(mps_ld_t mps_ld, mps_arena_t mps_arena, mps_addr_t addr)
{
Arena arena = (Arena)mps_arena;
@ -1418,8 +1393,7 @@ void mps_ld_add(mps_ld_t mps_ld, mps_arena_t mps_arena, mps_addr_t addr)
/* mps_ld_merge -- merge two location dependencies
*
* See design.mps.interface.c.lock-free.
*/
* See design.mps.interface.c.lock-free. */
void mps_ld_merge(mps_ld_t mps_ld, mps_arena_t mps_arena,
mps_ld_t mps_from)
@ -1434,8 +1408,8 @@ void mps_ld_merge(mps_ld_t mps_ld, mps_arena_t mps_arena,
/* mps_ld_isstale -- check whether a location dependency is "stale"
*
* See design.mps.interface.c.lock-free.
*/
* See design.mps.interface.c.lock-free. */
mps_bool_t mps_ld_isstale(mps_ld_t mps_ld, mps_arena_t mps_arena,
mps_addr_t addr)
{
@ -1725,10 +1699,10 @@ mps_alloc_pattern_t mps_alloc_pattern_ramp_collect_all(void)
/* mps_ap_alloc_pattern_begin -- signal start of an allocation pattern
*
* .ramp.hack: There are only two allocation patterns, both ramps.
* So we assume it's a ramp, and call BufferRampBegin/End directly,
* without dispatching. No point in creating a mechanism for that.
*/
* .ramp.hack: There are only two allocation patterns, both ramps. So
* we assume it's a ramp, and call BufferRampBegin/End directly, without
* dispatching. No point in creating a mechanism for that. */
mps_res_t mps_ap_alloc_pattern_begin(mps_ap_t mps_ap,
mps_alloc_pattern_t alloc_pattern)
{