1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-06 22:31:13 -07:00

Add new alloc function

Copied from Perforce
 Change: 20149
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Richard Tucker 1998-09-29 14:40:02 +01:00
parent 2ed73b661e
commit 0066b478cf
2 changed files with 19 additions and 8 deletions

View file

@ -1,4 +1,4 @@
/* $HopeName: MMQA_harness!testlib:epvmfmt.c(trunk.4) $
/* $HopeName: MMQA_harness!testlib:epvmfmt.c(trunk.5) $
*/
#include "mps.h"
@ -61,10 +61,16 @@ struct mps_fmt_A_s fmtepvm =
*/
psobj *allocepvm(mps_ap_t ap, int size) {
psobj *a;
die(allocrepvm(&a, ap, size), "Reserve: ");
return a;
}
mps_res_t allocrepvm(psobj **q, mps_ap_t ap, int size) {
mps_addr_t p;
psobj *q;
int i;
size_t bytes;
mps_res_t res;
asserts(sizeof(struct psobj) == 8, "Aaarg! How can EPVM pools possibly work");
bytes = size*8;
@ -73,19 +79,22 @@ psobj *allocepvm(mps_ap_t ap, int size) {
do
{
die(mps_reserve(&p, ap, bytes), "Reserve: ");
q=p;
res = mps_reserve(&p, ap, bytes);
if (res != MPS_RES_OK) {
return res;
}
*q=p;
for(i=0; i<size; i+=1)
{
(q+i)->obj = NULL;
(q+i)->size = 0;
(*q+i)->obj = NULL;
(*q+i)->size = 0;
}
}
while (!mps_commit(ap, p, bytes));
commentif(alloccomments, "allocated %p.", q);
return q;
return MPS_RES_OK;
}
void splatepvm(psobj *obj) {

View file

@ -1,4 +1,4 @@
/* $HopeName$
/* $HopeName: MMQA_harness!testlib:epvmfmt.h(trunk.3) $
epvmfmt.h
Format for objects in the EPVM pool.
*/
@ -30,6 +30,8 @@ extern struct mps_fmt_A_s fmtepvm;
psobj *allocepvm(mps_ap_t ap, int words);
mps_res_t allocrepvm(psobj **, mps_ap_t ap, int words);
void splatepvm(psobj *obj);
mps_bool_t issplatepvm(psobj *obj);